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
kpumuk/meta-tags
https://github.com/kpumuk/meta-tags/blob/ec137b3e500c3aca2d0e9c113bf732a2dbe6b9cb/lib/meta_tags/meta_tags_collection.rb
lib/meta_tags/meta_tags_collection.rb
# frozen_string_literal: true module MetaTags # Class represents a collection of meta tags. Basically a wrapper around # HashWithIndifferentAccess, with some additional helper methods. class MetaTagsCollection attr_reader :meta_tags # Initializes a new instance of MetaTagsCollection. # def initi...
ruby
MIT
ec137b3e500c3aca2d0e9c113bf732a2dbe6b9cb
2026-01-04T15:53:03.900592Z
false
kpumuk/meta-tags
https://github.com/kpumuk/meta-tags/blob/ec137b3e500c3aca2d0e9c113bf732a2dbe6b9cb/lib/meta_tags/text_normalizer.rb
lib/meta_tags/text_normalizer.rb
# frozen_string_literal: true module MetaTags # Module contains helpers that normalize text meta tag values. module TextNormalizer extend self # Normalize title value. # # @param [String] site_title site title. # @param [Array<String>] title title string. # @param [String] separator a stri...
ruby
MIT
ec137b3e500c3aca2d0e9c113bf732a2dbe6b9cb
2026-01-04T15:53:03.900592Z
false
kpumuk/meta-tags
https://github.com/kpumuk/meta-tags/blob/ec137b3e500c3aca2d0e9c113bf732a2dbe6b9cb/lib/generators/meta_tags/install_generator.rb
lib/generators/meta_tags/install_generator.rb
# frozen_string_literal: true module MetaTags module Generators class InstallGenerator < Rails::Generators::Base desc "Copy MetaTags default files" source_root File.expand_path("templates", __dir__) def copy_config template "config/initializers/meta_tags.rb" end end end end...
ruby
MIT
ec137b3e500c3aca2d0e9c113bf732a2dbe6b9cb
2026-01-04T15:53:03.900592Z
false
kpumuk/meta-tags
https://github.com/kpumuk/meta-tags/blob/ec137b3e500c3aca2d0e9c113bf732a2dbe6b9cb/lib/generators/meta_tags/templates/config/initializers/meta_tags.rb
lib/generators/meta_tags/templates/config/initializers/meta_tags.rb
# frozen_string_literal: true # Use this setup block to configure all options available in MetaTags. MetaTags.configure do |config| # How many characters should the title meta tag have at most. Default is 70. # Set to nil or 0 to remove limits. # config.title_limit = 70 # When true, site title will be truncat...
ruby
MIT
ec137b3e500c3aca2d0e9c113bf732a2dbe6b9cb
2026-01-04T15:53:03.900592Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/money_spec.rb
spec/money_spec.rb
# frozen_string_literal: true Subclass = Class.new(Money) RSpec.describe Money do describe '.locale_backend' do after { Money.locale_backend = :currency } it 'sets the locale_backend' do Money.locale_backend = :i18n expect(Money.locale_backend).to be_a(Money::LocaleBackend::I18n) end ...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
true
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/currency_spec.rb
spec/currency_spec.rb
# frozen_string_literal: true FOO = { priority: 1, iso_code: "FOO", iso_numeric: "840", name: "United States Dollar", symbol: "$", subunit: "Cent", subunit_to_unit: 1000, symbol_first: true, html_entity: "$", decimal_mark: ".", thousands_separator: ",", smallest_denomination: 1, }.freeze RSpec...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true if ENV['COVERAGE'] require 'simplecov' SimpleCov.start do add_filter '/spec/' track_files 'lib/**/*.rb' end end $LOAD_PATH.unshift File.dirname(__FILE__) require "rspec" require "money" Dir['./spec/support/**/*.rb'].each { |f| require f } # This file was generated by th...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/bank/single_currency_spec.rb
spec/bank/single_currency_spec.rb
# frozen_string_literal: true RSpec.describe Money::Bank::SingleCurrency do subject(:bank) { described_class.new } describe "#exchange_with" do it "raises when called" do expect do bank.exchange_with(Money.new(100, "USD"), "EUR") end.to raise_error(Money::Bank::DifferentCurrencyError, "No ...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/bank/base_spec.rb
spec/bank/base_spec.rb
# frozen_string_literal: true RSpec.describe Money::Bank::Base do subject(:bank) { described_class.new } describe ".instance" do it "is local to one class" do subclass = Class.new(described_class) expect(described_class.instance).not_to eq subclass.instance end end describe "#initialize" ...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/bank/variable_exchange_spec.rb
spec/bank/variable_exchange_spec.rb
# frozen_string_literal: true require 'json' require 'yaml' RSpec.describe Money::Bank::VariableExchange do subject(:bank) { described_class.new } describe "#initialize" do context "without &block" do let(:bank) do described_class.new.tap do |bank| bank.add_rate('USD', 'EUR', 1.33) ...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/support/default_currency.rb
spec/support/default_currency.rb
# frozen_string_literal: true RSpec.configure do |config| config.before do Money.default_currency = Money::Currency.new("USD") end end
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/support/locale.rb
spec/support/locale.rb
# frozen_string_literal: true RSpec.configure do |config| config.before(:each, :locale_backend_i18n) do Money.locale_backend = :i18n end config.after(:each, :locale_backend_i18n) do Money.locale_backend = :currency end config.before(:each, :locale_backend_currency) do Money.locale_backend = :cu...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/support/i18n.rb
spec/support/i18n.rb
# frozen_string_literal: true RSpec.configure do |config| config.before do I18n.enforce_available_locales = false I18n.backend = I18n::Backend::Simple.new end end
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/support/precision.rb
spec/support/precision.rb
# frozen_string_literal: true RSpec.configure do |config| config.before(:each, :default_infinite_precision_true) do Money.default_infinite_precision = true end config.after(:each, :default_infinite_precision_true) do Money.default_infinite_precision = false end end
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/support/silence_warnings.rb
spec/support/silence_warnings.rb
# frozen_string_literal: true class Money module Warning def warn(message); end end end class Money include Warning extend Warning end class Money::LocaleBackend::Base include Money::Warning end class Money::FormattingRules include Money::Warning end class Money::Bank::VariableExchange include Mo...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/support/shared_examples/money_examples.rb
spec/support/shared_examples/money_examples.rb
# frozen_string_literal: true RSpec.shared_examples 'instance with custom bank' do |operation, value| subject { evaluated_value ? instance.send(operation, evaluated_value) : instance.send(operation) } let(:custom_bank) { Money::Bank::VariableExchange.new } let(:instance) { Money.new(1, :usd, custom_bank) } le...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/currency/loader_spec.rb
spec/currency/loader_spec.rb
# frozen_string_literal: true RSpec.describe Money::Currency::Loader do it "returns a currency table hash" do expect(described_class.load_currencies).to be_a Hash end it "parse currency_iso.json & currency_non_iso.json & currency_backwards_compatible.json" do allow(described_class).to receive(:parse_cur...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/currency/heuristics_spec.rb
spec/currency/heuristics_spec.rb
# frozen_string_literal: true RSpec.describe Money::Currency::Heuristics do describe "#analyze_string" do it "raises deprecation error" do expect { Money::Currency.analyze('123') }.to raise_error(StandardError, 'Heuristics deprecated, add `gem "money-heuristics"` to Gemfile') end end end
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/locale_backend/currency_spec.rb
spec/locale_backend/currency_spec.rb
# frozen_string_literal: true RSpec.describe Money::LocaleBackend::Currency do subject(:backend) { described_class.new } describe '#lookup' do let(:currency) { Money::Currency.new('EUR') } it 'returns thousands_separator as defined in currency' do expect(backend.lookup(:thousands_separator, currenc...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/locale_backend/i18n_spec.rb
spec/locale_backend/i18n_spec.rb
# frozen_string_literal: true RSpec.describe Money::LocaleBackend::I18n do subject(:backend) { described_class.new } describe '#initialize' do it 'raises an error when I18n is not defined' do hide_const('I18n') expect { described_class.new }.to raise_error(Money::LocaleBackend::NotSupported) ...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/rates_store/memory_spec.rb
spec/rates_store/memory_spec.rb
# frozen_string_literal: true RSpec.describe Money::RatesStore::Memory do subject(:store) { described_class.new } describe '#add_rate and #get_rate' do it 'stores rate in memory' do expect(store.add_rate('USD', 'CAD', 0.9)).to be 0.9 expect(store.get_rate('USD', 'CAD')).to be 0.9 end end ...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/money/constructors_spec.rb
spec/money/constructors_spec.rb
# frozen_string_literal: true RSpec.describe Money::Constructors do describe "::empty" do it "creates a new Money object of 0 cents" do expect(Money.empty).to eq Money.new(0) end it "instantiates a subclass when inheritance is used" do special_money_class = Class.new(Money) expect(spec...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/money/formatting_spec.rb
spec/money/formatting_spec.rb
# frozen_string_literal: true # rubocop:disable RSpec/DescribeClass RSpec.describe "Money formatting" do context "without i18n" do subject(:money) { Money.empty("USD") } it "uses ',' as the thousands separator" do expect(money.thousands_separator).to eq ',' end it "uses '.' as the decimal mar...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
true
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/money/formatting_rules_spec.rb
spec/money/formatting_rules_spec.rb
# frozen_string_literal: true RSpec.describe Money::FormattingRules do it 'does not modify frozen rules in place' do expect do described_class.new(Money::Currency.new('USD'), { separator: '.' }.freeze) end.not_to raise_error end it 'does not modify rules in place' do rules = { separator: '.' }...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/money/arithmetic_spec.rb
spec/money/arithmetic_spec.rb
# frozen_string_literal: true RSpec.describe Money::Arithmetic do describe "-@" do it "changes the sign of a number" do expect(- Money.new(0)).to eq Money.new(0) expect(- Money.new(1)).to eq Money.new(-1) expect(- Money.new(-1)).to eq Money.new(1) end it "preserves the class in the r...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
true
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/money/allocation_spec.rb
spec/money/allocation_spec.rb
# frozen_string_literal: true RSpec.describe Money::Allocation do context 'when given number as argument' do it 'raises an error when invalid argument is given' do expect { described_class.generate(100, 0) }.to raise_error(ArgumentError) expect { described_class.generate(100, -1) }.to raise_error(Arg...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/spec/money/locale_backend_spec.rb
spec/money/locale_backend_spec.rb
# frozen_string_literal: true RSpec.describe Money::LocaleBackend do describe '.find' do it 'returns an initialized backend' do expect(described_class.find(:currency)).to be_a(Money::LocaleBackend::Currency) expect(described_class.find(:i18n)).to be_a(Money::LocaleBackend::I18n) end it 'rais...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money.rb
lib/money.rb
# frozen_string_literal: true require "bigdecimal" require "bigdecimal/util" require "set" require "i18n" require "money/currency" require "money/money" require "money/version"
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/version.rb
lib/money/version.rb
# frozen_string_literal: true class Money VERSION = "7.0.2" end
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/money.rb
lib/money/money.rb
# frozen_string_literal: true require "money/bank/variable_exchange" require "money/bank/single_currency" require "money/money/arithmetic" require "money/money/constructors" require "money/money/formatter" require "money/money/allocation" require "money/money/locale_backend" # "Money is any object or record that is g...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/currency.rb
lib/money/currency.rb
# frozen_string_literal: true require "json" require "money/currency/loader" require "money/currency/heuristics" class Money # Represents a specific currency unit. # # @see https://en.wikipedia.org/wiki/Currency # @see https://www.iso.org/iso-4217-currency-codes.html class Currency include Comparable ...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/bank/single_currency.rb
lib/money/bank/single_currency.rb
# frozen_string_literal: true require 'money/bank/base' class Money module Bank # Raised when trying to exchange currencies class DifferentCurrencyError < Error; end # Class to ensure client code is operating in a single currency # by raising if an exchange attempts to happen. # # This is u...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/bank/variable_exchange.rb
lib/money/bank/variable_exchange.rb
# frozen_string_literal: true require 'money/bank/base' require 'money/rates_store/memory' require 'json' require 'yaml' class Money module Bank # Thrown when an unknown rate format is requested. class UnknownRateFormat < StandardError; end # Class for aiding in exchanging money between different curre...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/bank/base.rb
lib/money/bank/base.rb
# frozen_string_literal: true class Money # Provides classes that aid in the ability of exchange one currency with # another. module Bank # The lowest Money::Bank error class. # All Money::Bank errors should inherit from it. class Error < StandardError end # Raised when the bank doesn't know...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/currency/loader.rb
lib/money/currency/loader.rb
# frozen_string_literal: true class Money class Currency module Loader DATA_PATH = File.expand_path("../../../config", __dir__) class << self # Loads and returns the currencies stored in JSON files in the config directory. # # @return [Hash] def load_currencies ...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/currency/heuristics.rb
lib/money/currency/heuristics.rb
# frozen_string_literal: true class Money class Currency module Heuristics def analyze(_str) raise StandardError, 'Heuristics deprecated, add `gem "money-heuristics"` to Gemfile' end end end end
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/locale_backend/errors.rb
lib/money/locale_backend/errors.rb
# frozen_string_literal: true class Money module LocaleBackend class NotSupported < StandardError; end class Unknown < ArgumentError; end end end
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/locale_backend/currency.rb
lib/money/locale_backend/currency.rb
# frozen_string_literal: true require 'money/locale_backend/base' class Money module LocaleBackend class Currency < Base def lookup(key, currency) currency.public_send(key) if currency.respond_to?(key) end end end end
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/locale_backend/base.rb
lib/money/locale_backend/base.rb
# frozen_string_literal: true require 'money/locale_backend/errors' class Money module LocaleBackend class Base; end end end
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/locale_backend/i18n.rb
lib/money/locale_backend/i18n.rb
# frozen_string_literal: true require 'money/locale_backend/base' class Money module LocaleBackend class I18n < Base KEY_MAP = { thousands_separator: :delimiter, decimal_mark: :separator, symbol: :unit, format: :format, }.freeze def initialize raise Not...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/rates_store/memory.rb
lib/money/rates_store/memory.rb
# frozen_string_literal: true require 'monitor' class Money module RatesStore # Class for thread-safe storage of exchange rate pairs. # Used by instances of +Money::Bank::VariableExchange+. # # @example # store = Money::RatesStore::Memory.new # store.add_rate 'USD', 'CAD', 0.98 # s...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/money/formatting_rules.rb
lib/money/money/formatting_rules.rb
# frozen_string_literal: true class Money class FormattingRules def initialize(currency, *raw_rules) @currency = currency # support for old format parameters @rules = normalize_formatting_rules(raw_rules) @rules = default_formatting_rules.merge(@rules) unless @rules[:ignore_defaults] ...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/money/allocation.rb
lib/money/money/allocation.rb
# frozen_string_literal: true class Money class Allocation # Allocates a specified amount into parts based on their proportions or distributes # it evenly when the number of parts is specified numerically. # # The total of the allocated amounts will always equal the original amount. # # The p...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/money/constructors.rb
lib/money/money/constructors.rb
# frozen_string_literal: true class Money module Constructors # Create a new money object with value 0. # # @param [Currency, String, Symbol] currency The currency to use. # # @return [Money] # # @example # Money.empty #=> #<Money @fractional=0> def empty(currency = default_curr...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/money/arithmetic.rb
lib/money/money/arithmetic.rb
# frozen_string_literal: true class Money module Arithmetic # Wrapper for coerced numeric values to distinguish # when numeric was on the 1st place in operation. CoercedNumeric = Struct.new(:value) do # Proxy #zero? method to skip unnecessary typecasts. See #- and #+. def zero? value....
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/money/formatter.rb
lib/money/money/formatter.rb
# frozen_string_literal: true require 'money/money/formatting_rules' class Money class Formatter DEFAULTS = { thousands_separator: '', decimal_mark: '.', }.freeze # Creates a formatted price string according to several rules. # # @param [Hash] rules The options used to format the st...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
RubyMoney/money
https://github.com/RubyMoney/money/blob/cf4a56bbdf6341056c234dbb110094099154b7ac/lib/money/money/locale_backend.rb
lib/money/money/locale_backend.rb
# frozen_string_literal: true require 'money/locale_backend/errors' require 'money/locale_backend/i18n' require 'money/locale_backend/currency' class Money module LocaleBackend BACKENDS = { i18n: Money::LocaleBackend::I18n, currency: Money::LocaleBackend::Currency, }.freeze def self.find(na...
ruby
MIT
cf4a56bbdf6341056c234dbb110094099154b7ac
2026-01-04T15:52:50.609008Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/.yard_support.rb
.yard_support.rb
# frozen_string_literal: true require 'kramdown' require 'kramdown-parser-gfm' # Custom markup provider class that always renders Kramdown using GFM (Github Flavored Markdown). # GFM is needed to render markdown tables and fenced code blocks in the README. class KramdownGfmDocument < Kramdown::Document def initiali...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/.mdstyle.rb
.mdstyle.rb
# frozen_string_literal: true # https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md all rule 'MD007', indent: 4 # Unordered list indentation exclude_rule 'MD013' # Line length exclude_rule 'MD033' # Inline HTML
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/scripts/benchmark_advisory_locks.rb
scripts/benchmark_advisory_locks.rb
# To run: # bundle exec ruby scripts/benchmark_job_throughput.rb # ENV['GOOD_JOB_EXECUTION_MODE'] = 'external' require_relative '../demo/config/environment' require_relative '../lib/good_job' require 'benchmark/ips' Benchmark.ips do |x| x.report("session") do Rails.application.executor.wrap do GoodJob::J...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/scripts/benchmark_job_throughput.rb
scripts/benchmark_job_throughput.rb
# To run: # bundle exec ruby scripts/benchmark_job_throughput.rb # ENV['GOOD_JOB_EXECUTION_MODE'] = 'external' require_relative '../demo/config/environment' require_relative '../lib/good_job' require 'benchmark/ips' booleans = [true, false] priorities = (1..10).to_a scheduled_minutes = (-60..60).to_a queue_names = [...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/scripts/benchmark_scheduler_memory.rb
scripts/benchmark_scheduler_memory.rb
# # $ bundle exec ruby scripts/benchmark_scheduler.rb # require_relative '../demo/config/environment' require_relative '../lib/good_job' require 'memory_profiler' MAX_CACHE = 10_000 MAX_THREADS = 0 JOBS_SIZE = 20_000 class CustomPerformer < GoodJob::JobPerformer def name 'script' end def next sleep 0.1...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/charts/good_job/scheduled_by_queue_chart.rb
app/charts/good_job/scheduled_by_queue_chart.rb
# frozen_string_literal: true module GoodJob class ScheduledByQueueChart < BaseChart def initialize(filter) super() @filter = filter end def data count_query = <<~SQL.squish SELECT * FROM generate_series( date_trunc('hour', $1::timestamp), date_trunc...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/charts/good_job/performance_index_chart.rb
app/charts/good_job/performance_index_chart.rb
# frozen_string_literal: true module GoodJob class PerformanceIndexChart < BaseChart def data table_name = GoodJob::Execution.table_name sum_query = <<~SQL.squish SELECT * FROM generate_series( date_trunc('hour', $1::timestamp), date_trunc('hour', $2::timestamp), ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/charts/good_job/base_chart.rb
app/charts/good_job/base_chart.rb
# frozen_string_literal: true module GoodJob class BaseChart def start_end_binds end_time = Time.current start_time = end_time - 1.day [ ActiveRecord::Relation::QueryAttribute.new('start_time', start_time, ActiveRecord::Type::DateTime.new), ActiveRecord::Relation::QueryAttribut...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/charts/good_job/performance_show_chart.rb
app/charts/good_job/performance_show_chart.rb
# frozen_string_literal: true module GoodJob class PerformanceShowChart < BaseChart # These numbers are lifted from Sidekiq BUCKET_INTERVALS = [ 0.02, 0.03, 0.045, 0.065, 0.1, 0.15, 0.225, 0.335, 0.5, 0.75, 1.1, 1.7, 2.5, 3.8, 5.75, 8.5, 13, 20, 30, 45, 65, 100, 150, 225, 335, ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/helpers/good_job/icons_helper.rb
app/helpers/good_job/icons_helper.rb
# frozen_string_literal: true module GoodJob module IconsHelper STATUS_ICONS = { discarded: "exclamation", succeeded: "check", queued: "dash_circle", retried: "arrow_clockwise", running: "play", scheduled: "clock", }.freeze STATUS_COLOR = { discarded: "danger", ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/helpers/good_job/application_helper.rb
app/helpers/good_job/application_helper.rb
# frozen_string_literal: true module GoodJob module ApplicationHelper # Explicit helper inclusion because ApplicationController inherits from the host app. # # We can't rely on +config.action_controller.include_all_helpers = true+ in the host app. include IconsHelper def format_duration(sec) ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/controllers/good_job/performance_controller.rb
app/controllers/good_job/performance_controller.rb
# frozen_string_literal: true module GoodJob class PerformanceController < ApplicationController def index @performances = GoodJob::Execution.group(:job_class).select(" job_class, COUNT(*) AS executions_count, AVG(duration) AS avg_duration, MIN(duration) AS min_duration, ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/controllers/good_job/jobs_controller.rb
app/controllers/good_job/jobs_controller.rb
# frozen_string_literal: true module GoodJob class JobsController < GoodJob::ApplicationController DISCARD_MESSAGE = "Discarded through dashboard" FORCE_DISCARD_MESSAGE = "Force discarded through dashboard" ACTIONS = { discard: "discarded", reschedule: "rescheduled", retry: "retried", ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/controllers/good_job/frontends_controller.rb
app/controllers/good_job/frontends_controller.rb
# frozen_string_literal: true module GoodJob class FrontendsController < ActionController::Base # rubocop:disable Rails/ApplicationController protect_from_forgery with: :exception skip_after_action :verify_same_origin_request, raise: false def self.asset_path(*path) Engine.root.join("app/frontend/...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/controllers/good_job/batches_controller.rb
app/controllers/good_job/batches_controller.rb
# frozen_string_literal: true module GoodJob class BatchesController < GoodJob::ApplicationController def index @filter = BatchesFilter.new(params) end def show @batch = GoodJob::BatchRecord.find(params[:id]) end def retry @batch = GoodJob::Batch.find(params[:id]) @batch...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/controllers/good_job/cleaner_controller.rb
app/controllers/good_job/cleaner_controller.rb
# frozen_string_literal: true module GoodJob class CleanerController < ApplicationController def index @filter = JobsFilter.new(params) @discarded_jobs_grouped_by_exception = GoodJob::Job.discarded .select(<<-SQL.squish) SPLIT_PART(error, ': ', 1) AS...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/controllers/good_job/metrics_controller.rb
app/controllers/good_job/metrics_controller.rb
# frozen_string_literal: true module GoodJob class MetricsController < ApplicationController def primary_nav jobs_count = GoodJob::Job.count batches_count = GoodJob::BatchRecord.all.size cron_entries_count = GoodJob::CronEntry.all.size pauses_count = GoodJob::Setting.paused.values.sum(&:c...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/controllers/good_job/processes_controller.rb
app/controllers/good_job/processes_controller.rb
# frozen_string_literal: true module GoodJob class ProcessesController < GoodJob::ApplicationController def index @processes = GoodJob::Process.active.order(created_at: :desc) end end end
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/controllers/good_job/pauses_controller.rb
app/controllers/good_job/pauses_controller.rb
# frozen_string_literal: true module GoodJob class PausesController < ApplicationController before_action :validate_type, only: [:create, :destroy] def index @paused = GoodJob::Setting.paused end def create pause_type = params[:type].to_sym pause_value = params[:value].to_s ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/controllers/good_job/cron_entries_controller.rb
app/controllers/good_job/cron_entries_controller.rb
# frozen_string_literal: true module GoodJob class CronEntriesController < GoodJob::ApplicationController def index @cron_entries = CronEntry.all end def show @cron_entry = CronEntry.find(params[:cron_key]) @jobs_filter = JobsFilter.new(params, @cron_entry.jobs) end def enqueu...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/controllers/good_job/application_controller.rb
app/controllers/good_job/application_controller.rb
# frozen_string_literal: true module GoodJob class ApplicationController < ActionController::Base protect_from_forgery with: :exception around_action :use_good_job_locale content_security_policy do |policy| policy.default_src(:self) if policy.default_src(*policy.default_src).blank? policy.c...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/concerns/good_job/error_events.rb
app/models/concerns/good_job/error_events.rb
# frozen_string_literal: true module GoodJob # Shared methods for filtering Execution/Job records from the +good_jobs+ table. module ErrorEvents extend ActiveSupport::Concern included do error_event_enum = { interrupted: 0, unhandled: 1, handled: 2, retried: 3, ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/concerns/good_job/reportable.rb
app/models/concerns/good_job/reportable.rb
# frozen_string_literal: true module GoodJob module Reportable # There are 3 buckets of non-overlapping statuses: # 1. The job will be executed # - queued: The job will execute immediately when an execution thread becomes available. # - scheduled: The job is scheduled to execute in the futu...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/concerns/good_job/filterable.rb
app/models/concerns/good_job/filterable.rb
# frozen_string_literal: true module GoodJob # Shared methods for filtering Execution/Job records from the +good_jobs+ table. module Filterable extend ActiveSupport::Concern included do # Get records in display order with optional keyset pagination. # @!method display_all(ordered_by: ["created...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/concerns/good_job/advisory_lockable.rb
app/models/concerns/good_job/advisory_lockable.rb
# frozen_string_literal: true module GoodJob # # Adds Postgres advisory locking capabilities to an ActiveRecord record. # For details on advisory locks, see the Postgres documentation: # - {https://www.postgresql.org/docs/current/explicit-locking.html#ADVISORY-LOCKS Advisory Locks Overview} # - {https://www....
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/batch.rb
app/models/good_job/batch.rb
# frozen_string_literal: true module GoodJob # NOTE: This class delegates to {GoodJob::BatchRecord} and is intended to be the public interface for Batches. class Batch include GlobalID::Identification thread_cattr_accessor :current_batch_id thread_cattr_accessor :current_batch_callback_id PROTECT...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/active_record_parent_class.rb
app/models/good_job/active_record_parent_class.rb
# frozen_string_literal: true module GoodJob ActiveRecordParentClass = if GoodJob.active_record_parent_class Object.const_get(GoodJob.active_record_parent_class) else ActiveRecord::Base end end
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/discrete_execution.rb
app/models/good_job/discrete_execution.rb
# frozen_string_literal: true module GoodJob # Deprecated, use +Execution+ instead. class DiscreteExecution < Execution end include ActiveSupport::Deprecation::DeprecatedConstantAccessor deprecate_constant :DiscreteExecution, 'Execution', deprecator: GoodJob.deprecator end
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/batch_record.rb
app/models/good_job/batch_record.rb
# frozen_string_literal: true require 'active_job/arguments' module GoodJob class BatchRecord < BaseRecord include AdvisoryLockable include Filterable self.table_name = 'good_job_batches' self.implicit_order_column = 'created_at' has_many :jobs, class_name: 'GoodJob::Job', inverse_of: :batch, ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/execution_result.rb
app/models/good_job/execution_result.rb
# frozen_string_literal: true module GoodJob # Stores the results of job execution class ExecutionResult # @return [Object, nil] attr_reader :value # @return [Exception, nil] attr_reader :handled_error # @return [Exception, nil] attr_reader :unhandled_error # @return [Symbol, nil] a...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/process.rb
app/models/good_job/process.rb
# frozen_string_literal: true require 'socket' module GoodJob # :nodoc: # Active Record model that represents a GoodJob capsule/process (either async or CLI). class Process < BaseRecord include AdvisoryLockable include OverridableConnection # Interval until the process record being updated STALE_...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/cron_entry.rb
app/models/good_job/cron_entry.rb
# frozen_string_literal: true require "concurrent/hash" require "concurrent/scheduled_task" require "fugit" module GoodJob # :nodoc: # # A CronEntry represents a single scheduled item's properties. # class CronEntry include ActiveModel::Model attr_reader :params def self.all(configuration: nil) ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/execution.rb
app/models/good_job/execution.rb
# frozen_string_literal: true module GoodJob # :nodoc: class Execution < BaseRecord include ErrorEvents self.table_name = 'good_job_executions' self.implicit_order_column = 'created_at' belongs_to :job, class_name: 'GoodJob::Job', foreign_key: 'active_job_id', primary_key: 'id', inverse_of: :execut...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/setting.rb
app/models/good_job/setting.rb
# frozen_string_literal: true module GoodJob class Setting < BaseRecord CRON_KEYS_ENABLED = "cron_keys_enabled" CRON_KEYS_DISABLED = "cron_keys_disabled" PAUSES = "pauses" self.table_name = 'good_job_settings' self.implicit_order_column = 'created_at' def self.cron_key_enabled?(key, default...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/i18n_config.rb
app/models/good_job/i18n_config.rb
# frozen_string_literal: true module GoodJob class I18nConfig < ::I18n::Config BACKEND = I18n::Backend::Simple.new AVAILABLE_LOCALES = GoodJob::Engine.root.join("config/locales").glob("*.yml").map { |path| File.basename(path, ".yml").to_sym }.uniq AVAILABLE_LOCALES_SET = AVAILABLE_LOCALES.inject(Set.new)...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/base_record.rb
app/models/good_job/base_record.rb
# frozen_string_literal: true module GoodJob # Base ActiveRecord class that all GoodJob models inherit from. # Parent class can be configured with +GoodJob.active_record_parent_class+. # @!parse # class BaseRecord < ActiveRecord::Base; end class BaseRecord < ActiveRecordParentClass self.abstract_class ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/models/good_job/job.rb
app/models/good_job/job.rb
# frozen_string_literal: true module GoodJob # Active Record model that represents an +ActiveJob+ job. class Job < BaseRecord include AdvisoryLockable include ErrorEvents include Filterable include Reportable # Raised if something attempts to execute a previously completed Execution again. ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/filters/good_job/batches_filter.rb
app/filters/good_job/batches_filter.rb
# frozen_string_literal: true module GoodJob class BatchesFilter < BaseFilter def filtered_query(_filtered_params = params) base_query end def query_for_records default_base_query end def default_base_query GoodJob::BatchRecord.includes(:jobs) end end end
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/filters/good_job/base_filter.rb
app/filters/good_job/base_filter.rb
# frozen_string_literal: true module GoodJob class BaseFilter DEFAULT_LIMIT = 25 EMPTY = '[none]' attr_accessor :params, :base_query def initialize(params, base_query = nil) @params = params @base_query = base_query || default_base_query end def records after_at = params[...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/app/filters/good_job/jobs_filter.rb
app/filters/good_job/jobs_filter.rb
# frozen_string_literal: true module GoodJob class JobsFilter < BaseFilter UUID_REGEX = /\A[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\z/i def state_names %w[scheduled retried queued running succeeded discarded] end def states @_states ||= begin query = filtered_query(params.exc...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/sorbet/rbi/shims/rack_handler.rb
sorbet/rbi/shims/rack_handler.rb
# frozen_string_literal: true # Manually exported via Tapioca because rackup is not compatible with Rack 2.0 # which is used for development, but Rackup is is necessary as a fallback for # Rack 3.0 compatibility. And Rackup 1.0 is bugged. # # https://github.com/rack/rackup/issues/13#issuecomment-2186788166 module Rac...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/sorbet/tapioca/prerequire.rb
sorbet/tapioca/prerequire.rb
# typed: true # frozen_string_literal: true # "Descendants doesn't load for engines: https://github.com/Shopify/tapioca/issues/517 require 'rails/all' # Necessary to load capybara/rails which creates a Rack::Builder with Rails.application if Rails.application.nil? class Application < Rails::Application end end
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/sorbet/tapioca/require.rb
sorbet/tapioca/require.rb
# typed: true # frozen_string_literal: true require "active_job" require "active_job/arguments" require "active_job/queue_adapters" require "active_job/queue_adapters/good_job_adapter" require "active_support/core_ext/module/attribute_accessors_per_thread" require "active_support/core_ext/numeric/time" require "active...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/rails_helper.rb
spec/rails_helper.rb
# frozen_string_literal: true # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' if RUBY_PLATFORM.include?('java') # Workaround for issue in I18n/JRuby combo. # See https://github.com/jruby/jruby/issues/6547 and # https://github.com/ruby-...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, withou...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/system/cron_entries_spec.rb
spec/system/cron_entries_spec.rb
# frozen_string_literal: true require 'rails_helper' describe 'Cron Schedules' do let(:cron_entry) { GoodJob::CronEntry.find(:example) } before do ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) end it 'can enqueue a cron_entry immediately' do visit '/good_job/cron_en...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/system/theme_spec.rb
spec/system/theme_spec.rb
# frozen_string_literal: true require 'rails_helper' describe 'Light and Dark Themes', :js do specify do visit good_job.jobs_path expect(page).to have_css('html[data-bs-theme="light"]') find('button[data-theme-target="dropdown"]').click click_button 'Dark' expect(page).to have_css('html[data-bs...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/system/cleaner_spec.rb
spec/system/cleaner_spec.rb
# frozen_string_literal: true require 'rails_helper' describe 'Cleaner Page', :js do let(:discarded_job) do Timecop.travel 1.hour.ago ExampleJob.set(queue: :elephants).perform_later(ExampleJob::DEAD_TYPE) 5.times do Timecop.travel 5.minutes GoodJob.perform_inline end Timecop.return ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/system/pauses_spec.rb
spec/system/pauses_spec.rb
# frozen_string_literal: true require 'rails_helper' describe 'Pauses' do before do ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) end it "can pause and unpause jobs" do ExampleJob.perform_later GoodJob.perform_inline visit good_job.root_path click_on "Pau...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/system/i18n_spec.rb
spec/system/i18n_spec.rb
# frozen_string_literal: true require 'rails_helper' describe 'I18n Internationalization', :js do describe "when changing language" do it "changes wording from English to Spanish" do visit good_job_path(locale: :en) expect(page).to have_content "Processes" find_by_id('localeOptions').click ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/system/jobs_spec.rb
spec/system/jobs_spec.rb
# frozen_string_literal: true require 'rails_helper' describe 'Jobs', :js, :without_executor do before do allow(GoodJob).to receive_messages(retry_on_unhandled_error: false, preserve_job_records: true) end it 'renders chart js' do visit good_job.jobs_path expect(page).to have_content 'GoodJob 👍' ...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/system/live_poll_spec.rb
spec/system/live_poll_spec.rb
# frozen_string_literal: true require 'rails_helper' describe 'Live Poll', :js do before do allow(GoodJob).to receive_messages(retry_on_unhandled_error: false, preserve_job_records: true) end context 'with dashboard_live_poll_enabled true' do before do allow(Rails.application.config).to receive(:...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false
bensheldon/good_job
https://github.com/bensheldon/good_job/blob/33c0174607c0c885597bab2b8f63a6a6276d2f0e/spec/system/custom_partials_spec.rb
spec/system/custom_partials_spec.rb
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'Custom partials' do before do ActiveJob::Base.queue_adapter = GoodJob::Adapter.new(execution_mode: :external) end it 'renders custom partials on the Job#show page' do ExampleJob.perform_later job = GoodJob::Job.last visit goo...
ruby
MIT
33c0174607c0c885597bab2b8f63a6a6276d2f0e
2026-01-04T15:52:28.507710Z
false