repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/environment.rb | config/environment.rb | # frozen_string_literal: true
# Load the Rails application.
require_relative "application"
# Load up Errbit::Config with values from the environment
require Rails.root.join("config/load")
case Errbit::Config.log_location
when "STDOUT"
# Skip. This is rails default behavior
when "Syslog::Logger"
require "syslog/l... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/load.rb | config/load.rb | # frozen_string_literal: true
# load default ENV values (without overwriting any existing value)
Dotenv.load(".env.default")
require_relative "../app/lib/configurator"
# map config keys to environment variables
#
# We use the first non-nil environment variable in the list. If the last array
# element is a proc, it r... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/puma.rb | config/puma.rb | # frozen_string_literal: true
# This configuration file will be evaluated by Puma. The top-level methods that
# are invoked here are part of Puma's configuration DSL. For more information
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
#
# Puma starts a configurable number of processes (wo... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/routes.rb | config/routes.rb | # frozen_string_literal: true
Rails.application.routes.draw do
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
# Can be used by load balancers and uptime monitors to verify that the app is live.
get "up" => "rails/health#show", :as => :rails_health_check
devi... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/importmap.rb | config/importmap.rb | # frozen_string_literal: true
# Pin npm packages by running ./bin/importmap
# Enable integrity calculation globally
enable_integrity!
pin "application"
pin "@hotwired/stimulus", to: "stimulus.min.js"
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
pin_all_from "app/javascript/controllers", under: "contr... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/mongo.rb | config/mongo.rb | # frozen_string_literal: true
# log_level = "info"
#
# logger = Logger.const_get log_level.upcase
#
# Mongoid.logger.level = logger
# Mongo::Logger.level = logger
Mongoid.configure do |config|
uri = if Errbit::Config.mongo_url == "mongodb://localhost"
"mongodb://localhost/errbit_#{Rails.env}"
else
Errbit:... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/boot.rb | config/boot.rb | # frozen_string_literal: true
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
| ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/content_security_policy.rb | config/initializers/content_security_policy.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/filter_parameter_logging.rb | config/initializers/filter_parameter_logging.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for ... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/application_controller_renderer.rb | config/initializers/application_controller_renderer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
| ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/time_formats.rb | config/initializers/time_formats.rb | # frozen_string_literal: true
Time::DATE_FORMATS[:micro] = "%b %d %l:%M%P"
Time::DATE_FORMATS[:precise] = "%b %d %H:%M:%S"
| ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/session_store.rb | config/initializers/session_store.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: "_errbit_session"
| ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/devise.rb | config/initializers/devise.rb | # frozen_string_literal: true
# Assuming you have not yet modified this file, each configuration option below
# is set to its default value. Note that some are commented out while others
# are not: uncommented lines are intended to protect your configuration from
# breaking changes in upgrades (i.e., in the event that... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/deprecations.rb | config/initializers/deprecations.rb | # frozen_string_literal: true
deprecator = ActiveSupport::Deprecation.new(nil, "Errbit")
if ENV["USER_GEMFILE"].present?
# Make it error in v0.11.0 release and remove in v0.12.0
deprecator.warn(
"ENV['USER_GEMFILE'] support is removed and has no effect in Errbit v0.10.0. " \
"Remove it from configuration.... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/wrap_parameters.rb | config/initializers/wrap_parameters.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_con... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/omniauth.rb | config/initializers/omniauth.rb | # frozen_string_literal: true
OmniAuth.config.logger = Rails.logger
| ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/inflections.rb | config/initializers/inflections.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflec... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/cookies_serializer.rb | config/initializers/cookies_serializer.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json
| ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/permissions_policy.rb | config/initializers/permissions_policy.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Define an application-wide HTTP permissions policy. For further
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
# Rails.application.config.permissions_policy do |policy|
# policy.camera ... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/assets.rb | config/initializers/assets.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.image... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/xml_backend.rb | config/initializers/xml_backend.rb | # frozen_string_literal: true
# We use nokogiri for performance
ActiveSupport::XmlMini.backend = "Nokogiri"
| ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/hash.rb | config/initializers/hash.rb | # frozen_string_literal: true
class Hash
# Apply a block to hash, and recursively apply that block
# to each sub-hash or +types+.
#
# h = {:a=>1, :b=>{:b1=>1, :b2=>2}}
# g = h.recurse{|h| h.inject({}){|h,(k,v)| h[k.to_s] = v; h} }
# g #=> {"a"=>1, "b"=>{"b1"=>1, "b2"=>2}}
#
def recurse(*types, &... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/action_mailer.rb | config/initializers/action_mailer.rb | # frozen_string_literal: true
# Set SMTP settings if given.
if Errbit::Config.email_delivery_method == :smtp
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: Errbit::Config.smtp_address,
port: Errbit::Config.smtp_port,
authentication: Errbit::Config.smtp_authenti... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/hoptoad.rb | config/initializers/hoptoad.rb | # frozen_string_literal: true
# Override the 'hoptoad_notifier' gem's 'send_notice' method for internal errors.
# Find or create a 'Self.Errbit' app, and save the error internally
# unless errors should be sent to a different Errbit instance.
HoptoadNotifier.module_eval do
class << self
private def send_notice(n... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/backtrace_silencers.rb | config/initializers/backtrace_silencers.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
# You can also remove all the silence... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/mime_types.rb | config/initializers/mime_types.rb | # frozen_string_literal: true
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/initializers/reactionview.rb | config/initializers/reactionview.rb | # frozen_string_literal: true
ReActionView.configure do |config|
# Intercept .html.erb templates and process them with `Herb::Engine` for enhanced features
config.intercept_erb = true
# Enable debug mode in development (adds debug attributes to HTML)
config.debug_mode = Rails.env.development?
# Add custom ... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/environments/test.rb | config/environments/test.rb | # frozen_string_literal: true
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.applic... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/environments/development.rb | config/environments/development.rb | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Make code changes take effect immediately without server restart.
config.enable_reloading = true
# Do not eager lo... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
errbit/errbit | https://github.com/errbit/errbit/blob/0f325841e2e723f662e2b0ec4ede3d5c30136fa0/config/environments/production.rb | config/environments/production.rb | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot for better perfor... | ruby | MIT | 0f325841e2e723f662e2b0ec4ede3d5c30136fa0 | 2026-01-04T15:46:48.143000Z | false |
ryanb/letter_opener | https://github.com/ryanb/letter_opener/blob/9038f2526619e9807191d50bf69d0c8599d75725/spec/spec_helper.rb | spec/spec_helper.rb | require 'rubygems'
require 'bundler/setup'
Bundler.require(:default)
require "mail"
RSpec.configure do |config|
config.run_all_when_everything_filtered = true
end
| ruby | MIT | 9038f2526619e9807191d50bf69d0c8599d75725 | 2026-01-04T15:48:36.324718Z | false |
ryanb/letter_opener | https://github.com/ryanb/letter_opener/blob/9038f2526619e9807191d50bf69d0c8599d75725/spec/letter_opener/message_spec.rb | spec/letter_opener/message_spec.rb | # encoding: utf-8
require 'spec_helper'
describe LetterOpener::Message do
let(:location) { File.expand_path('../../../tmp/letter_opener', __FILE__) }
def mail(options={}, &blk)
Mail.new(options, &blk)
end
describe '#reply_to' do
it 'handles one email as a string' do
mail = mail(:reply_to => ... | ruby | MIT | 9038f2526619e9807191d50bf69d0c8599d75725 | 2026-01-04T15:48:36.324718Z | false |
ryanb/letter_opener | https://github.com/ryanb/letter_opener/blob/9038f2526619e9807191d50bf69d0c8599d75725/spec/letter_opener/delivery_method_spec.rb | spec/letter_opener/delivery_method_spec.rb | require "spec_helper"
describe LetterOpener::DeliveryMethod do
let(:location) { File.expand_path('../../../tmp/letter_opener', __FILE__) }
let(:file_uri_scheme) { nil }
let(:plain_file) { Dir["#{location}/*/plain.html"].first }
let(:plain) { CGI.unescape_html(File.read(plain_file)) }
before do
... | ruby | MIT | 9038f2526619e9807191d50bf69d0c8599d75725 | 2026-01-04T15:48:36.324718Z | false |
ryanb/letter_opener | https://github.com/ryanb/letter_opener/blob/9038f2526619e9807191d50bf69d0c8599d75725/lib/letter_opener.rb | lib/letter_opener.rb | module LetterOpener
autoload :Message, "letter_opener/message"
autoload :DeliveryMethod, "letter_opener/delivery_method"
autoload :Configuration, "letter_opener/configuration"
def self.configuration
@configuration ||= Configuration.new
end
def self.configure
yield(configuration)
end
end
require... | ruby | MIT | 9038f2526619e9807191d50bf69d0c8599d75725 | 2026-01-04T15:48:36.324718Z | false |
ryanb/letter_opener | https://github.com/ryanb/letter_opener/blob/9038f2526619e9807191d50bf69d0c8599d75725/lib/letter_opener/railtie.rb | lib/letter_opener/railtie.rb | module LetterOpener
class Railtie < Rails::Railtie
initializer "letter_opener.add_delivery_method" do
ActiveSupport.on_load :action_mailer do
ActionMailer::Base.add_delivery_method(
:letter_opener,
LetterOpener::DeliveryMethod
)
end
end
rake_tasks do
... | ruby | MIT | 9038f2526619e9807191d50bf69d0c8599d75725 | 2026-01-04T15:48:36.324718Z | false |
ryanb/letter_opener | https://github.com/ryanb/letter_opener/blob/9038f2526619e9807191d50bf69d0c8599d75725/lib/letter_opener/message.rb | lib/letter_opener/message.rb | require "cgi"
require "erb"
require "fileutils"
require "uri"
module LetterOpener
class Message
attr_reader :mail
def self.rendered_messages(mail, options = {})
messages = []
messages << new(mail, options.merge(part: mail.html_part)) if mail.html_part
messages << new(mail, options.merge(pa... | ruby | MIT | 9038f2526619e9807191d50bf69d0c8599d75725 | 2026-01-04T15:48:36.324718Z | false |
ryanb/letter_opener | https://github.com/ryanb/letter_opener/blob/9038f2526619e9807191d50bf69d0c8599d75725/lib/letter_opener/configuration.rb | lib/letter_opener/configuration.rb | module LetterOpener
class Configuration
attr_accessor :location, :message_template, :file_uri_scheme
def initialize
@location = Rails.root.join('tmp', 'letter_opener') if defined?(Rails) && Rails.respond_to?(:root) && Rails.root
@message_template = 'default'
@file_uri_scheme = nil
end
... | ruby | MIT | 9038f2526619e9807191d50bf69d0c8599d75725 | 2026-01-04T15:48:36.324718Z | false |
ryanb/letter_opener | https://github.com/ryanb/letter_opener/blob/9038f2526619e9807191d50bf69d0c8599d75725/lib/letter_opener/delivery_method.rb | lib/letter_opener/delivery_method.rb | require "digest/sha1"
require "launchy"
module LetterOpener
class DeliveryMethod
class InvalidOption < StandardError; end
attr_accessor :settings
def initialize(options = {})
options[:message_template] ||= LetterOpener.configuration.message_template
options[:location] ||= LetterOpener.confi... | ruby | MIT | 9038f2526619e9807191d50bf69d0c8599d75725 | 2026-01-04T15:48:36.324718Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/benchmarks/ring.rb | benchmarks/ring.rb | #!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
require "celluloid"
require "benchmark/ips"
require File.expand_path("../examples/ring", __dir__)
# 512-node ring
ring = Ring.new 512
Benchmark.ips do |ips|
ips.report("ring-around") { |n| ring.run n }
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/benchmarks/uuid.rb | benchmarks/uuid.rb | #!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
require "celluloid"
require "benchmark/ips"
Benchmark.ips do |ips|
ips.report("uuid") { Celluloid.uuid }
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/benchmarks/actor.rb | benchmarks/actor.rb | #!/usr/bin/env ruby
require "rubygems"
require "bundler/setup"
require "celluloid"
require "benchmark/ips"
class BenchmarkingActor
include Celluloid
def initialize
@condition = Condition.new
end
def example_method; end
def finished
@condition.signal
end
def wait_until_finished
@condition... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/spec_helper.rb | spec/spec_helper.rb | require "rspec/retry"
require "celluloid/rspec"
require "celluloid/supervision"
Dir[*Specs::INCLUDE_PATHS].map { |f| require f }
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/debugging.rb | spec/support/debugging.rb | module Debugging
# Attempt to safely convert an object to a useful string (without side
# effects if possible)
#
# Feel free to add support for more objects/responses/etc.
def self.dump(obj)
case obj
when ::Symbol
obj.inspect
when ::String
obj
when ::Regexp
obj.inspect
wh... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/sleep_and_wait.rb | spec/support/sleep_and_wait.rb | module Specs
def self.sleep_and_wait_until(timeout = 10)
t1 = Time.now.to_f
::Timeout.timeout(timeout) do
loop until yield
end
diff = Time.now.to_f - t1
STDERR.puts "wait took a bit long: #{diff} seconds" if diff > Specs::TIMER_QUANTUM
rescue Timeout::Error
t2 = Time.now.to_f
rais... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/crash_checking.rb | spec/support/crash_checking.rb | module Specs
class FakeLogger
class << self
def current
allowed_logger.first
end
attr_accessor :allowed_logger
end
def initialize(real_logger, example)
@mutex = Mutex.new
@real_logger = real_logger
@crashes = Queue.new
@details = nil
@example = exa... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/configure_rspec.rb | spec/support/configure_rspec.rb | RSpec.configure do |config|
config.run_all_when_everything_filtered = true
config.disable_monkey_patching!
config.profile_examples = 3
config.filter_gems_from_backtrace(*Specs::BACKTRACE_OMITTED)
config.verbose_retry = true
config.default_retry_count = Specs::ALLOW_RETRIES
config.display_try_failure_mess... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/reset_class_variables.rb | spec/support/reset_class_variables.rb | module Specs
class << self
def reset_class_variables(description)
# build uuid from example ending (most unique)
uuid_prefix = description[-[description.size, 20].min..-1]
reset_uuid(uuid_prefix)
reset_probe(Queue.new)
yield
reset_probe(nil)
end
def reset_probe(value)... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/logging.rb | spec/support/logging.rb | module Specs
class << self
def logger
@logger ||= default_logger.tap { |log| log.level = Logger::WARN }
end
attr_writer :logger
private
def default_logger
Logger.new(STDERR)
end
def open_logfile(rel_path, sync)
root = Pathname(__FILE__).dirname.dirname.dirname
l... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/coverage.rb | spec/support/coverage.rb | require "coveralls"
Coveralls.wear!
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/includer.rb | spec/support/includer.rb | module CelluloidSpecs
def self.included_module
# Celluloid::IO implements this with with 'Celluloid::IO'
(defined? INCLUDED_MODULE) ? INCLUDED_MODULE : Celluloid
end
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/stubbing.rb | spec/support/stubbing.rb | module Specs
def self.stub_out_class_method(mod, meth)
meta = (class << mod; self; end)
original_meth = "original_#{meth}".to_sym
raise "ALREADY TRACED: #{mod}.#{meth}" if mod.respond_to?(original_meth)
meta.send(:alias_method, original_meth, meth)
meta.send(:define_method, meth) do |*args, &blo... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/loose_threads.rb | spec/support/loose_threads.rb | module Specs
class << self
def loose_threads
Thread.list.map do |thread|
next unless thread
next if thread == Thread.current
if RUBY_PLATFORM == "java"
# Avoid disrupting jRuby's "fiber" threads.
name = thread.to_java.getNativeThread.get_name
next if /F... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/examples/subordinate_class.rb | spec/support/examples/subordinate_class.rb | class SubordinateDead < Celluloid::Error; end
class Subordinate
include Celluloid
attr_reader :state
def initialize(state)
@state = state
end
def crack_the_whip
case @state
when :idle
@state = :working
else
raise SubordinateDead, "the spec purposely crashed me :("
end
end
... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/examples/call_class.rb | spec/support/examples/call_class.rb | class CallExampleActor
include Celluloid
def initialize(next_actor = nil)
@next = next_actor
end
def actual_method; end
def inspect
raise "Don't call!"
end
def chained_call_ids
[call_chain_id, @next.call_chain_id]
end
end
# de DEPRECATE:
class DeprecatedCallExampleActor
include Cellu... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/examples/evented_mailbox_class.rb | spec/support/examples/evented_mailbox_class.rb | class TestEventedMailbox < Celluloid::Mailbox::Evented
class Reactor
def initialize
@condition = ConditionVariable.new
@mutex = Mutex.new
end
def wakeup
@mutex.synchronize do
@condition.signal
end
end
def run_once(timeout)
@mutex.synchronize do
@cond... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/examples/actor_class.rb | spec/support/examples/actor_class.rb | class ExampleCrash < Celluloid::Error
attr_accessor :foo
end
module ExampleActorClass
def self.create(included_module, task_klass)
Class.new do
include included_module
task_class task_klass
attr_reader :name
finalizer :my_finalizer
execute_block_on_receiver :run_on_receiver
... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/examples/stack_methods.rb | spec/support/examples/stack_methods.rb | def create_async_blocking_actor(task_klass)
actor_klass = Class.new(StackBlocker) do
task_class task_klass
end
actor = actor_system.within do
actor_klass.new(threads)
end
actor.async.blocking
end
def create_thread_with_role(threads, role)
resume = Queue.new
thread = actor_system.get_thread do
... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/examples/container_class.rb | spec/support/examples/container_class.rb | class SupervisionContainerHelper
@queue = nil
class << self
def reset!
@queue = Queue.new
end
def done!
@queue << :done
end
def pop!
@queue.pop
end
end
end
class MyContainerActor
include Celluloid
attr_reader :args
def initialize(*args)
@args = args
rea... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/support/examples/stack_classes.rb | spec/support/examples/stack_classes.rb | class StackWaiter
QUEUE = Queue.new
WAITERS = Queue.new
ACTORS = Queue.new
class << self
def forever
WAITERS << Thread.current
# de QUEUE.pop
sleep
end
def no_longer
StackWaiter::ACTORS.pop.terminate until StackWaiter::ACTORS.empty?
loop do
break if WAITERS.e... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/shared/group_examples.rb | spec/shared/group_examples.rb | RSpec.shared_examples "a Celluloid Group" do
let!(:queue) { Queue.new }
let!(:busy_queue) { Queue.new }
let(:logger) { Specs::FakeLogger.current }
def wait_until_busy(busy_queue = nil)
return busy_queue.pop if busy_queue
Specs.sleep_and_wait_until { subject.busy? }
end
def wait_until_idle
Spe... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/shared/mailbox_examples.rb | spec/shared/mailbox_examples.rb | RSpec.shared_examples "a Celluloid Mailbox" do
after do
allow(Celluloid.logger).to receive(:debug)
subject.shutdown if subject.alive?
end
it "receives messages" do
message = :ohai
subject << message
expect(subject.receive).to eq(message)
end
it "prioritizes system events over other mess... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/shared/task_examples.rb | spec/shared/task_examples.rb | class MockActor
attr_reader :tasks
def initialize
@tasks = []
end
def setup_thread; end
end
RSpec.shared_examples "a Celluloid Task" do
let(:task_type) { :foobar }
let(:suspend_state) { :doing_something }
let(:actor) { MockActor.new }
subject { Celluloid.task_class.new(task_type, {})... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/shared/actor_examples.rb | spec/shared/actor_examples.rb | RSpec.shared_examples "a Celluloid Actor" do
around do |ex|
Celluloid.boot
ex.run
Celluloid.shutdown if Celluloid.running?
end
let(:task_klass) { Celluloid.task_class }
let(:actor_class) { ExampleActorClass.create(CelluloidSpecs.included_module, task_klass) }
let(:actor) { actor_class.new "Troy M... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | true |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/shared/stack_examples.rb | spec/shared/stack_examples.rb | RSpec.shared_examples "a Celluloid Stack" do
let(:actor_system) { Celluloid::Actor::System.new }
let(:threads) { Queue.new }
before(:each) do
items = 0
[Celluloid::Task::Fibered, Celluloid::Task::Threaded].each do |task_klass|
create_async_blocking_actor(task_klass)
items += 1
end
@... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/future_spec.rb | spec/celluloid/future_spec.rb | RSpec.describe Celluloid::Future, actor_system: :global do
it "creates future objects that can be retrieved later" do
future = Celluloid::Future.new { 40 + 2 }
expect(future.value).to eq(42)
end
it "passes arguments to future blocks" do
future = Celluloid::Future.new(40) { |n| n + 2 }
expect(futu... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/mailbox_spec.rb | spec/celluloid/mailbox_spec.rb | RSpec.describe Celluloid::Mailbox do
it_behaves_like "a Celluloid Mailbox"
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/condition_spec.rb | spec/celluloid/condition_spec.rb | RSpec.describe Celluloid::Condition, actor_system: :global do
let(:logger) { Specs::FakeLogger.current }
class ConditionExample
include Celluloid
attr_reader :condition, :signaled_times
def initialize
@condition = Condition.new
@waiting = false
@signaled_times = 0
end
def ... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/proxy_spec.rb | spec/celluloid/proxy_spec.rb | RSpec.describe Celluloid::Proxy::Abstract do
around do |ex|
Celluloid.boot
ex.run
Celluloid.shutdown
end
let(:task_klass) { Celluloid.task_class }
let(:actor_class) { ExampleActorClass.create(CelluloidSpecs.included_module, task_klass) }
let(:actor) { actor_class.new "Troy McClure" }
let(:logg... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/probe_spec.rb | spec/celluloid/probe_spec.rb | require "celluloid/probe"
class DummyActor; include Celluloid; end
class TestProbeClient
include Celluloid
include Celluloid::Notifications
attr_reader :buffer
finalizer :do_unsubscribe
def initialize(queue)
@events = queue
subscribe(/celluloid\.events\..+/, :event_received)
end
def event_rec... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/calls_spec.rb | spec/celluloid/calls_spec.rb | RSpec.describe Celluloid::Call::Sync, actor_system: :global do
# TODO: these should be Call::Sync unit tests (without working on actual actors)
let(:actor) { CallExampleActor.new }
let(:logger) { Specs::FakeLogger.current }
context "when obj does not respond to a method" do
it "raises a NoMethodError" do
... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/timer_spec.rb | spec/celluloid/timer_spec.rb | class EveryActor
include Celluloid
def initialize
@trace = []
@times = []
@start = Time.now
every(1) { log(1) }
every(2) { log(2) }
every(1) { log(11) }
every(2) { log(22) }
end
def log(t)
@trace << t
offset = Time.now - @start
@times << offset
# puts "log(#{t}) ... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/actor_spec.rb | spec/celluloid/actor_spec.rb | require "spec_helper"
RSpec.describe Celluloid do
it_behaves_like "a Celluloid Actor", Celluloid
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/notifications_spec.rb | spec/celluloid/notifications_spec.rb | RSpec.describe Celluloid::Notifications, actor_system: :global do
class Admirer
include Celluloid
include Celluloid::Notifications
attr_reader :mourning
attr_reader :mourning_count
def someone_died(_topic, name)
@mourning = name
@mourning_count ||= 0
@mourning_count += 1
en... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/block_spec.rb | spec/celluloid/block_spec.rb | RSpec.describe "Blocks", actor_system: :global do
class MyBlockActor
include Celluloid
def initialize(name, data)
@name = name
@data = data
end
attr_reader :name
def ask_for_something(other)
sender_actor = current_actor
@data << [:outside, @name, current_actor.name]
... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/evented_mailbox_spec.rb | spec/celluloid/evented_mailbox_spec.rb | RSpec.describe Celluloid::Mailbox::Evented do
subject { TestEventedMailbox.new }
it_behaves_like "a Celluloid Mailbox"
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/misc/leak_spec.rb | spec/celluloid/misc/leak_spec.rb | require "weakref"
RSpec.describe "Leaks", actor_system: :global, leaktest: true,
skip: !ENV["CELLULOID_LEAKTEST"] && "leak test disabled" do
class LeakActor
include Celluloid
def initialize(arg)
@arg = arg
end
def call(_arg)
[]
end
def terminate; end
e... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/logging/ring_buffer_spec.rb | spec/celluloid/logging/ring_buffer_spec.rb | RSpec.describe Celluloid::RingBuffer do
subject { Celluloid::RingBuffer.new(2) }
it { is_expected.to be_empty }
it { is_expected.not_to be_full }
it "should push and shift" do
subject.push("foo")
subject.push("foo2")
expect(subject.shift).to eq("foo")
expect(subject.shift).to eq("foo2")
end
... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/supervision/root_spec.rb | spec/celluloid/supervision/root_spec.rb | RSpec.describe Celluloid::Supervision::Service::Root, actor_system: :global do
class RootTestingActor
include Celluloid
def identity
:testing
end
end
before(:all) do
Celluloid::Supervision::Configuration.resync_parameters
end
context("deploys root services") do
it("properly") do
... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/supervision/configuration_spec.rb | spec/celluloid/supervision/configuration_spec.rb | RSpec.describe Celluloid::Supervision::Configuration, actor_system: :global do
class TestActor
include Celluloid
def identity
:testing
end
end
let(:succeeding) do
{
as: :testing,
type: TestActor
}
end
let(:failing) do
{
as: :testing,
type: TestActor,
... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/supervision/supervisor_spec.rb | spec/celluloid/supervision/supervisor_spec.rb | RSpec.describe "Celluloid supervisor", actor_system: :global do
let(:logger) { Specs::FakeLogger.current }
it "restarts actors when they die" do
supervisor = Celluloid.supervise(type: Subordinate, args: [:idle])
subordinate = supervisor.actors.first
expect(subordinate.state).to be(:idle)
subordina... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/supervision/instance_spec.rb | spec/celluloid/supervision/instance_spec.rb | # RSpec.describe Celluloid::Supervision::Configuration do
# xit("can be instantiated without a name") {
# }
#
# xit("can be instantiated with a name") {
# }
#
# context("can be terminated") {
# xit("cleanly") {
# }
# }
# end
# =
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/supervision/behavior_spec.rb | spec/celluloid/supervision/behavior_spec.rb | RSpec.describe Celluloid::Supervision::Container::Behavior do
class WellBehaved
include Celluloid
end
let(:typeless) do
{
as: :testing_behaviors,
supervises: [
{
as: :testing_behaved_instances,
type: WellBehaved
}
]
}
end
let(:normal) do
... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/supervision/container_spec.rb | spec/celluloid/supervision/container_spec.rb | RSpec.describe Celluloid::Supervision::Container, actor_system: :global do
let(:queue_count) { 1 }
before do
SupervisionContainerHelper.reset!
subject # init for easier debugging
queue_count.times { SupervisionContainerHelper.pop! }
end
after do
# TODO: hangs without condition on JRuby?
su... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/group/pool_spec.rb | spec/celluloid/group/pool_spec.rb | # set logger early on
require "celluloid/internals/logger"
if Celluloid.group_class == Celluloid::Group::Pool
RSpec.describe Celluloid::Group::Pool do
it_behaves_like "a Celluloid Group"
end
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/group/spawner_spec.rb | spec/celluloid/group/spawner_spec.rb | # set logger early on
require "celluloid/internals/logger"
if Celluloid.group_class == Celluloid::Group::Spawner
RSpec.describe Celluloid::Group::Spawner do
it_behaves_like "a Celluloid Group"
it "does not leak finished threads" do
queue = Queue.new
th = subject.get { queue.pop }
expect do... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/group/elastic_spec.rb | spec/celluloid/group/elastic_spec.rb | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false | |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/internals/uuid_spec.rb | spec/celluloid/internals/uuid_spec.rb | RSpec.describe Celluloid::Internals::UUID do
U = Celluloid::Internals::UUID
it "generates unique IDs across the BLOCK_SIZE boundary" do
upper_bound = U::BLOCK_SIZE * 2 + 10
uuids = (1..upper_bound).map { U.generate }
expect(uuids.size).to eq(uuids.uniq.size)
end
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/internals/properties_spec.rb | spec/celluloid/internals/properties_spec.rb | RSpec.describe Celluloid::Internals::Properties do
let(:default_value) { 42 }
let(:changed_value) { 43 }
let(:example_class) do
Class.new do
extend Celluloid::Internals::Properties
property :baz, default: 42
end
end
let(:example_subclass) do
Class.new(example_class)
end
let(:exa... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/internals/thread_handle_spec.rb | spec/celluloid/internals/thread_handle_spec.rb | RSpec.describe Celluloid::Internals::ThreadHandle do
let(:actor_system) { Celluloid::Actor::System.new }
after { actor_system.shutdown }
context "given a living thread" do
let(:args) { [actor_system] }
before do
@thread = nil
@thread_info_queue = Queue.new
@handle = Celluloid::Internal... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/internals/links_spec.rb | spec/celluloid/internals/links_spec.rb | RSpec.describe Celluloid::Internals::Links do
subject { Celluloid::Internals::Links.new }
let(:mailbox_mock) do
Class.new(Array) do
attr_reader :address
def initialize(address)
@address = address
end
end
end
let(:first_actor) do
Struct.new(:mailbox).new(mailbox_mock.new("... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/internals/cpu_counter_spec.rb | spec/celluloid/internals/cpu_counter_spec.rb | RSpec.describe Celluloid::Internals::CPUCounter do
describe "#cores" do
subject { described_class.cores }
let(:num_cores) { 1024 }
before do
allow(described_class).to receive(:`) { raise "backtick stub called" }
allow(::IO).to receive(:open).and_raise("IO.open stub called!")
described_... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/internals/logger_spec.rb | spec/celluloid/internals/logger_spec.rb | RSpec.describe Celluloid::Internals::Logger do
before :each do
Celluloid.logger = double
end
describe "#debug" do
subject { -> { described_class.debug("debug message") } }
context "when logger is nil" do
before do
Celluloid.logger = nil
end
it { is_expected.not_to raise_erro... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/internals/registry_spec.rb | spec/celluloid/internals/registry_spec.rb | RSpec.describe Celluloid::Internals::Registry, actor_system: :global do
class Marilyn
include Celluloid
def sing_for(person)
"o/~ Happy birthday, #{person}"
end
end
it "registers Actors" do
Celluloid::Actor[:marilyn] = Marilyn.new
expect(Celluloid::Actor[:marilyn].sing_for("Mr. Preside... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/internals/stack/summary_spec.rb | spec/celluloid/internals/stack/summary_spec.rb | RSpec.describe Celluloid::Internals::Stack::Summary do
subject { actor_system.stack_summary }
it_behaves_like "a Celluloid Stack"
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/internals/stack/dump_spec.rb | spec/celluloid/internals/stack/dump_spec.rb | RSpec.describe Celluloid::Internals::Stack::Dump do
subject { actor_system.stack_dump }
it_behaves_like "a Celluloid Stack"
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/mailbox/evented_spec.rb | spec/celluloid/mailbox/evented_spec.rb | RSpec.describe Celluloid::Mailbox::Evented do
subject { TestEventedMailbox.new }
it_behaves_like "a Celluloid Mailbox"
it "recovers from timeout exceeded to process mailbox message" do
timeout_interval = Specs::TIMER_QUANTUM + 0.1
started_at = Time.now
expect do
::Timeout.timeout(timeout_interv... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/task/fibered_spec.rb | spec/celluloid/task/fibered_spec.rb | RSpec.describe Celluloid::Task::Fibered, actor_system: :within do
it_behaves_like "a Celluloid Task" if Celluloid.task_class == Celluloid::Task::Fibered
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/task/threaded_spec.rb | spec/celluloid/task/threaded_spec.rb | RSpec.describe Celluloid::Task::Threaded, actor_system: :within do
it_behaves_like "a Celluloid Task" if Celluloid.task_class == Celluloid::Task::Threaded
end
| ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/spec/celluloid/actor/system_spec.rb | spec/celluloid/actor/system_spec.rb | RSpec.describe Celluloid::Actor::System do
class TestActor
include Celluloid
def identity
:testing
end
end
after do
subject.shutdown
end
it "supports non-global Actor::System" do
subject.within do
expect(Celluloid.actor_system).to eq(subject)
end
end
it "makes actors... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
celluloid/celluloid | https://github.com/celluloid/celluloid/blob/0a307cff21e1a55ddbc5687bcd6ba9e47f89796d/examples/configurations.rb | examples/configurations.rb | require "celluloid"
puts "Use Supervision::Configuration objects!"
class Hello
include Celluloid
finalizer :ceasing
def initialize(to)
@to = to
puts "Created Hello #{@to}"
end
def ceasing
puts "Hello #{@to} go buhbye"
end
end
class FooBar
include Celluloid
finalizer :ceasing
def in... | ruby | MIT | 0a307cff21e1a55ddbc5687bcd6ba9e47f89796d | 2026-01-04T15:48:19.397883Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.