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
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/spec/support/helpers.rb
spec/support/helpers.rb
require 'yaml' module Helpers def configs { db1: { adapter: "sqlite3", database: "tmp/db1.sqlite" }, db2: { adapter: "sqlite3", database: "tmp/db2.sqlite" } } end def mysql2_configs YAML.load_file('spec/support/config.yml').with_indifferent_access end def db(connection) case co...
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/spec/octoshark/connection_pools_manager_spec.rb
spec/octoshark/connection_pools_manager_spec.rb
require 'spec_helper' describe Octoshark::ConnectionPoolsManager do describe "#initialize" do it "initializes connection manager with default connection" do manager = Octoshark::ConnectionPoolsManager.new expect(manager.connection_pools.length).to eq(0) expect(manager.connection_pools[:default...
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/spec/octoshark/active_record_extensions_spec.rb
spec/octoshark/active_record_extensions_spec.rb
require 'spec_helper' require 'logger' describe "ActiveRecord Extensions" do it "logs current connection name" do io = StringIO.new logger = Logger.new(io) ActiveRecord::Base.logger = logger manager = Octoshark::ConnectionPoolsManager.new(configs) manager.with_connection(:db1) do |connection| ...
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/spec/octoshark/connection_manager_spec.rb
spec/octoshark/connection_manager_spec.rb
require 'spec_helper' describe Octoshark::ConnectionManager do describe "#with_connection", mysql2: true do it "creates temporary connection to database server" do manager = Octoshark::ConnectionManager.new connection_reference = nil config = mysql2_configs[:db1] manager.with_connection...
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/spec/octoshark/current_connection_spec.rb
spec/octoshark/current_connection_spec.rb
require 'spec_helper' describe "connection manager" do let(:config) { configs[:db1] } describe "#identifier" do it "has unique identifiers" do manager1 = Octoshark::ConnectionManager.new manager2 = Octoshark::ConnectionManager.new expect(manager1.identifier).to_not eq(manager2.identifier) ...
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/lib/octoshark.rb
lib/octoshark.rb
require 'octoshark/version' require 'active_record' require 'octoshark/active_record_extensions' module Octoshark autoload :CurrentConnection, 'octoshark/current_connection' autoload :ConnectionManager, 'octoshark/connection_manager' autoload :ConnectionPoolsManager, 'octoshark/connection_pools_manager...
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/lib/octoshark/connection_pools_manager.rb
lib/octoshark/connection_pools_manager.rb
module Octoshark class ConnectionPoolsManager include CurrentConnection # Octoshark needs to keep track of all persistent connection managers # in order to automatically reconnect on connection establish. @@connection_managers = [] def self.connection_managers @@connection_managers end...
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/lib/octoshark/connection_manager.rb
lib/octoshark/connection_manager.rb
module Octoshark class ConnectionManager include CurrentConnection def with_connection(config, connection_name: nil, &block) connection = if ActiveRecord::ConnectionAdapters.respond_to?(:resolve) # Rails 7.2+ ActiveRecord::ConnectionAdapters.resolve(config[:adapter]).new(con...
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/lib/octoshark/version.rb
lib/octoshark/version.rb
module Octoshark VERSION = "0.6.0" end
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/lib/octoshark/current_connection.rb
lib/octoshark/current_connection.rb
module Octoshark module CurrentConnection def current_connection Thread.current[identifier] || raise(Octoshark::Error::NoCurrentConnection, "No current connection") end def current_connection? !Thread.current[identifier].nil? end def current_or_default_connection Thread.current...
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/lib/octoshark/active_record_extensions.rb
lib/octoshark/active_record_extensions.rb
module Octoshark module ConnectionHandler # def establish_connection(owner, spec) # Rails 3.x # def establish_connection(config_or_env = nil) # Rails 4.x - 6.1 # def establish_connection(config, owner_name:, role:, shard:) # Rails 6.2+ def establish_connection(*ar...
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
dalibor/octoshark
https://github.com/dalibor/octoshark/blob/0971743cb8e5c8eb2686f60188267d3549001503/lib/octoshark/error.rb
lib/octoshark/error.rb
module Octoshark class Error < StandardError class NoConnection < Error; end; class NoCurrentConnection < Error; end; end end
ruby
MIT
0971743cb8e5c8eb2686f60188267d3549001503
2026-01-04T17:48:18.822915Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/init.rb
init.rb
require 'active_enum'
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/spec/active_enum_spec.rb
spec/active_enum_spec.rb
require "spec_helper" describe ActiveEnum do describe ".define" do it 'should define enum constants using block' do ActiveEnum.define do enum(:foo) do value :id => 1, :name => 'Foo 1' end enum(:bar) do value :id => 1, :name => 'Bar 1' end end ...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/spec/spec_helper.rb
spec/spec_helper.rb
ENV["RAILS_ENV"] ||= 'test' require 'logger' require 'rails' require 'active_record' require 'action_controller/railtie' require 'action_view' require 'action_mailer' require 'active_enum' require 'active_enum/acts_as_enum' module ActiveEnum class Application < Rails::Application config.generators do |g| ...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/spec/support/config_helper.rb
spec/support/config_helper.rb
module ConfigHelper extend ActiveSupport::Concern def with_config(preference_name, temporary_value) original_config_value = ActiveEnum.config.send(preference_name) ActiveEnum.config.send(:"#{preference_name}=", temporary_value) yield ensure ActiveEnum.config.send(:"#{preference_name}=", orig...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/spec/support/schema.rb
spec/support/schema.rb
ActiveRecord::Schema.define(:version => 1) do create_table :people, :force => true do |t| t.string :first_name t.string :last_name t.integer :sex t.integer :attending t.integer :staying t.integer :employment_status end create_table :sorted_people, :force => true do |t| t.s...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/spec/active_enum/base_spec.rb
spec/active_enum/base_spec.rb
require "spec_helper" describe ActiveEnum::Base do describe ".store" do it 'should load the storage class instance using the storage setting' do expect(ActiveEnum::Base.send(:store)).to be_instance_of(ActiveEnum::Storage::MemoryStore) end end describe ".enum_classes" do it 'should return all ...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/spec/active_enum/extensions_spec.rb
spec/active_enum/extensions_spec.rb
require "spec_helper" describe ActiveEnum::Extensions do class Sex < ActiveEnum::Base value id: 1, name: 'Male' value id: 2, name: 'Female' end class Accepted < ActiveEnum::Base value id: 0, name: 'No' value id: 1, name: 'Definitely' value id: 2, name: 'Maybe' end it 'should add class :...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/spec/active_enum/acts_as_enum_spec.rb
spec/active_enum/acts_as_enum_spec.rb
require "spec_helper" describe ActiveEnum::ActsAsEnum do class Person < ActiveRecord::Base acts_as_enum name_column: 'first_name' end class TestPerson < ActiveRecord::Base def self.extended_modules class << self self.included_modules end end end class SortedPerson < ActiveRe...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/spec/active_enum/storage/memory_store_spec.rb
spec/active_enum/storage/memory_store_spec.rb
require "spec_helper" describe ActiveEnum::Storage::MemoryStore do attr_accessor :store class TestMemoryStoreEnum < ActiveEnum::Base; end class TestOtherAREnum < ActiveEnum::Base; end describe '#set' do it 'should store value of id and name' do store.set 1, 'test name' expect(store.values).to...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/spec/active_enum/storage/i18n_store_spec.rb
spec/active_enum/storage/i18n_store_spec.rb
require "spec_helper" describe ActiveEnum::Storage::I18nStore do class TestI18nStoreEnum < ActiveEnum::Base; end let(:enum_class) { TestI18nStoreEnum } let(:enum_key) { enum_class.name.underscore } let(:store) { ActiveEnum::Storage::I18nStore.new(enum_class, :asc) } before(:all) do @_default_store = Ac...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/spec/active_enum/form_helpers/simple_form_spec.rb
spec/active_enum/form_helpers/simple_form_spec.rb
require "spec_helper" require 'simple_form' require 'active_enum/form_helpers/simple_form' describe ActiveEnum::FormHelpers::SimpleForm, type: :helper do include SimpleForm::ActionViewExtensions::FormHelper before do allow(controller).to receive(:action_name).and_return('new') reset_class Person do ...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/active_enum.rb
lib/active_enum.rb
require 'active_enum/base' require 'active_enum/extensions' require 'active_enum/storage/abstract_store' require 'active_enum/version' require 'active_enum/railtie' if defined?(Rails) module ActiveEnum mattr_accessor :enum_classes @@enum_classes = [] mattr_accessor :use_name_as_value @@use_name_as_value = fal...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/generators/active_enum/install_generator.rb
lib/generators/active_enum/install_generator.rb
module ActiveEnum module Generators class InstallGenerator < Rails::Generators::Base desc "Copy ActiveEnum default files" source_root File.expand_path('../templates', __FILE__) def copy_initializers copy_file 'config.rb', 'config/initializers/active_enum.rb' end end end end...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/generators/active_enum/locale_generator.rb
lib/generators/active_enum/locale_generator.rb
module ActiveEnum module Generators class LocaleGenerator < Rails::Generators::Base desc "Copy ActiveEnum locale file for I18n storage" source_root File.expand_path('../templates', __FILE__) class_option :lang, :type => :string, :default => 'en', :desc => "Language for locale file" def co...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/generators/active_enum/templates/config.rb
lib/generators/active_enum/templates/config.rb
# Form helper integration # require 'active_enum/form_helpers/simple_form' # for SimpleForm ActiveEnum.setup do |config| # Extend classes to add enumerate method # config.extend_classes = [ ActiveRecord::Base ] # Return name string as value for attribute method # config.use_name_as_value = false # Raise e...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/active_enum/version.rb
lib/active_enum/version.rb
module ActiveEnum VERSION = '1.3.0' end
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/active_enum/extensions.rb
lib/active_enum/extensions.rb
module ActiveEnum class EnumNotFound < StandardError; end module Extensions extend ActiveSupport::Concern included do class_attribute :enumerated_attributes end module ClassMethods # Declare an attribute to be enumerated by an enum class # # Example: # class Perso...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/active_enum/railtie.rb
lib/active_enum/railtie.rb
module ActiveEnum class Railtie < Rails::Railtie initializer "active_enum.active_record_extensions" do ActiveSupport.on_load(:active_record) do require 'active_enum/acts_as_enum' ActiveEnum.extend_classes << ActiveRecord::Base ActiveEnum.extend_classes! end end end end
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/active_enum/base.rb
lib/active_enum/base.rb
module ActiveEnum class DuplicateValue < StandardError; end class InvalidValue < StandardError; end class NotFound < StandardError; end class Base class << self attr_reader :store def inherited(subclass) ActiveEnum.enum_classes << subclass end # Define enum values. #...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/active_enum/acts_as_enum.rb
lib/active_enum/acts_as_enum.rb
module ActiveEnum module ActsAsEnum module MacroMethods def acts_as_enum(options={}) extend ClassMethods class_attribute :active_enum_options self.active_enum_options = options.reverse_merge(name_column: 'name') end end module ClassMethods def enum_values ...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/active_enum/storage/abstract_store.rb
lib/active_enum/storage/abstract_store.rb
module ActiveEnum module Storage autoload :MemoryStore, "active_enum/storage/memory_store" autoload :I18nStore, "active_enum/storage/i18n_store" class NotImplemented < StandardError; end class AbstractStore def initialize(enum_class, order, options={}) @enum, @order, @options = enum_c...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/active_enum/storage/i18n_store.rb
lib/active_enum/storage/i18n_store.rb
require 'i18n' module ActiveEnum module Storage class I18nStore < MemoryStore def get_by_id(id) row = _values.assoc(id) [ id, translate(row[1]), row[2] ].compact if row end def get_by_name(name) row = _values.rassoc(name.to_s) [ row[0], translate(row[1]), row[2]...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/active_enum/storage/memory_store.rb
lib/active_enum/storage/memory_store.rb
module ActiveEnum module Storage class MemoryStore < AbstractStore def set(id, name, meta=nil) check_duplicate id, name _values << [ id, name.to_s, meta ].compact sort! end def get_by_id(id) _values.assoc(id) end def get_by_name(name) _value...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
adzap/active_enum
https://github.com/adzap/active_enum/blob/18606452ea0dd2afa82a71a0b924e93d8a255a83/lib/active_enum/form_helpers/simple_form.rb
lib/active_enum/form_helpers/simple_form.rb
require 'simple_form/version' module ActiveEnum module FormHelpers module SimpleForm module BuilderExtension def find_custom_type(attribute_name) return :enum if object.class.active_enum_for(attribute_name) if object.class.respond_to?(:active_enum_for) super end ...
ruby
MIT
18606452ea0dd2afa82a71a0b924e93d8a255a83
2026-01-04T17:48:23.635701Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/test_helper.rb
test/test_helper.rb
begin require "hector" require "test/unit" require "mocha/test_unit" rescue LoadError => e if require "rubygems" retry else raise e end end $:.unshift File.dirname(__FILE__) + "/lib" require "logger" TEST_LOG_DIR = File.expand_path(File.dirname(__FILE__) + "/../log") Hector.logger = Logger.new(Fil...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/integration/services_test.rb
test/integration/services_test.rb
require "test_helper" module Hector class ServicesTest < IntegrationTest def setup super Hector::Session.register(Hector::TestService.new("TestService")) end test :"intercepting a channel message and delivering a replacement from the origin" do authenticated_connections(:join => "#test...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/integration/messaging_test.rb
test/integration/messaging_test.rb
require "test_helper" module Hector class MessagingTest < IntegrationTest test :"messages can be sent between two sessions" do authenticated_connections do |c1, c2| c1.receive_line "PRIVMSG user2 :hello world" assert_sent_to c2, ":user1!sam@hector.irc PRIVMSG user2 :hello world" end ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/integration/connection_test.rb
test/integration/connection_test.rb
# encoding: UTF-8 require "test_helper" module Hector class ConnectionTest < IntegrationTest test :"connecting without specifying a password shouldn't create a session" do connection.tap do |c| user! c nick! c assert_nil c.session end end test :"connecting with an i...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/integration/keep_alive_test.rb
test/integration/keep_alive_test.rb
require "test_helper" module Hector class KeepAliveTest < IntegrationTest test :"keep-alive ping is sent on pulse" do authenticated_connection.tap do |c| assert_not_sent_to c, "PING hector.irc" assert_sent_to c, "PING hector.irc" do pulse(c) end assert !c.connectio...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/integration/async_authentication_test.rb
test/integration/async_authentication_test.rb
require "test_helper" require "hector/async_identity_adapter" module Hector class AsyncAuthenticationTest < IntegrationTest def setup super @yaml_identity_adapter = Identity.adapter Identity.adapter = AsyncIdentityAdapter.new(IDENTITY_FIXTURES) end def teardown super Identi...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/integration/channels_test.rb
test/integration/channels_test.rb
# encoding: UTF-8 require "test_helper" module Hector class ChannelsTest < IntegrationTest test :"channels can be joined" do authenticated_connections do |c1, c2| c1.receive_line "JOIN #test" assert_sent_to c1, ":user1!sam@hector.irc JOIN :#test" c2.receive_line "JOIN #tes...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/lib/hector/integration_test.rb
test/lib/hector/integration_test.rb
module Hector class IntegrationTest < TestCase def setup reset! end def teardown reset! end def reset! Session.reset! Channel.reset! end def authenticated_connection(nickname = "sam") connection.tap do |c| authenticate! c, nickname end end...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/lib/hector/async_identity_adapter.rb
test/lib/hector/async_identity_adapter.rb
module Hector class AsyncIdentityAdapter < YamlIdentityAdapter def authenticate(username, password) Hector.next_tick do super username, password end end end end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/lib/hector/test_deference.rb
test/lib/hector/test_deference.rb
module Hector class << self def deferred_blocks @deferred_blocks ||= [] end def defer(&block) deferred_blocks.push(block) end alias_method :next_tick, :defer def process_deferred_blocks until deferred_blocks.empty? deferred_blocks.shift.call end end end...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/lib/hector/test_case.rb
test/lib/hector/test_case.rb
module Hector class TestCase < Test::Unit::TestCase undef_method :default_test if method_defined?(:default_test) def self.test(name, &block) define_method("test #{name.inspect}", &block) end def run(*) Hector.logger.info "--- #@method_name ---" super ensure Hector.logger....
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/lib/hector/test_heartbeat.rb
test/lib/hector/test_heartbeat.rb
module Hector class Heartbeat def self.create_timer(interval) Object.new.tap do |o| def o.cancel; end end end end end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/lib/hector/test_service.rb
test/lib/hector/test_service.rb
module Hector class TestService < Service def received_privmsg intercept(/^!reverse (.+)/) do |line, text| deliver_message_from_origin(text.reverse) end intercept(/^!sum (\d+) (\d+)/) do |line, n, m| n, m = n.to_i, m.to_i deliver_message_from_service("#{n} + #{m} = #{n +...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/lib/hector/test_connection.rb
test/lib/hector/test_connection.rb
module Hector class TestConnection < Connection def sent_data @sent_data ||= "" end def send_data(data) sent_data << data end def connection_closed? @connection_closed end def close_connection(after_writing = false) unbind unless connection_closed? @connect...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/unit/session_test.rb
test/unit/session_test.rb
# encoding: UTF-8 require "test_helper" module Hector class SessionTest < TestCase def teardown Session.reset! end test :"creating a session adds it to the session pool" do assert_equal [], session_names create_session("first") assert_equal ["first"], session_names creat...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/unit/irc_error_test.rb
test/unit/irc_error_test.rb
require "test_helper" module Hector class TestError < IrcError("FOO", :text => "This is a test"); end class FatalError < IrcError("FATAL", :fatal => true); end class IrcErrorTest < TestCase test :"raising an IrcError without an argument" do exception = begin raise TestError rescue Except...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/unit/response_test.rb
test/unit/response_test.rb
# encoding: UTF-8 require "test_helper" module Hector class ResponseTest < TestCase test :"numeric response from the server" do assert_response ":hector.irc 001 sam :Welcome to IRC\r\n", "001", "sam", :text => "Welcome to IRC" end test :"response from a user" do assert_response ":ross!r...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/unit/request_test.rb
test/unit/request_test.rb
require "test_helper" module Hector class RequestTest < TestCase test :"empty line" do assert_request :command => "", :args => [], :text => nil, :line => "" assert_request :command => "", :args => [], :text => nil, :line => " " end test :"just a command" do assert_request :command => "...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/unit/identity_test.rb
test/unit/identity_test.rb
require "test_helper" module Hector class IdentityTest < TestCase test :"authenticate yields nil when the identity doesn't exist" do Identity.authenticate("nonexistent", "foo") do |identity| assert_nil identity end end test :"authenticate yields nil when the password is invalid" do ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/test/unit/yaml_identity_adapter_test.rb
test/unit/yaml_identity_adapter_test.rb
module Hector class YamlIdentityAdapterTest < TestCase TEST_IDENTITY_FIXTURES = Hector.fixture_path("identities2.yml") attr_reader :adapter def setup FileUtils.cp(IDENTITY_FIXTURES, TEST_IDENTITY_FIXTURES) reload_adapter end def teardown FileUtils.rm_f(TEST_IDENTITY_FIXTURES) ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector.rb
lib/hector.rb
require "digest/sha1" require "eventmachine" require "fileutils" require "socket" require "yaml" require "hector/errors" require "hector/concerns/authentication" require "hector/concerns/keep_alive" require "hector/concerns/presence" require "hector/commands/away" require "hector/commands/invite" require "hector/com...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/session.rb
lib/hector/session.rb
module Hector class Session include Concerns::KeepAlive include Concerns::Presence include Commands::Join include Commands::Mode include Commands::Names include Commands::Nick include Commands::Notice include Commands::Part include Commands::Ping include Commands::Pong inc...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/version.rb
lib/hector/version.rb
module Hector VERSION = "1.0.9" end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/channel.rb
lib/hector/channel.rb
module Hector class Channel attr_reader :name, :topic, :user_sessions, :created_at class << self def find(name) channels[normalize(name)] end def find_all_for_session(session) channels.values.find_all do |channel| channel.has_session?(session) end en...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/identity.rb
lib/hector/identity.rb
module Hector class Identity attr_accessor :username class << self attr_accessor :adapter def authenticate(username, password) adapter.authenticate(username, password) do |authenticated| yield authenticated ? new(username) : nil end end end def initialize...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/errors.rb
lib/hector/errors.rb
module Hector class Error < ::StandardError; end class LoadError < Error; end class IrcError < Error def response Response.new(command, *options).tap do |response| response.args.push(message) unless message == self.class.name end end end def self.IrcError(command, *options) f...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/logging.rb
lib/hector/logging.rb
module Hector class NullLogger def level=(l) end def debug(*) end def info(*) end def warn(*) end def error(*) end def fatal(*) end end class << self attr_accessor :logger end self.logger = NullLogger.new end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/response.rb
lib/hector/response.rb
module Hector class Response attr_reader :command, :args, :source attr_accessor :text class << self def apportion_text(args, *base_args) base_response = Response.new(*base_args) max_length = 510 - base_response.to_s.bytesize args.inject([args.shift.dup]) do |texts, arg| ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/user_session.rb
lib/hector/user_session.rb
module Hector class UserSession < Session attr_reader :connection, :identity, :realname class << self def create(nickname, connection, identity, realname) if find(nickname) raise NicknameInUse, nickname else register UserSession.new(nickname, connection, identity, re...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/connection.rb
lib/hector/connection.rb
module Hector class Connection < EventMachine::Protocols::LineAndTextProtocol include Concerns::Authentication attr_reader :session, :request, :identity def post_init log(:info, "opened connection") end def receive_line(line) @request = Request.new(line) log(:debug, "received"...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/yaml_identity_adapter.rb
lib/hector/yaml_identity_adapter.rb
module Hector # Identity adapters must implement the following public methods: # - authenticate(username, password) # - remember(username, password) # - forget(username) # - normalize(username) # class YamlIdentityAdapter attr_reader :filename def initialize(filename) @filename = File.e...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/deference.rb
lib/hector/deference.rb
module Hector class << self def defer(&block) EM.defer(&block) end def next_tick(&block) EM.next_tick(&block) end end end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/heartbeat.rb
lib/hector/heartbeat.rb
module Hector class Heartbeat def self.create_timer(interval, &block) EventMachine::PeriodicTimer.new(interval, &block) end def initialize(interval = 60, &block) @interval, @block = interval, block start end def start @timer ||= self.class.create_timer(@interval) { pulse ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/server.rb
lib/hector/server.rb
module Hector class << self attr_accessor :server_name, :address, :port, :ssl_port, :ssl_certificate_path, :ssl_certificate_key_path def start_server EventMachine.start_server(@address, @port, Connection) EventMachine.start_server(@address, @ssl_port, SSLConnection) logger.info("Hecto...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/service.rb
lib/hector/service.rb
module Hector class Service < Session protected def deliver_message_from_origin(text) deliver_message_from_session(origin, text) end def deliver_message_from_service(text) deliver_message_from_session(self, text) end def deliver_message_from_session(session, text) ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/request.rb
lib/hector/request.rb
module Hector class Request attr_reader :line, :command, :args, :text alias_method :to_s, :line def initialize(line) @line = line parse end def event_name "on_#{command.downcase}" end def sensitive? command.downcase == "pass" end protected def par...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/boot.rb
lib/hector/boot.rb
require "pathname" require "logger" module Hector class << self attr_accessor :lib, :root def start raise LoadError, "please specify HECTOR_ROOT" unless Hector.root load_defaults load_application end def load_root if root = ENV["HECTOR_ROOT"] Hector.root = Pathname.n...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/concerns/authentication.rb
lib/hector/concerns/authentication.rb
module Hector module Concerns module Authentication def on_user @username = request.args.first @realname = request.text authenticate end def on_pass @password = request.text authenticate end def on_nick @nickname = request.text ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/concerns/presence.rb
lib/hector/concerns/presence.rb
module Hector module Concerns module Presence def self.included(klass) klass.class_eval do attr_reader :created_at, :updated_at end end def channels Channel.find_all_for_session(self) end def initialize_presence @created_at = Time.now ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/concerns/keep_alive.rb
lib/hector/concerns/keep_alive.rb
module Hector module Concerns module KeepAlive def initialize_keep_alive @received_pong = true @heartbeat = Hector::Heartbeat.new { on_heartbeat } end def on_heartbeat if @received_pong @received_pong = false respond_with(:ping, Hector.server_name) ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/ping.rb
lib/hector/commands/ping.rb
module Hector module Commands module Ping def on_ping respond_with(:pong, Hector.server_name, :source => Hector.server_name, :text => request.text) end end end end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/mode.rb
lib/hector/commands/mode.rb
module Hector module Commands module Mode def on_mode subject = find(request.args.first) if subject.channel? if requesting_modes? respond_with("324", nickname, subject.name, "+", :source => Hector.server_name) respond_with("329", nickname, subject.name, sub...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/nick.rb
lib/hector/commands/nick.rb
module Hector module Commands module Nick def on_nick old_nickname = nickname rename(request.args.first) broadcast(:nick, nickname, :source => old_nickname) end end end end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/topic.rb
lib/hector/commands/topic.rb
module Hector module Commands module Topic def on_topic channel = Channel.find(request.args.first) if request.args.length > 1 topic = request.text channel.change_topic(self, topic) channel.broadcast(:topic, channel.name, :source => source, :text => topic) ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/pong.rb
lib/hector/commands/pong.rb
module Hector module Commands module Pong def on_pong @received_pong = true end end end end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/who.rb
lib/hector/commands/who.rb
module Hector module Commands module Who def on_who name = request.args.first if destination = destination_klass_for(name).find(name) sessions_for_who(destination).each do |session| respond_with("352", nickname, name, session.who, :source => Hector.server_name) ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/away.rb
lib/hector/commands/away.rb
module Hector module Commands module Away def on_away away_message = request.args.first if away_message and !away_message.empty? @away_message = away_message respond_with("306", :text => "You have been marked as being away") else @away_message = nil ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/quit.rb
lib/hector/commands/quit.rb
module Hector module Commands module Quit def on_quit @quit_message = "Quit: #{request.text}" connection.close_connection(true) end end end end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/invite.rb
lib/hector/commands/invite.rb
module Hector module Commands module Invite def on_invite touch_presence nickname = request.args.first if session = Session.find(nickname) channel = Channel.find(request.args[1]) if channels.include?(channel) if !session.channels.include?(channel) ...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/privmsg.rb
lib/hector/commands/privmsg.rb
module Hector module Commands module Privmsg def on_privmsg touch_presence subject = find(request.args.first) subject.deliver(:privmsg, self, :source => source, :text => request.text) if !subject.channel? and subject.away? respond_with("301", subject.nickname, :te...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/realname.rb
lib/hector/commands/realname.rb
module Hector module Commands module Realname def on_realname @realname = request.text broadcast("352", :$nickname, "*", who, :source => Hector.server_name) end end end end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/join.rb
lib/hector/commands/join.rb
module Hector module Commands module Join def on_join request.args.first.split(/,(?=[#&+!])/).each do |channel_name| channel = Channel.find_or_create(channel_name) if channel.join(self) channel.broadcast(:join, :source => source, :text => channel.name) res...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/notice.rb
lib/hector/commands/notice.rb
module Hector module Commands module Notice def on_notice touch_presence find(request.args.first).deliver(:notice, self, :source => source, :text => request.text) end end end end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/whois.rb
lib/hector/commands/whois.rb
module Hector module Commands module Whois def on_whois nickname = request.args.first if session = Session.find(nickname) respond_to_whois_for(self.nickname, session) else raise NoSuchNickOrChannel, nickname end ensure respond_with("318", sel...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/names.rb
lib/hector/commands/names.rb
module Hector module Commands module Names def on_names channel = Channel.find(request.args.first) respond_to_names(channel) end def respond_to_names(channel) responses = Response.apportion_text(channel.nicknames, "353", nickname, "=", channel.name, :source => Hector.ser...
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
sstephenson/hector
https://github.com/sstephenson/hector/blob/91165fd15e20fd521ce270274c09100aaa74081c/lib/hector/commands/part.rb
lib/hector/commands/part.rb
module Hector module Commands module Part def on_part channel = Channel.find(request.args.first) channel.broadcast(:part, channel.name, :source => source, :text => request.text) channel.part(self) end end end end
ruby
MIT
91165fd15e20fd521ce270274c09100aaa74081c
2026-01-04T17:48:25.917910Z
false
stripe-contrib/stripe-cli
https://github.com/stripe-contrib/stripe-cli/blob/ee98caab204fabf3d5cc34d1baef33c1cc45c881/spec/command_spec.rb
spec/command_spec.rb
require 'spec_helper' describe Stripe::CLI::Command do let(:_id_) { "random-id-string" } describe "#find" do it "calls super, passing in `Stripe::Charge` and an `id`" do Stripe::Charge.should_receive(:retrieve).with( _id_, "stripe-key" ) Stripe::CLI::Runner.start ["charges", "find", _id_] en...
ruby
MIT
ee98caab204fabf3d5cc34d1baef33c1cc45c881
2026-01-04T17:48:21.359522Z
false
stripe-contrib/stripe-cli
https://github.com/stripe-contrib/stripe-cli/blob/ee98caab204fabf3d5cc34d1baef33c1cc45c881/spec/dollar_amounts_spec.rb
spec/dollar_amounts_spec.rb
require 'spec_helper' describe Stripe::CLI::Command do describe "#dollar_amounts" do it "defaults to true" do options = {} end end end
ruby
MIT
ee98caab204fabf3d5cc34d1baef33c1cc45c881
2026-01-04T17:48:21.359522Z
false
stripe-contrib/stripe-cli
https://github.com/stripe-contrib/stripe-cli/blob/ee98caab204fabf3d5cc34d1baef33c1cc45c881/spec/spec_helper.rb
spec/spec_helper.rb
require 'rspec' require_relative '../lib/stripe/cli.rb' module Stripe class StripeObject def body @stripe_values[:body] end end module CLI class Command < Thor protected def api_key "stripe-key" end def config Hash.new end end end end module ...
ruby
MIT
ee98caab204fabf3d5cc34d1baef33c1cc45c881
2026-01-04T17:48:21.359522Z
false
stripe-contrib/stripe-cli
https://github.com/stripe-contrib/stripe-cli/blob/ee98caab204fabf3d5cc34d1baef33c1cc45c881/spec/commands/recipient_spec.rb
spec/commands/recipient_spec.rb
require 'spec_helper' describe Stripe::CLI::Commands::Recipients do describe "#create" do it "can determine recipient type from the passed options" do Stripe.should_receive(:execute_request).with do |opts| opts[:headers][:authorization] == 'Bearer stripe-key' end request_hash = Stripe...
ruby
MIT
ee98caab204fabf3d5cc34d1baef33c1cc45c881
2026-01-04T17:48:21.359522Z
false
stripe-contrib/stripe-cli
https://github.com/stripe-contrib/stripe-cli/blob/ee98caab204fabf3d5cc34d1baef33c1cc45c881/spec/commands/charges_spec.rb
spec/commands/charges_spec.rb
require 'spec_helper' describe Stripe::CLI::Commands::Charges do let(:_id_){ "a-charge-id" } describe "#refund" do # it "takes a charge_id and refunds the associated charge entirely" do # request_hash = Stripe::CLI::Runner.start ["charges", "refund", _id_] # request_hash[:url].should == "https:/...
ruby
MIT
ee98caab204fabf3d5cc34d1baef33c1cc45c881
2026-01-04T17:48:21.359522Z
false
stripe-contrib/stripe-cli
https://github.com/stripe-contrib/stripe-cli/blob/ee98caab204fabf3d5cc34d1baef33c1cc45c881/lib/stripe/utils.rb
lib/stripe/utils.rb
module Stripe module Utils private def credit_card options = {} card = options.delete(:card) || {} { :name => card["name"] || options.delete(:card_name) || ask('Name on Card:'), :number => card["number"] || options.delete(:card_number) || ask('Card Number:...
ruby
MIT
ee98caab204fabf3d5cc34d1baef33c1cc45c881
2026-01-04T17:48:21.359522Z
false
stripe-contrib/stripe-cli
https://github.com/stripe-contrib/stripe-cli/blob/ee98caab204fabf3d5cc34d1baef33c1cc45c881/lib/stripe/cli.rb
lib/stripe/cli.rb
require "thor" require "stripe" require "stripe/cli/version" require "awesome_print" require "stripe/utils" module Stripe module CLI autoload :Command, 'stripe/cli/command' autoload :Runner, 'stripe/cli/runner' autoload :Commands, 'stripe/cli/commands' end # `alias_method_chain' style patch to tweek...
ruby
MIT
ee98caab204fabf3d5cc34d1baef33c1cc45c881
2026-01-04T17:48:21.359522Z
false
stripe-contrib/stripe-cli
https://github.com/stripe-contrib/stripe-cli/blob/ee98caab204fabf3d5cc34d1baef33c1cc45c881/lib/stripe/cli/command.rb
lib/stripe/cli/command.rb
require 'parseconfig' module Stripe module CLI class Command < Thor @@root_config = ::File.expand_path('~/.stripecli') @@local_config = ::File.expand_path('./.stripecli') class_option :key, :aliases => :k, :type => :string, :desc => "One of your API secret keys, provided by Stripe" class...
ruby
MIT
ee98caab204fabf3d5cc34d1baef33c1cc45c881
2026-01-04T17:48:21.359522Z
false