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 |
|---|---|---|---|---|---|---|---|---|
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/unicode_property.rb | lib/regexp_parser/syntax/token/unicode_property.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module UnicodeProperty
all = proc { |name| constants.grep(/#{name}/).flat_map(&method(:const_get)) }
CharType_V1_9_0 = %i[alnum alpha ascii blank cntrl digit graph
lower print punct space upper word xdigit].f... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/group.rb | lib/regexp_parser/syntax/token/group.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module Group
Basic = %i[capture close].freeze
Extended = Basic + %i[options options_switch]
Named = %i[named].freeze
Atomic = %i[atomic].freeze
Passive = %i[passive].freeze
Comment = %i[comment].... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/posix_class.rb | lib/regexp_parser/syntax/token/posix_class.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module PosixClass
Standard = %i[alnum alpha blank cntrl digit graph
lower print punct space upper xdigit].freeze
Extensions = %i[ascii word].freeze
All = Standard + Extensions
Type = :posixclass
N... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/keep.rb | lib/regexp_parser/syntax/token/keep.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module Keep
Mark = %i[mark].freeze
All = Mark
Type = :keep
end
Map[Keep::Type] = Keep::All
end
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/character_set.rb | lib/regexp_parser/syntax/token/character_set.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module CharacterSet
Basic = %i[open close negate range].freeze
Extended = Basic + %i[intersection]
All = Extended
Type = :set
end
Map[CharacterSet::Type] = CharacterSet::All
# alias for symmetry between t... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/assertion.rb | lib/regexp_parser/syntax/token/assertion.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module Assertion
Lookahead = %i[lookahead nlookahead].freeze
Lookbehind = %i[lookbehind nlookbehind].freeze
All = Lookahead + Lookbehind
Type = :assertion
end
Map[Assertion::Type] = Assertion::All
end
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/escape.rb | lib/regexp_parser/syntax/token/escape.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module Escape
Basic = %i[backslash literal].freeze
Control = %i[control meta_sequence].freeze
ASCII = %i[bell backspace escape form_feed newline carriage
tab vertical_tab].freeze
Unicode = %i[codepoint co... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/backreference.rb | lib/regexp_parser/syntax/token/backreference.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module Backreference
Plain = %i[number].freeze
NumberRef = %i[number_ref number_rel_ref].freeze
Number = Plain + NumberRef
Name = %i[name_ref].freeze
RecursionLevel = %i[name_recursion_ref number_recursion... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/conditional.rb | lib/regexp_parser/syntax/token/conditional.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module Conditional
Delimiters = %i[open close].freeze
Condition = %i[condition_open condition condition_close].freeze
Separator = %i[separator].freeze
All = Conditional::Delimiters + Conditional::Condition + Conditional:... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/virtual.rb | lib/regexp_parser/syntax/token/virtual.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module Virtual
Root = %i[root].freeze
Sequence = %i[sequence].freeze
All = %i[root sequence].freeze
Type = :expression
end
end
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/anchor.rb | lib/regexp_parser/syntax/token/anchor.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module Anchor
Basic = %i[bol eol].freeze
Extended = Basic + %i[word_boundary nonword_boundary]
String = %i[bos eos eos_ob_eol].freeze
MatchStart = %i[match_start].freeze
All = Extended + String + MatchS... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/token/quantifier.rb | lib/regexp_parser/syntax/token/quantifier.rb | # frozen_string_literal: true
module Regexp::Syntax
module Token
module Quantifier
Greedy = %i[
zero_or_one
zero_or_more
one_or_more
].freeze
Reluctant = %i[
zero_or_one_reluctant
zero_or_more_reluctant
one_or_more_reluctant
].freeze
... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/1.9.3.rb | lib/regexp_parser/syntax/versions/1.9.3.rb | # frozen_string_literal: true
class Regexp::Syntax::V1_9_3 < Regexp::Syntax::V1_9_1
implements :property, UnicodeProperty::V1_9_3
implements :nonproperty, UnicodeProperty::V1_9_3
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/2.6.3.rb | lib/regexp_parser/syntax/versions/2.6.3.rb | # frozen_string_literal: true
class Regexp::Syntax::V2_6_3 < Regexp::Syntax::V2_6_2
implements :property, UnicodeProperty::V2_6_3
implements :nonproperty, UnicodeProperty::V2_6_3
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/2.4.1.rb | lib/regexp_parser/syntax/versions/2.4.1.rb | # frozen_string_literal: true
class Regexp::Syntax::V2_4_1 < Regexp::Syntax::V2_4_0
implements :group, Group::V2_4_1
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/2.0.0.rb | lib/regexp_parser/syntax/versions/2.0.0.rb | # frozen_string_literal: true
class Regexp::Syntax::V2_0_0 < Regexp::Syntax::V1_9_3
implements :keep, Keep::All
implements :conditional, Conditional::All
implements :property, UnicodeProperty::V2_0_0
implements :nonproperty, UnicodeProperty::V2_0_0
implements :type, CharacterType::Clustered
... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/2.2.0.rb | lib/regexp_parser/syntax/versions/2.2.0.rb | # frozen_string_literal: true
class Regexp::Syntax::V2_2_0 < Regexp::Syntax::V2_0_0
implements :property, UnicodeProperty::V2_2_0
implements :nonproperty, UnicodeProperty::V2_2_0
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/1.8.6.rb | lib/regexp_parser/syntax/versions/1.8.6.rb | # frozen_string_literal: true
class Regexp::Syntax::V1_8_6 < Regexp::Syntax::Base
implements :anchor, Anchor::All
implements :assertion, Assertion::Lookahead
implements :backref, Backreference::V1_8_6
implements :escape, Escape::Basic + Escape::ASCII + Escape::Meta + Escape::Control
implements :f... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/3.5.0.rb | lib/regexp_parser/syntax/versions/3.5.0.rb | class Regexp::Syntax::V3_5_0 < Regexp::Syntax::V3_2_0
implements :property, UnicodeProperty::V3_5_0
implements :nonproperty, UnicodeProperty::V3_5_0
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/2.3.0.rb | lib/regexp_parser/syntax/versions/2.3.0.rb | # frozen_string_literal: true
class Regexp::Syntax::V2_3_0 < Regexp::Syntax::V2_2_0
implements :property, UnicodeProperty::V2_3_0
implements :nonproperty, UnicodeProperty::V2_3_0
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/3.2.0.rb | lib/regexp_parser/syntax/versions/3.2.0.rb | # frozen_string_literal: true
class Regexp::Syntax::V3_2_0 < Regexp::Syntax::V3_1_0
implements :property, UnicodeProperty::V3_2_0
implements :nonproperty, UnicodeProperty::V3_2_0
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/1.9.1.rb | lib/regexp_parser/syntax/versions/1.9.1.rb | # frozen_string_literal: true
class Regexp::Syntax::V1_9_1 < Regexp::Syntax::V1_8_6
implements :assertion, Assertion::Lookbehind
implements :backref, Backreference::V1_9_1 + SubexpressionCall::All
implements :escape, Escape::Unicode + Escape::Hex + Escape::Octal
implements :posixclass, Posi... | ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/2.6.0.rb | lib/regexp_parser/syntax/versions/2.6.0.rb | # frozen_string_literal: true
class Regexp::Syntax::V2_6_0 < Regexp::Syntax::V2_5_0
implements :property, UnicodeProperty::V2_6_0
implements :nonproperty, UnicodeProperty::V2_6_0
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/2.6.2.rb | lib/regexp_parser/syntax/versions/2.6.2.rb | # frozen_string_literal: true
class Regexp::Syntax::V2_6_2 < Regexp::Syntax::V2_6_0
implements :property, UnicodeProperty::V2_6_2
implements :nonproperty, UnicodeProperty::V2_6_2
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/2.4.0.rb | lib/regexp_parser/syntax/versions/2.4.0.rb | # frozen_string_literal: true
class Regexp::Syntax::V2_4_0 < Regexp::Syntax::V2_3_0
implements :property, UnicodeProperty::V2_4_0
implements :nonproperty, UnicodeProperty::V2_4_0
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/3.1.0.rb | lib/regexp_parser/syntax/versions/3.1.0.rb | # frozen_string_literal: true
class Regexp::Syntax::V3_1_0 < Regexp::Syntax::V2_6_3
implements :property, UnicodeProperty::V3_1_0
implements :nonproperty, UnicodeProperty::V3_1_0
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
ammar/regexp_parser | https://github.com/ammar/regexp_parser/blob/c5094a84e56eb445297556500f19bcc2128a8859/lib/regexp_parser/syntax/versions/2.5.0.rb | lib/regexp_parser/syntax/versions/2.5.0.rb | # frozen_string_literal: true
class Regexp::Syntax::V2_5_0 < Regexp::Syntax::V2_4_1
implements :property, UnicodeProperty::V2_5_0
implements :nonproperty, UnicodeProperty::V2_5_0
end
| ruby | MIT | c5094a84e56eb445297556500f19bcc2128a8859 | 2026-01-04T17:37:37.784074Z | false |
github/training-utils | https://github.com/github/training-utils/blob/ec611e36634339763fb34160205110f1722810cb/common.rb | common.rb | REGEX = %r{github\.com/([^/]+/[^/]+)/issues/(\d+)}
# https://github.com/username/reponame/issues/2
# -> username/reponame, 2
def parse_issue_url(url)
if md = REGEX.match(url)
[md[1], md[2]]
end
end
| ruby | MIT | ec611e36634339763fb34160205110f1722810cb | 2026-01-04T17:37:41.500410Z | false |
github/training-utils | https://github.com/github/training-utils/blob/ec611e36634339763fb34160205110f1722810cb/transpose-csv.rb | transpose-csv.rb | #!/usr/bin/env ruby
require 'CSV'
def get_dest(src)
dest = src.split('.')
dest[0] += '-transposed'
dest.join('.')
end
src = ARGV[0]
file = File.open(src, "r:ISO-8859-1")
rows = CSV.parse(file)
CSV.open(get_dest(src), "wb") do |csv|
rows.transpose.each do |row|
csv << row
end
end
| ruby | MIT | ec611e36634339763fb34160205110f1722810cb | 2026-01-04T17:37:41.500410Z | false |
github/training-utils | https://github.com/github/training-utils/blob/ec611e36634339763fb34160205110f1722810cb/add-to-org.rb | add-to-org.rb | #!/usr/bin/env ruby
# add USERNAME as member to ORGANIZATION and optionally to TEAM
# assumes you created and stored the appropriate OAuth token as an ENV variable called GITHUBTEACHER_TOKEN
require 'octokit'
require 'optparse'
# Make sure arguments are specified
ARGV << '-h' if ARGV.empty?
# Create options hash
opt... | ruby | MIT | ec611e36634339763fb34160205110f1722810cb | 2026-01-04T17:37:41.500410Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/test/sysv_adapter_test.rb | test/sysv_adapter_test.rb | require 'test_helper'
class SysvAdapterTest < LocaljobTestCase
def setup
@localjob = queue
@localjob.queue = Localjob::SysvAdapter.new(0xDEADC0DE)
end
def teardown
@localjob.destroy
end
def test_send_and_receive
msg = "Hello World"
@localjob << msg
assert_equal msg, @localjob.shift
... | ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/test/test_helper.rb | test/test_helper.rb | require 'coveralls'
Coveralls.wear!
require 'minitest/autorun'
$:<< File.dirname(__FILE__) + "/../lib"
require 'localjob'
require "mocha/setup"
require 'jobs'
class LocaljobTestCase < MiniTest::Test
protected
# This is a method to make sure the logger is set right.
def worker(queue)
Localjob::Worker.new(que... | ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/test/integration.rb | test/integration.rb | require 'localjob'
class PrintJob
def perform
puts "hello world"
end
end
if ARGV[0] == "produce"
queue = Localjob.new
queue << PrintJob.new
end
| ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/test/worker_test.rb | test/worker_test.rb | require 'test_helper'
class WorkerTest < LocaljobTestCase
def setup
@localjob = queue
@worker = worker(@localjob)
end
def teardown
@localjob.destroy
end
def test_pop_and_send_to_worker
WalrusJob.any_instance.expects(:perform)
@localjob << WalrusJob.new("move")
job = @localjob.sh... | ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/test/mock_adapter.rb | test/mock_adapter.rb | require 'test_helper'
require 'localjob/mock_adapter'
class MockAdapterTest < LocaljobTestCase
def setup
@localjob = queue
@localjob.queue = Localjob::MockAdapter.new("localjob")
end
def test_push_to_queue
@localjob << "hello world"
assert_equal 1, @localjob.size
end
def test_push_and_pop_f... | ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/test/jobs.rb | test/jobs.rb | class WalrusJob < Struct.new(:action)
def perform
"Nice try, but there's no way I'll #{action}.."
end
end
class AngryWalrusJob < Struct.new(:angryness)
def perform
raise "I am this angry: #{angryness}"
end
end
| ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/test/localjob_test.rb | test/localjob_test.rb | require 'test_helper'
class LocaljobTest < LocaljobTestCase
def setup
@localjob = queue
end
def test_push_should_put_a_job_in_queue
@localjob << WalrusJob.new("move")
assert_equal 1, @localjob.size
end
def test_pop_from_queue
@localjob << WalrusJob.new("move")
job = @localjob.shift
... | ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/lib/localjob.rb | lib/localjob.rb | require 'yaml'
require 'logger'
require 'forwardable'
require "localjob/version"
require 'localjob/worker'
require 'localjob/sysv_adapter'
class Localjob
extend Forwardable
attr_reader :name
attr_writer :queue
def_delegators :queue, :stats, :destroy, :size
# LOCALJOB in 1337speak
def initialize(name = ... | ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/lib/localjob/version.rb | lib/localjob/version.rb | class Localjob
VERSION = "0.4.1"
end
| ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/lib/localjob/cli.rb | lib/localjob/cli.rb | require 'thor'
class Localjob
class CLI < Thor
option :queue, aliases: ["-q"], type: :string, default: "0x10CA110B"
option :require, aliases: ["-r"], type: :string, default: "."
option :pid_file, aliases: ["-p"], type: :string
desc "work", "Start worker to process jobs"
def work
load... | ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/lib/localjob/worker.rb | lib/localjob/worker.rb | require 'fileutils'
class Localjob
class Worker
TERMINATION_MESSAGE = "__TERMINATE__"
attr_accessor :logger
attr_reader :options, :queue
def initialize(queue, logger: Logger.new(STDOUT), **options)
@logger = logger
@queue = queue.kind_of?(Fixnum) ? Localjob.new(@queue) : queue
@op... | ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/lib/localjob/mock_adapter.rb | lib/localjob/mock_adapter.rb | class Localjob
class Channel
def shift
queue = @queues.find { |q| q.size > 0 }
return queue.shift
end
end
class MockAdapter
def initialize(name = 'default')
@@queues ||= {}
@name = name
@@queues[@name] ||= []
end
def receive
@@queues[@name].shift
end
... | ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
sirupsen/localjob | https://github.com/sirupsen/localjob/blob/53c39b076ec46981399c05d99fa28f03a03bde4d/lib/localjob/sysv_adapter.rb | lib/localjob/sysv_adapter.rb | require 'sysvmq'
class Localjob
class SysvAdapter
RECEIVE_ALL_TYPES = 0
attr_reader :queue
def initialize(key, size: 8192, flags: SysVMQ::IPC_CREAT | 0660)
@key = key
@queue = SysVMQ.new(key, size, flags)
end
def receive
queue.receive(RECEIVE_ALL_TYPES)
end
def send(... | ruby | MIT | 53c39b076ec46981399c05d99fa28f03a03bde4d | 2026-01-04T17:37:42.899741Z | false |
zendesk/zendesk_jwt_sso_examples | https://github.com/zendesk/zendesk_jwt_sso_examples/blob/2af3976e7037fb61ce58da879d8d5c13ec6d659f/jwt_generation/ruby_on_rails_jwt.rb | jwt_generation/ruby_on_rails_jwt.rb | # Using JWT from Ruby is straight forward. The below example expects you to have `jwt`
# in your Gemfile, you can read more about that gem at https://github.com/jwt/ruby-jwt.
# Assuming that you've set your shared secret and Zendesk subdomain in the environment, you
# can use Zendesk SSO from your controller like this ... | ruby | Apache-2.0 | 2af3976e7037fb61ce58da879d8d5c13ec6d659f | 2026-01-04T17:37:46.571213Z | false |
zendesk/zendesk_jwt_sso_examples | https://github.com/zendesk/zendesk_jwt_sso_examples/blob/2af3976e7037fb61ce58da879d8d5c13ec6d659f/form_submission/rails_html_erb_jwt.rb | form_submission/rails_html_erb_jwt.rb | class JwtController < ApplicationController
...
ZENDESK_SUBDOMAIN = ENV['ZENDESK_SUBDOMAIN']
# Zendesk will pass various params when redirecting you to your remote login URL
JWT_PARAMS = %i[return_to brand_id locale_id timestamp].freeze
...
def create
if (user = User.authenticate(params[:login], params... | ruby | Apache-2.0 | 2af3976e7037fb61ce58da879d8d5c13ec6d659f | 2026-01-04T17:37:46.571213Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/spec_helper_acceptance_local.rb | spec/spec_helper_acceptance_local.rb | # frozen_string_literal: true
include PuppetLitmus
UNSUPPORTED_PLATFORMS = ['windows', 'darwin'].freeze
| ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/spec_helper_local.rb | spec/spec_helper_local.rb | # frozen_string_literal: true
if ENV['COVERAGE'] == 'yes'
require 'simplecov'
require 'simplecov-console'
require 'codecov'
SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::Console,
SimpleCov::Formatter::Codecov,
]
SimpleCov.start do
track_files 'lib/**/*... | ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
RSpec.configure do |c|
c.mock_with :rspec
end
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
include RspecPuppetFacts
default_facts = {
puppetvers... | ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/spec_helper_acceptance.rb | spec/spec_helper_acceptance.rb | # frozen_string_literal: true
require 'puppet_litmus'
require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb'))
PuppetLitmus.configure!
| ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/acceptance/ntp_user_and_daemon_opts_spec.rb | spec/acceptance/ntp_user_and_daemon_opts_spec.rb | # frozen_string_literal: true
require 'spec_helper_acceptance'
case os[:family]
when 'redhat', 'freebsd', 'linux'
servicename = 'ntpd'
when 'solaris'
case fact('kernelrelease')
when '5.10'
servicename = 'network/ntp4'
when '5.11'
servicename = 'network/ntp'
end
when 'aix'
servicename = 'xntpd'
els... | ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/acceptance/ntp_service_spec.rb | spec/acceptance/ntp_service_spec.rb | # frozen_string_literal: true
require 'spec_helper_acceptance'
require 'specinfra'
case os[:family]
when 'redhat', 'freebsd', 'linux'
servicename = 'ntpd'
when 'solaris'
case fact('kernelrelease')
when '5.10'
servicename = 'network/ntp4'
when '5.11'
servicename = 'network/ntp'
end
when 'aix'
servi... | ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/acceptance/ntp_parameters_spec.rb | spec/acceptance/ntp_parameters_spec.rb | # frozen_string_literal: true
require 'spec_helper_acceptance'
case os[:family]
when 'freebsd'
packagename = 'net/ntp'
when 'aix'
packagename = 'bos.net.tcp.client'
when 'solaris'
case linux_kernel_parameter('kernel.osrelease').value
when %r{^5.10}
packagename = ['SUNWntp4r', 'SUNWntp4u']
when %r{^5.11}... | ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/acceptance/unsupported_spec.rb | spec/acceptance/unsupported_spec.rb | # frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'unsupported distributions and OSes', if: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
it 'fails' do
pp = <<-MANIFEST
class { 'ntp': }
MANIFEST
expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{is not suppor... | ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/acceptance/class_spec.rb | spec/acceptance/class_spec.rb | # frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'ntp class:', unless: UNSUPPORTED_PLATFORMS.include?(os[:family]) do
context 'with ntp' do
let(:pp) { "class { 'ntp': }" }
it 'runs successfully - not_to match' do
apply_manifest(pp, catch_failures: true) do |r|
expect(r.... | ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/acceptance/ntp_install_spec.rb | spec/acceptance/ntp_install_spec.rb | # frozen_string_literal: true
require 'spec_helper_acceptance'
case os[:family]
when 'freebsd'
packagename = 'net/ntp'
when 'aix'
packagename = 'bos.net.tcp.client'
when 'solaris'
case fact('kernelrelease')
when '5.10'
packagename = ['SUNWntp4r', 'SUNWntp4u']
when '5.11'
packagename = 'service/netwo... | ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/acceptance/preferred_servers_spec.rb | spec/acceptance/preferred_servers_spec.rb | # frozen_string_literal: true
require 'spec_helper_acceptance'
config = if os[:family] == 'solaris'
'/etc/inet/ntp.conf'
elsif os[:family] == 'debian' && os[:release].start_with?('12')
'/etc/ntpsec/ntp.conf'
elsif os[:family] == 'ubuntu' && os[:release].start_with?('24')
... | ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/classes/contains_spec.rb | spec/classes/contains_spec.rb | # frozen_string_literal: true
# To check the correct dependancies are set up for NTP.
require 'spec_helper'
describe 'ntp' do
let(:facts) { { is_virtual: false } }
let :pre_condition do
'file { "foo.rb":
ensure => present,
path => "/etc/tmp",
notify => Service["ntp"] }'
end
on_supported... | ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | false |
puppetlabs/puppetlabs-ntp | https://github.com/puppetlabs/puppetlabs-ntp/blob/9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4/spec/classes/ntp_spec.rb | spec/classes/ntp_spec.rb | # frozen_string_literal: true
require 'spec_helper'
on_supported_os.each do |os, f|
describe 'ntp' do
let(:facts) { { is_virtual: false } }
let(:conf_path) do
if os.include?('solaris')
'/etc/inet/ntp.conf'
elsif f[:os]['name'] == 'Debian' && f[:os]['release']['major'].to_f >= 12
... | ruby | Apache-2.0 | 9b1a54c1dd6c8793e2c50b69d5d73b2d265aa5e4 | 2026-01-04T17:37:42.093822Z | true |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/init.rb | init.rb | require 'record_cache' | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/spec_helper.rb | spec/spec_helper.rb | ENV["RAILS_ENV"]="test"
dir = File.dirname(__FILE__)
$LOAD_PATH.unshift dir + "/../lib"
$LOAD_PATH.unshift dir
require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
end
require 'rubygems'
require 'rspec'
require 'database_cleaner'
require 'logger'
require 'record_cache'
require 'record_cache/test/resettable_v... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/initializers/backward_compatibility.rb | spec/initializers/backward_compatibility.rb | if ActiveRecord::VERSION::MAJOR < 4
module ActiveRecord
class Base
class << self
# generic find_by introduced in Rails 4
def find_by(*args)
where(*args).first
rescue RangeError
nil
end unless method_defined? :find_by
end
end
end
module Acti... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/initializers/record_cache.rb | spec/initializers/record_cache.rb | # --- Version Store
# All Workers that use the Record Cache should point to the same Version Store
# E.g. a MemCached cluster or a Redis Store (defaults to Rails.cache)
RecordCache::Base.version_store = ActiveSupport::Cache.lookup_store(:memory_store)
# --- Record Stores
# Register Cache Stores for the Records themsel... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/support/matchers/log.rb | spec/support/matchers/log.rb | # Examples:
# 1) expect{ Person.find(22) }.to log(:debug, %(UniqueIndexCache on 'id' hit for ids 1)
# _should have at least one debug log statement as given above_
#
# 2) expect{ Person.find(22) }.to log(:debug, /^UniqueIndexCache/)
# _should have at least one debug log statement starting with UniqueIndexCach... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/support/matchers/hit_cache_matcher.rb | spec/support/matchers/hit_cache_matcher.rb | # Examples:
# 1) expect{ Person.find(22) }.to hit_cache(Person)
# _should have at least one hit in any of the cache strategies for the Person model_
#
# 2) expect{ Person.find(22) }.to hit_cache(Person).on(:id)
# _should have at least one hit in the ID cache strategy for the Person model_
#
# 3) expect{ Pers... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/support/matchers/miss_cache_matcher.rb | spec/support/matchers/miss_cache_matcher.rb | # Examples:
# 1) expect{ Person.find(22) }.to miss_cache(Person)
# _should have at least one miss in any of the cache strategies for the Person model_
#
# 2) expect{ Person.find(22) }.to miss_cache(Person).on(:id)
# _should have at least one miss for the ID cache strategy for the Person model_
#
# 3) expect{... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/support/matchers/use_cache_matcher.rb | spec/support/matchers/use_cache_matcher.rb | # Examples:
# 1) expect{ Person.find(22) }.to use_cache(Person)
# _should perform at least one call (hit/miss) to any of the cache strategies for the Person model_
#
# 2) expect{ Person.find(22) }.to use_cache(Person).on(:id)
# _should perform at least one call (hit/miss) to the ID cache strategy for the Pers... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/db/seeds.rb | spec/db/seeds.rb | # coding: utf-8
ActiveRecord::Schema.define :version => 1 do
# Make sure that at the beginning of the tests, NOTHING is known to Record Cache
RecordCache::Base.disable!
@adam = Person.create!(:name => "Adam", :birthday => Date.civil(1975,03,20), :height => 1.83)
@blue = Person.create!(:name => "Blue", :bi... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/db/schema.rb | spec/db/schema.rb | ActiveRecord::Schema.define version: 0 do
create_table :people, force: true do |t|
t.string :name
t.date :birthday
t.float :height
end
create_table :stores, force: true do |t|
t.string :name
t.integer :owner_id
end
create_table :people_stores, id: false, force: true do |t|
t.... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/models/language.rb | spec/models/language.rb | class Language < ActiveRecord::Base
cache_records :store => :local, :full_table => true
end
| ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/models/store.rb | spec/models/store.rb | class Store < ActiveRecord::Base
cache_records :store => :local, :key => "st"
belongs_to :owner, :class_name => "Person"
has_many :apples, :autosave => true # cached with index on store
has_many :bananas # cached without index on store
has_many :pears # not cached
has_one :address, :autosave => true
... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/models/address.rb | spec/models/address.rb | class Address < ActiveRecord::Base
cache_records :store => :shared, :key => "add", :index => [:store_id]
serialize :location, Hash
belongs_to :store
end
| ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/models/apple.rb | spec/models/apple.rb | class Apple < ActiveRecord::Base
cache_records :store => :shared, :key => "apl", :index => [:store_id, :person_id], :ttl => 300
belongs_to :store
belongs_to :person
end
| ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/models/banana.rb | spec/models/banana.rb | class Banana < ActiveRecord::Base
cache_records :store => :local, :index => [:person_id]
belongs_to :store
belongs_to :person
after_initialize :do_after_initialize
after_find :do_after_find
def logs
@logs ||= []
end
private
def do_after_initialize
self.logs << "after_initialize"
... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/models/person.rb | spec/models/person.rb | class Person < ActiveRecord::Base
cache_records :store => :shared, :key => "per", :unique_index => :name
has_many :apples # cached with index on person_id
has_many :bananas # cached with index on person_id
has_many :pears # not cached
has_and_belongs_to_many :stores
end
| ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/models/pear.rb | spec/models/pear.rb | class Pear < ActiveRecord::Base
belongs_to :store
belongs_to :person
end
| ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/dispatcher_spec.rb | spec/lib/dispatcher_spec.rb | require 'spec_helper'
RSpec.describe RecordCache::Dispatcher do
before(:each) do
@apple_dispatcher = Apple.record_cache
end
it "should return the (ordered) strategy classes" do
expect(RecordCache::Dispatcher.strategy_classes).to eq([RecordCache::Strategy::UniqueIndexCache, RecordCache::Strategy::FullTab... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/query_spec.rb | spec/lib/query_spec.rb | require 'spec_helper'
RSpec.describe RecordCache::Query do
before(:each) do
@query = RecordCache::Query.new
end
context "wheres" do
it "should be an empty hash by default" do
expect(@query.wheres).to eq({})
end
it "should fill wheres on instantiation" do
@query = RecordCache::Query.... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/statistics_spec.rb | spec/lib/statistics_spec.rb | require 'spec_helper'
RSpec.describe RecordCache::Statistics do
before(:each) do
# remove active setting from other tests
RecordCache::Statistics.send(:remove_instance_variable, :@active) if RecordCache::Statistics.instance_variable_get(:@active)
end
context "active" do
it "should default to false" ... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/multi_read_spec.rb | spec/lib/multi_read_spec.rb | require 'spec_helper'
RSpec.describe RecordCache::MultiRead do
it "should not delegate to single reads when multi_read is supported" do
class MultiReadSupported
def read(key) "single" end
def read_multi(*keys) "multi" end
end
store = RecordCache::MultiRead.test(MultiReadSupported.new)
ex... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/base_spec.rb | spec/lib/base_spec.rb | # encoding: utf-8
require 'spec_helper'
RSpec.describe RecordCache::Base do
it "should run a block in enabled mode" do
RecordCache::Base.disable!
RecordCache::Base.enabled do
expect(RecordCache::Base.status).to eq(RecordCache::ENABLED)
end
expect(RecordCache::Base.status).to eq(RecordCache::DI... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/version_store_spec.rb | spec/lib/version_store_spec.rb | require 'spec_helper'
RSpec.describe RecordCache::VersionStore do
before(:each) do
@version_store = RecordCache::Base.version_store
@version_store.store.write("key1", 1000)
@version_store.store.write("key2", 2000)
end
it "should only accept ActiveSupport cache stores" do
expect{ RecordCache... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/active_record/visitor_spec.rb | spec/lib/active_record/visitor_spec.rb | # encoding: utf-8
require 'spec_helper'
RSpec.describe 'ActiveRecord Visitor' do
def find_visit_methods(visitor_class)
(visitor_class.instance_methods + visitor_class.private_instance_methods).select{ |method| method.to_s =~ /^visit_Arel_/ }.sort.uniq
end
it 'should implement all visitor methods' do
al... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/strategy/unique_index_on_id_cache_spec.rb | spec/lib/strategy/unique_index_on_id_cache_spec.rb | require 'spec_helper'
RSpec.describe RecordCache::Strategy::UniqueIndexCache do
it "should retrieve an Apple from the cache" do
expect{ Apple.find(1) }.to miss_cache(Apple).on(:id).times(1)
expect{ Apple.find(1) }.to hit_cache(Apple).on(:id).times(1)
end
it "should accept find_by_sql queries (can not u... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/strategy/util_spec.rb | spec/lib/strategy/util_spec.rb | # encoding: utf-8
require 'spec_helper'
RSpec.describe RecordCache::Strategy::Util do
it "should serialize a record (currently Active Record only)" do
expect(subject.serialize(Banana.find(1))).to eq({:a=>{"name"=>"Blue Banana 1", "id"=>1, "store_id"=>2, "person_id"=>4}, :c=>"Banana"})
end
it "should deseri... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/strategy/query_cache_spec.rb | spec/lib/strategy/query_cache_spec.rb | require 'spec_helper'
# This describes the behaviour as expected when ActiveRecord::QueryCache is
# enabled. ActiveRecord::QueryCache is enabled by default in rails via a
# middleware. During the scope of a request that cache is used.
#
# In console mode (or within e.g. a cron job) QueryCache isn't enabled.
# You can ... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/strategy/base_spec.rb | spec/lib/strategy/base_spec.rb | # encoding: utf-8
require 'spec_helper'
RSpec.describe RecordCache::Strategy::Base do
it "should force implementation of self.parse method" do
module RecordCache
module Strategy
class MissingParseCache < Base
end
end
end
expect{ RecordCache::Strategy::MissingParseCache.parse(... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/strategy/unique_index_on_string_cache_spec.rb | spec/lib/strategy/unique_index_on_string_cache_spec.rb | require "spec_helper"
RSpec.describe RecordCache::Strategy::UniqueIndexCache do
it "should retrieve an Person from the cache" do
expect{ Person.find_by(name: "Fry") }.to miss_cache(Person).on(:name).times(1)
expect{ Person.find_by(name: "Fry") }.to hit_cache(Person).on(:name).times(1)
end
it "should re... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/strategy/full_table_cache_spec.rb | spec/lib/strategy/full_table_cache_spec.rb | require 'spec_helper'
RSpec.describe RecordCache::Strategy::FullTableCache do
it "should retrieve a Language from the cache" do
expect { Language.where(:locale => 'en-US').load }.to miss_cache(Language).on(:full_table).times(1)
expect { Language.where(:locale => 'en-US').load }.to hit_cache(Language).on(:fu... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/spec/lib/strategy/index_cache_spec.rb | spec/lib/strategy/index_cache_spec.rb | require 'spec_helper'
require 'timecop'
RSpec.describe RecordCache::Strategy::IndexCache do
context "initialize" do
it "should only accept index cache on DB columns" do
expect{ Apple.send(:cache_records, :index => :unknown_column) }.to raise_error("No column found for index 'unknown_column' on Apple.")
... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/lib/record_cache.rb | lib/record_cache.rb | # Record Cache files
require "record_cache/version"
["query", "version_store", "multi_read",
"strategy/util", "strategy/base", "strategy/unique_index_cache", "strategy/full_table_cache", "strategy/index_cache",
"statistics", "dispatcher", "base"].each do |file|
require File.dirname(__FILE__) + "/record_cache/#{file... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/lib/record-cache.rb | lib/record-cache.rb | require 'record_cache' | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/lib/record_cache/version.rb | lib/record_cache/version.rb | module RecordCache # :nodoc:
module Version # :nodoc:
STRING = '0.1.6'
end
end | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/lib/record_cache/version_store.rb | lib/record_cache/version_store.rb | module RecordCache
class VersionStore
attr_accessor :store
def initialize(store)
[:write, :read, :read_multi, :delete].each do |method|
raise "Store #{store.class.name} must respond to #{method}" unless store.respond_to?(method)
end
@store = store
end
def on_write_failure(&... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/lib/record_cache/statistics.rb | lib/record_cache/statistics.rb | module RecordCache
# Collect cache hit/miss statistics for each cache strategy
module Statistics
class << self
# returns +true+ if statistics need to be collected
def active?
!!@active
end
# start statistics collection
def start
@active = true
end
... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/lib/record_cache/query.rb | lib/record_cache/query.rb | module RecordCache
# Container for the Query parameters
class Query
attr_reader :wheres, :sort_orders, :limit
def initialize(equality = nil)
@wheres = equality || {}
@sort_orders = []
@limit = nil
@where_values = {}
end
# Set equality of an attribute (usually found in wher... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/lib/record_cache/base.rb | lib/record_cache/base.rb | module RecordCache
# Normal mode
ENABLED = 1
# Do not fetch queries through the cache (but still update the cache after commit)
NO_FETCH = 2
# Completely disable the cache (may lead to stale results in case caching for other workers is not DISABLED)
DISABLED = 3
module Base
class << self
def i... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/lib/record_cache/dispatcher.rb | lib/record_cache/dispatcher.rb | module RecordCache
# Every model that calls cache_records will receive an instance of this class
# accessible through +<model>.record_cache+
#
# The dispatcher is responsible for dispatching queries, record_changes and invalidation calls
# to the appropriate cache strategies.
class Dispatcher
# Retrie... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/lib/record_cache/multi_read.rb | lib/record_cache/multi_read.rb | # This class will delegate read_multi to sequential read calls in case read_multi is not supported.
#
# If a particular Store Class does support read_multi, but is somehow slower because of a bug,
# you can disable read_multi by calling:
# RecordCache::MultiRead.disable(ActiveSupport::Cache::DalliStore)
#
# Important... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/lib/record_cache/test/resettable_version_store.rb | lib/record_cache/test/resettable_version_store.rb | # Make sure the version store can be reset to it's starting point after each test
# Usage:
# require 'record_cache/test/resettable_version_store'
# after(:each) { RecordCache::Base.version_store.reset! }
module RecordCache
module Test
module ResettableVersionStore
def self.included(base)
base.... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
orslumen/record-cache | https://github.com/orslumen/record-cache/blob/9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6/lib/record_cache/datastore/active_record.rb | lib/record_cache/datastore/active_record.rb | require 'active_record'
# basic Record Cache functionality
ActiveRecord::Base.send(:include, RecordCache::Base)
# To be able to fetch records from the cache and invalidate records in the cache
# some internal Active Record methods need to be aliased.
# The downside of using internal methods, is that they may change i... | ruby | MIT | 9bf4285c0a086f831b4b6e1d3fc292fbe44a14d6 | 2026-01-04T17:37:41.322462Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.