repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/time/calculations.rb
activesupport/lib/active_support/core_ext/time/calculations.rb
# frozen_string_literal: true require "active_support/duration" require "active_support/core_ext/time/conversions" require "active_support/time_with_zone" require "active_support/core_ext/time/zones" require "active_support/core_ext/date_and_time/calculations" require "active_support/core_ext/date/calculations" requir...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/time/zones.rb
activesupport/lib/active_support/core_ext/time/zones.rb
# frozen_string_literal: true require "active_support/time_with_zone" require "active_support/core_ext/time/acts_like" require "active_support/core_ext/date_and_time/zones" class Time include DateAndTime::Zones class << self attr_accessor :zone_default # Returns the TimeZone for the current request, if t...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/instance_variables.rb
activesupport/lib/active_support/core_ext/object/instance_variables.rb
# frozen_string_literal: true class Object # Returns a hash with string keys that maps instance variable names without "@" to their # corresponding values. # # class C # def initialize(x, y) # @x, @y = x, y # end # end # # C.new(0, 1).instance_values # => {"x" => 0, "y" => 1} ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/duplicable.rb
activesupport/lib/active_support/core_ext/object/duplicable.rb
# frozen_string_literal: true #-- # Most objects are cloneable, but not all. For example you can't dup methods: # # method(:puts).dup # => TypeError: allocator undefined for Method # # Classes may signal their instances are not duplicable removing +dup+/+clone+ # or raising exceptions from them. So, to dup an arbitr...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/to_param.rb
activesupport/lib/active_support/core_ext/object/to_param.rb
# frozen_string_literal: true require "active_support/core_ext/object/to_query"
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/blank.rb
activesupport/lib/active_support/core_ext/object/blank.rb
# frozen_string_literal: true require "concurrent/map" class Object # An object is blank if it's false, empty, or a whitespace string. # For example, +nil+, '', ' ', [], {}, and +false+ are all blank. # # This simplifies # # !address || address.empty? # # to # # address.blank? # # @retur...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/deep_dup.rb
activesupport/lib/active_support/core_ext/object/deep_dup.rb
# frozen_string_literal: true require "active_support/core_ext/object/duplicable" class Object # Returns a deep copy of object if it's duplicable. If it's # not duplicable, returns +self+. # # object = Object.new # dup = object.deep_dup # dup.instance_variable_set(:@a, 1) # # object.instanc...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/conversions.rb
activesupport/lib/active_support/core_ext/object/conversions.rb
# frozen_string_literal: true require "active_support/core_ext/object/to_param" require "active_support/core_ext/object/to_query" require "active_support/core_ext/array/conversions" require "active_support/core_ext/hash/conversions"
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/json.rb
activesupport/lib/active_support/core_ext/object/json.rb
# frozen_string_literal: true # Hack to load JSON gem first so we can override its to_json. require "json" require "bigdecimal" require "ipaddr" require "uri" require "pathname" require "active_support/core_ext/big_decimal/conversions" # for #to_s require "active_support/core_ext/hash/except" require "active_support/c...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/to_query.rb
activesupport/lib/active_support/core_ext/object/to_query.rb
# frozen_string_literal: true require "cgi/escape" require "cgi/util" if RUBY_VERSION < "3.5" class Object # Alias of <tt>to_s</tt>. def to_param to_s end # Converts an object into a string suitable for use as a URL query string, # using the given <tt>key</tt> as the param name. def to_query(key) ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/try.rb
activesupport/lib/active_support/core_ext/object/try.rb
# frozen_string_literal: true require "delegate" module ActiveSupport module Tryable # :nodoc: def try(*args, &block) if args.empty? && block_given? if block.arity == 0 instance_eval(&block) else yield self end elsif respond_to?(args.first) public_...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/acts_like.rb
activesupport/lib/active_support/core_ext/object/acts_like.rb
# frozen_string_literal: true class Object # Provides a way to check whether some class acts like some other class based on the existence of # an appropriately-named marker method. # # A class that provides the same interface as <tt>SomeClass</tt> may define a marker method named # <tt>acts_like_some_class?<...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/inclusion.rb
activesupport/lib/active_support/core_ext/object/inclusion.rb
# frozen_string_literal: true class Object # Returns true if this object is included in the argument. # # When argument is a +Range+, +#cover?+ is used to properly handle inclusion # check within open ranges. Otherwise, argument must be any object which responds # to +#include?+. Usage: # # characters ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/with_options.rb
activesupport/lib/active_support/core_ext/object/with_options.rb
# frozen_string_literal: true require "active_support/option_merger" class Object # An elegant way to factor duplication out of options passed to a series of # method calls. Each method called in the block, with the block variable as # the receiver, will have its options merged with the default +options+ # <t...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/object/with.rb
activesupport/lib/active_support/core_ext/object/with.rb
# frozen_string_literal: true class Object # Set and restore public attributes around a block. # # client.timeout # => 5 # client.with(timeout: 1) do |c| # c.timeout # => 1 # end # client.timeout # => 5 # # The receiver is yielded to the provided block. # # This method is a shorthand ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb
activesupport/lib/active_support/core_ext/date_and_time/compatibility.rb
# frozen_string_literal: true require "active_support/core_ext/module/attribute_accessors" require "active_support/core_ext/module/redefine_method" module DateAndTime module Compatibility # Change the output of <tt>ActiveSupport::TimeZone.utc_to_local</tt>. # # When +true+, it returns local times with a...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/date_and_time/calculations.rb
activesupport/lib/active_support/core_ext/date_and_time/calculations.rb
# frozen_string_literal: true require "active_support/core_ext/object/try" require "active_support/core_ext/date_time/conversions" module DateAndTime module Calculations DAYS_INTO_WEEK = { sunday: 0, monday: 1, tuesday: 2, wednesday: 3, thursday: 4, friday: 5, saturday:...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/date_and_time/zones.rb
activesupport/lib/active_support/core_ext/date_and_time/zones.rb
# frozen_string_literal: true module DateAndTime module Zones # Returns the simultaneous time in <tt>Time.zone</tt> if a zone is given or # if Time.zone_default is set. Otherwise, it returns the current time. # # Time.zone = 'Hawaii' # => 'Hawaii' # Time.utc(2000).in_time_zone # => Fri...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/digest/uuid.rb
activesupport/lib/active_support/core_ext/digest/uuid.rb
# frozen_string_literal: true require "securerandom" require "openssl" module Digest module UUID DNS_NAMESPACE = "k\xA7\xB8\x10\x9D\xAD\x11\xD1\x80\xB4\x00\xC0O\xD40\xC8" # :nodoc: URL_NAMESPACE = "k\xA7\xB8\x11\x9D\xAD\x11\xD1\x80\xB4\x00\xC0O\xD40\xC8" # :nodoc: OID_NAMESPACE = "k\xA7\xB8\x12\x9D\x...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/array/inquiry.rb
activesupport/lib/active_support/core_ext/array/inquiry.rb
# frozen_string_literal: true require "active_support/array_inquirer" class Array # Wraps the array in an ActiveSupport::ArrayInquirer object, which gives a # friendlier way to check its string-like contents. # # pets = [:cat, :dog].inquiry # # pets.cat? # => true # pets.ferret? # => false ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/array/extract.rb
activesupport/lib/active_support/core_ext/array/extract.rb
# frozen_string_literal: true class Array # Removes and returns the elements for which the block returns a true value. # If no block is given, an Enumerator is returned instead. # # numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] # odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9] #...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/array/conversions.rb
activesupport/lib/active_support/core_ext/array/conversions.rb
# frozen_string_literal: true require "active_support/core_ext/hash/keys" require "active_support/core_ext/string/inflections" require "active_support/core_ext/object/to_param" require "active_support/core_ext/object/to_query" class Array # Converts the array to a comma-separated sentence where the last element is ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/array/extract_options.rb
activesupport/lib/active_support/core_ext/array/extract_options.rb
# frozen_string_literal: true class Hash # By default, only instances of Hash itself are extractable. # Subclasses of Hash may implement this method and return # true to declare themselves as extractable. If a Hash # is extractable, Array#extract_options! pops it from # the Array when it is the last element ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/array/grouping.rb
activesupport/lib/active_support/core_ext/array/grouping.rb
# frozen_string_literal: true class Array # Splits or iterates over the array in groups of size +number+, # padding any remaining slots with +fill_with+ unless it is +false+. # # %w(1 2 3 4 5 6 7 8 9 10).in_groups_of(3) {|group| p group} # ["1", "2", "3"] # ["4", "5", "6"] # ["7", "8", "9"] # ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/array/access.rb
activesupport/lib/active_support/core_ext/array/access.rb
# frozen_string_literal: true class Array # Returns the tail of the array from +position+. # # %w( a b c d ).from(0) # => ["a", "b", "c", "d"] # %w( a b c d ).from(2) # => ["c", "d"] # %w( a b c d ).from(10) # => [] # %w().from(0) # => [] # %w( a b c d ).from(-2) # => ["c", "d"] #...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/array/wrap.rb
activesupport/lib/active_support/core_ext/array/wrap.rb
# frozen_string_literal: true class Array # Wraps its argument in an array unless it is already an array (or array-like). # # Specifically: # # * If the argument is +nil+ an empty array is returned. # * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned. # * Otherwise,...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/class/subclasses.rb
activesupport/lib/active_support/core_ext/class/subclasses.rb
# frozen_string_literal: true require "active_support/descendants_tracker" class Class # Returns an array with all classes that are < than its receiver. # # class C; end # C.descendants # => [] # # class B < C; end # C.descendants # => [B] # # class A < B; end # C.descendants # => [B, ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/class/attribute.rb
activesupport/lib/active_support/core_ext/class/attribute.rb
# frozen_string_literal: true require "active_support/core_ext/module/redefine_method" require "active_support/class_attribute" class Class # Declare a class-level attribute whose value is inheritable by subclasses. # Subclasses can change their own value and it will not impact parent class. # # ==== Options ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
# frozen_string_literal: true # cattr_* became mattr_* aliases in 7dfbd91b0780fbd6a1dd9bfbc176e10894871d2d, # but we keep this around for libraries that directly require it knowing they # want cattr_*. No need to deprecate. require "active_support/core_ext/module/attribute_accessors"
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/module/redefine_method.rb
activesupport/lib/active_support/core_ext/module/redefine_method.rb
# frozen_string_literal: true class Module # Marks the named method as intended to be redefined, if it exists. # Suppresses the Ruby method redefinition warning. Prefer # #redefine_method where possible. def silence_redefinition_of_method(method) if method_defined?(method) || private_method_defined?(method...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/module/anonymous.rb
activesupport/lib/active_support/core_ext/module/anonymous.rb
# frozen_string_literal: true class Module # A module may or may not have a name. # # module M; end # M.name # => "M" # # m = Module.new # m.name # => nil # # +anonymous?+ method returns true if module does not have a name, false otherwise: # # Module.new.anonymous? # => true # # ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/module/deprecation.rb
activesupport/lib/active_support/core_ext/module/deprecation.rb
# frozen_string_literal: true class Module # deprecate :foo, deprecator: MyLib.deprecator # deprecate :foo, bar: "warning!", deprecator: MyLib.deprecator # # A deprecator is typically an instance of ActiveSupport::Deprecation, but you can also pass any object that responds # to <tt>deprecation_warning(de...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/module/concerning.rb
activesupport/lib/active_support/core_ext/module/concerning.rb
# frozen_string_literal: true require "active_support/concern" class Module # == Bite-sized separation of concerns # # We often find ourselves with a medium-sized chunk of behavior that we'd # like to extract, but only mix in to a single class. # # Extracting a plain old Ruby object to encapsulate it and ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/module/remove_method.rb
activesupport/lib/active_support/core_ext/module/remove_method.rb
# frozen_string_literal: true require "active_support/core_ext/module/redefine_method" class Module # Removes the named method, if it exists. def remove_possible_method(method) if method_defined?(method) || private_method_defined?(method) undef_method(method) end end # Removes the named singlet...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
# frozen_string_literal: true # == Attribute Accessors # # Extends the module object with class/module and instance accessors for # class/module attributes, just like the native attr* accessors for instance # attributes. class Module # Defines a class attribute and creates a class and instance reader methods. # Th...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb
activesupport/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb
# frozen_string_literal: true # == Attribute Accessors per Thread # # Extends the module object with class/module and instance accessors for # class/module attributes, just like the native attr* accessors for instance # attributes, but does so on a per-thread basis. # # So the values are scoped within the Thread.curre...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/module/introspection.rb
activesupport/lib/active_support/core_ext/module/introspection.rb
# frozen_string_literal: true require "active_support/inflector" class Module # Returns the name of the module containing this one. # # M::N.module_parent_name # => "M" def module_parent_name if defined?(@parent_name) @parent_name else name = self.name return if name.nil? pa...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/module/delegation.rb
activesupport/lib/active_support/core_ext/module/delegation.rb
# frozen_string_literal: true class Module require "active_support/delegation" DelegationError = ActiveSupport::DelegationError # :nodoc: # Provides a +delegate+ class method to easily expose contained objects' # public methods as your own. # # ==== Options # * <tt>:to</tt> - Specifies the target object...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/module/aliasing.rb
activesupport/lib/active_support/core_ext/module/aliasing.rb
# frozen_string_literal: true class Module # Allows you to make aliases for attributes, which includes # getter, setter, and a predicate. # # class Content < ActiveRecord::Base # # has a title attribute # end # # class Email < Content # alias_attribute :subject, :title # end # #...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/module/attr_internal.rb
activesupport/lib/active_support/core_ext/module/attr_internal.rb
# frozen_string_literal: true class Module # Declares an attribute reader backed by an internally-named instance variable. def attr_internal_reader(*attrs) attrs.each { |attr_name| attr_internal_define(attr_name, :reader) } end # Declares an attribute writer backed by an internally-named instance variable...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/date_time/blank.rb
activesupport/lib/active_support/core_ext/date_time/blank.rb
# frozen_string_literal: true require "date" class DateTime # :nodoc: # No DateTime is ever blank: # # DateTime.now.blank? # => false # # @return [false] def blank? false end def present? true end end
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/date_time/conversions.rb
activesupport/lib/active_support/core_ext/date_time/conversions.rb
# frozen_string_literal: true require "date" require "active_support/inflector/methods" require "active_support/core_ext/time/conversions" require "active_support/core_ext/date_time/calculations" require "active_support/values/time_zone" class DateTime # Convert to a formatted string. See +Time::DATE_FORMATS+ for p...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/date_time/acts_like.rb
activesupport/lib/active_support/core_ext/date_time/acts_like.rb
# frozen_string_literal: true require "date" require "active_support/core_ext/object/acts_like" class DateTime # Duck-types as a Date-like class. See Object#acts_like?. def acts_like_date? true end # Duck-types as a Time-like class. See Object#acts_like?. def acts_like_time? true end end
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/date_time/compatibility.rb
activesupport/lib/active_support/core_ext/date_time/compatibility.rb
# frozen_string_literal: true require "active_support/core_ext/date_and_time/compatibility" require "active_support/core_ext/module/redefine_method" class DateTime include DateAndTime::Compatibility silence_redefinition_of_method :to_time # Return an instance of +Time+ with the same UTC offset # as +self+. ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/date_time/calculations.rb
activesupport/lib/active_support/core_ext/date_time/calculations.rb
# frozen_string_literal: true require "date" class DateTime class << self # Returns <tt>Time.zone.now.to_datetime</tt> when <tt>Time.zone</tt> or # <tt>config.time_zone</tt> are set, otherwise returns # <tt>Time.now.to_datetime</tt>. def current ::Time.zone ? ::Time.zone.now.to_datetime : ::Ti...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/big_decimal/conversions.rb
activesupport/lib/active_support/core_ext/big_decimal/conversions.rb
# frozen_string_literal: true require "bigdecimal" require "bigdecimal/util" module ActiveSupport module BigDecimalWithDefaultFormat # :nodoc: def to_s(format = "F") super(format) end end end BigDecimal.prepend(ActiveSupport::BigDecimalWithDefaultFormat)
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/numeric/time.rb
activesupport/lib/active_support/core_ext/numeric/time.rb
# frozen_string_literal: true require "active_support/duration" require "active_support/core_ext/time/calculations" require "active_support/core_ext/time/acts_like" require "active_support/core_ext/date/calculations" require "active_support/core_ext/date/acts_like" class Numeric # Returns a Duration instance matchi...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/numeric/conversions.rb
activesupport/lib/active_support/core_ext/numeric/conversions.rb
# frozen_string_literal: true require "active_support/core_ext/big_decimal/conversions" require "active_support/number_helper" module ActiveSupport module NumericWithFormat # \Numeric With Format # # Provides options for converting numbers into formatted strings. # Options are provided for phone num...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/numeric/bytes.rb
activesupport/lib/active_support/core_ext/numeric/bytes.rb
# frozen_string_literal: true class Numeric KILOBYTE = 1024 MEGABYTE = KILOBYTE * 1024 GIGABYTE = MEGABYTE * 1024 TERABYTE = GIGABYTE * 1024 PETABYTE = TERABYTE * 1024 EXABYTE = PETABYTE * 1024 ZETTABYTE = EXABYTE * 1024 # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.meg...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/symbol/starts_ends_with.rb
activesupport/lib/active_support/core_ext/symbol/starts_ends_with.rb
# frozen_string_literal: true class Symbol alias :starts_with? :start_with? alias :ends_with? :end_with? end
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/core_ext/erb/util.rb
activesupport/lib/active_support/core_ext/erb/util.rb
# frozen_string_literal: true require "strscan" require "erb" module ActiveSupport module CoreExt module ERBUtil # HTML escapes strings but doesn't wrap them with an ActiveSupport::SafeBuffer. # This method is not for public consumption! Seriously! def html_escape(s) # :nodoc: s = s.to...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/dependencies/autoload.rb
activesupport/lib/active_support/dependencies/autoload.rb
# frozen_string_literal: true require "active_support/inflector/methods" module ActiveSupport # = Active Support \Autoload # # Autoload and eager load conveniences for your library. # # This module allows you to define autoloads based on # \Rails conventions (i.e. no need to define the path # it is auto...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/dependencies/require_dependency.rb
activesupport/lib/active_support/dependencies/require_dependency.rb
# frozen_string_literal: true module ActiveSupport::Dependencies::RequireDependency # <b>Warning:</b> This method is obsolete. The semantics of the autoloader # match Ruby's and you do not need to be defensive with load order anymore. # Just refer to classes and modules normally. # # Engines that do not cont...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/dependencies/interlock.rb
activesupport/lib/active_support/dependencies/interlock.rb
# frozen_string_literal: true require "active_support/concurrency/share_lock" module ActiveSupport # :nodoc: module Dependencies # :nodoc: class Interlock def initialize # :nodoc: @lock = ActiveSupport::Concurrency::ShareLock.new end def loading(&block) ActiveSupport.deprecato...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/duration/iso8601_parser.rb
activesupport/lib/active_support/duration/iso8601_parser.rb
# frozen_string_literal: true require "strscan" module ActiveSupport class Duration # Parses a string formatted according to ISO 8601 Duration into the hash. # # See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information. # # This parser allows negative parts to be pre...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/duration/iso8601_serializer.rb
activesupport/lib/active_support/duration/iso8601_serializer.rb
# frozen_string_literal: true module ActiveSupport class Duration # Serializes duration to string according to ISO 8601 Duration format. class ISO8601Serializer # :nodoc: DATE_COMPONENTS = %i(years months days) def initialize(duration, precision: nil) @duration = duration @precis...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/locale/en.rb
activesupport/lib/active_support/locale/en.rb
# frozen_string_literal: true { en: { number: { nth: { ordinals: lambda do |_key, options| number = options[:number] case number when 1; "st" when 2; "nd" when 3; "rd" when 4, 5, 6, 7, 8, 9, 10, 11, 12, 13; "th" else ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/executor/test_helper.rb
activesupport/lib/active_support/executor/test_helper.rb
# frozen_string_literal: true module ActiveSupport::Executor::TestHelper # :nodoc: def run(...) Rails.application.executor.perform { super } end end
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/deprecation/deprecators.rb
activesupport/lib/active_support/deprecation/deprecators.rb
# frozen_string_literal: true module ActiveSupport class Deprecation # A managed collection of deprecators. Configuration methods, such as # #behavior=, affect all deprecators in the collection. Additionally, the # #silence method silences all deprecators in the collection for the # duration of a giv...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/deprecation/proxy_wrappers.rb
activesupport/lib/active_support/deprecation/proxy_wrappers.rb
# frozen_string_literal: true module ActiveSupport class Deprecation class DeprecationProxy # :nodoc: def self.new(*args, **kwargs, &block) object = args.first return object unless object super end instance_methods.each { |m| undef_method m unless /^__|^object_id$/.mat...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/deprecation/method_wrappers.rb
activesupport/lib/active_support/deprecation/method_wrappers.rb
# frozen_string_literal: true require "active_support/core_ext/array/extract_options" require "active_support/core_ext/module/redefine_method" module ActiveSupport class Deprecation module MethodWrapper # Declare that a method has been deprecated. # # class Fred # def aaa; end ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/deprecation/constant_accessor.rb
activesupport/lib/active_support/deprecation/constant_accessor.rb
# frozen_string_literal: true module ActiveSupport class Deprecation module DeprecatedConstantAccessor def self.included(base) require "active_support/inflector/methods" extension = Module.new do def const_missing(missing_const_name) if class_variable_defined?(:@@_dep...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/deprecation/reporting.rb
activesupport/lib/active_support/deprecation/reporting.rb
# frozen_string_literal: true require "rbconfig" module ActiveSupport class Deprecation module Reporting # Whether to print a message (silent mode) attr_writer :silenced # Name of gem where method is deprecated attr_accessor :gem_name # Outputs a deprecation warning to the output ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/deprecation/disallowed.rb
activesupport/lib/active_support/deprecation/disallowed.rb
# frozen_string_literal: true module ActiveSupport class Deprecation module Disallowed # Sets the criteria used to identify deprecation messages which should be # disallowed. Can be an array containing strings, symbols, or regular # expressions. (Symbols are treated as strings.) These are compa...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/deprecation/behaviors.rb
activesupport/lib/active_support/deprecation/behaviors.rb
# frozen_string_literal: true require "active_support/notifications" module ActiveSupport # Raised when ActiveSupport::Deprecation::Behavior#behavior is set with <tt>:raise</tt>. # You would set <tt>:raise</tt>, as a behavior to raise errors and proactively report exceptions from deprecations. class Deprecation...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/event_reporter_assertions.rb
activesupport/lib/active_support/testing/event_reporter_assertions.rb
# frozen_string_literal: true module ActiveSupport module Testing # Provides test helpers for asserting on ActiveSupport::EventReporter events. module EventReporterAssertions module EventCollector # :nodoc: @subscribed = false @mutex = Mutex.new class Event # :nodoc: ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/tests_without_assertions.rb
activesupport/lib/active_support/testing/tests_without_assertions.rb
# frozen_string_literal: true module ActiveSupport module Testing # Warns when a test case does not perform any assertions. # # This is helpful in detecting broken tests that do not perform intended assertions. module TestsWithoutAssertions # :nodoc: def after_teardown super if...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/declarative.rb
activesupport/lib/active_support/testing/declarative.rb
# frozen_string_literal: true module ActiveSupport module Testing module Declarative unless defined?(Spec) # Helper to define a test method using a String. Under the hood, it replaces # spaces with underscores and defines the test method. # # test "verify something" do ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/deprecation.rb
activesupport/lib/active_support/testing/deprecation.rb
# frozen_string_literal: true require "active_support/deprecation" module ActiveSupport module Testing module Deprecation ## # :call-seq: # assert_deprecated(deprecator, &block) # assert_deprecated(match, deprecator, &block) # # Asserts that a matching deprecation warning...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/assertions.rb
activesupport/lib/active_support/testing/assertions.rb
# frozen_string_literal: true require "active_support/core_ext/enumerable" module ActiveSupport module Testing module Assertions UNTRACKED = Object.new # :nodoc: # Asserts that an expression is not truthy. Passes if +object+ is +nil+ or # +false+. "Truthy" means "considered true in a conditio...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/setup_and_teardown.rb
activesupport/lib/active_support/testing/setup_and_teardown.rb
# frozen_string_literal: true require "active_support/callbacks" module ActiveSupport module Testing # Adds support for +setup+ and +teardown+ callbacks. # These callbacks serve as a replacement to overwriting the # <tt>#setup</tt> and <tt>#teardown</tt> methods of your TestCase. # # class Exa...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/parallelize_executor.rb
activesupport/lib/active_support/testing/parallelize_executor.rb
# frozen_string_literal: true module ActiveSupport module Testing class ParallelizeExecutor # :nodoc: attr_reader :size, :parallelize_with, :threshold, :work_stealing def initialize(size:, with:, threshold: ActiveSupport.test_parallelization_threshold, work_stealing: false) @size = size ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/error_reporter_assertions.rb
activesupport/lib/active_support/testing/error_reporter_assertions.rb
# frozen_string_literal: true module ActiveSupport module Testing module ErrorReporterAssertions module ErrorCollector # :nodoc: @subscribed = false @mutex = Mutex.new Report = Struct.new(:error, :handled, :severity, :context, :source, keyword_init: true) class Report ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/method_call_assertions.rb
activesupport/lib/active_support/testing/method_call_assertions.rb
# frozen_string_literal: true require "minitest/mock" module ActiveSupport module Testing module MethodCallAssertions # :nodoc: private def assert_called(object, method_name, message = nil, times: 1, returns: nil, &block) times_called = 0 object.stub(method_name, proc { times_...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/parallelization.rb
activesupport/lib/active_support/testing/parallelization.rb
# frozen_string_literal: true require "drb" require "drb/unix" unless Gem.win_platform? require "active_support/core_ext/module/attribute_accessors" require "active_support/testing/parallelization/test_distributor" require "active_support/testing/parallelization/thread_pool_executor" require "active_support/testing/pa...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/stream.rb
activesupport/lib/active_support/testing/stream.rb
# frozen_string_literal: true module ActiveSupport module Testing module Stream # :nodoc: private def silence_stream(stream) old_stream = stream.dup stream.reopen(IO::NULL) stream.sync = true yield ensure stream.reopen(old_stream) ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/notification_assertions.rb
activesupport/lib/active_support/testing/notification_assertions.rb
# frozen_string_literal: true module ActiveSupport module Testing module NotificationAssertions # Assert a notification was emitted with a given +pattern+ and optional +payload+. # # You can assert that a notification was emitted by passing a pattern, which accepts # either a string or re...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/autorun.rb
activesupport/lib/active_support/testing/autorun.rb
# frozen_string_literal: true require "minitest" # This respond_to check handles tests running sub-processes in an # unbundled environment, which triggers MT5 usage. This conditional may # be removable after the version bump, though it currently safeguards # against issues in environments with multiple versions insta...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/isolation.rb
activesupport/lib/active_support/testing/isolation.rb
# frozen_string_literal: true require "active_support/testing/parallelize_executor" module ActiveSupport module Testing module Isolation SubprocessCrashed = Class.new(StandardError) def self.included(klass) # :nodoc: klass.class_eval do parallelize_me! unless Minitest.parallel_exe...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/constant_stubbing.rb
activesupport/lib/active_support/testing/constant_stubbing.rb
# frozen_string_literal: true module ActiveSupport module Testing module ConstantStubbing # Changes the value of a constant for the duration of a block. Example: # # # World::List::Import::LARGE_IMPORT_THRESHOLD = 5000 # stub_const(World::List::Import, :LARGE_IMPORT_THRESHOLD, 1) do ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/time_helpers.rb
activesupport/lib/active_support/testing/time_helpers.rb
# frozen_string_literal: true require "active_support/core_ext/module/redefine_method" require "active_support/core_ext/time/calculations" module ActiveSupport module Testing # Manages stubs for TimeHelpers class SimpleStubs # :nodoc: Stub = Struct.new(:object, :method_name, :original_method) d...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/constant_lookup.rb
activesupport/lib/active_support/testing/constant_lookup.rb
# frozen_string_literal: true require "active_support/concern" require "active_support/inflector" module ActiveSupport module Testing # Resolves a constant from a minitest spec name. # # Given the following spec-style test: # # describe WidgetsController, :index do # describe "authenti...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/file_fixtures.rb
activesupport/lib/active_support/testing/file_fixtures.rb
# frozen_string_literal: true require "active_support/concern" module ActiveSupport module Testing # Adds simple access to sample files called file fixtures. # File fixtures are normal files stored in # <tt>ActiveSupport::TestCase.file_fixture_path</tt>. # # File fixtures are represented as +Pat...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/tagged_logging.rb
activesupport/lib/active_support/testing/tagged_logging.rb
# frozen_string_literal: true module ActiveSupport module Testing # Logs a "PostsControllerTest: test name" heading before each test to # make test.log easier to search and follow along with. module TaggedLogging # :nodoc: attr_writer :tagged_logger def before_setup if tagged_logger ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/parallelization/thread_pool_executor.rb
activesupport/lib/active_support/testing/parallelization/thread_pool_executor.rb
# frozen_string_literal: true require "concurrent/executor/fixed_thread_pool" module ActiveSupport module Testing class Parallelization # :nodoc: # Thread pool executor using a test distributor strategy. # Provides the same interface as Minitest::Parallel::Executor but # with configurable dist...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/parallelization/test_distributor.rb
activesupport/lib/active_support/testing/parallelization/test_distributor.rb
# frozen_string_literal: true module ActiveSupport module Testing class Parallelization # :nodoc: # Abstract base class for test distribution strategies. # Subclasses implement different ways of assigning tests to workers. class TestDistributor # Add a test to be distributed to workers....
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/parallelization/worker.rb
activesupport/lib/active_support/testing/parallelization/worker.rb
# frozen_string_literal: true module ActiveSupport module Testing class Parallelization # :nodoc: class Worker def initialize(number, url) @id = SecureRandom.uuid @number = number @url = url @setup_exception = nil end def start fork...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/testing/parallelization/server.rb
activesupport/lib/active_support/testing/parallelization/server.rb
# frozen_string_literal: true require "drb" require "drb/unix" unless Gem.win_platform? module ActiveSupport module Testing class Parallelization # :nodoc: PrerecordResultClass = Struct.new(:name) class Server include DRb::DRbUndumped def initialize(distributor:) @distribu...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/notifications/fanout.rb
activesupport/lib/active_support/notifications/fanout.rb
# frozen_string_literal: true require "concurrent/map" require "active_support/core_ext/object/try" module ActiveSupport module Notifications class InstrumentationSubscriberError < RuntimeError attr_reader :exceptions def initialize(exceptions) @exceptions = exceptions exception_cla...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/notifications/instrumenter.rb
activesupport/lib/active_support/notifications/instrumenter.rb
# frozen_string_literal: true require "active_support/core_ext/module/delegation" require "securerandom" module ActiveSupport module Notifications # Instrumenters are stored in a thread local. class Instrumenter attr_reader :id def initialize(notifier) unless notifier.respond_to?(:build...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/xml_mini/libxmlsax.rb
activesupport/lib/active_support/xml_mini/libxmlsax.rb
# frozen_string_literal: true require "libxml" require "active_support/core_ext/object/blank" require "stringio" module ActiveSupport module XmlMini_LibXMLSAX # :nodoc: extend self # Class that will build the hash while the XML document # is being parsed using SAX events. class HashBuilder in...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/xml_mini/libxml.rb
activesupport/lib/active_support/xml_mini/libxml.rb
# frozen_string_literal: true require "libxml" require "active_support/core_ext/object/blank" require "stringio" module ActiveSupport module XmlMini_LibXML # :nodoc: extend self # Parse an XML Document string or IO into a simple hash using libxml. # data:: # XML Document string or IO to parse ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/xml_mini/nokogiri.rb
activesupport/lib/active_support/xml_mini/nokogiri.rb
# frozen_string_literal: true begin require "nokogiri" rescue LoadError => e warn "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install" raise e end require "active_support/core_ext/object/blank" require "stringio" module ActiveSupport module XmlMini_Noko...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/xml_mini/rexml.rb
activesupport/lib/active_support/xml_mini/rexml.rb
# frozen_string_literal: true require "active_support/core_ext/kernel/reporting" require "active_support/core_ext/object/blank" require "stringio" module ActiveSupport module XmlMini_REXML # :nodoc: extend self CONTENT_KEY = "__content__" # Parse an XML Document string or IO into a simple hash. # ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/xml_mini/jdom.rb
activesupport/lib/active_support/xml_mini/jdom.rb
# frozen_string_literal: true raise "JRuby is required to use the JDOM backend for XmlMini" unless RUBY_PLATFORM.include?("java") require "jruby" include Java require "active_support/core_ext/object/blank" java_import javax.xml.parsers.DocumentBuilder unless defined? DocumentBuilder java_import javax.xml.parsers.Do...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/xml_mini/nokogirisax.rb
activesupport/lib/active_support/xml_mini/nokogirisax.rb
# frozen_string_literal: true begin require "nokogiri" rescue LoadError => e warn "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install" raise e end require "active_support/core_ext/object/blank" require "stringio" module ActiveSupport module XmlMini_Noko...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/execution_context/test_helper.rb
activesupport/lib/active_support/execution_context/test_helper.rb
# frozen_string_literal: true module ActiveSupport::ExecutionContext::TestHelper # :nodoc: def before_setup ActiveSupport::ExecutionContext.clear super end def after_teardown super ActiveSupport::ExecutionContext.clear end end
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/activesupport/lib/active_support/values/time_zone.rb
activesupport/lib/active_support/values/time_zone.rb
# frozen_string_literal: true require "tzinfo" require "concurrent/map" module ActiveSupport # = Active Support \Time Zone # # The TimeZone class serves as a wrapper around +TZInfo::Timezone+ instances. # It allows us to do the following: # # * Limit the set of zones provided by TZInfo to a meaningful sub...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/test/generators_test.rb
railties/test/generators_test.rb
# frozen_string_literal: true require "generators/generators_test_helper" require "rails/generators/rails/model/model_generator" require "rails/generators/test_unit/model/model_generator" class GeneratorsTest < Rails::Generators::TestCase include GeneratorsTestHelper def setup @path = File.expand_path("lib",...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false
rails/rails
https://github.com/rails/rails/blob/ba0d6f09e991d0621cc30f19c9d189cd21dbf76e/railties/test/initializable_test.rb
railties/test/initializable_test.rb
# frozen_string_literal: true require "abstract_unit" require "rails/initializable" module InitializableTests class Foo include Rails::Initializable attr_accessor :foo, :bar initializer :start do @foo ||= 0 @foo += 1 end end class Bar < Foo initializer :bar do @bar ||= 0 ...
ruby
MIT
ba0d6f09e991d0621cc30f19c9d189cd21dbf76e
2026-01-04T15:37:27.222351Z
false