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 |
|---|---|---|---|---|---|---|---|---|
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/configuration.rb | lib/solid_queue/configuration.rb | # frozen_string_literal: true
module SolidQueue
class Configuration
include ActiveModel::Model
validate :ensure_configured_processes
validate :ensure_valid_recurring_tasks
validate :ensure_correctly_sized_thread_pool
class Process < Struct.new(:kind, :attributes)
def instantiate
"... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/dispatcher.rb | lib/solid_queue/dispatcher.rb | # frozen_string_literal: true
module SolidQueue
class Dispatcher < Processes::Poller
include LifecycleHooks
attr_reader :batch_size
after_boot :run_start_hooks
after_boot :start_concurrency_maintenance
before_shutdown :stop_concurrency_maintenance
before_shutdown :run_stop_hooks
after_sh... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/cli.rb | lib/solid_queue/cli.rb | # frozen_string_literal: true
require "thor"
module SolidQueue
class Cli < Thor
class_option :config_file, type: :string, aliases: "-c",
desc: "Path to config file (default: #{Configuration::DEFAULT_CONFIG_FILE_PATH}).",
banner: "SOLID_QUEUE_CONFIG"
class_option :recurring_schedule_file, type: ... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/worker.rb | lib/solid_queue/worker.rb | # frozen_string_literal: true
module SolidQueue
class Worker < Processes::Poller
include LifecycleHooks
after_boot :run_start_hooks
before_shutdown :run_stop_hooks
after_shutdown :run_exit_hooks
attr_reader :queues, :pool
def initialize(**options)
options = options.dup.with_defaults(... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/tasks.rb | lib/solid_queue/tasks.rb | namespace :solid_queue do
desc "Install Solid Queue"
task :install do
Rails::Command.invoke :generate, [ "solid_queue:install" ]
end
desc "start solid_queue supervisor to dispatch and process jobs"
task start: :environment do
SolidQueue::Supervisor.start
end
end
| ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/engine.rb | lib/solid_queue/engine.rb | # frozen_string_literal: true
module SolidQueue
class Engine < ::Rails::Engine
isolate_namespace SolidQueue
rake_tasks do
load "solid_queue/tasks.rb"
end
config.solid_queue = ActiveSupport::OrderedOptions.new
initializer "solid_queue.config" do
config.solid_queue.each do |name, val... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/timer.rb | lib/solid_queue/timer.rb | # frozen_string_literal: true
module SolidQueue
module Timer
extend self
def wait_until(timeout, condition, &block)
if timeout > 0
deadline = monotonic_time_now + timeout
while monotonic_time_now < deadline && !condition.call
sleep 0.1
block.call
end
... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/lifecycle_hooks.rb | lib/solid_queue/lifecycle_hooks.rb | # frozen_string_literal: true
module SolidQueue
module LifecycleHooks
extend ActiveSupport::Concern
included do
mattr_reader :lifecycle_hooks, default: { start: [], stop: [], exit: [] }
end
class_methods do
def on_start(&block)
self.lifecycle_hooks[:start] << block
end
... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/dispatcher/concurrency_maintenance.rb | lib/solid_queue/dispatcher/concurrency_maintenance.rb | # frozen_string_literal: true
module SolidQueue
class Dispatcher::ConcurrencyMaintenance
include AppExecutor
attr_reader :interval, :batch_size
def initialize(interval, batch_size)
@interval = interval
@batch_size = batch_size
end
def start
@concurrency_maintenance_task = Con... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/supervisor/maintenance.rb | lib/solid_queue/supervisor/maintenance.rb | module SolidQueue
module Supervisor::Maintenance
extend ActiveSupport::Concern
included do
after_boot :fail_orphaned_executions
end
private
def launch_maintenance_task
@maintenance_task = Concurrent::TimerTask.new(run_now: true, execution_interval: SolidQueue.process_alive_thresh... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/supervisor/pidfile.rb | lib/solid_queue/supervisor/pidfile.rb | # frozen_string_literal: true
module SolidQueue
class Supervisor::Pidfile
def initialize(path)
@path = path
@pid = ::Process.pid
end
def setup
check_status
write_file
set_at_exit_hook
end
def delete
delete_file
end
private
attr_reader :path, :p... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/supervisor/signals.rb | lib/solid_queue/supervisor/signals.rb | # frozen_string_literal: true
module SolidQueue
class Supervisor
module Signals
extend ActiveSupport::Concern
included do
before_boot :register_signal_handlers
after_shutdown :restore_default_signal_handlers
end
private
SIGNALS = %i[ QUIT INT TERM ]
def ... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/supervisor/pidfiled.rb | lib/solid_queue/supervisor/pidfiled.rb | # frozen_string_literal: true
module SolidQueue
class Supervisor
module Pidfiled
extend ActiveSupport::Concern
included do
before_boot :setup_pidfile
after_shutdown :delete_pidfile
end
private
def setup_pidfile
if path = SolidQueue.supervisor_pidfile
... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/scheduler/recurring_schedule.rb | lib/solid_queue/scheduler/recurring_schedule.rb | # frozen_string_literal: true
module SolidQueue
class Scheduler::RecurringSchedule
include AppExecutor
attr_reader :configured_tasks, :scheduled_tasks
def initialize(tasks)
@configured_tasks = Array(tasks).map { |task| SolidQueue::RecurringTask.wrap(task) }.select(&:valid?)
@scheduled_tasks... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/processes/interruptible.rb | lib/solid_queue/processes/interruptible.rb | # frozen_string_literal: true
module SolidQueue::Processes
module Interruptible
def initialize(...)
super
@self_pipe = create_self_pipe
end
def wake_up
interrupt
end
private
SELF_PIPE_BLOCK_SIZE = 11
attr_reader :self_pipe
def interrupt
self_pipe[:w... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/processes/registrable.rb | lib/solid_queue/processes/registrable.rb | # frozen_string_literal: true
module SolidQueue::Processes
module Registrable
extend ActiveSupport::Concern
included do
after_boot :register, :launch_heartbeat
after_shutdown :stop_heartbeat, :deregister
end
def process_id
process&.id
end
private
attr_accessor :pro... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/processes/runnable.rb | lib/solid_queue/processes/runnable.rb | # frozen_string_literal: true
module SolidQueue::Processes
module Runnable
include Supervised
attr_writer :mode
def start
boot
if running_async?
@thread = create_thread { run }
else
run
end
end
def stop
super
wake_up
@thread&.join
... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/processes/poller.rb | lib/solid_queue/processes/poller.rb | # frozen_string_literal: true
module SolidQueue::Processes
class Poller < Base
include Runnable
attr_accessor :polling_interval
def initialize(polling_interval:, **options)
@polling_interval = polling_interval
super(**options)
end
def metadata
super.merge(polling_interval: p... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/processes/process_exit_error.rb | lib/solid_queue/processes/process_exit_error.rb | # frozen_string_literal: true
module SolidQueue
module Processes
class ProcessExitError < RuntimeError
def initialize(status)
message = "Process pid=#{status.pid} exited unexpectedly."
if status.exitstatus.present?
message += " Exited with status #{status.exitstatus}."
end... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/processes/procline.rb | lib/solid_queue/processes/procline.rb | # frozen_string_literal: true
module SolidQueue::Processes
module Procline
# Sets the procline ($0)
# solid-queue-supervisor(0.1.0): <string>
def procline(string)
$0 = "solid-queue-#{self.class.name.demodulize.underscore.dasherize}(#{SolidQueue::VERSION}): #{string}"
end
end
end
| ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/processes/callbacks.rb | lib/solid_queue/processes/callbacks.rb | # frozen_string_literal: true
module SolidQueue::Processes
module Callbacks
extend ActiveSupport::Concern
included do
extend ActiveModel::Callbacks
define_model_callbacks :boot, :shutdown
end
end
end
| ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/processes/base.rb | lib/solid_queue/processes/base.rb | # frozen_string_literal: true
module SolidQueue
module Processes
class Base
include Callbacks # Defines callbacks needed by other concerns
include AppExecutor, Registrable, Procline
prepend Interruptible
attr_reader :name
def initialize(*)
@name = generate_name
@st... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/processes/process_pruned_error.rb | lib/solid_queue/processes/process_pruned_error.rb | # frozen_string_literal: true
module SolidQueue
module Processes
class ProcessPrunedError < RuntimeError
def initialize(last_heartbeat_at)
super("Process was found dead and pruned (last heartbeat at: #{last_heartbeat_at})")
end
end
end
end
| ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/processes/supervised.rb | lib/solid_queue/processes/supervised.rb | # frozen_string_literal: true
module SolidQueue::Processes
module Supervised
extend ActiveSupport::Concern
included do
attr_reader :supervisor
end
def supervised_by(process)
@supervisor = process
end
private
def set_procline
procline "waiting"
end
def... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/solid_queue/processes/process_missing_error.rb | lib/solid_queue/processes/process_missing_error.rb | module SolidQueue
module Processes
class ProcessMissingError < RuntimeError
def initialize
super("The process that was running this job no longer exists")
end
end
end
end
| ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/puma/plugin/solid_queue.rb | lib/puma/plugin/solid_queue.rb | require "puma/plugin"
Puma::Plugin.create do
attr_reader :puma_pid, :solid_queue_pid, :log_writer, :solid_queue_supervisor
def start(launcher)
@log_writer = launcher.log_writer
@puma_pid = $$
in_background do
monitor_solid_queue
end
if Gem::Version.new(Puma::Const::VERSION) < Gem::Vers... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/generators/solid_queue/install/install_generator.rb | lib/generators/solid_queue/install/install_generator.rb | # frozen_string_literal: true
class SolidQueue::InstallGenerator < Rails::Generators::Base
source_root File.expand_path("templates", __dir__)
def copy_files
template "config/queue.yml"
template "config/recurring.yml"
template "db/queue_schema.rb"
template "bin/jobs"
chmod "bin/jobs", 0755 & ~F... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/generators/solid_queue/install/templates/db/queue_schema.rb | lib/generators/solid_queue/install/templates/db/queue_schema.rb | ActiveRecord::Schema[7.1].define(version: 1) do
create_table "solid_queue_blocked_executions", force: :cascade do |t|
t.bigint "job_id", null: false
t.string "queue_name", null: false
t.integer "priority", default: 0, null: false
t.string "concurrency_key", null: false
t.datetime "expires_at", nul... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/active_job/concurrency_controls.rb | lib/active_job/concurrency_controls.rb | # frozen_string_literal: true
module ActiveJob
module ConcurrencyControls
extend ActiveSupport::Concern
DEFAULT_CONCURRENCY_GROUP = ->(*) { self.class.name }
CONCURRENCY_ON_CONFLICT_BEHAVIOUR = %i[ block discard ]
included do
class_attribute :concurrency_key, instance_accessor: false
cl... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/lib/active_job/queue_adapters/solid_queue_adapter.rb | lib/active_job/queue_adapters/solid_queue_adapter.rb | # frozen_string_literal: true
module ActiveJob
module QueueAdapters
# == Active Job SolidQueue adapter
#
# To use it set the queue_adapter config to +:solid_queue+.
#
# Rails.application.config.active_job.queue_adapter = :solid_queue
class SolidQueueAdapter < (Rails::VERSION::MAJOR == 7 && ... | ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
rails/solid_queue | https://github.com/rails/solid_queue/blob/a0b35ead31216c198af4cff01cd289cd5b200208/config/routes.rb | config/routes.rb | Rails.application.routes.draw do
end
| ruby | MIT | a0b35ead31216c198af4cff01cd289cd5b200208 | 2026-01-04T15:56:23.248573Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/sanitization_filter_test.rb | test/sanitization_filter_test.rb | # frozen_string_literal: true
require "test_helper"
require "html_pipeline/node_filter/mention_filter"
class HTMLPipeline
class SanitizationFilterTest < Minitest::Test
SanitizationFilter = HTMLPipeline::SanitizationFilter
DEFAULT_CONFIG = SanitizationFilter::DEFAULT_CONFIG
def test_removing_script_tags... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline_test.rb | test/html_pipeline_test.rb | # frozen_string_literal: true
require "test_helper"
require "helpers/mocked_instrumentation_service"
require "html_pipeline/node_filter/image_max_width_filter"
require "html_pipeline/node_filter/mention_filter"
require "html_pipeline/convert_filter/markdown_filter"
class HTMLPipelineTest < Minitest::Test
def setup
... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
require "bundler/setup"
require "html_pipeline"
require "minitest/autorun"
require "minitest/pride"
require "minitest/focus"
require "awesome_print"
require "nokogiri"
module TestHelpers
end
Minitest::Test.include(TestHelpers)
class TestReverseFilter < HTMLPipeline::TextFilter
def... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/helpers/mocked_instrumentation_service.rb | test/helpers/mocked_instrumentation_service.rb | # frozen_string_literal: true
class MockedInstrumentationService
attr_reader :events
def initialize(event = nil, events = [])
@events = events
subscribe(event)
end
def instrument(event, payload = nil)
payload ||= {}
res = yield payload
events << [event, payload, res] if @subscribe == even... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/require_helper_test.rb | test/html_pipeline/require_helper_test.rb | # frozen_string_literal: true
require "test_helper"
class HTMLPipeline
class RequireHelperTest < Minitest::Test
def test_works_with_existing_dependency
HTMLPipeline.require_dependency("rake", "SomeClass")
end
def test_works_with_existing_dependencies
HTMLPipeline.require_dependencies(["old_... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/node_filter/team_mention_filter_test.rb | test/html_pipeline/node_filter/team_mention_filter_test.rb | # frozen_string_literal: true
require "test_helper"
require "html_pipeline/node_filter/team_mention_filter"
class HTMLPipeline
class TeamMentionFilterTest < Minitest::Test
def setup
@filter = HTMLPipeline::NodeFilter::TeamMentionFilter
@pipeline =
HTMLPipeline.new(
convert_filter:... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/node_filter/https_filter_test.rb | test/html_pipeline/node_filter/https_filter_test.rb | # frozen_string_literal: true
require "test_helper"
require "html_pipeline/node_filter/https_filter"
HttpsFilter = HTMLPipeline::NodeFilter::HttpsFilter
class HTMLPipeline
class HttpsFilterTest < Minitest::Test
def setup
@options = { base_url: "http://github.com" }
end
def test_http
assert... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/node_filter/emoji_filter_test.rb | test/html_pipeline/node_filter/emoji_filter_test.rb | # frozen_string_literal: true
require "test_helper"
require "html_pipeline/node_filter/emoji_filter"
EmojiFilterFilter = HTMLPipeline::NodeFilter::EmojiFilter
class HTMLPipeline
class EmojiFilterTest < Minitest::Test
def setup
@emoji_filter = HTMLPipeline::NodeFilter::EmojiFilter
end
def test_emo... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/node_filter/absolute_source_filter_test.rb | test/html_pipeline/node_filter/absolute_source_filter_test.rb | # frozen_string_literal: true
require "test_helper"
require "html_pipeline/node_filter/absolute_source_filter"
AbsoluteSourceFilter = HTMLPipeline::NodeFilter::AbsoluteSourceFilter
class HTMLPipeline
class NodeFilter
class AbsoluteSourceFilterTest < Minitest::Test
def setup
@image_base_url = "http... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/node_filter/image_max_width_filter_test.rb | test/html_pipeline/node_filter/image_max_width_filter_test.rb | # frozen_string_literal: true
require "test_helper"
class HTMLPipeline
class ImageMaxWidthFilterTest < Minitest::Test
def setup
@filter = HTMLPipeline::NodeFilter::ImageMaxWidthFilter
end
def test_rewrites_image_style_tags
body = '<p>Screenshot: <img src="screenshot.png"></p>'
res = @... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/node_filter/table_of_contents_filter_test.rb | test/html_pipeline/node_filter/table_of_contents_filter_test.rb | # frozen_string_literal: true
require "test_helper"
require "html_pipeline/node_filter/table_of_contents_filter"
class HTMLPipeline
class NodeFilter
class TableOfContentsFilterTest < Minitest::Test
TocFilter = HTMLPipeline::NodeFilter::TableOfContentsFilter
TocPipeline =
HTMLPipeline.new(co... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/node_filter/syntax_highlight_filter_test.rb | test/html_pipeline/node_filter/syntax_highlight_filter_test.rb | # frozen_string_literal: true
require "test_helper"
require "html_pipeline/node_filter/syntax_highlight_filter"
SyntaxHighlightFilter = HTMLPipeline::NodeFilter::SyntaxHighlightFilter
class HTMLPipeline
class SyntaxHighlightFilterTest < Minitest::Test
def test_highlight_default
result = SyntaxHighlightFi... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/node_filter/mention_filter_test.rb | test/html_pipeline/node_filter/mention_filter_test.rb | # frozen_string_literal: true
require "test_helper"
class HTMLPipeline
class MentionFilterTest < Minitest::Test
def setup
@filter = HTMLPipeline::NodeFilter::MentionFilter
@context = { base_url: "/", info_url: nil, username_pattern: nil }
@pipeline = HTMLPipeline.new(
convert_filter:
... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/node_filter/asset_proxy_filter_test.rb | test/html_pipeline/node_filter/asset_proxy_filter_test.rb | # frozen_string_literal: true
require "test_helper"
require "html_pipeline/node_filter/asset_proxy_filter"
class HTMLPipeline
class AssetProxyFilterTest < Minitest::Spec
DESCRIBED_CLASS = HTMLPipeline::NodeFilter::AssetProxyFilter
def setup
@filter = DESCRIBED_CLASS
end
def image(path)
... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/convert_filter/markdown_filter_test.rb | test/html_pipeline/convert_filter/markdown_filter_test.rb | # frozen_string_literal: true
require "test_helper"
require "html_pipeline/convert_filter/markdown_filter"
MarkdownFilter = HTMLPipeline::ConvertFilter::MarkdownFilter
class HTMLPipeline
class MarkdownFilterTest < Minitest::Test
def setup
@haiku =
"Pointing at the moon\n" \
"Reminded of... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/text_filter/image_filter_test.rb | test/html_pipeline/text_filter/image_filter_test.rb | # frozen_string_literal: true
require "test_helper"
require "html_pipeline/text_filter/image_filter"
ImageFilter = HTMLPipeline::TextFilter::ImageFilter
class HTMLPipeline
class ImageFilterTest < Minitest::Test
def setup
@filter = ImageFilter
end
def test_jpg
assert_equal(
%(<img s... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/test/html_pipeline/text_filter/plain_text_input_filter_test.rb | test/html_pipeline/text_filter/plain_text_input_filter_test.rb | # frozen_string_literal: true
require "test_helper"
require "html_pipeline/text_filter/plain_text_input_filter"
class HTMLPipeline
class PlainTextInputFilterTest < Minitest::Test
PlainTextInputFilter = HTMLPipeline::TextFilter::PlainTextInputFilter
def test_fails_when_given_a_documentfragment
body = ... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline.rb | lib/html_pipeline.rb | # frozen_string_literal: true
require "zeitwerk"
lib_dir = File.join(File.dirname(__dir__), "lib")
lib_html_pipeline_dir = File.join(File.dirname(__dir__), "lib", "html_pipeline")
gem_loader = Zeitwerk::Loader.for_gem
gem_loader.inflector.inflect(
"html_pipeline" => "HTMLPipeline",
)
gem_loader.ignore(File.join(lib... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html-pipeline.rb | lib/html-pipeline.rb | # frozen_string_literal: true
require_relative "html_pipeline"
| ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/convert_filter.rb | lib/html_pipeline/convert_filter.rb | # frozen_string_literal: true
class HTMLPipeline
class ConvertFilter < Filter
attr_reader :text, :html
def initialize(context: {}, result: {})
super
end
class << self
def call(text, context: {}, result: {})
new(context: context, result: result).call(text)
end
end
end... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/version.rb | lib/html_pipeline/version.rb | # frozen_string_literal: true
class HTMLPipeline
VERSION = "3.2.3"
end
| ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/node_filter.rb | lib/html_pipeline/node_filter.rb | # frozen_string_literal: true
require "selma"
class HTMLPipeline
class NodeFilter < Filter
attr_accessor :context
def initialize(context: {}, result: {})
super(context: context, result: {})
send(:after_initialize) if respond_to?(:after_initialize)
end
# The String representation of the... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/text_filter.rb | lib/html_pipeline/text_filter.rb | # frozen_string_literal: true
class HTMLPipeline
class TextFilter < Filter
attr_reader :text
def initialize(context: {}, result: {})
super
end
class << self
def call(text, context: {}, result: {})
raise TypeError, "text must be a String" unless text.is_a?(String)
# Ensu... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/filter.rb | lib/html_pipeline/filter.rb | # frozen_string_literal: true
class HTMLPipeline
# Base class for user content HTML filters. Each filter takes an
# HTML string, performs modifications on it, and/or writes information to a result hash.
# Filters must return a String with HTML markup.
#
# The `context` Hash passes options to filters and shou... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/sanitization_filter.rb | lib/html_pipeline/sanitization_filter.rb | # frozen_string_literal: true
require "selma"
class HTMLPipeline
# A special filter with sanization routines and allowlists. This module defines
# what HTML is allowed in user provided content and fixes up issues with
# unbalanced tags and whatnot.
#
# See the Selma docs for more information on the underlyi... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/node_filter/absolute_source_filter.rb | lib/html_pipeline/node_filter/absolute_source_filter.rb | # frozen_string_literal: true
require "uri"
class HTMLPipeline
class NodeFilter
# HTML Filter for replacing relative and root relative image URLs with
# fully qualified URLs
#
# This is useful if an image is root relative but should really be going
# through a cdn, or if the content for the page... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/node_filter/image_max_width_filter.rb | lib/html_pipeline/node_filter/image_max_width_filter.rb | # frozen_string_literal: true
class HTMLPipeline
class NodeFilter
# This filter rewrites image tags with a max-width inline style and also wraps
# the image in an <a> tag that causes the full size image to be opened in a
# new tab.
#
# The max-width inline styles are especially useful in HTML ema... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/node_filter/mention_filter.rb | lib/html_pipeline/node_filter/mention_filter.rb | # frozen_string_literal: true
require "set"
class HTMLPipeline
class NodeFilter
# HTML filter that replaces @user mentions with links. Mentions within <pre>,
# <code>, and <a> elements are ignored. Mentions that reference users that do
# not exist are ignored.
#
# Context options:
# :base_... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/node_filter/emoji_filter.rb | lib/html_pipeline/node_filter/emoji_filter.rb | # frozen_string_literal: true
require "cgi"
HTMLPipeline.require_dependencies(["gemoji", "gemojione"], "EmojiFilter")
class HTMLPipeline
class NodeFilter
# HTML filter that replaces :emoji: with images.
#
# Context:
# :asset_root (required) - base url to link to emoji sprite
# :asset_path (o... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/node_filter/syntax_highlight_filter.rb | lib/html_pipeline/node_filter/syntax_highlight_filter.rb | # frozen_string_literal: true
HTMLPipeline.require_dependency("rouge", "SyntaxHighlightFilter")
class HTMLPipeline
class NodeFilter
# HTML Filter that syntax highlights text inside code blocks.
#
# Context options:
#
# :highlight => String represents the language to pick lexer. Defaults to emp... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/node_filter/asset_proxy_filter.rb | lib/html_pipeline/node_filter/asset_proxy_filter.rb | # frozen_string_literal: true
require "openssl"
class HTMLPipeline
class NodeFilter
# Proxy images/assets to another server, such as
# [cactus/go-camo](https://github.com/cactus/go-camo#).
# Reduces mixed content warnings as well as hiding the customer's
# IP address when requesting images.
# Co... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/node_filter/team_mention_filter.rb | lib/html_pipeline/node_filter/team_mention_filter.rb | # frozen_string_literal: true
require "set"
class HTMLPipeline
class NodeFilter
# HTML filter that replaces @org/team mentions with links. Mentions within
# <pre>, <code>, <a>, <style>, and <script> elements are ignored.
#
# Context options:
# :base_url - Used to construct links to team profil... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/node_filter/table_of_contents_filter.rb | lib/html_pipeline/node_filter/table_of_contents_filter.rb | # frozen_string_literal: true
class HTMLPipeline
class NodeFilter
# Generates a Table of Contents: an array of hashes containing:
# * `href`: the relative link to the header
# * `text`: the text of the header
# Examples
#
# TocPipeline =
# HTMLPipeline.new [
# HTMLPipeline::... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/node_filter/https_filter.rb | lib/html_pipeline/node_filter/https_filter.rb | # frozen_string_literal: true
class HTMLPipeline
class NodeFilter
# HTML Filter for replacing http references to :http_url with https versions.
# Subdomain references are not rewritten.
#
# Context options:
# :http_url - The HTTP url to force HTTPS. Falls back to :base_url
class HttpsFilter... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/convert_filter/markdown_filter.rb | lib/html_pipeline/convert_filter/markdown_filter.rb | # frozen_string_literal: true
HTMLPipeline.require_dependency("commonmarker", "MarkdownFilter")
class HTMLPipeline
class ConvertFilter < Filter
# HTML Filter that converts Markdown text into HTML.
#
# Context options:
# :markdown[:parse] => Commonmarker parse options
# :markdown[:render] => ... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/text_filter/image_filter.rb | lib/html_pipeline/text_filter/image_filter.rb | # frozen_string_literal: true
class HTMLPipeline
class TextFilter
# HTML Filter that converts image's url into <img> tag.
# For example, it will convert
# http://example.com/test.jpg
# into
# <img src="http://example.com/test.jpg" alt=""/>.
class ImageFilter < TextFilter
def call(t... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
gjtorikian/html-pipeline | https://github.com/gjtorikian/html-pipeline/blob/b2c288f80ce6da9e7e686b442935bf0e4bb43e73/lib/html_pipeline/text_filter/plain_text_input_filter.rb | lib/html_pipeline/text_filter/plain_text_input_filter.rb | # frozen_string_literal: true
class HTMLPipeline
class TextFilter
# Simple filter for plain text input. HTML escapes the text input and wraps it
# in a div.
class PlainTextInputFilter < TextFilter
def call(text, context: {}, result: {})
"<div>#{CGI.escapeHTML(text)}</div>"
end
end... | ruby | MIT | b2c288f80ce6da9e7e686b442935bf0e4bb43e73 | 2026-01-04T15:56:05.337757Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/gems.rb | gems.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2017-2025, by Samuel Williams.
# Copyright, 2017, by Kent Gruber.
# Copyright, 2024, by Patrik Wenger.
source "https://rubygems.org"
gemspec
# gem "io-event", git: "https://github.com/socketry/io-event.git"
# In order to capture both code... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/bake.rb | bake.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2020-2025, by Samuel Williams.
# Update the project documentation with the new version number.
#
# @parameter version [String] The new version number.
def after_gem_release_version_increment(version)
context["releases:update"].call(version)... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/task.rb | benchmark/task.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Shopify Inc.
# Copyright, 2025, by Samuel Williams.
require "sus/fixtures/benchmark"
require "async"
describe Async::Task do
include Sus::Fixtures::Benchmark
with "task creation and execution" do
measure "... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/gems.rb | benchmark/gems.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Shopify Inc.
# Copyright, 2025, by Samuel Williams.
source "https://rubygems.org"
# gem "async"
gem "async", path: "../"
gem "sus"
gem "sus-fixtures-benchmark"
| ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/thread_vs_fiber.rb | benchmark/thread_vs_fiber.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2024, by Samuel Williams.
require "benchmark/ips"
GC.disable
Benchmark.ips do |benchmark|
benchmark.time = 1
benchmark.warmup = 1
benchmark.report("Thread.new{}") do |count|
while count > 0
Thread.new{cou... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/fiber_count.rb | benchmark/fiber_count.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2022, by Samuel Williams.
fibers = []
(1..).each do |i|
fibers << Fiber.new{}
fibers.last.resume
puts i
end
| ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/queue.rb | benchmark/queue.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Shopify Inc.
# Copyright, 2025, by Samuel Williams.
require "sus/fixtures/benchmark"
require "async/queue"
require "async"
describe Async::Queue do
include Sus::Fixtures::Benchmark
let(:queue) {Async::Queue.... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/thread_count.rb | benchmark/thread_count.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2022, by Samuel Williams.
threads = []
(1..).each do |i|
threads << Thread.new{sleep}
puts i
end
| ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/async_vs_lightio.rb | benchmark/async_vs_lightio.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
require "async"
require "lightio"
require "benchmark/ips"
#
# It's hard to know exactly how to interpret these results. When running parallel
# instances, resource contention is more likel... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/condition.rb | benchmark/condition.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Shopify Inc.
# Copyright, 2025, by Samuel Williams.
require "sus/fixtures/benchmark"
require "async/condition"
require "async"
describe Async::Condition do
include Sus::Fixtures::Benchmark
let(:condition) {A... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/async/barrier.rb | benchmark/async/barrier.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
require "async/barrier"
require "sus/fixtures/async/scheduler_context"
require "sus/fixtures/benchmark"
describe Async::Barrier do
include Sus::Fixtures::Async::SchedulerContext
include Sus::Fixtures::Benchmark
... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/rubies/benchmark.rb | benchmark/rubies/benchmark.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
require "socket"
require "fiber"
puts
puts RUBY_DESCRIPTION
if RUBY_VERSION < "2.0"
class String
def b
self
end
end
end
# TODO: make these much larger, see if we're effectively b... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/core/thread-creation.rb | benchmark/core/thread-creation.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2023, by Samuel Williams.
puts RUBY_VERSION
times = []
10.times do
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
threads = 20_000.times.map do
Thread.new do
true
end
end
threads.each(&:join)
duration = Proc... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/core/fiber-creation.rb | benchmark/core/fiber-creation.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2023, by Samuel Williams.
puts RUBY_VERSION
times = []
10.times do
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
fibers = 10_000.times.map do
Fiber.new do
true
end
end
fibers.each(&:resume)
duration = Proce... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/timers/gems.rb | benchmark/timers/gems.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024, by Samuel Williams.
source "https://rubygems.org"
gem "benchmark-ips", "2.13"
gem "timers", "~> 4.3"
gem "io-event", "~> 1.6"
| ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/timers/after_0.rb | benchmark/timers/after_0.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Samuel Williams.
require "benchmark/ips"
require "timers"
require "io/event/timers"
Benchmark.ips do |benchmark|
benchmark.time = 1
benchmark.warmup = 1
benchmark.report("Timers::Group") do |count|
... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/timers/after_cancel.rb | benchmark/timers/after_cancel.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Samuel Williams.
require "benchmark/ips"
require "timers"
require "io/event/timers"
Benchmark.ips do |benchmark|
benchmark.time = 1
benchmark.warmup = 1
benchmark.report("Timers::Group") do |count|
... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/benchmark/timers/after_n.rb | benchmark/timers/after_n.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2024-2025, by Samuel Williams.
require "benchmark/ips"
require "timers"
require "io/event/timers"
Benchmark.ips do |benchmark|
benchmark.time = 1
benchmark.warmup = 1
benchmark.report("Timers::Group") do |count|
... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/fixtures/async/a_condition.rb | fixtures/async/a_condition.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
require "async/variable"
module Async
ACondition = Sus::Shared("a condition") do
let(:condition) {subject.new}
it "can signal waiting task" do
state = nil
task = reactor.async do
state = ... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/fixtures/async/a_queue.rb | fixtures/async/a_queue.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Samuel Williams.
# Copyright, 2025, by Shopify Inc.
require "async"
require "async/queue"
require "sus/fixtures/async"
require "async/semaphore"
require "async/chainable_async"
module Async
AQueue = Sus::Shared("a queue") do
le... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/fixtures/async/chainable_async.rb | fixtures/async/chainable_async.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2025, by Samuel Williams.
module Async
ChainableAsync = Sus::Shared("chainable async") do
let(:parent) {Object.new}
let(:chainable) {subject.new(parent: parent)}
it "should chain async to parent" do
expect(parent).to receiv... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/fixtures/async/a_priority_queue.rb | fixtures/async/a_priority_queue.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Shopify Inc.
# Copyright, 2025, by Samuel Williams.
require "async"
require "async/priority_queue"
require "sus/fixtures/async"
require "async/chainable_async"
module Async
APriorityQueue = Sus::Shared("a priority queue") do
le... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/fixtures/async/a_queue_with_timeout.rb | fixtures/async/a_queue_with_timeout.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Shopify Inc.
# Copyright, 2025, by Samuel Williams.
require "sus/fixtures/async"
module Async
AQueueWithTimeout = Sus::Shared("a queue with timeout support") do
include Sus::Fixtures::Async::ReactorContext
let(:queue) {subj... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/test/io.rb | test/io.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
# Copyright, 2025, by Shopify Inc.
require "sus/fixtures/async"
describe IO do
include Sus::Fixtures::Async::ReactorContext
describe ".pipe" do
let(:message) {"Helloooooo World!"}
it "can send messa... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/test/thread.rb | test/thread.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
require "thread"
require "sus/fixtures/async"
describe Thread do
include Sus::Fixtures::Async::ReactorContext
it "can join thread" do
queue = Thread::Queue.new
thread = Thread.new{queue.pop}
waiti... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/test/tempfile.rb | test/tempfile.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
require "tempfile"
require "sus/fixtures/async"
describe Tempfile do
include Sus::Fixtures::Async::ReactorContext
it "should be able to read and write" do
tempfile = Tempfile.new
1_000.times{tempfil... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/test/file.rb | test/file.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2026, by Samuel Williams.
require "async"
require "securerandom"
require "tmpdir"
require "sus/fixtures/temporary_directory_context"
require "sus/fixtures/async/scheduler_context"
describe File do
include Sus::Fixtures::TemporaryDirectoryC... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/test/kernel.rb | test/kernel.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
# Copyright, 2025, by Shopify Inc.
require "sus/fixtures/async"
describe Kernel do
include Sus::Fixtures::Async::ReactorContext
with "#sleep" do
it "can intercept sleep" do
sleeps = []
mock(rea... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/test/enumerator.rb | test/enumerator.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2025, by Samuel Williams.
require "async"
describe Enumerator do
def some_yielder(task)
yield 1
sleep(0.002)
yield 2
end
def enum(task)
to_enum(:some_yielder, task)
end
it "should play well with Enumerator as internal ... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/test/process.rb | test/process.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
require "sus/fixtures/async"
describe Process do
include Sus::Fixtures::Async::ReactorContext
describe ".wait2" do
it "can wait on child process" do
expect(reactor).to receive(:process_wait)
pi... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/test/fiber.rb | test/fiber.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2022-2025, by Samuel Williams.
require "async"
require "async/variable"
describe Fiber do
with ".new" do
it "can stop a task with a nested resumed fiber" do
skip_unless_minimum_ruby_version("3.3.4")
variable = Async::Variable.n... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
socketry/async | https://github.com/socketry/async/blob/1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477/test/process/fork.rb | test/process/fork.rb | # frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2025, by Shopify Inc.
# Copyright, 2025, by Samuel Williams.
require "sus/fixtures/async"
require "async"
describe Process do
describe ".fork" do
it "can fork with block form" do
r, w = IO.pipe
Async do
pid = Process.fork d... | ruby | MIT | 1c41e4729bd3ef22cc58b27aaff7f5df8d8dd477 | 2026-01-04T15:55:57.398633Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.