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
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/exceptions.rb
lib/statesman/exceptions.rb
# frozen_string_literal: true module Statesman class InvalidStateError < StandardError; end class InvalidTransitionError < StandardError; end class InvalidCallbackError < StandardError; end class TransitionConflictError < StandardError; end class MissingTransitionAssociation < StandardError; end class...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/utils.rb
lib/statesman/utils.rb
# frozen_string_literal: true module Statesman module Utils def self.rails_major_version Rails.version.split(".").map(&:to_i).first end def self.rails_5_or_higher? rails_major_version >= 5 end def self.rails_4_or_higher? rails_major_version >= 4 end end end
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/railtie.rb
lib/statesman/railtie.rb
# frozen_string_literal: true module Statesman class Railtie < ::Rails::Railtie railtie_name :statesman rake_tasks do load "tasks/statesman.rake" end end end
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/machine.rb
lib/statesman/machine.rb
# frozen_string_literal: true require_relative "version" require_relative "exceptions" require_relative "guard" require_relative "callback" require_relative "adapters/memory_transition" module Statesman # The main module, that should be `extend`ed in to state machine classes. module Machine def self.included(...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/guard.rb
lib/statesman/guard.rb
# frozen_string_literal: true require_relative "callback" require_relative "exceptions" module Statesman class Guard < Callback def call(*args) raise GuardFailedError.new(from, to, callback) unless super end end end
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/config.rb
lib/statesman/config.rb
# frozen_string_literal: true require "json" require_relative "exceptions" module Statesman class Config attr_reader :adapter_class def initialize(block = nil) instance_eval(&block) unless block.nil? end def storage_adapter(adapter_class) @adapter_class = adapter_class end def...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/adapters/active_record.rb
lib/statesman/adapters/active_record.rb
# frozen_string_literal: true require_relative "../exceptions" module Statesman module Adapters class ActiveRecord JSON_COLUMN_TYPES = %w[json jsonb].freeze def self.database_supports_partial_indexes?(model) # Rails 3 doesn't implement `supports_partial_index?` if model.connection.r...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/adapters/memory.rb
lib/statesman/adapters/memory.rb
# frozen_string_literal: true require "json" module Statesman module Adapters class Memory attr_reader :transition_class attr_reader :parent_model # We only accept mode as a parameter to maintain a consistent interface # with other adapters which require it. def initialize(transit...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/adapters/active_record_transition.rb
lib/statesman/adapters/active_record_transition.rb
# frozen_string_literal: true require "json" module Statesman module Adapters module ActiveRecordTransition DEFAULT_UPDATED_TIMESTAMP_COLUMN = :updated_at extend ActiveSupport::Concern included do if ::ActiveRecord.gem_version >= Gem::Version.new("7.1") serialize :metadata,...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/adapters/memory_transition.rb
lib/statesman/adapters/memory_transition.rb
# frozen_string_literal: true module Statesman module Adapters class MemoryTransition attr_accessor :created_at attr_accessor :updated_at attr_accessor :from_state attr_accessor :to_state attr_accessor :sort_key attr_accessor :metadata def initialize(from, to, sort_key,...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/adapters/type_safe_active_record_queries.rb
lib/statesman/adapters/type_safe_active_record_queries.rb
# frozen_string_literal: true module Statesman module Adapters module TypeSafeActiveRecordQueries def configure_state_machine(args = {}) transition_class = args.fetch(:transition_class) initial_state = args.fetch(:initial_state) include( ActiveRecordQueries::ClassMethods....
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
gocardless/statesman
https://github.com/gocardless/statesman/blob/312d6264dac8f68a89d87a88792b95679960841d/lib/statesman/adapters/active_record_queries.rb
lib/statesman/adapters/active_record_queries.rb
# frozen_string_literal: true module Statesman module Adapters module ActiveRecordQueries def self.check_missing_methods!(base) missing_methods = %i[transition_class initial_state]. reject { |m| base.respond_to?(m) } return if missing_methods.none? raise NotImplementedErr...
ruby
MIT
312d6264dac8f68a89d87a88792b95679960841d
2026-01-04T16:00:22.647260Z
false
lazaronixon/authentication-zero
https://github.com/lazaronixon/authentication-zero/blob/b76b4f90e31a3bd89f5c08da2cc16c45073c020a/lib/authentication-zero.rb
lib/authentication-zero.rb
require "authentication_zero"
ruby
MIT
b76b4f90e31a3bd89f5c08da2cc16c45073c020a
2026-01-04T16:00:23.071088Z
false
lazaronixon/authentication-zero
https://github.com/lazaronixon/authentication-zero/blob/b76b4f90e31a3bd89f5c08da2cc16c45073c020a/lib/authentication_zero.rb
lib/authentication_zero.rb
require "authentication_zero/version" module AuthenticationZero end
ruby
MIT
b76b4f90e31a3bd89f5c08da2cc16c45073c020a
2026-01-04T16:00:23.071088Z
false
lazaronixon/authentication-zero
https://github.com/lazaronixon/authentication-zero/blob/b76b4f90e31a3bd89f5c08da2cc16c45073c020a/lib/generators/authentication/authentication_generator.rb
lib/generators/authentication/authentication_generator.rb
require "rails/generators/active_record" class AuthenticationGenerator < Rails::Generators::Base include ActiveRecord::Generators::Migration class_option :api, type: :boolean, desc: "Generates API authentication" class_option :pwned, type: :boolean, desc: "Add pwned password validation" clas...
ruby
MIT
b76b4f90e31a3bd89f5c08da2cc16c45073c020a
2026-01-04T16:00:23.071088Z
false
lazaronixon/authentication-zero
https://github.com/lazaronixon/authentication-zero/blob/b76b4f90e31a3bd89f5c08da2cc16c45073c020a/lib/generators/authentication/templates/models/concerns/account_scoped.rb
lib/generators/authentication/templates/models/concerns/account_scoped.rb
module AccountScoped extend ActiveSupport::Concern included do belongs_to :account default_scope { where account: Current.account } end end
ruby
MIT
b76b4f90e31a3bd89f5c08da2cc16c45073c020a
2026-01-04T16:00:23.071088Z
false
lazaronixon/authentication-zero
https://github.com/lazaronixon/authentication-zero/blob/b76b4f90e31a3bd89f5c08da2cc16c45073c020a/lib/generators/authentication/templates/lib/account_middleware.rb
lib/generators/authentication/templates/lib/account_middleware.rb
class AccountMiddleware def initialize(app) @app = app end def call(env) request = ActionDispatch::Request.new(env) if m = /\A(\/(\d{1,}))/.match(request.path_info) script_name, account_id, path_info = [m[1], m[2], m.post_match] request.script_name = script_name request.path_info ...
ruby
MIT
b76b4f90e31a3bd89f5c08da2cc16c45073c020a
2026-01-04T16:00:23.071088Z
false
lazaronixon/authentication-zero
https://github.com/lazaronixon/authentication-zero/blob/b76b4f90e31a3bd89f5c08da2cc16c45073c020a/lib/generators/authentication/templates/config/initializers/webauthn.rb
lib/generators/authentication/templates/config/initializers/webauthn.rb
WebAuthn.configure do |config| config.origin = "http://localhost:3000" config.rp_name = "Example Inc." end
ruby
MIT
b76b4f90e31a3bd89f5c08da2cc16c45073c020a
2026-01-04T16:00:23.071088Z
false
lazaronixon/authentication-zero
https://github.com/lazaronixon/authentication-zero/blob/b76b4f90e31a3bd89f5c08da2cc16c45073c020a/lib/generators/authentication/templates/config/initializers/omniauth.rb
lib/generators/authentication/templates/config/initializers/omniauth.rb
Rails.application.config.middleware.use OmniAuth::Builder do provider :developer unless Rails.env.production? # You should replace it with your provider end
ruby
MIT
b76b4f90e31a3bd89f5c08da2cc16c45073c020a
2026-01-04T16:00:23.071088Z
false
lazaronixon/authentication-zero
https://github.com/lazaronixon/authentication-zero/blob/b76b4f90e31a3bd89f5c08da2cc16c45073c020a/lib/authentication_zero/version.rb
lib/authentication_zero/version.rb
module AuthenticationZero VERSION = "4.0.4" end
ruby
MIT
b76b4f90e31a3bd89f5c08da2cc16c45073c020a
2026-01-04T16:00:23.071088Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/benchmark/memory_usage.rb
benchmark/memory_usage.rb
# frozen-string-literal: true require 'memory_profiler' require 'did_you_mean' # public def foo; end # error = (self.fooo rescue $!) # executable = -> { error.to_s } METHODS = ''.methods INPUT = 'start_with?' collection = DidYouMean::SpellChecker.new(dictionary: METHODS) executable = proc { collection.c...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/benchmark/require_path_checker.rb
benchmark/require_path_checker.rb
# frozen-string-literal: true # # Run the following command to run this script: # # $ ruby --disable-did_you_mean benchmark/require_path_checker.rb # require_relative '../lib/did_you_mean/spell_checkers/require_path_checker' require 'benchmark/ips' Benchmark.ips do |x| x.config(time: 10, warmup: 10) exception...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/benchmark/levenshtein/memory_usage.rb
benchmark/levenshtein/memory_usage.rb
# frozen-string-literal: true require 'memory_profiler' require 'did_you_mean/levenshtein' report = MemoryProfiler.report do 1000.times do DidYouMean::Levenshtein.distance "user_signed_in?", "user_logged_in?" end end report.pretty_print
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/benchmark/levenshtein/speed.rb
benchmark/levenshtein/speed.rb
# frozen-string-literal: true require 'benchmark/ips' require 'did_you_mean/levenshtein' Benchmark.ips do |x| x.report "original" do DidYouMean::Levenshtein.distance "user_signed_in?", "user_logged_in?" end # This #proposed method is not defined. Write your own method using this # name so we can reliably...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/benchmark/jaro_winkler/memory_usage.rb
benchmark/jaro_winkler/memory_usage.rb
# frozen-string-literal: true require 'memory_profiler' require 'did_you_mean/jaro_winkler' report = MemoryProfiler.report do 1000.times do DidYouMean::Jaro.distance "user_signed_in?", "user_logged_in?" end end report.pretty_print
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/benchmark/jaro_winkler/speed.rb
benchmark/jaro_winkler/speed.rb
# frozen-string-literal: true require 'benchmark/ips' require 'did_you_mean/jaro_winkler' Benchmark.ips do |x| x.report "original" do DidYouMean::Jaro.distance "user_signed_in?", "user_logged_in?" end # This #proposed method is not defined. Write your own method using this # name so we can reliably run t...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/test_tree_spell_checker.rb
test/test_tree_spell_checker.rb
# frozen_string_literal: true require "yaml" require_relative "./helper" class TreeSpellCheckerTest < Test::Unit::TestCase MINI_DIRECTORIES = YAML.load_file(File.expand_path("fixtures/mini_dir.yml", __dir__)) RSPEC_DIRECTORIES = YAML.load_file(File.expand_path("fixtures/rspec_dir.yml", __dir__)) def setup ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/test_spell_checker.rb
test/test_spell_checker.rb
require_relative './helper' class SpellCheckerTest < Test::Unit::TestCase def test_spell_checker_corrects_mistypes assert_spell 'foo', input: 'doo', dictionary: ['foo', 'fork'] assert_spell 'email', input: 'meail', dictionary: ['email', 'fail', 'eval'] assert_spell 'fail', input: 'fial', dictionary...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/helper.rb
test/helper.rb
require 'test/unit' module DidYouMean module TestHelper class << self attr_reader :root def ractor_compatible? defined?(Ractor) && RUBY_VERSION >= "3.1.0" end end if File.file?(File.expand_path('../lib/did_you_mean.rb', __dir__)) # In this case we're being run from insid...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/test_ractor_compatibility.rb
test/test_ractor_compatibility.rb
require_relative './helper' return if not DidYouMean::TestHelper.ractor_compatible? class RactorCompatibilityTest < Test::Unit::TestCase def test_class_name_suggestion_works_in_ractor assert_ractor(<<~CODE, require_relative: "helper") class ::Book; end include DidYouMean::TestHelper error = Ra...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/fixtures/book.rb
test/fixtures/book.rb
class Book class Spine end end
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/core_ext/test_name_error_extension.rb
test/core_ext/test_name_error_extension.rb
require_relative '../helper' class NameErrorExtensionTest < Test::Unit::TestCase include DidYouMean::TestHelper SPELL_CHECKERS = DidYouMean.spell_checkers class TestSpellChecker def initialize(*); end def corrections; ["does_exist"]; end end def setup @original_spell_checker = DidYouMean.spell...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/lib/helper.rb
test/lib/helper.rb
require "test/unit" require "core_assertions" Test::Unit::TestCase.include Test::Unit::CoreAssertions
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/tree_spell/test_explore.rb
test/tree_spell/test_explore.rb
require 'set' require 'yaml' require_relative '../helper' require_relative 'human_typo' # statistical tests on tree_spell algorithms class ExploreTest < Test::Unit::TestCase MINI_DIRECTORIES = YAML.load_file(File.expand_path('../fixtures/mini_dir.yml', __dir__)) RSPEC_DIRECTORIES = YAML.load_file(File.expand_path...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/tree_spell/human_typo.rb
test/tree_spell/human_typo.rb
# module for classes needed to test TreeSpellChecker module TreeSpell require_relative 'change_word' # Simulate an error prone human typist # see doc/human_typo_api.md for the api description class HumanTypo POPULAR_CHARS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ?<>,.!`+=-_":;@#$%^&*()'.split(...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/tree_spell/test_human_typo.rb
test/tree_spell/test_human_typo.rb
require_relative '../helper' require_relative 'human_typo' class HumanTypoTest < Test::Unit::TestCase def setup @input = 'spec/services/anything_spec' @sh = TreeSpell::HumanTypo.new(@input, lambda: 0.05) @len = @input.length end def test_changes # srand seed ensures all four actions are called ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/tree_spell/test_change_word.rb
test/tree_spell/test_change_word.rb
require_relative '../helper' require_relative 'change_word' class ChangeWordTest < Test::Unit::TestCase def setup @input = 'spec/services/anything_spec' @cw = TreeSpell::ChangeWord.new(@input) @len = @input.length end def test_deletion assert_match @cw.deletion(5), 'spec/ervices/anything_spec' ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/tree_spell/change_word.rb
test/tree_spell/change_word.rb
module TreeSpell # Changes a word with one of four actions: # insertion, substitution, deletion and transposition. class ChangeWord # initialize with input string def initialize(input) @input = input @len = input.length end # insert char after index of i_place def insertion(i_plac...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/edit_distance/test_jaro_winkler.rb
test/edit_distance/test_jaro_winkler.rb
require_relative '../helper' # These tests were originally written by Jian Weihang (簡煒航) as part of his work # on the jaro_winkler gem. The original code could be found here: # https://github.com/tonytonyjan/jaro_winkler/blob/9bd12421/spec/jaro_winkler_spec.rb # # Copyright (c) 2014 Jian Weihang class JaroWinklerTe...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/spell_checking/test_pattern_key_name_check.rb
test/spell_checking/test_pattern_key_name_check.rb
require_relative '../helper' return if !defined?(::NoMatchingPatternKeyError) class PatternKeyNameCheckTest < Test::Unit::TestCase include DidYouMean::TestHelper def test_corrects_hash_key_name_with_single_pattern_match error = assert_raise(NoMatchingPatternKeyError) do eval(<<~RUBY, binding, __FILE__,...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/spell_checking/test_require_path_check.rb
test/spell_checking/test_require_path_check.rb
require_relative '../helper' return if !(RUBY_VERSION >= '2.8.0') class RequirePathCheckTest < Test::Unit::TestCase include DidYouMean::TestHelper def test_load_error_from_require_has_suggestions error = assert_raise LoadError do require 'open' end assert_correction 'open3', er...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/spell_checking/test_class_name_check.rb
test/spell_checking/test_class_name_check.rb
require_relative '../helper' module ACRONYM end class Project def self.bo0k Bo0k end end class Book class TableOfContents; end def tableof_contents TableofContents end class Page def tableof_contents TableofContents end def self.tableof_contents TableofContents end ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/spell_checking/test_method_name_check.rb
test/spell_checking/test_method_name_check.rb
require_relative '../helper' class MethodNameCheckTest < Test::Unit::TestCase include DidYouMean::TestHelper class User attr_writer :writer attr_reader :reader def friends; end def first_name; end def descendants; end def call_incorrect_private_method raiae NoMethodError end ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/spell_checking/test_key_name_check.rb
test/spell_checking/test_key_name_check.rb
require_relative '../helper' class KeyNameCheckTest < Test::Unit::TestCase include DidYouMean::TestHelper def test_corrects_hash_key_name_with_fetch hash = { "foo" => 1, bar: 2 } error = assert_raise(KeyError) { hash.fetch(:bax) } assert_correction ":bar", error.corrections assert_match "Did you ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/spell_checking/test_uncorrectable_name_check.rb
test/spell_checking/test_uncorrectable_name_check.rb
require_relative '../helper' class UncorrectableNameCheckTest < Test::Unit::TestCase class FirstNameError < NameError; end def setup @error = assert_raise(FirstNameError) do raise FirstNameError, "Other name error" end end def test_message assert_not_match(/Did you mean\?/, @error.message) ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/test/spell_checking/test_variable_name_check.rb
test/spell_checking/test_variable_name_check.rb
require_relative '../helper' class VariableNameCheckTest < Test::Unit::TestCase include DidYouMean::TestHelper class User def initialize @email_address = 'email_address@address.net' @first_name = nil @last_name = nil end def first_name; end def to_s "#{@first_name} ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean.rb
lib/did_you_mean.rb
require_relative "did_you_mean/version" require_relative "did_you_mean/core_ext/name_error" require_relative "did_you_mean/spell_checker" require_relative 'did_you_mean/spell_checkers/name_error_checkers' require_relative 'did_you_mean/spell_checkers/method_name_checker' require_relative 'did_you_mean/spell_checkers/k...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/version.rb
lib/did_you_mean/version.rb
module DidYouMean VERSION = "2.0.0".freeze end
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/spell_checker.rb
lib/did_you_mean/spell_checker.rb
# frozen-string-literal: true require_relative "levenshtein" require_relative "jaro_winkler" module DidYouMean class SpellChecker def initialize(dictionary:) @dictionary = dictionary end def correct(input) normalized_input = normalize(input) threshold = normalized_input.length > 3 ? 0...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/experimental.rb
lib/did_you_mean/experimental.rb
warn "Experimental features in the did_you_mean gem has been removed " \ "and `require \"did_you_mean/experimental\"' has no effect."
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/verbose.rb
lib/did_you_mean/verbose.rb
warn "The verbose formatter has been removed and now `require 'did_you_mean/verbose'` has no effect. Please " \ "remove this call."
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/tree_spell_checker.rb
lib/did_you_mean/tree_spell_checker.rb
# frozen_string_literal: true module DidYouMean # spell checker for a dictionary that has a tree # structure, see doc/tree_spell_checker_api.md class TreeSpellChecker attr_reader :dictionary, :separator, :augment def initialize(dictionary:, separator: '/', augment: nil) @dictionary = dictionary ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/levenshtein.rb
lib/did_you_mean/levenshtein.rb
module DidYouMean module Levenshtein # :nodoc: # This code is based directly on the Text gem implementation # Copyright (c) 2006-2013 Paul Battley, Michael Neumann, Tim Fletcher. # # Returns a value representing the "cost" of transforming str1 into str2 def distance(str1, str2) n = str1.leng...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/formatter.rb
lib/did_you_mean/formatter.rb
# frozen-string-literal: true module DidYouMean # The +DidYouMean::Formatter+ is the basic, default formatter for the # gem. The formatter responds to the +message_for+ method and it returns a # human readable string. class Formatter # Returns a human readable string that contains +corrections+. This ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/jaro_winkler.rb
lib/did_you_mean/jaro_winkler.rb
module DidYouMean module Jaro module_function def distance(str1, str2) str1, str2 = str2, str1 if str1.length > str2.length length1, length2 = str1.length, str2.length m = 0.0 t = 0.0 range = length2 > 3 ? length2 / 2 - 1 : 0 flags1 = 0 fl...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/core_ext/name_error.rb
lib/did_you_mean/core_ext/name_error.rb
module DidYouMean module Correctable if Exception.method_defined?(:detailed_message) # just for compatibility def original_message # we cannot use alias here because to_s end def detailed_message(highlight: true, did_you_mean: true, **) msg = super.dup ret...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/spell_checkers/null_checker.rb
lib/did_you_mean/spell_checkers/null_checker.rb
module DidYouMean class NullChecker def initialize(*); end def corrections; [] end end end
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/spell_checkers/pattern_key_name_checker.rb
lib/did_you_mean/spell_checkers/pattern_key_name_checker.rb
require_relative "../spell_checker" module DidYouMean class PatternKeyNameChecker def initialize(no_matching_pattern_key_error) @key = no_matching_pattern_key_error.key @keys = no_matching_pattern_key_error.matchee.keys end def corrections @corrections ||= exact_matches.empty? ? SpellC...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/spell_checkers/name_error_checkers.rb
lib/did_you_mean/spell_checkers/name_error_checkers.rb
require_relative 'name_error_checkers/class_name_checker' require_relative 'name_error_checkers/variable_name_checker' module DidYouMean class << (NameErrorCheckers = Object.new) def new(exception) case exception.original_message when /uninitialized constant/ ClassNameChecker when /unde...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/spell_checkers/require_path_checker.rb
lib/did_you_mean/spell_checkers/require_path_checker.rb
# frozen-string-literal: true require_relative "../spell_checker" require_relative "../tree_spell_checker" require "rbconfig" module DidYouMean class RequirePathChecker attr_reader :path INITIAL_LOAD_PATH = $LOAD_PATH.dup.freeze Ractor.make_shareable(INITIAL_LOAD_PATH) if defined?(Ractor) ENV_SPEC...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/spell_checkers/method_name_checker.rb
lib/did_you_mean/spell_checkers/method_name_checker.rb
require_relative "../spell_checker" module DidYouMean class MethodNameChecker attr_reader :method_name, :receiver NAMES_TO_EXCLUDE = { NilClass => nil.methods } NAMES_TO_EXCLUDE.default = [] Ractor.make_shareable(NAMES_TO_EXCLUDE) if defined?(Ractor) # +MethodNameChecker::RB_RESERVED_WORDS+ is ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/spell_checkers/key_error_checker.rb
lib/did_you_mean/spell_checkers/key_error_checker.rb
require_relative "../spell_checker" module DidYouMean class KeyErrorChecker def initialize(key_error) @key = key_error.key @keys = key_error.receiver.keys end def corrections @corrections ||= exact_matches.empty? ? SpellChecker.new(dictionary: @keys).correct(@key).map(&:inspect) : exac...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
# frozen-string-literal: true require_relative "../../spell_checker" module DidYouMean class VariableNameChecker attr_reader :name, :method_names, :lvar_names, :ivar_names, :cvar_names NAMES_TO_EXCLUDE = { 'foo' => [:fork, :for] } NAMES_TO_EXCLUDE.default = [] Ractor.make_shareable(NAMES_TO_EXCLUDE...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
# frozen-string-literal: true require_relative "../../spell_checker" module DidYouMean class ClassNameChecker attr_reader :class_name def initialize(exception) @class_name, @receiver, @original_message = exception.name, exception.receiver, exception.original_message end def corrections ...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/formatters/plain_formatter.rb
lib/did_you_mean/formatters/plain_formatter.rb
require_relative '../formatter' warn "`require 'did_you_mean/formatters/plain_formatter'` is deprecated. Please `require 'did_you_mean/formatter'` " \ "instead."
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/lib/did_you_mean/formatters/verbose_formatter.rb
lib/did_you_mean/formatters/verbose_formatter.rb
# frozen-string-literal: true warn "`require 'did_you_mean/formatters/verbose_formatter'` is deprecated and falls back to the default formatter. " require_relative '../formatter' module DidYouMean # For compatibility: VerboseFormatter = Formatter end
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/evaluation/dictionary_generator.rb
evaluation/dictionary_generator.rb
require 'open-uri' require 'cgi' require 'json' per_page = 500 base_url = "https://simple.wiktionary.org/w/api.php?action=query&aplimit=#{per_page}&list=allpages&format=json" filename = "evaluation/dictionary.yml" apfrom = "" num = 0 titles = [] loop do url = base_url + "&apfrom=#{apfrom}" puts ("downlo...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/evaluation/calculator.rb
evaluation/calculator.rb
# frozen-string-literal: true require 'benchmark' require 'did_you_mean' def report(message, &block) time = 1000 * Benchmark.realtime(&block) if (time / 1000 / 60) >= 1 minutes = (time / 1000 / 60).floor seconds = (time % (60 * 1000)) / 1000 puts " \e[36m%2dm%.3fs:\e[0m %s" % [minutes, seconds, mess...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
ruby/did_you_mean
https://github.com/ruby/did_you_mean/blob/74d3054c814d2461eb778b8dda39eba970ae93b3/documentation/changelog_generator.rb
documentation/changelog_generator.rb
require 'octokit' require 'reverse_markdown' require 'erb' class ChangeLogGenerator attr :repository, :template_path, :changelog_path def initialize(repository, template_path: "CHANGELOG.md.erb", changelog_path: "CHANGELOG.md") @repository = repository @template_path = template_path @changelog_pa...
ruby
MIT
74d3054c814d2461eb778b8dda39eba970ae93b3
2026-01-04T16:00:13.702044Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/test_helper.rb
spec/test_helper.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require 'minitest/autorun' require 'minitest/spec' require 'minitest/mock' require 'pathname' require 'lhm' $project = Pathname.new(File.dirname(__FILE__) + '/..').cleanpath $spec = $project.join('spec') $fixtures = $spec.j...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/integration/lock_wait_timeout_spec.rb
spec/integration/lock_wait_timeout_spec.rb
require File.expand_path(File.dirname(__FILE__)) + '/integration_helper' describe Lhm do include IntegrationHelper before(:each) do connect_master! table_create(:users) end it 'set_session_lock_wait_timeouts should set the sessions lock wait timeouts to less than the global values by a delta' do ...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/integration/entangler_spec.rb
spec/integration/entangler_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/integration_helper' require 'lhm/table' require 'lhm/migration' require 'lhm/entangler' describe Lhm::Entangler do include IntegrationHelper before(:each) { connect...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/integration/integration_helper.rb
spec/integration/integration_helper.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require 'test_helper' require 'yaml' require 'active_support' $password = YAML.load_file(File.expand_path(File.dirname(__FILE__)) + '/database.yml')['password'] rescue nil require 'lhm/table' require 'lhm/sql_helper' module...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/integration/lhm_spec.rb
spec/integration/lhm_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/integration_helper' describe Lhm do include IntegrationHelper before(:each) { connect_master!; Lhm.cleanup(:run) } describe 'id column requirement' do it 'sho...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/integration/chunker_spec.rb
spec/integration/chunker_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/integration_helper' require 'lhm/table' require 'lhm/migration' describe Lhm::Chunker do include IntegrationHelper before(:each) { connect_master! } describe 'cop...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/integration/locked_switcher_spec.rb
spec/integration/locked_switcher_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/integration_helper' require 'lhm/table' require 'lhm/migration' require 'lhm/locked_switcher' describe Lhm::LockedSwitcher do include IntegrationHelper before(:each...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/integration/table_spec.rb
spec/integration/table_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/integration_helper' require 'lhm/table' describe Lhm::Table do include IntegrationHelper describe 'id numeric column requirement' do describe 'when met' do ...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/integration/atomic_switcher_spec.rb
spec/integration/atomic_switcher_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/integration_helper' require 'lhm/table' require 'lhm/migration' require 'lhm/atomic_switcher' describe Lhm::AtomicSwitcher do include IntegrationHelper before(:each...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/integration/cleanup_spec.rb
spec/integration/cleanup_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/integration_helper' describe Lhm, 'cleanup' do include IntegrationHelper before(:each) { connect_master! } describe 'changes' do before(:each) do table_c...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/entangler_spec.rb
spec/unit/entangler_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' require 'lhm/table' require 'lhm/migration' require 'lhm/entangler' describe Lhm::Entangler do include UnitHelper before(:each) do @origin = Lhm::T...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/migration_spec.rb
spec/unit/migration_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' require 'lhm/table' require 'lhm/migration' describe Lhm::Migration do include UnitHelper before(:each) do @start = Time.now @origin = Lhm::Tab...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/unit_helper.rb
spec/unit/unit_helper.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require 'test_helper' module UnitHelper def fixture(name) File.read $fixtures.join(name) end def strip(sql) sql.strip.gsub(/\n */, "\n") end end
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/lhm_spec.rb
spec/unit/lhm_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd. require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' describe Lhm do before(:each) do Lhm.remove_class_variable :@@logger if Lhm.class_variable_defined? :@@logger end describe 'logger' do it 'should use the default parameters if no logger expl...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/throttler_spec.rb
spec/unit/throttler_spec.rb
require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' require 'lhm/throttler' describe Lhm::Throttler do include UnitHelper before :each do @mock = Class.new do extend Lhm::Throttler end @conn = Class.new do def execute end end end describe '#setup_throttler' d...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/chunker_spec.rb
spec/unit/chunker_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' require 'lhm/table' require 'lhm/migration' require 'lhm/chunker' require 'lhm/throttler' describe Lhm::Chunker do include UnitHelper before(:each) do ...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/locked_switcher_spec.rb
spec/unit/locked_switcher_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' require 'lhm/table' require 'lhm/migration' require 'lhm/locked_switcher' describe Lhm::LockedSwitcher do include UnitHelper before(:each) do @star...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/table_spec.rb
spec/unit/table_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' require 'lhm/table' describe Lhm::Table do include UnitHelper describe 'names' do it 'should name destination' do @table = Lhm::Table.new('us...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/atomic_switcher_spec.rb
spec/unit/atomic_switcher_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' require 'lhm/table' require 'lhm/migration' require 'lhm/atomic_switcher' describe Lhm::AtomicSwitcher do include UnitHelper before(:each) do @star...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/printer_spec.rb
spec/unit/printer_spec.rb
require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' require 'lhm/printer' describe Lhm::Printer do include UnitHelper describe 'percentage printer' do before(:each) do @printer = Lhm::Printer::Percentage.new end it 'prints the percentage' do mock = MiniTest::Mock.new ...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/sql_helper_spec.rb
spec/unit/sql_helper_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' require 'lhm/sql_helper' describe Lhm::SqlHelper do it 'should name index with a single column' do Lhm::SqlHelper. idx_name(:users, :name). ...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/migrator_spec.rb
spec/unit/migrator_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' require 'lhm/table' require 'lhm/migrator' describe Lhm::Migrator do include UnitHelper before(:each) do @table = Lhm::Table.new('alt') @creato...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/intersection_spec.rb
spec/unit/intersection_spec.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require File.expand_path(File.dirname(__FILE__)) + '/unit_helper' require 'lhm/table' require 'lhm/migrator' describe Lhm::Intersection do include UnitHelper it 'should not have dropped changes' do origin = Lhm::T...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/spec/unit/throttler/slave_lag_spec.rb
spec/unit/throttler/slave_lag_spec.rb
require File.expand_path(File.dirname(__FILE__)) + '/../unit_helper' require 'lhm/throttler/slave_lag' describe Lhm::Throttler::SlaveLag do include UnitHelper before :each do @throttler = Lhm::Throttler::SlaveLag.new end describe '#throttle_seconds' do describe 'with no slave lag' do before do...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/lib/lhm.rb
lib/lhm.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require 'lhm/table' require 'lhm/invoker' require 'lhm/throttler' require 'lhm/version' require 'logger' # Large hadron migrator - online schema change tool # # @example # # Lhm.change_table(:users) do |m| # m.add_col...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/lib/lhm/command.rb
lib/lhm/command.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt module Lhm class Error < StandardError end module Command def run(&block) Lhm.logger.info "Starting run of class=#{self.class}" validate if block_given? before block.call(self) ...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/lib/lhm/table.rb
lib/lhm/table.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require 'lhm/sql_helper' module Lhm class Table attr_reader :name, :columns, :indices, :pk, :ddl def initialize(name, pk = 'id', ddl = nil) @name = name @columns = {} @indices = {} @pk = p...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/lib/lhm/version.rb
lib/lhm/version.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt module Lhm VERSION = '3.0.0.alpha' end
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/lib/lhm/locked_switcher.rb
lib/lhm/locked_switcher.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require 'lhm/command' require 'lhm/migration' require 'lhm/sql_helper' module Lhm # Switches origin with destination table nonatomically using a locked write. # LockedSwitcher adopts the Facebook strategy, with the foll...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/lib/lhm/atomic_switcher.rb
lib/lhm/atomic_switcher.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require 'lhm/command' require 'lhm/migration' require 'lhm/sql_helper' module Lhm # Switches origin with destination table using an atomic rename. # # It should only be used if the MySQL server version is not affected...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false
soundcloud/lhm
https://github.com/soundcloud/lhm/blob/50907121eee514649fa944fb300d5d8a64fa873e/lib/lhm/chunker.rb
lib/lhm/chunker.rb
# Copyright (c) 2011 - 2013, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias # Schmidt require 'lhm/command' require 'lhm/sql_helper' require 'lhm/printer' module Lhm class Chunker include Command include SqlHelper attr_reader :connection # Copy from origin to destination in chunks of size ...
ruby
BSD-3-Clause
50907121eee514649fa944fb300d5d8a64fa873e
2026-01-04T16:00:26.636526Z
false