sorbet/rbi/gems/activesupport@7.2.2.rbi
# typed: false
# DO NOT EDIT MANUALLY
# This is an autogenerated file for types exported from the `activesupport` gem.
# Please instead update this file by running `bin/tapioca gem activesupport`.
# :include: ../README.rdoc
#
# source://activesupport//lib/active_support/deep_mergeable.rb#3
module ActiveSupport
extend ::ActiveSupport::LazyLoadHooks
extend ::ActiveSupport::Autoload
# source://activesupport//lib/active_support/json/decoding.rb#9
def parse_json_times; end
# source://activesupport//lib/active_support/json/decoding.rb#9
def parse_json_times=(val); end
# source://activesupport//lib/active_support.rb#99
def test_order; end
# source://activesupport//lib/active_support.rb#99
def test_order=(val); end
# source://activesupport//lib/active_support.rb#100
def test_parallelization_threshold; end
# source://activesupport//lib/active_support.rb#100
def test_parallelization_threshold=(val); end
class << self
# source://activesupport//lib/active_support.rb#105
def cache_format_version; end
# source://activesupport//lib/active_support.rb#109
def cache_format_version=(value); end
# source://activesupport//lib/active_support/deprecator.rb#4
def deprecator; end
# source://activesupport//lib/active_support.rb#93
def eager_load!; end
# source://activesupport//lib/active_support.rb#103
def error_reporter; end
# source://activesupport//lib/active_support.rb#103
def error_reporter=(_arg0); end
# source://activesupport//lib/active_support/json/encoding.rb#8
def escape_html_entities_in_json(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/json/encoding.rb#8
def escape_html_entities_in_json=(arg); end
# Returns the currently loaded version of Active Support as a +Gem::Version+.
#
# source://activesupport//lib/active_support/gem_version.rb#5
def gem_version; end
# source://activesupport//lib/active_support/json/encoding.rb#8
def json_encoder(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/json/encoding.rb#8
def json_encoder=(arg); end
# source://activesupport//lib/active_support/json/decoding.rb#9
def parse_json_times; end
# source://activesupport//lib/active_support/json/decoding.rb#9
def parse_json_times=(val); end
# source://activesupport//lib/active_support.rb#99
def test_order; end
# source://activesupport//lib/active_support.rb#99
def test_order=(val); end
# source://activesupport//lib/active_support.rb#100
def test_parallelization_threshold; end
# source://activesupport//lib/active_support.rb#100
def test_parallelization_threshold=(val); end
# source://activesupport//lib/active_support/json/encoding.rb#8
def time_precision(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/json/encoding.rb#8
def time_precision=(arg); end
# source://activesupport//lib/active_support.rb#113
def to_time_preserves_timezone; end
# source://activesupport//lib/active_support.rb#117
def to_time_preserves_timezone=(value); end
# source://activesupport//lib/active_support/json/encoding.rb#8
def use_standard_json_time_format(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/json/encoding.rb#8
def use_standard_json_time_format=(arg); end
# source://activesupport//lib/active_support.rb#127
def utc_to_local_returns_utc_offset_times; end
# source://activesupport//lib/active_support.rb#131
def utc_to_local_returns_utc_offset_times=(value); end
# Returns the currently loaded version of Active Support as a +Gem::Version+.
#
# source://activesupport//lib/active_support/version.rb#7
def version; end
end
end
# = Actionable Errors
#
# Actionable errors lets you define actions to resolve an error.
#
# To make an error actionable, include the +ActiveSupport::ActionableError+
# module and invoke the +action+ class macro to define the action. An action
# needs a name and a block to execute.
#
# source://activesupport//lib/active_support/actionable_error.rb#11
module ActiveSupport::ActionableError
extend ::ActiveSupport::Concern
include GeneratedInstanceMethods
mixes_in_class_methods GeneratedClassMethods
mixes_in_class_methods ::ActiveSupport::ActionableError::ClassMethods
class << self
# source://activesupport//lib/active_support/actionable_error.rb#20
def actions(error); end
# source://activesupport//lib/active_support/actionable_error.rb#29
def dispatch(error, name); end
end
module GeneratedClassMethods
def _actions; end
def _actions=(value); end
def _actions?; end
end
module GeneratedInstanceMethods
def _actions; end
def _actions=(value); end
def _actions?; end
end
end
# source://activesupport//lib/active_support/actionable_error.rb#35
module ActiveSupport::ActionableError::ClassMethods
# Defines an action that can resolve the error.
#
# class PendingMigrationError < MigrationError
# include ActiveSupport::ActionableError
#
# action "Run pending migrations" do
# ActiveRecord::Tasks::DatabaseTasks.migrate
# end
# end
#
# source://activesupport//lib/active_support/actionable_error.rb#45
def action(name, &block); end
end
# source://activesupport//lib/active_support/actionable_error.rb#14
class ActiveSupport::ActionableError::NonActionable < ::StandardError; end
# = \Array Inquirer
#
# Wrapping an array in an +ArrayInquirer+ gives a friendlier way to check
# its string-like contents:
#
# variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
#
# variants.phone? # => true
# variants.tablet? # => true
# variants.desktop? # => false
#
# source://activesupport//lib/active_support/array_inquirer.rb#14
class ActiveSupport::ArrayInquirer < ::Array
# Passes each element of +candidates+ collection to ArrayInquirer collection.
# The method returns true if any element from the ArrayInquirer collection
# is equal to the stringified or symbolized form of any element in the +candidates+ collection.
#
# If +candidates+ collection is not given, method returns true.
#
# variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
#
# variants.any? # => true
# variants.any?(:phone, :tablet) # => true
# variants.any?('phone', 'desktop') # => true
# variants.any?(:desktop, :watch) # => false
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/array_inquirer.rb#27
def any?(*candidates); end
private
# source://activesupport//lib/active_support/array_inquirer.rb#42
def method_missing(name, *_arg1, **_arg2, &_arg3); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/array_inquirer.rb#38
def respond_to_missing?(name, include_private = T.unsafe(nil)); end
end
# = 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 automatically guessed based on the filename)
# and also define a set of constants that needs to be
# eager loaded:
#
# module MyLib
# extend ActiveSupport::Autoload
#
# autoload :Model
#
# eager_autoload do
# autoload :Cache
# end
# end
#
# Then your library can be eager loaded by simply calling:
#
# MyLib.eager_load!
#
# source://activesupport//lib/active_support/dependencies/autoload.rb#29
module ActiveSupport::Autoload
# source://activesupport//lib/active_support/dependencies/autoload.rb#30
def autoload(const_name, path = T.unsafe(nil)); end
# source://activesupport//lib/active_support/dependencies/autoload.rb#51
def autoload_at(path); end
# source://activesupport//lib/active_support/dependencies/autoload.rb#44
def autoload_under(path); end
# source://activesupport//lib/active_support/dependencies/autoload.rb#58
def eager_autoload; end
# source://activesupport//lib/active_support/dependencies/autoload.rb#65
def eager_load!; end
end
# = Backtrace Cleaner
#
# Backtraces often include many lines that are not relevant for the context
# under review. This makes it hard to find the signal amongst the backtrace
# noise, and adds debugging time. With a BacktraceCleaner, filters and
# silencers are used to remove the noisy lines, so that only the most relevant
# lines remain.
#
# Filters are used to modify lines of data, while silencers are used to remove
# lines entirely. The typical filter use case is to remove lengthy path
# information from the start of each line, and view file paths relevant to the
# app directory instead of the file system root. The typical silencer use case
# is to exclude the output of a noisy library from the backtrace, so that you
# can focus on the rest.
#
# bc = ActiveSupport::BacktraceCleaner.new
# root = "#{Rails.root}/"
# bc.add_filter { |line| line.start_with?(root) ? line.from(root.size) : line } # strip the Rails.root prefix
# bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems
# bc.clean(exception.backtrace) # perform the cleanup
#
# To reconfigure an existing BacktraceCleaner (like the default one in \Rails)
# and show as much data as possible, you can always call
# BacktraceCleaner#remove_silencers!, which will restore the
# backtrace to a pristine state. If you need to reconfigure an existing
# BacktraceCleaner so that it does not filter or modify the paths of any lines
# of the backtrace, you can call BacktraceCleaner#remove_filters!
# These two methods will give you a completely untouched backtrace.
#
# Inspired by the Quiet Backtrace gem by thoughtbot.
#
# source://activesupport//lib/active_support/backtrace_cleaner.rb#34
class ActiveSupport::BacktraceCleaner
# @return [BacktraceCleaner] a new instance of BacktraceCleaner
#
# source://activesupport//lib/active_support/backtrace_cleaner.rb#35
def initialize; end
# Adds a filter from the block provided. Each line in the backtrace will be
# mapped against this filter.
#
# # Will turn "/my/rails/root/app/models/person.rb" into "app/models/person.rb"
# root = "#{Rails.root}/"
# backtrace_cleaner.add_filter { |line| line.start_with?(root) ? line.from(root.size) : line }
#
# source://activesupport//lib/active_support/backtrace_cleaner.rb#83
def add_filter(&block); end
# Adds a silencer from the block provided. If the silencer returns +true+
# for a given line, it will be excluded from the clean backtrace.
#
# # Will reject all lines that include the word "puma", like "/gems/puma/server.rb" or "/app/my_puma_server/rb"
# backtrace_cleaner.add_silencer { |line| /puma/.match?(line) }
#
# source://activesupport//lib/active_support/backtrace_cleaner.rb#92
def add_silencer(&block); end
# Returns the backtrace after all filters and silencers have been run
# against it. Filters run first, then silencers.
#
# source://activesupport//lib/active_support/backtrace_cleaner.rb#45
def clean(backtrace, kind = T.unsafe(nil)); end
# Returns the frame with all filters applied.
# returns +nil+ if the frame was silenced.
#
# source://activesupport//lib/active_support/backtrace_cleaner.rb#61
def clean_frame(frame, kind = T.unsafe(nil)); end
# Returns the backtrace after all filters and silencers have been run
# against it. Filters run first, then silencers.
#
# source://activesupport//lib/active_support/backtrace_cleaner.rb#45
def filter(backtrace, kind = T.unsafe(nil)); end
# Removes all filters, but leaves in the silencers. Useful if you suddenly
# need to see entire filepaths in the backtrace that you had already
# filtered out.
#
# source://activesupport//lib/active_support/backtrace_cleaner.rb#106
def remove_filters!; end
# Removes all silencers, but leaves in the filters. Useful if your
# context of debugging suddenly expands as you suspect a bug in one of
# the libraries you use.
#
# source://activesupport//lib/active_support/backtrace_cleaner.rb#99
def remove_silencers!; end
private
# source://activesupport//lib/active_support/backtrace_cleaner.rb#127
def add_core_silencer; end
# source://activesupport//lib/active_support/backtrace_cleaner.rb#118
def add_gem_filter; end
# source://activesupport//lib/active_support/backtrace_cleaner.rb#131
def add_gem_silencer; end
# source://activesupport//lib/active_support/backtrace_cleaner.rb#135
def add_stdlib_silencer; end
# source://activesupport//lib/active_support/backtrace_cleaner.rb#139
def filter_backtrace(backtrace); end
# source://activesupport//lib/active_support/backtrace_cleaner.rb#113
def initialize_copy(_other); end
# source://activesupport//lib/active_support/backtrace_cleaner.rb#155
def noise(backtrace); end
# source://activesupport//lib/active_support/backtrace_cleaner.rb#147
def silence(backtrace); end
end
# source://activesupport//lib/active_support/backtrace_cleaner.rb#111
ActiveSupport::BacktraceCleaner::FORMATTED_GEMS_PATTERN = T.let(T.unsafe(nil), Regexp)
# = \Benchmarkable
#
# source://activesupport//lib/active_support/benchmarkable.rb#8
module ActiveSupport::Benchmarkable
# Allows you to measure the execution time of a block in a template and
# records the result to the log. Wrap this block around expensive operations
# or possible bottlenecks to get a time reading for the operation. For
# example, let's say you thought your file processing method was taking too
# long; you could wrap it in a benchmark block.
#
# <% benchmark 'Process data files' do %>
# <%= expensive_files_operation %>
# <% end %>
#
# That would add something like "Process data files (345.2ms)" to the log,
# which you can then use to compare timings when optimizing your code.
#
# You may give an optional logger level (<tt>:debug</tt>, <tt>:info</tt>,
# <tt>:warn</tt>, <tt>:error</tt>) as the <tt>:level</tt> option. The
# default logger level value is <tt>:info</tt>.
#
# <% benchmark 'Low-level files', level: :debug do %>
# <%= lowlevel_files_operation %>
# <% end %>
#
# Finally, you can pass true as the third argument to silence all log
# activity (other than the timing information) from inside the block. This
# is great for boiling down a noisy block to just a single statement that
# produces one log line:
#
# <% benchmark 'Process data files', level: :info, silence: true do %>
# <%= expensive_and_chatty_files_operation %>
# <% end %>
#
# source://activesupport//lib/active_support/benchmarkable.rb#38
def benchmark(message = T.unsafe(nil), options = T.unsafe(nil), &block); end
end
# source://activesupport//lib/active_support/core_ext/big_decimal/conversions.rb#7
module ActiveSupport::BigDecimalWithDefaultFormat
# source://activesupport//lib/active_support/core_ext/big_decimal/conversions.rb#8
def to_s(format = T.unsafe(nil)); end
end
# = Active Support Broadcast Logger
#
# The Broadcast logger is a logger used to write messages to multiple IO. It is commonly used
# in development to display messages on STDOUT and also write them to a file (development.log).
# With the Broadcast logger, you can broadcast your logs to a unlimited number of sinks.
#
# The BroadcastLogger acts as a standard logger and all methods you are used to are available.
# However, all the methods on this logger will propagate and be delegated to the other loggers
# that are part of the broadcast.
#
# Broadcasting your logs.
#
# stdout_logger = Logger.new(STDOUT)
# file_logger = Logger.new("development.log")
# broadcast = BroadcastLogger.new(stdout_logger, file_logger)
#
# broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file.
#
# Add a logger to the broadcast.
#
# stdout_logger = Logger.new(STDOUT)
# broadcast = BroadcastLogger.new(stdout_logger)
# file_logger = Logger.new("development.log")
# broadcast.broadcast_to(file_logger)
#
# broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file.
#
# Modifying the log level for all broadcasted loggers.
#
# stdout_logger = Logger.new(STDOUT)
# file_logger = Logger.new("development.log")
# broadcast = BroadcastLogger.new(stdout_logger, file_logger)
#
# broadcast.level = Logger::FATAL # Modify the log level for the whole broadcast.
#
# Stop broadcasting log to a sink.
#
# stdout_logger = Logger.new(STDOUT)
# file_logger = Logger.new("development.log")
# broadcast = BroadcastLogger.new(stdout_logger, file_logger)
# broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file.
#
# broadcast.stop_broadcasting_to(file_logger)
# broadcast.info("Hello world!") # Writes the log *only* to STDOUT.
#
# At least one sink has to be part of the broadcast. Otherwise, your logs will not
# be written anywhere. For instance:
#
# broadcast = BroadcastLogger.new
# broadcast.info("Hello world") # The log message will appear nowhere.
#
# If you are adding a custom logger with custom methods to the broadcast,
# the `BroadcastLogger` will proxy them and return the raw value, or an array
# of raw values, depending on how many loggers in the broadcasts responded to
# the method:
#
# class MyLogger < ::Logger
# def loggable?
# true
# end
# end
#
# logger = BroadcastLogger.new
# logger.loggable? # => A NoMethodError exception is raised because no loggers in the broadcasts could respond.
#
# logger.broadcast_to(MyLogger.new(STDOUT))
# logger.loggable? # => true
# logger.broadcast_to(MyLogger.new(STDOUT))
# puts logger.broadcasts # => [MyLogger, MyLogger]
# logger.loggable? # [true, true]
#
# source://activesupport//lib/active_support/broadcast_logger.rb#74
class ActiveSupport::BroadcastLogger
include ::ActiveSupport::LoggerSilence
include ::ActiveSupport::LoggerThreadSafeLevel
# @return [BroadcastLogger] a new instance of BroadcastLogger
#
# source://activesupport//lib/active_support/broadcast_logger.rb#82
def initialize(*loggers); end
# source://activesupport//lib/active_support/broadcast_logger.rb#112
def <<(message); end
# source://activesupport//lib/active_support/broadcast_logger.rb#116
def add(*_arg0, **_arg1, &_arg2); end
# Add logger(s) to the broadcast.
#
# broadcast_logger = ActiveSupport::BroadcastLogger.new
# broadcast_logger.broadcast_to(Logger.new(STDOUT), Logger.new(STDERR))
#
# source://activesupport//lib/active_support/broadcast_logger.rb#93
def broadcast_to(*loggers); end
# Returns all the logger that are part of this broadcast.
#
# source://activesupport//lib/active_support/broadcast_logger.rb#78
def broadcasts; end
# source://activesupport//lib/active_support/broadcast_logger.rb#162
def close; end
# source://activesupport//lib/active_support/broadcast_logger.rb#121
def debug(*_arg0, **_arg1, &_arg2); end
# Sets the log level to Logger::DEBUG for the whole broadcast.
#
# source://activesupport//lib/active_support/broadcast_logger.rb#173
def debug!; end
# +True+ if the log level allows entries with severity Logger::DEBUG to be written
# to at least one broadcast. +False+ otherwise.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/broadcast_logger.rb#168
def debug?; end
# source://activesupport//lib/active_support/broadcast_logger.rb#133
def error(*_arg0, **_arg1, &_arg2); end
# Sets the log level to Logger::ERROR for the whole broadcast.
#
# source://activesupport//lib/active_support/broadcast_logger.rb#206
def error!; end
# +True+ if the log level allows entries with severity Logger::ERROR to be written
# to at least one broadcast. +False+ otherwise.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/broadcast_logger.rb#201
def error?; end
# source://activesupport//lib/active_support/broadcast_logger.rb#137
def fatal(*_arg0, **_arg1, &_arg2); end
# Sets the log level to Logger::FATAL for the whole broadcast.
#
# source://activesupport//lib/active_support/broadcast_logger.rb#217
def fatal!; end
# +True+ if the log level allows entries with severity Logger::FATAL to be written
# to at least one broadcast. +False+ otherwise.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/broadcast_logger.rb#212
def fatal?; end
# Returns the value of attribute formatter.
#
# source://activesupport//lib/active_support/broadcast_logger.rb#79
def formatter; end
# source://activesupport//lib/active_support/broadcast_logger.rb#145
def formatter=(formatter); end
# source://activesupport//lib/active_support/broadcast_logger.rb#125
def info(*_arg0, **_arg1, &_arg2); end
# Sets the log level to Logger::INFO for the whole broadcast.
#
# source://activesupport//lib/active_support/broadcast_logger.rb#184
def info!; end
# +True+ if the log level allows entries with severity Logger::INFO to be written
# to at least one broadcast. +False+ otherwise.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/broadcast_logger.rb#179
def info?; end
# source://activesupport//lib/active_support/broadcast_logger.rb#108
def level; end
# source://activesupport//lib/active_support/broadcast_logger.rb#151
def level=(level); end
# source://activesupport//lib/active_support/broadcast_logger.rb#156
def local_level=(level); end
# source://activesupport//lib/active_support/broadcast_logger.rb#116
def log(*_arg0, **_arg1, &_arg2); end
# Returns the value of attribute progname.
#
# source://activesupport//lib/active_support/broadcast_logger.rb#80
def progname; end
# Sets the attribute progname
#
# @param value the value to set the attribute progname to.
#
# source://activesupport//lib/active_support/broadcast_logger.rb#80
def progname=(_arg0); end
# source://activesupport//lib/active_support/broadcast_logger.rb#151
def sev_threshold=(level); end
# source://activesupport//lib/active_support/logger_silence.rb#12
def silencer; end
# source://activesupport//lib/active_support/logger_silence.rb#12
def silencer=(val); end
# Remove a logger from the broadcast. When a logger is removed, messages sent to
# the broadcast will no longer be written to its sink.
#
# sink = Logger.new(STDOUT)
# broadcast_logger = ActiveSupport::BroadcastLogger.new
#
# broadcast_logger.stop_broadcasting_to(sink)
#
# source://activesupport//lib/active_support/broadcast_logger.rb#104
def stop_broadcasting_to(logger); end
# source://activesupport//lib/active_support/broadcast_logger.rb#141
def unknown(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/broadcast_logger.rb#129
def warn(*_arg0, **_arg1, &_arg2); end
# Sets the log level to Logger::WARN for the whole broadcast.
#
# source://activesupport//lib/active_support/broadcast_logger.rb#195
def warn!; end
# +True+ if the log level allows entries with severity Logger::WARN to be written
# to at least one broadcast. +False+ otherwise.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/broadcast_logger.rb#190
def warn?; end
private
# source://activesupport//lib/active_support/broadcast_logger.rb#230
def dispatch(&block); end
# source://activesupport//lib/active_support/broadcast_logger.rb#221
def initialize_copy(other); end
# source://activesupport//lib/active_support/broadcast_logger.rb#235
def method_missing(name, *_arg1, **_arg2, &_arg3); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/broadcast_logger.rb#247
def respond_to_missing?(method, include_all); end
class << self
# source://activesupport//lib/active_support/logger_silence.rb#12
def silencer; end
# source://activesupport//lib/active_support/logger_silence.rb#12
def silencer=(val); end
end
end
# See ActiveSupport::Cache::Store for documentation.
#
# source://activesupport//lib/active_support/cache/entry.rb#6
module ActiveSupport::Cache
class << self
# Expands out the +key+ argument into a key that can be used for the
# cache store. Optionally accepts a namespace, and all keys will be
# scoped within that namespace.
#
# If the +key+ argument provided is an array, or responds to +to_a+, then
# each of elements in the array will be turned into parameters/keys and
# concatenated into a single key. For example:
#
# ActiveSupport::Cache.expand_cache_key([:foo, :bar]) # => "foo/bar"
# ActiveSupport::Cache.expand_cache_key([:foo, :bar], "namespace") # => "namespace/foo/bar"
#
# The +key+ argument can also respond to +cache_key+ or +to_param+.
#
# source://activesupport//lib/active_support/cache.rb#111
def expand_cache_key(key, namespace = T.unsafe(nil)); end
# Returns the value of attribute format_version.
#
# source://activesupport//lib/active_support/cache.rb#58
def format_version; end
# Sets the attribute format_version
#
# @param value the value to set the attribute format_version to.
#
# source://activesupport//lib/active_support/cache.rb#58
def format_version=(_arg0); end
# Creates a new Store object according to the given options.
#
# If no arguments are passed to this method, then a new
# ActiveSupport::Cache::MemoryStore object will be returned.
#
# If you pass a Symbol as the first argument, then a corresponding cache
# store class under the ActiveSupport::Cache namespace will be created.
# For example:
#
# ActiveSupport::Cache.lookup_store(:memory_store)
# # => returns a new ActiveSupport::Cache::MemoryStore object
#
# ActiveSupport::Cache.lookup_store(:mem_cache_store)
# # => returns a new ActiveSupport::Cache::MemCacheStore object
#
# Any additional arguments will be passed to the corresponding cache store
# class's constructor:
#
# ActiveSupport::Cache.lookup_store(:file_store, '/tmp/cache')
# # => same as: ActiveSupport::Cache::FileStore.new('/tmp/cache')
#
# If the first argument is not a Symbol, then it will simply be returned:
#
# ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new)
# # => returns MyOwnCacheStore.new
#
# source://activesupport//lib/active_support/cache.rb#85
def lookup_store(store = T.unsafe(nil), *parameters); end
private
# source://activesupport//lib/active_support/cache.rb#123
def retrieve_cache_key(key); end
# Obtains the specified cache store class, given the name of the +store+.
# Raises an error when the store class cannot be found.
#
# source://activesupport//lib/active_support/cache.rb#135
def retrieve_store_class(store); end
end
end
# source://activesupport//lib/active_support/cache/coder.rb#7
class ActiveSupport::Cache::Coder
# @return [Coder] a new instance of Coder
#
# source://activesupport//lib/active_support/cache/coder.rb#8
def initialize(serializer, compressor, legacy_serializer: T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/coder.rb#14
def dump(entry); end
# source://activesupport//lib/active_support/cache/coder.rb#20
def dump_compressed(entry, threshold); end
# source://activesupport//lib/active_support/cache/coder.rb#48
def load(dumped); end
private
# source://activesupport//lib/active_support/cache/coder.rb#136
def dump_version(version); end
# source://activesupport//lib/active_support/cache/coder.rb#144
def load_version(dumped_version); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/coder.rb#121
def signature?(dumped); end
# source://activesupport//lib/active_support/cache/coder.rb#129
def try_compress(string, threshold); end
# source://activesupport//lib/active_support/cache/coder.rb#125
def type_for_string(value); end
end
# source://activesupport//lib/active_support/cache/coder.rb#76
ActiveSupport::Cache::Coder::COMPRESSED_FLAG = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/cache/coder.rb#98
class ActiveSupport::Cache::Coder::LazyEntry < ::ActiveSupport::Cache::Entry
# @return [LazyEntry] a new instance of LazyEntry
#
# source://activesupport//lib/active_support/cache/coder.rb#99
def initialize(serializer, compressor, payload, **options); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/coder.rb#114
def mismatched?(version); end
# source://activesupport//lib/active_support/cache/coder.rb#106
def value; end
end
# source://activesupport//lib/active_support/cache/coder.rb#84
ActiveSupport::Cache::Coder::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/cache/coder.rb#68
ActiveSupport::Cache::Coder::OBJECT_DUMP_TYPE = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/cache/coder.rb#80
ActiveSupport::Cache::Coder::PACKED_EXPIRES_AT_TEMPLATE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/cache/coder.rb#78
ActiveSupport::Cache::Coder::PACKED_TEMPLATE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/cache/coder.rb#79
ActiveSupport::Cache::Coder::PACKED_TYPE_TEMPLATE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/cache/coder.rb#82
ActiveSupport::Cache::Coder::PACKED_VERSION_INDEX = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/cache/coder.rb#81
ActiveSupport::Cache::Coder::PACKED_VERSION_LENGTH_TEMPLATE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/cache/coder.rb#66
ActiveSupport::Cache::Coder::SIGNATURE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/cache/coder.rb#96
ActiveSupport::Cache::Coder::STRING_DESERIALIZERS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/cache/coder.rb#70
ActiveSupport::Cache::Coder::STRING_ENCODINGS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/cache/coder.rb#86
class ActiveSupport::Cache::Coder::StringDeserializer
# @return [StringDeserializer] a new instance of StringDeserializer
#
# source://activesupport//lib/active_support/cache/coder.rb#87
def initialize(encoding); end
# source://activesupport//lib/active_support/cache/coder.rb#91
def load(payload); end
end
# source://activesupport//lib/active_support/cache.rb#45
ActiveSupport::Cache::DEFAULT_COMPRESS_LIMIT = T.let(T.unsafe(nil), Integer)
# Raised by coders when the cache entry can't be deserialized.
# This error is treated as a cache miss.
#
# source://activesupport//lib/active_support/cache.rb#49
class ActiveSupport::Cache::DeserializationError < ::StandardError; end
# This class is used to represent cache entries. Cache entries have a value, an optional
# expiration time, and an optional version. The expiration time is used to support the :race_condition_ttl option
# on the cache. The version is used to support the :version option on the cache for rejecting
# mismatches.
#
# Since cache entries in most instances will be serialized, the internals of this class are highly optimized
# using short instance variable names that are lazily defined.
#
# source://activesupport//lib/active_support/cache/entry.rb#14
class ActiveSupport::Cache::Entry
# Creates a new cache entry for the specified value. Options supported are
# +:compressed+, +:version+, +:expires_at+ and +:expires_in+.
#
# @return [Entry] a new instance of Entry
#
# source://activesupport//lib/active_support/cache/entry.rb#25
def initialize(value, compressed: T.unsafe(nil), version: T.unsafe(nil), expires_in: T.unsafe(nil), expires_at: T.unsafe(nil), **_arg5); end
# Returns the size of the cached value. This could be less than
# <tt>value.bytesize</tt> if the data is compressed.
#
# source://activesupport//lib/active_support/cache/entry.rb#61
def bytesize; end
# source://activesupport//lib/active_support/cache/entry.rb#76
def compressed(compress_threshold); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/entry.rb#72
def compressed?; end
# Duplicates the value in a class. This is used by cache implementations that don't natively
# serialize entries to protect against accidental cache modifications.
#
# source://activesupport//lib/active_support/cache/entry.rb#106
def dup_value!; end
# Checks if the entry is expired. The +expires_in+ parameter can override
# the value set when the entry was created.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/entry.rb#43
def expired?; end
# source://activesupport//lib/active_support/cache/entry.rb#47
def expires_at; end
# source://activesupport//lib/active_support/cache/entry.rb#51
def expires_at=(value); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/entry.rb#100
def local?; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/entry.rb#37
def mismatched?(version); end
# source://activesupport//lib/active_support/cache/entry.rb#116
def pack; end
# source://activesupport//lib/active_support/cache/entry.rb#33
def value; end
# Returns the value of attribute version.
#
# source://activesupport//lib/active_support/cache/entry.rb#21
def version; end
private
# source://activesupport//lib/active_support/cache/entry.rb#127
def marshal_load(payload); end
# source://activesupport//lib/active_support/cache/entry.rb#123
def uncompress(value); end
class << self
# source://activesupport//lib/active_support/cache/entry.rb#16
def unpack(members); end
end
end
# = \File \Cache \Store
#
# A cache store implementation which stores everything on the filesystem.
#
# source://activesupport//lib/active_support/cache/file_store.rb#12
class ActiveSupport::Cache::FileStore < ::ActiveSupport::Cache::Store
# @return [FileStore] a new instance of FileStore
#
# source://activesupport//lib/active_support/cache/file_store.rb#20
def initialize(cache_path, **options); end
# Returns the value of attribute cache_path.
#
# source://activesupport//lib/active_support/cache/file_store.rb#13
def cache_path; end
# Preemptively iterates through all stored keys and removes the ones which have expired.
#
# source://activesupport//lib/active_support/cache/file_store.rb#40
def cleanup(options = T.unsafe(nil)); end
# Deletes all items from the cache. In this case it deletes all the entries in the specified
# file store directory except for .keep or .gitkeep. Be careful which directory is specified in your
# config file when using +FileStore+ because everything in that directory will be deleted.
#
# source://activesupport//lib/active_support/cache/file_store.rb#33
def clear(options = T.unsafe(nil)); end
# Decrement a cached integer value. Returns the updated value.
#
# If the key is unset, it will be set to +-amount+.
#
# cache.decrement("foo") # => -1
#
# To set a specific value, call #write:
#
# cache.write("baz", 5)
# cache.decrement("baz") # => 4
#
# source://activesupport//lib/active_support/cache/file_store.rb#75
def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/file_store.rb#79
def delete_matched(matcher, options = T.unsafe(nil)); end
# Increment a cached integer value. Returns the updated value.
#
# If the key is unset, it starts from +0+:
#
# cache.increment("foo") # => 1
# cache.increment("bar", 100) # => 100
#
# To set a specific value, call #write:
#
# cache.write("baz", 5)
# cache.increment("baz") # => 6
#
# source://activesupport//lib/active_support/cache/file_store.rb#60
def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/file_store.rb#91
def inspect; end
private
# Delete empty directories in the cache.
#
# source://activesupport//lib/active_support/cache/file_store.rb#185
def delete_empty_directories(dir); end
# source://activesupport//lib/active_support/cache/file_store.rb#121
def delete_entry(key, **options); end
# Make sure a file path's directories exist.
#
# source://activesupport//lib/active_support/cache/file_store.rb#194
def ensure_cache_path(path); end
# Translate a file path into a key.
#
# source://activesupport//lib/active_support/cache/file_store.rb#179
def file_path_key(path); end
# Lock a file for a block so only one process can modify it at a time.
#
# source://activesupport//lib/active_support/cache/file_store.rb#138
def lock_file(file_name, &block); end
# Modifies the amount of an integer value that is stored in the cache.
# If the key is not found it is created and set to +amount+.
#
# source://activesupport//lib/active_support/cache/file_store.rb#212
def modify_value(name, amount, options); end
# Translate a key into a file path.
#
# source://activesupport//lib/active_support/cache/file_store.rb#152
def normalize_key(key, options); end
# source://activesupport//lib/active_support/cache/file_store.rb#96
def read_entry(key, **options); end
# source://activesupport//lib/active_support/cache/file_store.rb#103
def read_serialized_entry(key, **_arg1); end
# source://activesupport//lib/active_support/cache/file_store.rb#198
def search_dir(dir, &callback); end
# source://activesupport//lib/active_support/cache/file_store.rb#110
def write_entry(key, entry, **options); end
# source://activesupport//lib/active_support/cache/file_store.rb#114
def write_serialized_entry(key, payload, **options); end
class << self
# Advertise cache versioning support.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/file_store.rb#26
def supports_cache_versioning?; end
end
end
# source://activesupport//lib/active_support/cache/file_store.rb#15
ActiveSupport::Cache::FileStore::DIR_FORMATTER = T.let(T.unsafe(nil), String)
# max filename size on file system is 255, minus room for timestamp, pid, and random characters appended by Tempfile (used by atomic write)
#
# source://activesupport//lib/active_support/cache/file_store.rb#16
ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE = T.let(T.unsafe(nil), Integer)
# max is 1024, plus some room
#
# source://activesupport//lib/active_support/cache/file_store.rb#17
ActiveSupport::Cache::FileStore::FILEPATH_MAX_SIZE = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/cache/file_store.rb#18
ActiveSupport::Cache::FileStore::GITKEEP_FILES = T.let(T.unsafe(nil), Array)
# = Memory \Cache \Store
#
# A cache store implementation which stores everything into memory in the
# same process. If you're running multiple Ruby on \Rails server processes
# (which is the case if you're using Phusion Passenger or puma clustered mode),
# then this means that \Rails server process instances won't be able
# to share cache data with each other and this may not be the most
# appropriate cache in that scenario.
#
# This cache has a bounded size specified by the +:size+ options to the
# initializer (default is 32Mb). When the cache exceeds the allotted size,
# a cleanup will occur which tries to prune the cache down to three quarters
# of the maximum size by removing the least recently used entries.
#
# Unlike other Cache store implementations, +MemoryStore+ does not compress
# values by default. +MemoryStore+ does not benefit from compression as much
# as other Store implementations, as it does not send data over a network.
# However, when compression is enabled, it still pays the full cost of
# compression in terms of cpu use.
#
# +MemoryStore+ is thread-safe.
#
# source://activesupport//lib/active_support/cache/memory_store.rb#28
class ActiveSupport::Cache::MemoryStore < ::ActiveSupport::Cache::Store
# @return [MemoryStore] a new instance of MemoryStore
#
# source://activesupport//lib/active_support/cache/memory_store.rb#73
def initialize(options = T.unsafe(nil)); end
# Preemptively iterates through all stored keys and removes the ones which have expired.
#
# source://activesupport//lib/active_support/cache/memory_store.rb#101
def cleanup(options = T.unsafe(nil)); end
# Delete all data stored in a given cache store.
#
# source://activesupport//lib/active_support/cache/memory_store.rb#93
def clear(options = T.unsafe(nil)); end
# Decrement a cached integer value. Returns the updated value.
#
# If the key is unset or has expired, it will be set to +-amount+.
#
# cache.decrement("foo") # => -1
#
# To set a specific value, call #write:
#
# cache.write("baz", 5)
# cache.decrement("baz") # => 4
#
# source://activesupport//lib/active_support/cache/memory_store.rb#164
def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
# Deletes cache entries if the cache key matches a given pattern.
#
# source://activesupport//lib/active_support/cache/memory_store.rb#169
def delete_matched(matcher, options = T.unsafe(nil)); end
# Increment a cached integer value. Returns the updated value.
#
# If the key is unset, it will be set to +amount+:
#
# cache.increment("foo") # => 1
# cache.increment("bar", 100) # => 100
#
# To set a specific value, call #write:
#
# cache.write("baz", 5)
# cache.increment("baz") # => 6
#
# source://activesupport//lib/active_support/cache/memory_store.rb#149
def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/memory_store.rb#181
def inspect; end
# To ensure entries fit within the specified memory prune the cache by removing the least
# recently accessed entries.
#
# source://activesupport//lib/active_support/cache/memory_store.rb#114
def prune(target_size, max_time = T.unsafe(nil)); end
# Returns true if the cache is currently being pruned.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/memory_store.rb#133
def pruning?; end
# Synchronize calls to the cache. This should be called wherever the underlying cache implementation
# is not thread safe.
#
# source://activesupport//lib/active_support/cache/memory_store.rb#187
def synchronize(&block); end
private
# source://activesupport//lib/active_support/cache/memory_store.rb#194
def cached_size(key, payload); end
# source://activesupport//lib/active_support/cache/memory_store.rb#227
def delete_entry(key, **options); end
# Modifies the amount of an integer value that is stored in the cache.
# If the key is not found it is created and set to +amount+.
#
# source://activesupport//lib/active_support/cache/memory_store.rb#237
def modify_value(name, amount, options); end
# source://activesupport//lib/active_support/cache/memory_store.rb#198
def read_entry(key, **options); end
# source://activesupport//lib/active_support/cache/memory_store.rb#210
def write_entry(key, entry, **options); end
class << self
# Advertise cache versioning support.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/memory_store.rb#88
def supports_cache_versioning?; end
end
end
# source://activesupport//lib/active_support/cache/memory_store.rb#29
module ActiveSupport::Cache::MemoryStore::DupCoder
extend ::ActiveSupport::Cache::MemoryStore::DupCoder
# source://activesupport//lib/active_support/cache/memory_store.rb#32
def dump(entry); end
# source://activesupport//lib/active_support/cache/memory_store.rb#40
def dump_compressed(entry, threshold); end
# source://activesupport//lib/active_support/cache/memory_store.rb#45
def load(entry); end
private
# source://activesupport//lib/active_support/cache/memory_store.rb#56
def dump_value(value); end
# source://activesupport//lib/active_support/cache/memory_store.rb#64
def load_value(string); end
end
# source://activesupport//lib/active_support/cache/memory_store.rb#54
ActiveSupport::Cache::MemoryStore::DupCoder::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/cache/memory_store.rb#192
ActiveSupport::Cache::MemoryStore::PER_ENTRY_OVERHEAD = T.let(T.unsafe(nil), Integer)
# = Null \Cache \Store
#
# A cache store implementation which doesn't actually store anything. Useful in
# development and test environments where you don't want caching turned on but
# need to go through the caching interface.
#
# This cache does implement the local cache strategy, so values will actually
# be cached inside blocks that utilize this strategy. See
# ActiveSupport::Cache::Strategy::LocalCache for more details.
#
# source://activesupport//lib/active_support/cache/null_store.rb#14
class ActiveSupport::Cache::NullStore < ::ActiveSupport::Cache::Store
include ::ActiveSupport::Cache::Strategy::LocalCache
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#85
def cleanup(options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#79
def clear(options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#108
def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#91
def delete_matched(matcher, options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#97
def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/null_store.rb#37
def inspect; end
private
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#162
def delete_entry(key, **_arg1); end
# source://activesupport//lib/active_support/cache/null_store.rb#42
def read_entry(key, **s); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#120
def read_serialized_entry(key, raw: T.unsafe(nil), **options); end
# source://activesupport//lib/active_support/cache/null_store.rb#49
def write_entry(key, entry, **_arg2); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#153
def write_serialized_entry(key, payload, **_arg2); end
class << self
# Advertise cache versioning support.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/null_store.rb#18
def supports_cache_versioning?; end
end
end
# Mapping of canonical option names to aliases that a store will recognize.
#
# source://activesupport//lib/active_support/cache.rb#41
ActiveSupport::Cache::OPTION_ALIASES = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#8
module ActiveSupport::Cache::SerializerWithFallback
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#17
def load(dumped); end
private
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#39
def marshal_load(payload); end
class << self
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#9
def [](format); end
end
end
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#66
module ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback
include ::ActiveSupport::Cache::SerializerWithFallback
extend ::ActiveSupport::Cache::SerializerWithFallback
extend ::ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#88
def _load(marked); end
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#73
def dump(entry); end
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#77
def dump_compressed(entry, threshold); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#94
def dumped?(dumped); end
end
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#71
ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback::MARK_COMPRESSED = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#70
ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback::MARK_UNCOMPRESSED = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#99
module ActiveSupport::Cache::SerializerWithFallback::Marshal71WithFallback
include ::ActiveSupport::Cache::SerializerWithFallback
extend ::ActiveSupport::Cache::SerializerWithFallback
extend ::ActiveSupport::Cache::SerializerWithFallback::Marshal71WithFallback
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#109
def _load(dumped); end
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#105
def dump(value); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#113
def dumped?(dumped); end
end
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#103
ActiveSupport::Cache::SerializerWithFallback::Marshal71WithFallback::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#118
module ActiveSupport::Cache::SerializerWithFallback::MessagePackWithFallback
include ::ActiveSupport::Cache::SerializerWithFallback
extend ::ActiveSupport::Cache::SerializerWithFallback
extend ::ActiveSupport::Cache::SerializerWithFallback::MessagePackWithFallback
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#126
def _load(dumped); end
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#122
def dump(value); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#130
def dumped?(dumped); end
private
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#135
def available?; end
end
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#45
module ActiveSupport::Cache::SerializerWithFallback::PassthroughWithFallback
include ::ActiveSupport::Cache::SerializerWithFallback
extend ::ActiveSupport::Cache::SerializerWithFallback
extend ::ActiveSupport::Cache::SerializerWithFallback::PassthroughWithFallback
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#57
def _load(entry); end
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#49
def dump(entry); end
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#53
def dump_compressed(entry, threshold); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#61
def dumped?(dumped); end
end
# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#144
ActiveSupport::Cache::SerializerWithFallback::SERIALIZERS = T.let(T.unsafe(nil), Hash)
# = Active Support \Cache \Store
#
# An abstract cache store class. There are multiple cache store
# implementations, each having its own additional features. See the classes
# under the ActiveSupport::Cache module, e.g.
# ActiveSupport::Cache::MemCacheStore. MemCacheStore is currently the most
# popular cache store for large production websites.
#
# Some implementations may not support all methods beyond the basic cache
# methods of #fetch, #write, #read, #exist?, and #delete.
#
# +ActiveSupport::Cache::Store+ can store any Ruby object that is supported
# by its +coder+'s +dump+ and +load+ methods.
#
# cache = ActiveSupport::Cache::MemoryStore.new
#
# cache.read('city') # => nil
# cache.write('city', "Duckburgh") # => true
# cache.read('city') # => "Duckburgh"
#
# cache.write('not serializable', Proc.new {}) # => TypeError
#
# Keys are always translated into Strings and are case sensitive. When an
# object is specified as a key and has a +cache_key+ method defined, this
# method will be called to define the key. Otherwise, the +to_param+
# method will be called. Hashes and Arrays can also be used as keys. The
# elements will be delimited by slashes, and the elements within a Hash
# will be sorted by key so they are consistent.
#
# cache.read('city') == cache.read(:city) # => true
#
# Nil values can be cached.
#
# If your cache is on a shared infrastructure, you can define a namespace
# for your cache entries. If a namespace is defined, it will be prefixed on
# to every key. The namespace can be either a static value or a Proc. If it
# is a Proc, it will be invoked when each key is evaluated so that you can
# use application logic to invalidate keys.
#
# cache.namespace = -> { @last_mod_time } # Set the namespace to a variable
# @last_mod_time = Time.now # Invalidate the entire cache by changing namespace
#
# source://activesupport//lib/active_support/cache.rb#188
class ActiveSupport::Cache::Store
# Creates a new cache.
#
# ==== Options
#
# [+:namespace+]
# Sets the namespace for the cache. This option is especially useful if
# your application shares a cache with other applications.
#
# [+:serializer+]
# The serializer for cached values. Must respond to +dump+ and +load+.
#
# The default serializer depends on the cache format version (set via
# +config.active_support.cache_format_version+ when using Rails). The
# default serializer for each format version includes a fallback
# mechanism to deserialize values from any format version. This behavior
# makes it easy to migrate between format versions without invalidating
# the entire cache.
#
# You can also specify <tt>serializer: :message_pack</tt> to use a
# preconfigured serializer based on ActiveSupport::MessagePack. The
# +:message_pack+ serializer includes the same deserialization fallback
# mechanism, allowing easy migration from (or to) the default
# serializer. The +:message_pack+ serializer may improve performance,
# but it requires the +msgpack+ gem.
#
# [+:compressor+]
# The compressor for serialized cache values. Must respond to +deflate+
# and +inflate+.
#
# The default compressor is +Zlib+. To define a new custom compressor
# that also decompresses old cache entries, you can check compressed
# values for Zlib's <tt>"\x78"</tt> signature:
#
# module MyCompressor
# def self.deflate(dumped)
# # compression logic... (make sure result does not start with "\x78"!)
# end
#
# def self.inflate(compressed)
# if compressed.start_with?("\x78")
# Zlib.inflate(compressed)
# else
# # decompression logic...
# end
# end
# end
#
# ActiveSupport::Cache.lookup_store(:redis_cache_store, compressor: MyCompressor)
#
# [+:coder+]
# The coder for serializing and (optionally) compressing cache entries.
# Must respond to +dump+ and +load+.
#
# The default coder composes the serializer and compressor, and includes
# some performance optimizations. If you only need to override the
# serializer or compressor, you should specify the +:serializer+ or
# +:compressor+ options instead.
#
# If the store can handle cache entries directly, you may also specify
# <tt>coder: nil</tt> to omit the serializer, compressor, and coder. For
# example, if you are using ActiveSupport::Cache::MemoryStore and can
# guarantee that cache values will not be mutated, you can specify
# <tt>coder: nil</tt> to avoid the overhead of safeguarding against
# mutation.
#
# The +:coder+ option is mutally exclusive with the +:serializer+ and
# +:compressor+ options. Specifying them together will raise an
# +ArgumentError+.
#
# Any other specified options are treated as default options for the
# relevant cache operations, such as #read, #write, and #fetch.
#
# @return [Store] a new instance of Store
#
# source://activesupport//lib/active_support/cache.rb#295
def initialize(options = T.unsafe(nil)); end
# Cleans up the cache by removing expired entries.
#
# Options are passed to the underlying cache implementation.
#
# Some implementations may not support this method.
#
# @raise [NotImplementedError]
#
# source://activesupport//lib/active_support/cache.rb#747
def cleanup(options = T.unsafe(nil)); end
# Clears the entire cache. Be careful with this method since it could
# affect other processes if shared cache is being used.
#
# The options hash is passed to the underlying cache implementation.
#
# Some implementations may not support this method.
#
# @raise [NotImplementedError]
#
# source://activesupport//lib/active_support/cache.rb#757
def clear(options = T.unsafe(nil)); end
# Decrements an integer value in the cache.
#
# Options are passed to the underlying cache implementation.
#
# Some implementations may not support this method.
#
# @raise [NotImplementedError]
#
# source://activesupport//lib/active_support/cache.rb#738
def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
# Deletes an entry in the cache. Returns +true+ if an entry is deleted
# and +false+ otherwise.
#
# Options are passed to the underlying cache implementation.
#
# source://activesupport//lib/active_support/cache.rb#674
def delete(name, options = T.unsafe(nil)); end
# Deletes all entries with keys matching the pattern.
#
# Options are passed to the underlying cache implementation.
#
# Some implementations may not support this method.
#
# @raise [NotImplementedError]
#
# source://activesupport//lib/active_support/cache.rb#720
def delete_matched(matcher, options = T.unsafe(nil)); end
# Deletes multiple entries in the cache. Returns the number of deleted
# entries.
#
# Options are passed to the underlying cache implementation.
#
# source://activesupport//lib/active_support/cache.rb#687
def delete_multi(names, options = T.unsafe(nil)); end
# Returns +true+ if the cache contains an entry for the given key.
#
# Options are passed to the underlying cache implementation.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/cache.rb#701
def exist?(name, options = T.unsafe(nil)); end
# Fetches data from the cache, using the given key. If there is data in
# the cache with the given key, then that data is returned.
#
# If there is no such data in the cache (a cache miss), then +nil+ will be
# returned. However, if a block has been passed, that block will be passed
# the key and executed in the event of a cache miss. The return value of the
# block will be written to the cache under the given cache key, and that
# return value will be returned.
#
# cache.write('today', 'Monday')
# cache.fetch('today') # => "Monday"
#
# cache.fetch('city') # => nil
# cache.fetch('city') do
# 'Duckburgh'
# end
# cache.fetch('city') # => "Duckburgh"
#
# ==== Options
#
# Internally, +fetch+ calls +read_entry+, and calls +write_entry+ on a
# cache miss. Thus, +fetch+ supports the same options as #read and #write.
# Additionally, +fetch+ supports the following options:
#
# * <tt>force: true</tt> - Forces a cache "miss," meaning we treat the
# cache value as missing even if it's present. Passing a block is
# required when +force+ is true so this always results in a cache write.
#
# cache.write('today', 'Monday')
# cache.fetch('today', force: true) { 'Tuesday' } # => 'Tuesday'
# cache.fetch('today', force: true) # => ArgumentError
#
# The +:force+ option is useful when you're calling some other method to
# ask whether you should force a cache write. Otherwise, it's clearer to
# just call +write+.
#
# * <tt>skip_nil: true</tt> - Prevents caching a nil result:
#
# cache.fetch('foo') { nil }
# cache.fetch('bar', skip_nil: true) { nil }
# cache.exist?('foo') # => true
# cache.exist?('bar') # => false
#
# * +:race_condition_ttl+ - Specifies the number of seconds during which
# an expired value can be reused while a new value is being generated.
# This can be used to prevent race conditions when cache entries expire,
# by preventing multiple processes from simultaneously regenerating the
# same entry (also known as the dog pile effect).
#
# When a process encounters a cache entry that has expired less than
# +:race_condition_ttl+ seconds ago, it will bump the expiration time by
# +:race_condition_ttl+ seconds before generating a new value. During
# this extended time window, while the process generates a new value,
# other processes will continue to use the old value. After the first
# process writes the new value, other processes will then use it.
#
# If the first process errors out while generating a new value, another
# process can try to generate a new value after the extended time window
# has elapsed.
#
# # Set all values to expire after one minute.
# cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 1)
#
# cache.write("foo", "original value")
# val_1 = nil
# val_2 = nil
# p cache.read("foo") # => "original value"
#
# sleep 1 # wait until the cache expires
#
# t1 = Thread.new do
# # fetch does the following:
# # 1. gets an recent expired entry
# # 2. extends the expiry by 2 seconds (race_condition_ttl)
# # 3. regenerates the new value
# val_1 = cache.fetch("foo", race_condition_ttl: 2) do
# sleep 1
# "new value 1"
# end
# end
#
# # Wait until t1 extends the expiry of the entry
# # but before generating the new value
# sleep 0.1
#
# val_2 = cache.fetch("foo", race_condition_ttl: 2) do
# # This block won't be executed because t1 extended the expiry
# "new value 2"
# end
#
# t1.join
#
# p val_1 # => "new value 1"
# p val_2 # => "oritinal value"
# p cache.fetch("foo") # => "new value 1"
#
# # The entry requires 3 seconds to expire (expires_in + race_condition_ttl)
# # We have waited 2 seconds already (sleep(1) + t1.join) thus we need to wait 1
# # more second to see the entry expire.
# sleep 1
#
# p cache.fetch("foo") # => nil
#
# ==== Dynamic Options
#
# In some cases it may be necessary to dynamically compute options based
# on the cached value. To support this, an ActiveSupport::Cache::WriteOptions
# instance is passed as the second argument to the block. For example:
#
# cache.fetch("authentication-token:#{user.id}") do |key, options|
# token = authenticate_to_service
# options.expires_at = token.expires_at
# token
# end
#
# source://activesupport//lib/active_support/cache.rb#444
def fetch(name, options = T.unsafe(nil), &block); end
# Fetches data from the cache, using the given keys. If there is data in
# the cache with the given keys, then that data is returned. Otherwise,
# the supplied block is called for each key for which there was no data,
# and the result will be written to the cache and returned.
# Therefore, you need to pass a block that returns the data to be written
# to the cache. If you do not want to write the cache when the cache is
# not found, use #read_multi.
#
# Returns a hash with the data for each of the names. For example:
#
# cache.write("bim", "bam")
# cache.fetch_multi("bim", "unknown_key") do |key|
# "Fallback value for key: #{key}"
# end
# # => { "bim" => "bam",
# # "unknown_key" => "Fallback value for key: unknown_key" }
#
# You may also specify additional options via the +options+ argument. See #fetch for details.
# Other options are passed to the underlying cache implementation. For example:
#
# cache.fetch_multi("fizz", expires_in: 5.seconds) do |key|
# "buzz"
# end
# # => {"fizz"=>"buzz"}
# cache.read("fizz")
# # => "buzz"
# sleep(6)
# cache.read("fizz")
# # => nil
#
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/cache.rb#593
def fetch_multi(*names); end
# Increments an integer value in the cache.
#
# Options are passed to the underlying cache implementation.
#
# Some implementations may not support this method.
#
# @raise [NotImplementedError]
#
# source://activesupport//lib/active_support/cache.rb#729
def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache.rb#189
def logger; end
# source://activesupport//lib/active_support/cache.rb#189
def logger=(val); end
# Silences the logger within a block.
#
# source://activesupport//lib/active_support/cache.rb#322
def mute; end
# source://activesupport//lib/active_support/cache.rb#711
def new_entry(value, options = T.unsafe(nil)); end
# Returns the value of attribute options.
#
# source://activesupport//lib/active_support/cache.rb#192
def options; end
# source://activesupport//lib/active_support/cache.rb#190
def raise_on_invalid_cache_expiration_time; end
# source://activesupport//lib/active_support/cache.rb#190
def raise_on_invalid_cache_expiration_time=(val); end
# Reads data from the cache, using the given key. If there is data in
# the cache with the given key, then that data is returned. Otherwise,
# +nil+ is returned.
#
# Note, if data was written with the <tt>:expires_in</tt> or
# <tt>:version</tt> options, both of these conditions are applied before
# the data is returned.
#
# ==== Options
#
# * +:namespace+ - Replace the store namespace for this call.
# * +:version+ - Specifies a version for the cache entry. If the cached
# version does not match the requested version, the read will be treated
# as a cache miss. This feature is used to support recyclable cache keys.
#
# Other options will be handled by the specific cache store implementation.
#
# source://activesupport//lib/active_support/cache.rb#498
def read(name, options = T.unsafe(nil)); end
# Reads multiple values at once from the cache. Options can be passed
# in the last argument.
#
# Some cache implementation may optimize this method.
#
# Returns a hash mapping the names provided to the values found.
#
# source://activesupport//lib/active_support/cache.rb#536
def read_multi(*names); end
# Returns the value of attribute silence.
#
# source://activesupport//lib/active_support/cache.rb#192
def silence; end
# Silences the logger.
#
# source://activesupport//lib/active_support/cache.rb#316
def silence!; end
# Returns the value of attribute silence.
#
# source://activesupport//lib/active_support/cache.rb#192
def silence?; end
# Writes the value to the cache with the key. The value must be supported
# by the +coder+'s +dump+ and +load+ methods.
#
# Returns +true+ if the write succeeded, +nil+ if there was an error talking
# to the cache backend, or +false+ if the write failed for another reason.
#
# By default, cache entries larger than 1kB are compressed. Compression
# allows more data to be stored in the same memory footprint, leading to
# fewer cache evictions and higher hit rates.
#
# ==== Options
#
# * <tt>compress: false</tt> - Disables compression of the cache entry.
#
# * +:compress_threshold+ - The compression threshold, specified in bytes.
# \Cache entries larger than this threshold will be compressed. Defaults
# to +1.kilobyte+.
#
# * +:expires_in+ - Sets a relative expiration time for the cache entry,
# specified in seconds. +:expire_in+ and +:expired_in+ are aliases for
# +:expires_in+.
#
# cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 5.minutes)
# cache.write(key, value, expires_in: 1.minute) # Set a lower value for one entry
#
# * +:expires_at+ - Sets an absolute expiration time for the cache entry.
#
# cache = ActiveSupport::Cache::MemoryStore.new
# cache.write(key, value, expires_at: Time.now.at_end_of_hour)
#
# * +:version+ - Specifies a version for the cache entry. When reading
# from the cache, if the cached version does not match the requested
# version, the read will be treated as a cache miss. This feature is
# used to support recyclable cache keys.
#
# Other options will be handled by the specific cache store implementation.
#
# source://activesupport//lib/active_support/cache.rb#660
def write(name, value, options = T.unsafe(nil)); end
# Cache Storage API to write multiple values at once.
#
# source://activesupport//lib/active_support/cache.rb#550
def write_multi(hash, options = T.unsafe(nil)); end
private
# source://activesupport//lib/active_support/cache.rb#1005
def _instrument(operation, multi: T.unsafe(nil), options: T.unsafe(nil), **payload, &block); end
# source://activesupport//lib/active_support/cache.rb#762
def default_serializer; end
# Deletes an entry from the cache implementation. Subclasses must
# implement this method.
#
# @raise [NotImplementedError]
#
# source://activesupport//lib/active_support/cache.rb#848
def delete_entry(key, **options); end
# Deletes multiples entries in the cache implementation. Subclasses MAY
# implement this method.
#
# source://activesupport//lib/active_support/cache.rb#854
def delete_multi_entries(entries, **options); end
# source://activesupport//lib/active_support/cache.rb#813
def deserialize_entry(payload, **_arg1); end
# Expands key to be a consistent string value. Invokes +cache_key+ if
# object responds to +cache_key+. Otherwise, +to_param+ method will be
# called. If the key is a Hash, then keys will be sorted alphabetically.
#
# source://activesupport//lib/active_support/cache.rb#968
def expanded_key(key); end
# source://activesupport//lib/active_support/cache.rb#989
def expanded_version(key); end
# source://activesupport//lib/active_support/cache.rb#1043
def get_entry_value(entry, name, options); end
# source://activesupport//lib/active_support/cache.rb#1026
def handle_expired_entry(entry, key, options); end
# source://activesupport//lib/active_support/cache.rb#888
def handle_invalid_expires_in(message); end
# source://activesupport//lib/active_support/cache.rb#997
def instrument(operation, key, options = T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/cache.rb#1001
def instrument_multi(operation, keys, options = T.unsafe(nil), &block); end
# Adds the namespace defined in the options to a pattern designed to
# match keys. Implementations that support delete_matched should call
# this method to translate a pattern that matches names into one that
# matches namespaced keys.
#
# source://activesupport//lib/active_support/cache.rb#777
def key_matcher(pattern, options); end
# Merges the default options with ones specific to a method call.
#
# source://activesupport//lib/active_support/cache.rb#859
def merged_options(call_options); end
# Prefix the key with a namespace string:
#
# namespace_key 'foo', namespace: 'cache'
# # => 'cache:foo'
#
# With a namespace block:
#
# namespace_key 'foo', namespace: -> { 'cache' }
# # => 'cache:foo'
#
# source://activesupport//lib/active_support/cache.rb#946
def namespace_key(key, options = T.unsafe(nil)); end
# Expands and namespaces the cache key.
# Raises an exception when the key is +nil+ or an empty string.
# May be overridden by cache stores to do additional normalization.
#
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/cache.rb#930
def normalize_key(key, options = T.unsafe(nil)); end
# Normalize aliased options to their canonical form
#
# source://activesupport//lib/active_support/cache.rb#899
def normalize_options(options); end
# source://activesupport//lib/active_support/cache.rb#985
def normalize_version(key, options = T.unsafe(nil)); end
# Reads an entry from the cache implementation. Subclasses must implement
# this method.
#
# @raise [NotImplementedError]
#
# source://activesupport//lib/active_support/cache.rb#794
def read_entry(key, **options); end
# Reads multiple entries from the cache implementation. Subclasses MAY
# implement this method.
#
# source://activesupport//lib/active_support/cache.rb#821
def read_multi_entries(names, **options); end
# source://activesupport//lib/active_support/cache.rb#1048
def save_block_result_to_cache(name, key, options); end
# source://activesupport//lib/active_support/cache.rb#804
def serialize_entry(entry, **options); end
# source://activesupport//lib/active_support/cache.rb#910
def validate_options(options); end
# Writes an entry to the cache implementation. Subclasses must implement
# this method.
#
# @raise [NotImplementedError]
#
# source://activesupport//lib/active_support/cache.rb#800
def write_entry(key, entry, **options); end
# Writes multiple entries to the cache implementation. Subclasses MAY
# implement this method.
#
# source://activesupport//lib/active_support/cache.rb#840
def write_multi_entries(hash, **options); end
class << self
# source://activesupport//lib/active_support/cache.rb#189
def logger; end
# source://activesupport//lib/active_support/cache.rb#189
def logger=(val); end
# source://activesupport//lib/active_support/cache.rb#190
def raise_on_invalid_cache_expiration_time; end
# source://activesupport//lib/active_support/cache.rb#190
def raise_on_invalid_cache_expiration_time=(val); end
private
# source://activesupport//lib/active_support/cache.rb#200
def retrieve_pool_options(options); end
end
end
# source://activesupport//lib/active_support/cache.rb#51
module ActiveSupport::Cache::Strategy; end
# = Local \Cache \Strategy
#
# Caches that implement LocalCache will be backed by an in-memory cache for the
# duration of a block. Repeated calls to the cache for the same key will hit the
# in-memory cache for faster access.
#
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#13
module ActiveSupport::Cache::Strategy::LocalCache
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#85
def cleanup(options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#79
def clear(options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#108
def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#91
def delete_matched(matcher, options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#97
def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
# Middleware class can be inserted as a Rack handler to be local cache for the
# duration of request.
#
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#73
def middleware; end
# Use a local cache for the duration of block.
#
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#67
def with_local_cache(&block); end
private
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#185
def bypass_local_cache(&block); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#162
def delete_entry(key, **_arg1); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#181
def local_cache; end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#177
def local_cache_key; end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#134
def read_multi_entries(names, **options); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#120
def read_serialized_entry(key, raw: T.unsafe(nil), **options); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#189
def use_temporary_local_cache(temporary_cache); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#167
def write_cache_value(name, value, **options); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#153
def write_serialized_entry(key, payload, **_arg2); end
end
# Class for storing and registering the local caches.
#
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#17
module ActiveSupport::Cache::Strategy::LocalCache::LocalCacheRegistry
extend ::ActiveSupport::Cache::Strategy::LocalCache::LocalCacheRegistry
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#20
def cache_for(local_cache_key); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#25
def set_cache_for(local_cache_key, value); end
end
# = Local \Cache \Store
#
# Simple memory backed cache. This cache is not thread safe and is intended only
# for serving as a temporary memory cache for a single thread.
#
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#35
class ActiveSupport::Cache::Strategy::LocalCache::LocalStore
# @return [LocalStore] a new instance of LocalStore
#
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#36
def initialize; end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#40
def clear(options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#57
def delete_entry(key); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#61
def fetch_entry(key); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#44
def read_entry(key); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#48
def read_multi_entries(keys); end
# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#52
def write_entry(key, entry); end
end
# --
# This class wraps up local storage for middlewares. Only the middleware method should
# construct them.
#
# source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#13
class ActiveSupport::Cache::Strategy::LocalCache::Middleware
# @return [Middleware] a new instance of Middleware
#
# source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#16
def initialize(name, local_cache_key); end
# source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#27
def call(env); end
# source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#14
def local_cache_key; end
# source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#14
def name; end
# source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#22
def new(app); end
end
# These options mean something to all cache implementations. Individual cache
# implementations may support additional options.
#
# source://activesupport//lib/active_support/cache.rb#26
ActiveSupport::Cache::UNIVERSAL_OPTIONS = T.let(T.unsafe(nil), Array)
# Enables the dynamic configuration of Cache entry options while ensuring
# that conflicting options are not both set. When a block is given to
# ActiveSupport::Cache::Store#fetch, the second argument will be an
# instance of +WriteOptions+.
#
# source://activesupport//lib/active_support/cache.rb#1064
class ActiveSupport::Cache::WriteOptions
# @return [WriteOptions] a new instance of WriteOptions
#
# source://activesupport//lib/active_support/cache.rb#1065
def initialize(options); end
# source://activesupport//lib/active_support/cache.rb#1089
def expires_at; end
# Sets the Cache entry's +expires_at+ value. If an +expires_in+ option was
# previously set, this will unset it since +expires_at+ and +expires_in+
# cannot both be set.
#
# source://activesupport//lib/active_support/cache.rb#1096
def expires_at=(expires_at); end
# source://activesupport//lib/active_support/cache.rb#1077
def expires_in; end
# Sets the Cache entry's +expires_in+ value. If an +expires_at+ option was
# previously set, this will unset it since +expires_in+ and +expires_at+
# cannot both be set.
#
# source://activesupport//lib/active_support/cache.rb#1084
def expires_in=(expires_in); end
# source://activesupport//lib/active_support/cache.rb#1069
def version; end
# source://activesupport//lib/active_support/cache.rb#1073
def version=(version); end
end
# = Caching Key Generator
#
# CachingKeyGenerator is a wrapper around KeyGenerator which allows users to avoid
# re-executing the key generation process when it's called using the same +salt+ and
# +key_size+.
#
# source://activesupport//lib/active_support/key_generator.rb#55
class ActiveSupport::CachingKeyGenerator
# @return [CachingKeyGenerator] a new instance of CachingKeyGenerator
#
# source://activesupport//lib/active_support/key_generator.rb#56
def initialize(key_generator); end
# Returns a derived key suitable for use.
#
# source://activesupport//lib/active_support/key_generator.rb#62
def generate_key(*args); end
end
# = Active Support \Callbacks
#
# \Callbacks are code hooks that are run at key points in an object's life cycle.
# The typical use case is to have a base class define a set of callbacks
# relevant to the other functionality it supplies, so that subclasses can
# install callbacks that enhance or modify the base functionality without
# needing to override or redefine methods of the base class.
#
# Mixing in this module allows you to define the events in the object's
# life cycle that will support callbacks (via ClassMethods#define_callbacks),
# set the instance methods, procs, or callback objects to be called (via
# ClassMethods#set_callback), and run the installed callbacks at the
# appropriate times (via +run_callbacks+).
#
# By default callbacks are halted by throwing +:abort+.
# See ClassMethods#define_callbacks for details.
#
# Three kinds of callbacks are supported: before callbacks, run before a
# certain event; after callbacks, run after the event; and around callbacks,
# blocks that surround the event, triggering it when they yield. Callback code
# can be contained in instance methods, procs or lambdas, or callback objects
# that respond to certain predetermined methods. See ClassMethods#set_callback
# for details.
#
# class Record
# include ActiveSupport::Callbacks
# define_callbacks :save
#
# def save
# run_callbacks :save do
# puts "- save"
# end
# end
# end
#
# class PersonRecord < Record
# set_callback :save, :before, :saving_message
# def saving_message
# puts "saving..."
# end
#
# set_callback :save, :after do |object|
# puts "saved"
# end
# end
#
# person = PersonRecord.new
# person.save
#
# Output:
# saving...
# - save
# saved
#
# source://activesupport//lib/active_support/callbacks.rb#65
module ActiveSupport::Callbacks
extend ::ActiveSupport::Concern
include GeneratedInstanceMethods
mixes_in_class_methods GeneratedClassMethods
mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods
mixes_in_class_methods ::ActiveSupport::DescendantsTracker
# Runs the callbacks for the given event.
#
# Calls the before and around callbacks in the order they were set, yields
# the block (if given one), and then runs the after callbacks in reverse
# order.
#
# If the callback chain was halted, returns +false+. Otherwise returns the
# result of the block, +nil+ if no callbacks have been set, or +true+
# if callbacks have been set but no block is given.
#
# run_callbacks :save do
# save
# end
#
# --
#
# As this method is used in many places, and often wraps large portions of
# user code, it has an additional design goal of minimizing its impact on
# the visible call stack. An exception from inside a :before or :after
# callback can be as noisy as it likes -- but when control has passed
# smoothly through and into the supplied block, we want as little evidence
# as possible that we were here.
#
# source://activesupport//lib/active_support/callbacks.rb#97
def run_callbacks(kind, type = T.unsafe(nil)); end
private
# A hook invoked every time a before callback is halted.
# This can be overridden in ActiveSupport::Callbacks implementors in order
# to provide better debugging/logging.
#
# source://activesupport//lib/active_support/callbacks.rb#150
def halted_callback_hook(filter, name); end
module GeneratedClassMethods
def __callbacks; end
def __callbacks=(value); end
def __callbacks?; end
end
module GeneratedInstanceMethods
def __callbacks; end
def __callbacks?; end
end
end
# source://activesupport//lib/active_support/callbacks.rb#73
ActiveSupport::Callbacks::CALLBACK_FILTER_TYPES = T.let(T.unsafe(nil), Array)
# A future invocation of user-supplied code (either as a callback,
# or a condition filter).
#
# source://activesupport//lib/active_support/callbacks.rb#337
module ActiveSupport::Callbacks::CallTemplate
class << self
# Filters support:
#
# Symbols:: A method to call.
# Procs:: A proc to call with the object.
# Objects:: An object with a <tt>before_foo</tt> method on it to call.
#
# All of these objects are converted into a CallTemplate and handled
# the same after this point.
#
# source://activesupport//lib/active_support/callbacks.rb#495
def build(filter, callback); end
end
end
# source://activesupport//lib/active_support/callbacks.rb#396
class ActiveSupport::Callbacks::CallTemplate::InstanceExec0
# @return [InstanceExec0] a new instance of InstanceExec0
#
# source://activesupport//lib/active_support/callbacks.rb#397
def initialize(block); end
# source://activesupport//lib/active_support/callbacks.rb#401
def expand(target, value, block); end
# source://activesupport//lib/active_support/callbacks.rb#411
def inverted_lambda; end
# source://activesupport//lib/active_support/callbacks.rb#405
def make_lambda; end
end
# source://activesupport//lib/active_support/callbacks.rb#418
class ActiveSupport::Callbacks::CallTemplate::InstanceExec1
# @return [InstanceExec1] a new instance of InstanceExec1
#
# source://activesupport//lib/active_support/callbacks.rb#419
def initialize(block); end
# source://activesupport//lib/active_support/callbacks.rb#423
def expand(target, value, block); end
# source://activesupport//lib/active_support/callbacks.rb#433
def inverted_lambda; end
# source://activesupport//lib/active_support/callbacks.rb#427
def make_lambda; end
end
# source://activesupport//lib/active_support/callbacks.rb#440
class ActiveSupport::Callbacks::CallTemplate::InstanceExec2
# @return [InstanceExec2] a new instance of InstanceExec2
#
# source://activesupport//lib/active_support/callbacks.rb#441
def initialize(block); end
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/callbacks.rb#445
def expand(target, value, block); end
# source://activesupport//lib/active_support/callbacks.rb#457
def inverted_lambda; end
# source://activesupport//lib/active_support/callbacks.rb#450
def make_lambda; end
end
# source://activesupport//lib/active_support/callbacks.rb#338
class ActiveSupport::Callbacks::CallTemplate::MethodCall
# @return [MethodCall] a new instance of MethodCall
#
# source://activesupport//lib/active_support/callbacks.rb#339
def initialize(method); end
# Return the parts needed to make this call, with the given
# input values.
#
# Returns an array of the form:
#
# [target, block, method, *arguments]
#
# This array can be used as such:
#
# target.send(method, *arguments, &block)
#
# The actual invocation is left up to the caller to minimize
# call stack pollution.
#
# source://activesupport//lib/active_support/callbacks.rb#356
def expand(target, value, block); end
# source://activesupport//lib/active_support/callbacks.rb#366
def inverted_lambda; end
# source://activesupport//lib/active_support/callbacks.rb#360
def make_lambda; end
end
# source://activesupport//lib/active_support/callbacks.rb#373
class ActiveSupport::Callbacks::CallTemplate::ObjectCall
# @return [ObjectCall] a new instance of ObjectCall
#
# source://activesupport//lib/active_support/callbacks.rb#374
def initialize(target, method); end
# source://activesupport//lib/active_support/callbacks.rb#379
def expand(target, value, block); end
# source://activesupport//lib/active_support/callbacks.rb#389
def inverted_lambda; end
# source://activesupport//lib/active_support/callbacks.rb#383
def make_lambda; end
end
# source://activesupport//lib/active_support/callbacks.rb#465
class ActiveSupport::Callbacks::CallTemplate::ProcCall
# @return [ProcCall] a new instance of ProcCall
#
# source://activesupport//lib/active_support/callbacks.rb#466
def initialize(target); end
# source://activesupport//lib/active_support/callbacks.rb#470
def expand(target, value, block); end
# source://activesupport//lib/active_support/callbacks.rb#480
def inverted_lambda; end
# source://activesupport//lib/active_support/callbacks.rb#474
def make_lambda; end
end
# source://activesupport//lib/active_support/callbacks.rb#231
class ActiveSupport::Callbacks::Callback
# @return [Callback] a new instance of Callback
#
# source://activesupport//lib/active_support/callbacks.rb#246
def initialize(name, filter, kind, options, chain_config); end
# Wraps code with filter
#
# source://activesupport//lib/active_support/callbacks.rb#300
def apply(callback_sequence); end
# Returns the value of attribute chain_config.
#
# source://activesupport//lib/active_support/callbacks.rb#244
def chain_config; end
# source://activesupport//lib/active_support/callbacks.rb#282
def compiled; end
# source://activesupport//lib/active_support/callbacks.rb#304
def current_scopes; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/callbacks.rb#273
def duplicates?(other); end
# Returns the value of attribute filter.
#
# source://activesupport//lib/active_support/callbacks.rb#244
def filter; end
# Returns the value of attribute kind.
#
# source://activesupport//lib/active_support/callbacks.rb#243
def kind; end
# Sets the attribute kind
#
# @param value the value to set the attribute kind to.
#
# source://activesupport//lib/active_support/callbacks.rb#243
def kind=(_arg0); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/callbacks.rb#269
def matches?(_kind, _filter); end
# source://activesupport//lib/active_support/callbacks.rb#257
def merge_conditional_options(chain, if_option:, unless_option:); end
# Returns the value of attribute name.
#
# source://activesupport//lib/active_support/callbacks.rb#243
def name; end
# Sets the attribute name
#
# @param value the value to set the attribute name to.
#
# source://activesupport//lib/active_support/callbacks.rb#243
def name=(_arg0); end
private
# source://activesupport//lib/active_support/callbacks.rb#312
def check_conditionals(conditionals); end
# source://activesupport//lib/active_support/callbacks.rb#327
def conditions_lambdas; end
class << self
# source://activesupport//lib/active_support/callbacks.rb#232
def build(chain, filter, kind, options); end
end
end
# source://activesupport//lib/active_support/callbacks.rb#309
ActiveSupport::Callbacks::Callback::EMPTY_ARRAY = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/callbacks.rb#567
class ActiveSupport::Callbacks::CallbackChain
include ::Enumerable
# @return [CallbackChain] a new instance of CallbackChain
#
# source://activesupport//lib/active_support/callbacks.rb#572
def initialize(name, config); end
# source://activesupport//lib/active_support/callbacks.rb#632
def append(*callbacks); end
# source://activesupport//lib/active_support/callbacks.rb#600
def clear; end
# source://activesupport//lib/active_support/callbacks.rb#614
def compile(type); end
# Returns the value of attribute config.
#
# source://activesupport//lib/active_support/callbacks.rb#570
def config; end
# source://activesupport//lib/active_support/callbacks.rb#594
def delete(o); end
# source://activesupport//lib/active_support/callbacks.rb#584
def each(&block); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/callbacks.rb#586
def empty?; end
# source://activesupport//lib/active_support/callbacks.rb#585
def index(o); end
# source://activesupport//lib/active_support/callbacks.rb#588
def insert(index, o); end
# Returns the value of attribute name.
#
# source://activesupport//lib/active_support/callbacks.rb#570
def name; end
# source://activesupport//lib/active_support/callbacks.rb#636
def prepend(*callbacks); end
protected
# Returns the value of attribute chain.
#
# source://activesupport//lib/active_support/callbacks.rb#641
def chain; end
private
# source://activesupport//lib/active_support/callbacks.rb#644
def append_one(callback); end
# source://activesupport//lib/active_support/callbacks.rb#664
def default_terminator; end
# source://activesupport//lib/active_support/callbacks.rb#607
def initialize_copy(other); end
# source://activesupport//lib/active_support/callbacks.rb#651
def prepend_one(callback); end
# source://activesupport//lib/active_support/callbacks.rb#658
def remove_duplicates(callback); end
end
# Execute before and after filters in a sequence instead of
# chaining them with nested lambda calls, see:
# https://github.com/rails/rails/issues/18011
#
# source://activesupport//lib/active_support/callbacks.rb#518
class ActiveSupport::Callbacks::CallbackSequence
# @return [CallbackSequence] a new instance of CallbackSequence
#
# source://activesupport//lib/active_support/callbacks.rb#519
def initialize(nested = T.unsafe(nil), call_template = T.unsafe(nil), user_conditions = T.unsafe(nil)); end
# source://activesupport//lib/active_support/callbacks.rb#534
def after(after); end
# source://activesupport//lib/active_support/callbacks.rb#540
def around(call_template, user_conditions); end
# source://activesupport//lib/active_support/callbacks.rb#528
def before(before); end
# source://activesupport//lib/active_support/callbacks.rb#554
def expand_call_template(arg, block); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/callbacks.rb#550
def final?; end
# source://activesupport//lib/active_support/callbacks.rb#562
def invoke_after(arg); end
# source://activesupport//lib/active_support/callbacks.rb#558
def invoke_before(arg); end
# Returns the value of attribute nested.
#
# source://activesupport//lib/active_support/callbacks.rb#548
def nested; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/callbacks.rb#544
def skip?(arg); end
end
# source://activesupport//lib/active_support/callbacks.rb#676
module ActiveSupport::Callbacks::ClassMethods
# This is used internally to append, prepend and skip callbacks to the
# CallbackChain.
#
# source://activesupport//lib/active_support/callbacks.rb#686
def __update_callbacks(name); end
# Define sets of events in the object life cycle that support callbacks.
#
# define_callbacks :validate
# define_callbacks :initialize, :save, :destroy
#
# ===== Options
#
# * <tt>:terminator</tt> - Determines when a before filter will halt the
# callback chain, preventing following before and around callbacks from
# being called and the event from being triggered.
# This should be a lambda to be executed.
# The current object and the result lambda of the callback will be provided
# to the terminator lambda.
#
# define_callbacks :validate, terminator: ->(target, result_lambda) { result_lambda.call == false }
#
# In this example, if any before validate callbacks returns +false+,
# any successive before and around callback is not executed.
#
# The default terminator halts the chain when a callback throws +:abort+.
#
# * <tt>:skip_after_callbacks_if_terminated</tt> - Determines if after
# callbacks should be terminated by the <tt>:terminator</tt> option. By
# default after callbacks are executed no matter if callback chain was
# terminated or not. This option has no effect if <tt>:terminator</tt>
# option is set to +nil+.
#
# * <tt>:scope</tt> - Indicates which methods should be executed when an
# object is used as a callback.
#
# class Audit
# def before(caller)
# puts 'Audit: before is called'
# end
#
# def before_save(caller)
# puts 'Audit: before_save is called'
# end
# end
#
# class Account
# include ActiveSupport::Callbacks
#
# define_callbacks :save
# set_callback :save, :before, Audit.new
#
# def save
# run_callbacks :save do
# puts 'save in main'
# end
# end
# end
#
# In the above case whenever you save an account the method
# <tt>Audit#before</tt> will be called. On the other hand
#
# define_callbacks :save, scope: [:kind, :name]
#
# would trigger <tt>Audit#before_save</tt> instead. That's constructed
# by calling <tt>#{kind}_#{name}</tt> on the given instance. In this
# case "kind" is "before" and "name" is "save". In this context +:kind+
# and +:name+ have special meanings: +:kind+ refers to the kind of
# callback (before/after/around) and +:name+ refers to the method on
# which callbacks are being defined.
#
# A declaration like
#
# define_callbacks :save, scope: [:name]
#
# would call <tt>Audit#save</tt>.
#
# ===== Notes
#
# +names+ passed to +define_callbacks+ must not end with
# <tt>!</tt>, <tt>?</tt> or <tt>=</tt>.
#
# Calling +define_callbacks+ multiple times with the same +names+ will
# overwrite previous callbacks registered with #set_callback.
#
# source://activesupport//lib/active_support/callbacks.rb#901
def define_callbacks(*names); end
# source://activesupport//lib/active_support/callbacks.rb#677
def normalize_callback_params(filters, block); end
# Remove all set callbacks for the given event.
#
# source://activesupport//lib/active_support/callbacks.rb#811
def reset_callbacks(name); end
# Install a callback for the given event.
#
# set_callback :save, :before, :before_method
# set_callback :save, :after, :after_method, if: :condition
# set_callback :save, :around, ->(r, block) { stuff; result = block.call; stuff }
#
# The second argument indicates whether the callback is to be run +:before+,
# +:after+, or +:around+ the event. If omitted, +:before+ is assumed. This
# means the first example above can also be written as:
#
# set_callback :save, :before_method
#
# The callback can be specified as a symbol naming an instance method; as a
# proc, lambda, or block; or as an object that responds to a certain method
# determined by the <tt>:scope</tt> argument to #define_callbacks.
#
# If a proc, lambda, or block is given, its body is evaluated in the context
# of the current object. It can also optionally accept the current object as
# an argument.
#
# Before and around callbacks are called in the order that they are set;
# after callbacks are called in the reverse order.
#
# Around callbacks can access the return value from the event, if it
# wasn't halted, from the +yield+ call.
#
# ===== Options
#
# * <tt>:if</tt> - A symbol or an array of symbols, each naming an instance
# method or a proc; the callback will be called only when they all return
# a true value.
#
# If a proc is given, its body is evaluated in the context of the
# current object. It can also optionally accept the current object as
# an argument.
# * <tt>:unless</tt> - A symbol or an array of symbols, each naming an
# instance method or a proc; the callback will be called only when they
# all return a false value.
#
# If a proc is given, its body is evaluated in the context of the
# current object. It can also optionally accept the current object as
# an argument.
# * <tt>:prepend</tt> - If +true+, the callback will be prepended to the
# existing chain rather than appended.
#
# source://activesupport//lib/active_support/callbacks.rb#737
def set_callback(name, *filter_list, &block); end
# Skip a previously set callback. Like #set_callback, <tt>:if</tt> or
# <tt>:unless</tt> options may be passed in order to control when the
# callback is skipped.
#
# Note: this example uses +PersonRecord+ and +#saving_message+, which you
# can see defined here[rdoc-ref:ActiveSupport::Callbacks]
#
# class Writer < PersonRecord
# attr_accessor :age
# skip_callback :save, :before, :saving_message, if: -> { age > 18 }
# end
#
# When if option returns true, callback is skipped.
#
# writer = Writer.new
# writer.age = 20
# writer.save
#
# Output:
# - save
# saved
#
# When if option returns false, callback is NOT skipped.
#
# young_writer = Writer.new
# young_writer.age = 17
# young_writer.save
#
# Output:
# saving...
# - save
# saved
#
# An <tt>ArgumentError</tt> will be raised if the callback has not
# already been set (unless the <tt>:raise</tt> option is set to <tt>false</tt>).
#
# source://activesupport//lib/active_support/callbacks.rb#786
def skip_callback(name, *filter_list, &block); end
protected
# source://activesupport//lib/active_support/callbacks.rb#932
def get_callbacks(name); end
# source://activesupport//lib/active_support/callbacks.rb#936
def set_callbacks(name, callbacks); end
end
# source://activesupport//lib/active_support/callbacks.rb#153
module ActiveSupport::Callbacks::Conditionals; end
# source://activesupport//lib/active_support/callbacks.rb#154
class ActiveSupport::Callbacks::Conditionals::Value
# @return [Value] a new instance of Value
#
# source://activesupport//lib/active_support/callbacks.rb#155
def initialize(&block); end
# source://activesupport//lib/active_support/callbacks.rb#158
def call(target, value); end
end
# source://activesupport//lib/active_support/callbacks.rb#162
module ActiveSupport::Callbacks::Filters; end
# source://activesupport//lib/active_support/callbacks.rb#194
class ActiveSupport::Callbacks::Filters::After
# @return [After] a new instance of After
#
# source://activesupport//lib/active_support/callbacks.rb#196
def initialize(user_callback, user_conditions, chain_config); end
# source://activesupport//lib/active_support/callbacks.rb#214
def apply(callback_sequence); end
# source://activesupport//lib/active_support/callbacks.rb#202
def call(env); end
# Returns the value of attribute halting.
#
# source://activesupport//lib/active_support/callbacks.rb#195
def halting; end
# Returns the value of attribute user_callback.
#
# source://activesupport//lib/active_support/callbacks.rb#195
def user_callback; end
# Returns the value of attribute user_conditions.
#
# source://activesupport//lib/active_support/callbacks.rb#195
def user_conditions; end
end
# source://activesupport//lib/active_support/callbacks.rb#219
class ActiveSupport::Callbacks::Filters::Around
# @return [Around] a new instance of Around
#
# source://activesupport//lib/active_support/callbacks.rb#220
def initialize(user_callback, user_conditions); end
# source://activesupport//lib/active_support/callbacks.rb#225
def apply(callback_sequence); end
end
# source://activesupport//lib/active_support/callbacks.rb#165
class ActiveSupport::Callbacks::Filters::Before
# @return [Before] a new instance of Before
#
# source://activesupport//lib/active_support/callbacks.rb#166
def initialize(user_callback, user_conditions, chain_config, filter, name); end
# source://activesupport//lib/active_support/callbacks.rb#189
def apply(callback_sequence); end
# source://activesupport//lib/active_support/callbacks.rb#173
def call(env); end
# Returns the value of attribute filter.
#
# source://activesupport//lib/active_support/callbacks.rb#171
def filter; end
# Returns the value of attribute halted_lambda.
#
# source://activesupport//lib/active_support/callbacks.rb#171
def halted_lambda; end
# Returns the value of attribute name.
#
# source://activesupport//lib/active_support/callbacks.rb#171
def name; end
# Returns the value of attribute user_callback.
#
# source://activesupport//lib/active_support/callbacks.rb#171
def user_callback; end
# Returns the value of attribute user_conditions.
#
# source://activesupport//lib/active_support/callbacks.rb#171
def user_conditions; end
end
# source://activesupport//lib/active_support/callbacks.rb#163
class ActiveSupport::Callbacks::Filters::Environment < ::Struct
# Returns the value of attribute halted
#
# @return [Object] the current value of halted
def halted; end
# Sets the attribute halted
#
# @param value [Object] the value to set the attribute halted to.
# @return [Object] the newly set value
def halted=(_); end
# Returns the value of attribute target
#
# @return [Object] the current value of target
def target; end
# Sets the attribute target
#
# @param value [Object] the value to set the attribute target to.
# @return [Object] the newly set value
def target=(_); end
# Returns the value of attribute value
#
# @return [Object] the current value of value
def value; end
# Sets the attribute value
#
# @param value [Object] the value to set the attribute value to.
# @return [Object] the newly set value
def value=(_); end
class << self
def [](*_arg0); end
def inspect; end
def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
# source://activesupport//lib/active_support/code_generator.rb#4
class ActiveSupport::CodeGenerator
# @return [CodeGenerator] a new instance of CodeGenerator
#
# source://activesupport//lib/active_support/code_generator.rb#53
def initialize(owner, path, line); end
# source://activesupport//lib/active_support/code_generator.rb#60
def define_cached_method(canonical_name, namespace:, as: T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/code_generator.rb#64
def execute; end
class << self
# source://activesupport//lib/active_support/code_generator.rb#41
def batch(owner, path, line); end
end
end
# source://activesupport//lib/active_support/code_generator.rb#5
class ActiveSupport::CodeGenerator::MethodSet
# @return [MethodSet] a new instance of MethodSet
#
# source://activesupport//lib/active_support/code_generator.rb#8
def initialize(namespace); end
# source://activesupport//lib/active_support/code_generator.rb#28
def apply(owner, path, line); end
# source://activesupport//lib/active_support/code_generator.rb#15
def define_cached_method(canonical_name, as: T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/code_generator.rb#6
ActiveSupport::CodeGenerator::MethodSet::METHOD_CACHES = T.let(T.unsafe(nil), Hash)
# = Active Support \Concern
#
# A typical module looks like this:
#
# module M
# def self.included(base)
# base.extend ClassMethods
# base.class_eval do
# scope :disabled, -> { where(disabled: true) }
# end
# end
#
# module ClassMethods
# ...
# end
# end
#
# By using +ActiveSupport::Concern+ the above module could instead be
# written as:
#
# require "active_support/concern"
#
# module M
# extend ActiveSupport::Concern
#
# included do
# scope :disabled, -> { where(disabled: true) }
# end
#
# class_methods do
# ...
# end
# end
#
# Moreover, it gracefully handles module dependencies. Given a +Foo+ module
# and a +Bar+ module which depends on the former, we would typically write the
# following:
#
# module Foo
# def self.included(base)
# base.class_eval do
# def self.method_injected_by_foo
# ...
# end
# end
# end
# end
#
# module Bar
# def self.included(base)
# base.method_injected_by_foo
# end
# end
#
# class Host
# include Foo # We need to include this dependency for Bar
# include Bar # Bar is the module that Host really needs
# end
#
# But why should +Host+ care about +Bar+'s dependencies, namely +Foo+? We
# could try to hide these from +Host+ directly including +Foo+ in +Bar+:
#
# module Bar
# include Foo
# def self.included(base)
# base.method_injected_by_foo
# end
# end
#
# class Host
# include Bar
# end
#
# Unfortunately this won't work, since when +Foo+ is included, its <tt>base</tt>
# is the +Bar+ module, not the +Host+ class. With +ActiveSupport::Concern+,
# module dependencies are properly resolved:
#
# require "active_support/concern"
#
# module Foo
# extend ActiveSupport::Concern
# included do
# def self.method_injected_by_foo
# ...
# end
# end
# end
#
# module Bar
# extend ActiveSupport::Concern
# include Foo
#
# included do
# self.method_injected_by_foo
# end
# end
#
# class Host
# include Bar # It works, now Bar takes care of its dependencies
# end
#
# === Prepending concerns
#
# Just like <tt>include</tt>, concerns also support <tt>prepend</tt> with a corresponding
# <tt>prepended do</tt> callback. <tt>module ClassMethods</tt> or <tt>class_methods do</tt> are
# prepended as well.
#
# <tt>prepend</tt> is also used for any dependencies.
#
# source://activesupport//lib/active_support/concern.rb#112
module ActiveSupport::Concern
# source://activesupport//lib/active_support/concern.rb#129
def append_features(base); end
# Define class methods from given block.
# You can define private class methods as well.
#
# module Example
# extend ActiveSupport::Concern
#
# class_methods do
# def foo; puts 'foo'; end
#
# private
# def bar; puts 'bar'; end
# end
# end
#
# class Buzz
# include Example
# end
#
# Buzz.foo # => "foo"
# Buzz.bar # => private method 'bar' called for Buzz:Class(NoMethodError)
#
# source://activesupport//lib/active_support/concern.rb#209
def class_methods(&class_methods_module_definition); end
# Evaluate given block in context of base class,
# so that you can write class macros here.
# When you define more than one +included+ block, it raises an exception.
#
# source://activesupport//lib/active_support/concern.rb#158
def included(base = T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/concern.rb#142
def prepend_features(base); end
# Evaluate given block in context of base class,
# so that you can write class macros here.
# When you define more than one +prepended+ block, it raises an exception.
#
# source://activesupport//lib/active_support/concern.rb#175
def prepended(base = T.unsafe(nil), &block); end
class << self
# source://activesupport//lib/active_support/concern.rb#125
def extended(base); end
end
end
# source://activesupport//lib/active_support/concern.rb#113
class ActiveSupport::Concern::MultipleIncludedBlocks < ::StandardError
# @return [MultipleIncludedBlocks] a new instance of MultipleIncludedBlocks
#
# source://activesupport//lib/active_support/concern.rb#114
def initialize; end
end
# source://activesupport//lib/active_support/concern.rb#119
class ActiveSupport::Concern::MultiplePrependBlocks < ::StandardError
# @return [MultiplePrependBlocks] a new instance of MultiplePrependBlocks
#
# source://activesupport//lib/active_support/concern.rb#120
def initialize; end
end
# source://activesupport//lib/active_support/concurrency/share_lock.rb#7
module ActiveSupport::Concurrency; end
# A share/exclusive lock, otherwise known as a read/write lock.
#
# https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock
#
# source://activesupport//lib/active_support/concurrency/share_lock.rb#11
class ActiveSupport::Concurrency::ShareLock
include ::MonitorMixin
# @return [ShareLock] a new instance of ShareLock
#
# source://activesupport//lib/active_support/concurrency/share_lock.rb#50
def initialize; end
# Execute the supplied block while holding the Exclusive lock. If
# +no_wait+ is set and the lock is not immediately available,
# returns +nil+ without yielding. Otherwise, returns the result of
# the block.
#
# See +start_exclusive+ for other options.
#
# source://activesupport//lib/active_support/concurrency/share_lock.rb#148
def exclusive(purpose: T.unsafe(nil), compatible: T.unsafe(nil), after_compatible: T.unsafe(nil), no_wait: T.unsafe(nil)); end
# We track Thread objects, instead of just using counters, because
# we need exclusive locks to be reentrant, and we need to be able
# to upgrade share locks to exclusive.
#
# source://activesupport//lib/active_support/concurrency/share_lock.rb#18
def raw_state; end
# Execute the supplied block while holding the Share lock.
#
# source://activesupport//lib/active_support/concurrency/share_lock.rb#159
def sharing; end
# Returns false if +no_wait+ is set and the lock is not
# immediately available. Otherwise, returns true after the lock
# has been acquired.
#
# +purpose+ and +compatible+ work together; while this thread is
# waiting for the exclusive lock, it will yield its share (if any)
# to any other attempt whose +purpose+ appears in this attempt's
# +compatible+ list. This allows a "loose" upgrade, which, being
# less strict, prevents some classes of deadlocks.
#
# For many resources, loose upgrades are sufficient: if a thread
# is awaiting a lock, it is not running any other code. With
# +purpose+ matching, it is possible to yield only to other
# threads whose activity will not interfere.
#
# source://activesupport//lib/active_support/concurrency/share_lock.rb#76
def start_exclusive(purpose: T.unsafe(nil), compatible: T.unsafe(nil), no_wait: T.unsafe(nil)); end
# source://activesupport//lib/active_support/concurrency/share_lock.rb#114
def start_sharing; end
# Relinquish the exclusive lock. Must only be called by the thread
# that called start_exclusive (and currently holds the lock).
#
# source://activesupport//lib/active_support/concurrency/share_lock.rb#96
def stop_exclusive(compatible: T.unsafe(nil)); end
# source://activesupport//lib/active_support/concurrency/share_lock.rb#131
def stop_sharing; end
# Temporarily give up all held Share locks while executing the
# supplied block, allowing any +compatible+ exclusive lock request
# to proceed.
#
# source://activesupport//lib/active_support/concurrency/share_lock.rb#171
def yield_shares(purpose: T.unsafe(nil), compatible: T.unsafe(nil), block_share: T.unsafe(nil)); end
private
# Must be called within synchronize
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/concurrency/share_lock.rb#204
def busy_for_exclusive?(purpose); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/concurrency/share_lock.rb#209
def busy_for_sharing?(purpose); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/concurrency/share_lock.rb#214
def eligible_waiters?(compatible); end
# source://activesupport//lib/active_support/concurrency/share_lock.rb#218
def wait_for(method, &block); end
end
# = Active Support \Configurable
#
# Configurable provides a <tt>config</tt> method to store and retrieve
# configuration options as an OrderedOptions.
#
# source://activesupport//lib/active_support/configurable.rb#11
module ActiveSupport::Configurable
extend ::ActiveSupport::Concern
mixes_in_class_methods ::ActiveSupport::Configurable::ClassMethods
# Reads and writes attributes from a configuration OrderedOptions.
#
# require "active_support/configurable"
#
# class User
# include ActiveSupport::Configurable
# end
#
# user = User.new
#
# user.config.allowed_access = true
# user.config.level = 1
#
# user.config.allowed_access # => true
# user.config.level # => 1
#
# source://activesupport//lib/active_support/configurable.rb#155
def config; end
end
# source://activesupport//lib/active_support/configurable.rb#29
module ActiveSupport::Configurable::ClassMethods
# source://activesupport//lib/active_support/configurable.rb#30
def config; end
# @yield [config]
#
# source://activesupport//lib/active_support/configurable.rb#39
def configure; end
private
# Allows you to add shortcut so that you don't have to refer to attribute
# through config. Also look at the example for config to contrast.
#
# Defines both class and instance config accessors.
#
# class User
# include ActiveSupport::Configurable
# config_accessor :allowed_access
# end
#
# User.allowed_access # => nil
# User.allowed_access = false
# User.allowed_access # => false
#
# user = User.new
# user.allowed_access # => false
# user.allowed_access = true
# user.allowed_access # => true
#
# User.allowed_access # => false
#
# The attribute name must be a valid method name in Ruby.
#
# class User
# include ActiveSupport::Configurable
# config_accessor :"1_Badname"
# end
# # => NameError: invalid config attribute name
#
# To omit the instance writer method, pass <tt>instance_writer: false</tt>.
# To omit the instance reader method, pass <tt>instance_reader: false</tt>.
#
# class User
# include ActiveSupport::Configurable
# config_accessor :allowed_access, instance_reader: false, instance_writer: false
# end
#
# User.allowed_access = false
# User.allowed_access # => false
#
# User.new.allowed_access = true # => NoMethodError
# User.new.allowed_access # => NoMethodError
#
# Or pass <tt>instance_accessor: false</tt>, to omit both instance methods.
#
# class User
# include ActiveSupport::Configurable
# config_accessor :allowed_access, instance_accessor: false
# end
#
# User.allowed_access = false
# User.allowed_access # => false
#
# User.new.allowed_access = true # => NoMethodError
# User.new.allowed_access # => NoMethodError
#
# Also you can pass <tt>default</tt> or a block to set up the attribute with a default value.
#
# class User
# include ActiveSupport::Configurable
# config_accessor :allowed_access, default: false
# config_accessor :hair_colors do
# [:brown, :black, :blonde, :red]
# end
# end
#
# User.allowed_access # => false
# User.hair_colors # => [:brown, :black, :blonde, :red]
#
# source://activesupport//lib/active_support/configurable.rb#111
def config_accessor(*names, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end
# source://activesupport//lib/active_support/configurable.rb#132
def inherited(subclass); end
end
# source://activesupport//lib/active_support/configurable.rb#14
class ActiveSupport::Configurable::Configuration < ::ActiveSupport::InheritableOptions
# source://activesupport//lib/active_support/configurable.rb#15
def compile_methods!; end
class << self
# Compiles reader methods so we don't have to go through method_missing.
#
# source://activesupport//lib/active_support/configurable.rb#20
def compile_methods!(keys); end
end
end
# Reads a YAML configuration file, evaluating any ERB, then
# parsing the resulting YAML.
#
# Warns in case of YAML confusing characters, like invisible
# non-breaking spaces.
#
# source://activesupport//lib/active_support/configuration_file.rb#9
class ActiveSupport::ConfigurationFile
# @return [ConfigurationFile] a new instance of ConfigurationFile
#
# source://activesupport//lib/active_support/configuration_file.rb#12
def initialize(content_path); end
# source://activesupport//lib/active_support/configuration_file.rb#21
def parse(context: T.unsafe(nil), **options); end
private
# source://activesupport//lib/active_support/configuration_file.rb#35
def read(content_path); end
# source://activesupport//lib/active_support/configuration_file.rb#46
def render(context); end
class << self
# source://activesupport//lib/active_support/configuration_file.rb#17
def parse(content_path, **options); end
end
end
# source://activesupport//lib/active_support/configuration_file.rb#10
class ActiveSupport::ConfigurationFile::FormatError < ::StandardError; end
# source://activesupport//lib/active_support/core_ext/erb/util.rb#6
module ActiveSupport::CoreExt; end
# source://activesupport//lib/active_support/core_ext/erb/util.rb#7
module ActiveSupport::CoreExt::ERBUtil
# A utility method for escaping HTML tag characters.
# This method is also aliased as <tt>h</tt>.
#
# puts html_escape('is a > 0 & a < 10?')
# # => is a > 0 & a < 10?
#
# source://activesupport//lib/active_support/core_ext/erb/util.rb#25
def h(s); end
# A utility method for escaping HTML tag characters.
# This method is also aliased as <tt>h</tt>.
#
# puts html_escape('is a > 0 & a < 10?')
# # => is a > 0 & a < 10?
#
# source://activesupport//lib/active_support/core_ext/erb/util.rb#25
def html_escape(s); end
# HTML escapes strings but doesn't wrap them with an ActiveSupport::SafeBuffer.
# This method is not for public consumption! Seriously!
#
# source://activesupport//lib/active_support/core_ext/erb/util.rb#10
def unwrapped_html_escape(s); end
end
# source://activesupport//lib/active_support/core_ext/erb/util.rb#31
module ActiveSupport::CoreExt::ERBUtilPrivate
include ::ActiveSupport::CoreExt::ERBUtil
private
# source://activesupport//lib/active_support/core_ext/erb/util.rb#25
def h(s); end
# source://activesupport//lib/active_support/core_ext/erb/util.rb#25
def html_escape(s); end
# source://activesupport//lib/active_support/core_ext/erb/util.rb#10
def unwrapped_html_escape(s); end
end
# = Current Attributes
#
# Abstract super class that provides a thread-isolated attributes singleton, which resets automatically
# before and after each request. This allows you to keep all the per-request attributes easily
# available to the whole system.
#
# The following full app-like example demonstrates how to use a Current class to
# facilitate easy access to the global, per-request attributes without passing them deeply
# around everywhere:
#
# # app/models/current.rb
# class Current < ActiveSupport::CurrentAttributes
# attribute :account, :user
# attribute :request_id, :user_agent, :ip_address
#
# resets { Time.zone = nil }
#
# def user=(user)
# super
# self.account = user.account
# Time.zone = user.time_zone
# end
# end
#
# # app/controllers/concerns/authentication.rb
# module Authentication
# extend ActiveSupport::Concern
#
# included do
# before_action :authenticate
# end
#
# private
# def authenticate
# if authenticated_user = User.find_by(id: cookies.encrypted[:user_id])
# Current.user = authenticated_user
# else
# redirect_to new_session_url
# end
# end
# end
#
# # app/controllers/concerns/set_current_request_details.rb
# module SetCurrentRequestDetails
# extend ActiveSupport::Concern
#
# included do
# before_action do
# Current.request_id = request.uuid
# Current.user_agent = request.user_agent
# Current.ip_address = request.ip
# end
# end
# end
#
# class ApplicationController < ActionController::Base
# include Authentication
# include SetCurrentRequestDetails
# end
#
# class MessagesController < ApplicationController
# def create
# Current.account.messages.create(message_params)
# end
# end
#
# class Message < ApplicationRecord
# belongs_to :creator, default: -> { Current.user }
# after_create { |message| Event.create(record: message) }
# end
#
# class Event < ApplicationRecord
# before_create do
# self.request_id = Current.request_id
# self.user_agent = Current.user_agent
# self.ip_address = Current.ip_address
# end
# end
#
# A word of caution: It's easy to overdo a global singleton like Current and tangle your model as a result.
# Current should only be used for a few, top-level globals, like account, user, and request details.
# The attributes stuck in Current should be used by more or less all actions on all requests. If you start
# sticking controller-specific attributes in there, you're going to create a mess.
#
# source://activesupport//lib/active_support/current_attributes.rb#92
class ActiveSupport::CurrentAttributes
include ::ActiveSupport::Callbacks
extend ::ActiveSupport::Callbacks::ClassMethods
extend ::ActiveSupport::DescendantsTracker
# @return [CurrentAttributes] a new instance of CurrentAttributes
#
# source://activesupport//lib/active_support/current_attributes.rb#199
def initialize; end
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks?; end
# source://activesupport//lib/active_support/callbacks.rb#924
def _reset_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#912
def _run_reset_callbacks(&block); end
# Returns the value of attribute attributes.
#
# source://activesupport//lib/active_support/current_attributes.rb#197
def attributes; end
# Sets the attribute attributes
#
# @param value the value to set the attribute attributes to.
#
# source://activesupport//lib/active_support/current_attributes.rb#197
def attributes=(_arg0); end
# source://activesupport//lib/active_support/current_attributes.rb#195
def defaults; end
# source://activesupport//lib/active_support/current_attributes.rb#195
def defaults?; end
# Reset all attributes. Should be called before and after actions, when used as a per-request singleton.
#
# source://activesupport//lib/active_support/current_attributes.rb#218
def reset; end
# Expose one or more attributes within a block. Old values are returned after the block concludes.
# Example demonstrating the common use of needing to set Current attributes outside the request-cycle:
#
# class Chat::PublicationJob < ApplicationJob
# def perform(attributes, room_number, creator)
# Current.set(person: creator) do
# Chat::Publisher.publish(attributes: attributes, room_number: room_number)
# end
# end
# end
#
# source://activesupport//lib/active_support/current_attributes.rb#213
def set(attributes, &block); end
private
# source://activesupport//lib/active_support/current_attributes.rb#225
def resolve_defaults; end
class << self
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks=(value); end
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks?; end
# source://activesupport//lib/active_support/callbacks.rb#916
def _reset_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#920
def _reset_callbacks=(value); end
# Calls this callback after #reset is called on the instance. Used for resetting external collaborators, like Time.zone.
#
# source://activesupport//lib/active_support/current_attributes.rb#149
def after_reset(*methods, &block); end
# Declares one or more attributes that will be given both class and instance accessor methods.
#
# ==== Options
#
# * <tt>:default</tt> - The default value for the attributes. If the value
# is a proc or lambda, it will be called whenever an instance is
# constructed. Otherwise, the value will be duplicated with +#dup+.
# Default values are re-assigned when the attributes are reset.
#
# source://activesupport//lib/active_support/current_attributes.rb#114
def attribute(*names, default: T.unsafe(nil)); end
# Calls this callback before #reset is called on the instance. Used for resetting external collaborators that depend on current values.
#
# source://activesupport//lib/active_support/current_attributes.rb#144
def before_reset(*methods, &block); end
# source://activesupport//lib/active_support/current_attributes.rb#160
def clear_all; end
# source://activesupport//lib/active_support/current_attributes.rb#195
def defaults; end
# source://activesupport//lib/active_support/current_attributes.rb#195
def defaults=(value); end
# source://activesupport//lib/active_support/current_attributes.rb#195
def defaults?; end
# Returns singleton instance for this class in this thread. If none exists, one is created.
#
# source://activesupport//lib/active_support/current_attributes.rb#102
def instance; end
# source://activesupport//lib/active_support/current_attributes.rb#154
def reset(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/current_attributes.rb#156
def reset_all; end
# Calls this callback after #reset is called on the instance. Used for resetting external collaborators, like Time.zone.
#
# source://activesupport//lib/active_support/current_attributes.rb#149
def resets(*methods, &block); end
# source://activesupport//lib/active_support/current_attributes.rb#154
def set(*_arg0, **_arg1, &_arg2); end
private
# source://activesupport//lib/active_support/current_attributes.rb#170
def current_instances; end
# source://activesupport//lib/active_support/current_attributes.rb#174
def current_instances_key; end
# source://activesupport//lib/active_support/current_attributes.rb#166
def generated_attribute_methods; end
# @private
#
# source://activesupport//lib/active_support/current_attributes.rb#186
def method_added(name); end
# source://activesupport//lib/active_support/current_attributes.rb#178
def method_missing(name, *_arg1, **_arg2, &_arg3); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/current_attributes.rb#182
def respond_to_missing?(name, _); end
end
end
# source://activesupport//lib/active_support/current_attributes.rb#96
ActiveSupport::CurrentAttributes::INVALID_ATTRIBUTE_NAMES = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/current_attributes.rb#98
ActiveSupport::CurrentAttributes::NOT_SET = T.let(T.unsafe(nil), Object)
# Provides +deep_merge+ and +deep_merge!+ methods. Expects the including class
# to provide a <tt>merge!(other, &block)</tt> method.
#
# source://activesupport//lib/active_support/deep_mergeable.rb#6
module ActiveSupport::DeepMergeable
# Returns a new instance with the values from +other+ merged recursively.
#
# class Hash
# include ActiveSupport::DeepMergeable
# end
#
# hash_1 = { a: true, b: { c: [1, 2, 3] } }
# hash_2 = { a: false, b: { x: [3, 4, 5] } }
#
# hash_1.deep_merge(hash_2)
# # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } }
#
# A block can be provided to merge non-<tt>DeepMergeable</tt> values:
#
# hash_1 = { a: 100, b: 200, c: { c1: 100 } }
# hash_2 = { b: 250, c: { c1: 200 } }
#
# hash_1.deep_merge(hash_2) do |key, this_val, other_val|
# this_val + other_val
# end
# # => { a: 100, b: 450, c: { c1: 300 } }
#
# source://activesupport//lib/active_support/deep_mergeable.rb#29
def deep_merge(other, &block); end
# Same as #deep_merge, but modifies +self+.
#
# source://activesupport//lib/active_support/deep_mergeable.rb#34
def deep_merge!(other, &block); end
# Returns true if +other+ can be deep merged into +self+. Classes may
# override this method to restrict or expand the domain of deep mergeable
# values. Defaults to checking that +other+ is of type +self.class+.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/deep_mergeable.rb#49
def deep_merge?(other); end
end
# source://activesupport//lib/active_support/delegation.rb#16
module ActiveSupport::Delegation
class << self
# source://activesupport//lib/active_support/delegation.rb#23
def generate(owner, methods, location: T.unsafe(nil), to: T.unsafe(nil), prefix: T.unsafe(nil), allow_nil: T.unsafe(nil), nilable: T.unsafe(nil), private: T.unsafe(nil), as: T.unsafe(nil), signature: T.unsafe(nil)); end
# source://activesupport//lib/active_support/delegation.rb#152
def generate_method_missing(owner, target, allow_nil: T.unsafe(nil)); end
end
end
# source://activesupport//lib/active_support/delegation.rb#20
ActiveSupport::Delegation::RESERVED_METHOD_NAMES = T.let(T.unsafe(nil), Set)
# source://activesupport//lib/active_support/delegation.rb#17
ActiveSupport::Delegation::RUBY_RESERVED_KEYWORDS = T.let(T.unsafe(nil), Array)
# Error generated by +delegate+ when a method is called on +nil+ and +allow_nil+
# option is not used.
#
# source://activesupport//lib/active_support/delegation.rb#8
class ActiveSupport::DelegationError < ::NoMethodError
class << self
# source://activesupport//lib/active_support/delegation.rb#10
def nil_target(method_name, target); end
end
end
# source://activesupport//lib/active_support/dependencies/interlock.rb#6
module ActiveSupport::Dependencies
class << self
# source://activesupport//lib/active_support/dependencies.rb#62
def _autoloaded_tracked_classes; end
# source://activesupport//lib/active_support/dependencies.rb#62
def _autoloaded_tracked_classes=(_arg0); end
# source://activesupport//lib/active_support/dependencies.rb#56
def _eager_load_paths; end
# source://activesupport//lib/active_support/dependencies.rb#56
def _eager_load_paths=(_arg0); end
# source://activesupport//lib/active_support/dependencies.rb#49
def autoload_once_paths; end
# source://activesupport//lib/active_support/dependencies.rb#49
def autoload_once_paths=(_arg0); end
# source://activesupport//lib/active_support/dependencies.rb#43
def autoload_paths; end
# source://activesupport//lib/active_support/dependencies.rb#43
def autoload_paths=(_arg0); end
# source://activesupport//lib/active_support/dependencies.rb#69
def autoloader; end
# source://activesupport//lib/active_support/dependencies.rb#69
def autoloader=(_arg0); end
# Private method that reloads constants autoloaded by the main autoloader.
#
# Rails.application.reloader.reload! is the public interface for application
# reload. That involves more things, like deleting unloaded classes from the
# internal state of the descendants tracker, or reloading routes.
#
# source://activesupport//lib/active_support/dependencies.rb#76
def clear; end
# Private method that helps configuring the autoloaders.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/dependencies.rb#94
def eager_load?(path); end
# source://activesupport//lib/active_support/dependencies.rb#10
def interlock; end
# source://activesupport//lib/active_support/dependencies.rb#10
def interlock=(_arg0); end
# Execute the supplied block while holding an exclusive lock,
# preventing any other thread from being inside a #run_interlock
# block at the same time.
#
# source://activesupport//lib/active_support/dependencies.rb#24
def load_interlock(&block); end
# Execute the supplied block without interference from any
# concurrent loads.
#
# source://activesupport//lib/active_support/dependencies.rb#17
def run_interlock(&block); end
# Private method used by require_dependency.
#
# source://activesupport//lib/active_support/dependencies.rb#84
def search_for_file(relpath); end
# Execute the supplied block while holding an exclusive lock,
# preventing any other thread from being inside a #run_interlock
# block at the same time.
#
# source://activesupport//lib/active_support/dependencies.rb#31
def unload_interlock(&block); end
end
end
# source://activesupport//lib/active_support/dependencies/interlock.rb#7
class ActiveSupport::Dependencies::Interlock
# @return [Interlock] a new instance of Interlock
#
# source://activesupport//lib/active_support/dependencies/interlock.rb#8
def initialize; end
# source://activesupport//lib/active_support/dependencies/interlock.rb#32
def done_running; end
# source://activesupport//lib/active_support/dependencies/interlock.rb#24
def done_unloading; end
# source://activesupport//lib/active_support/dependencies/interlock.rb#12
def loading(&block); end
# source://activesupport//lib/active_support/dependencies/interlock.rb#40
def permit_concurrent_loads(&block); end
# source://activesupport//lib/active_support/dependencies/interlock.rb#44
def raw_state(&block); end
# source://activesupport//lib/active_support/dependencies/interlock.rb#36
def running(&block); end
# source://activesupport//lib/active_support/dependencies/interlock.rb#28
def start_running; end
# source://activesupport//lib/active_support/dependencies/interlock.rb#20
def start_unloading; end
# source://activesupport//lib/active_support/dependencies/interlock.rb#16
def unloading(&block); end
end
# source://activesupport//lib/active_support/dependencies/require_dependency.rb#3
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 control the mode in which their parent application runs
# should call +require_dependency+ where needed in case the runtime mode is
# +:classic+.
#
# source://activesupport//lib/active_support/dependencies/require_dependency.rb#11
def require_dependency(filename); end
end
# = Active Support \Deprecation
#
# \Deprecation specifies the API used by \Rails to deprecate methods, instance variables, objects, and constants. It's
# also available for gems or applications.
#
# For a gem, use Deprecation.new to create a Deprecation object and store it in your module or class (in order for
# users to be able to configure it).
#
# module MyLibrary
# def self.deprecator
# @deprecator ||= ActiveSupport::Deprecation.new("2.0", "MyLibrary")
# end
# end
#
# For a Railtie or Engine, you may also want to add it to the application's deprecators, so that the application's
# configuration can be applied to it.
#
# module MyLibrary
# class Railtie < Rails::Railtie
# initializer "my_library.deprecator" do |app|
# app.deprecators[:my_library] = MyLibrary.deprecator
# end
# end
# end
#
# With the above initializer, configuration settings like the following will affect +MyLibrary.deprecator+:
#
# # in config/environments/test.rb
# config.active_support.deprecation = :raise
#
# source://activesupport//lib/active_support/deprecation.rb#33
class ActiveSupport::Deprecation
include ::ActiveSupport::Deprecation::Behavior
include ::ActiveSupport::Deprecation::Reporting
include ::ActiveSupport::Deprecation::Disallowed
include ::ActiveSupport::Deprecation::MethodWrapper
# It accepts two parameters on initialization. The first is a version of library
# and the second is a library name.
#
# ActiveSupport::Deprecation.new('2.0', 'MyLibrary')
#
# @return [Deprecation] a new instance of Deprecation
#
# source://activesupport//lib/active_support/deprecation.rb#71
def initialize(deprecation_horizon = T.unsafe(nil), gem_name = T.unsafe(nil)); end
# The version number in which the deprecated behavior will be removed, by default.
#
# source://activesupport//lib/active_support/deprecation.rb#65
def deprecation_horizon; end
# The version number in which the deprecated behavior will be removed, by default.
#
# source://activesupport//lib/active_support/deprecation.rb#65
def deprecation_horizon=(_arg0); end
class << self
# source://activesupport//lib/active_support/deprecation.rb#60
def _instance; end
end
end
# Behavior module allows to determine how to display deprecation messages.
# You can create a custom behavior or set any from the +DEFAULT_BEHAVIORS+
# constant. Available behaviors are:
#
# [+:raise+] Raise ActiveSupport::DeprecationException.
# [+:stderr+] Log all deprecation warnings to <tt>$stderr</tt>.
# [+:log+] Log all deprecation warnings to +Rails.logger+.
# [+:notify+] Use ActiveSupport::Notifications to notify +deprecation.rails+.
# [+:report+] Use ActiveSupport::ErrorReporter to report deprecations.
# [+:silence+] Do nothing. On \Rails, set <tt>config.active_support.report_deprecations = false</tt> to disable all behaviors.
#
# Setting behaviors only affects deprecations that happen after boot time.
# For more information you can read the documentation of the #behavior= method.
#
# source://activesupport//lib/active_support/deprecation/behaviors.rb#69
module ActiveSupport::Deprecation::Behavior
# Returns the current behavior or if one isn't set, defaults to +:stderr+.
#
# source://activesupport//lib/active_support/deprecation/behaviors.rb#74
def behavior; end
# Sets the behavior to the specified value. Can be a single value, array,
# or an object that responds to +call+.
#
# Available behaviors:
#
# [+:raise+] Raise ActiveSupport::DeprecationException.
# [+:stderr+] Log all deprecation warnings to <tt>$stderr</tt>.
# [+:log+] Log all deprecation warnings to +Rails.logger+.
# [+:notify+] Use ActiveSupport::Notifications to notify +deprecation.rails+.
# [+:report+] Use ActiveSupport::ErrorReporter to report deprecations.
# [+:silence+] Do nothing.
#
# Setting behaviors only affects deprecations that happen after boot time.
# Deprecation warnings raised by gems are not affected by this setting
# because they happen before \Rails boots up.
#
# deprecator = ActiveSupport::Deprecation.new
# deprecator.behavior = :stderr
# deprecator.behavior = [:stderr, :log]
# deprecator.behavior = MyCustomHandler
# deprecator.behavior = ->(message, callstack, deprecation_horizon, gem_name) {
# # custom stuff
# }
#
# If you are using \Rails, you can set
# <tt>config.active_support.report_deprecations = false</tt> to disable
# all deprecation behaviors. This is similar to the +:silence+ option but
# more performant.
#
# source://activesupport//lib/active_support/deprecation/behaviors.rb#111
def behavior=(behavior); end
# Whether to print a backtrace along with the warning.
#
# source://activesupport//lib/active_support/deprecation/behaviors.rb#71
def debug; end
# Whether to print a backtrace along with the warning.
#
# source://activesupport//lib/active_support/deprecation/behaviors.rb#71
def debug=(_arg0); end
# Returns the current behavior for disallowed deprecations or if one isn't set, defaults to +:raise+.
#
# source://activesupport//lib/active_support/deprecation/behaviors.rb#79
def disallowed_behavior; end
# Sets the behavior for disallowed deprecations (those configured by
# ActiveSupport::Deprecation#disallowed_warnings=) to the specified
# value. As with #behavior=, this can be a single value, array, or an
# object that responds to +call+.
#
# source://activesupport//lib/active_support/deprecation/behaviors.rb#119
def disallowed_behavior=(behavior); end
private
# source://activesupport//lib/active_support/deprecation/behaviors.rb#124
def arity_coerce(behavior); end
# source://activesupport//lib/active_support/deprecation/behaviors.rb#143
def arity_of_callable(callable); end
end
# Default warning behaviors per Rails.env.
#
# source://activesupport//lib/active_support/deprecation/behaviors.rb#13
ActiveSupport::Deprecation::DEFAULT_BEHAVIORS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/deprecation/constant_accessor.rb#5
module ActiveSupport::Deprecation::DeprecatedConstantAccessor
class << self
# @private
#
# source://activesupport//lib/active_support/deprecation/constant_accessor.rb#6
def included(base); end
end
end
# DeprecatedConstantProxy transforms a constant into a deprecated one. It takes the full names of an old
# (deprecated) constant and of a new constant (both in string form) and a deprecator. The deprecated constant now
# returns the value of the new one.
#
# PLANETS = %w(mercury venus earth mars jupiter saturn uranus neptune pluto)
#
# # (In a later update, the original implementation of `PLANETS` has been removed.)
#
# PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune)
# PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("PLANETS", "PLANETS_POST_2006", ActiveSupport::Deprecation.new)
#
# PLANETS.map { |planet| planet.capitalize }
# # => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead.
# (Backtrace information…)
# ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]
#
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#120
class ActiveSupport::Deprecation::DeprecatedConstantProxy < ::Module
# @return [DeprecatedConstantProxy] a new instance of DeprecatedConstantProxy
#
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#128
def initialize(old_const, new_const, deprecator, message: T.unsafe(nil)); end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#158
def append_features(base); end
# Returns the class of the new constant.
#
# PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune)
# PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('PLANETS', 'PLANETS_POST_2006')
# PLANETS.class # => Array
#
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#154
def class; end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#168
def extended(base); end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#147
def hash(*_arg0, **_arg1, &_arg2); end
# Don't give a deprecation warning on inspect since test/unit and error
# logs rely on it for diagnostics.
#
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#141
def inspect; end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#147
def instance_methods(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#147
def name(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#163
def prepend_features(base); end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#147
def respond_to?(*_arg0, **_arg1, &_arg2); end
private
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#178
def const_missing(name); end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#183
def method_missing(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#174
def target; end
class << self
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#121
def new(*args, **options, &block); end
end
end
# DeprecatedInstanceVariableProxy transforms an instance variable into a deprecated one. It takes an instance of a
# class, a method on that class, an instance variable, and a deprecator as the last argument.
#
# Trying to use the deprecated instance variable will result in a deprecation warning, pointing to the method as a
# replacement.
#
# class Example
# def initialize
# @request = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(self, :request, :@request, ActiveSupport::Deprecation.new)
# @_request = :special_request
# end
#
# def request
# @_request
# end
#
# def old_request
# @request
# end
# end
#
# example = Example.new
# # => #<Example:0x007fb9b31090b8 @_request=:special_request, @request=:special_request>
#
# example.old_request.to_s
# # => DEPRECATION WARNING: @request is deprecated! Call request.to_s instead of
# @request.to_s
# (Backtrace information…)
# "special_request"
#
# example.request.to_s
# # => "special_request"
#
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#87
class ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy < ::ActiveSupport::Deprecation::DeprecationProxy
# @return [DeprecatedInstanceVariableProxy] a new instance of DeprecatedInstanceVariableProxy
#
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#88
def initialize(instance, method, var = T.unsafe(nil), deprecator:); end
private
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#96
def target; end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#100
def warn(callstack, called, args); end
end
# DeprecatedObjectProxy transforms an object into a deprecated one. It takes an object, a deprecation message, and
# a deprecator.
#
# deprecated_object = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(Object.new, "This object is now deprecated", ActiveSupport::Deprecation.new)
# # => #<Object:0x007fb9b34c34b0>
#
# deprecated_object.to_s
# DEPRECATION WARNING: This object is now deprecated.
# (Backtrace)
# # => "#<Object:0x007fb9b34c34b0>"
#
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#38
class ActiveSupport::Deprecation::DeprecatedObjectProxy < ::ActiveSupport::Deprecation::DeprecationProxy
# @return [DeprecatedObjectProxy] a new instance of DeprecatedObjectProxy
#
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#39
def initialize(object, message, deprecator); end
private
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#46
def target; end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#50
def warn(callstack, called, args); end
end
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#5
class ActiveSupport::Deprecation::DeprecationProxy
# Don't give a deprecation warning on inspect since test/unit and error
# logs rely on it for diagnostics.
#
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#17
def inspect; end
private
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#22
def method_missing(called, *args, &block); end
class << self
# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#6
def new(*args, **kwargs, &block); end
end
end
# 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 given block.
#
# source://activesupport//lib/active_support/deprecation/deprecators.rb#9
class ActiveSupport::Deprecation::Deprecators
# @return [Deprecators] a new instance of Deprecators
#
# source://activesupport//lib/active_support/deprecation/deprecators.rb#10
def initialize; end
# Returns a deprecator added to this collection via #[]=.
#
# source://activesupport//lib/active_support/deprecation/deprecators.rb#16
def [](name); end
# Adds a given +deprecator+ to this collection. The deprecator will be
# immediately configured with any options previously set on this
# collection.
#
# deprecators = ActiveSupport::Deprecation::Deprecators.new
# deprecators.debug = true
#
# foo_deprecator = ActiveSupport::Deprecation.new("2.0", "Foo")
# foo_deprecator.debug # => false
#
# deprecators[:foo] = foo_deprecator
# deprecators[:foo].debug # => true
# foo_deprecator.debug # => true
#
# source://activesupport//lib/active_support/deprecation/deprecators.rb#34
def []=(name, deprecator); end
# Sets the deprecation warning behavior for all deprecators in this
# collection.
#
# See ActiveSupport::Deprecation#behavior=.
#
# source://activesupport//lib/active_support/deprecation/deprecators.rb#60
def behavior=(behavior); end
# Sets the debug flag for all deprecators in this collection.
#
# source://activesupport//lib/active_support/deprecation/deprecators.rb#52
def debug=(debug); end
# Sets the disallowed deprecation warning behavior for all deprecators in
# this collection.
#
# See ActiveSupport::Deprecation#disallowed_behavior=.
#
# source://activesupport//lib/active_support/deprecation/deprecators.rb#68
def disallowed_behavior=(disallowed_behavior); end
# Sets the disallowed deprecation warnings for all deprecators in this
# collection.
#
# See ActiveSupport::Deprecation#disallowed_warnings=.
#
# source://activesupport//lib/active_support/deprecation/deprecators.rb#76
def disallowed_warnings=(disallowed_warnings); end
# Iterates over all deprecators in this collection. If no block is given,
# returns an +Enumerator+.
#
# source://activesupport//lib/active_support/deprecation/deprecators.rb#41
def each(&block); end
# Silences all deprecators in this collection for the duration of the
# given block.
#
# See ActiveSupport::Deprecation#silence.
#
# source://activesupport//lib/active_support/deprecation/deprecators.rb#84
def silence(&block); end
# Sets the silenced flag for all deprecators in this collection.
#
# source://activesupport//lib/active_support/deprecation/deprecators.rb#47
def silenced=(silenced); end
private
# source://activesupport//lib/active_support/deprecation/deprecators.rb#97
def apply_options(deprecator); end
# source://activesupport//lib/active_support/deprecation/deprecators.rb#92
def set_option(name, value); end
end
# source://activesupport//lib/active_support/deprecation/disallowed.rb#5
module ActiveSupport::Deprecation::Disallowed
# Returns the configured criteria used to identify deprecation messages
# which should be treated as disallowed.
#
# source://activesupport//lib/active_support/deprecation/disallowed.rb#21
def disallowed_warnings; end
# 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 compared against
# the text of the generated deprecation warning.
#
# Additionally the scalar symbol +:all+ may be used to treat all
# deprecations as disallowed.
#
# Deprecations matching a substring or regular expression will be handled
# using the configured Behavior#disallowed_behavior rather than
# Behavior#behavior.
#
# source://activesupport//lib/active_support/deprecation/disallowed.rb#17
def disallowed_warnings=(_arg0); end
private
# @return [Boolean]
#
# source://activesupport//lib/active_support/deprecation/disallowed.rb#26
def deprecation_disallowed?(message); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/deprecation/disallowed.rb#39
def explicitly_allowed?(message); end
end
# source://activesupport//lib/active_support/deprecation.rb#57
ActiveSupport::Deprecation::MUTEX = T.let(T.unsafe(nil), Thread::Mutex)
# source://activesupport//lib/active_support/deprecation/method_wrappers.rb#8
module ActiveSupport::Deprecation::MethodWrapper
# Declare that a method has been deprecated.
#
# class Fred
# def aaa; end
# def bbb; end
# def ccc; end
# def ddd; end
# def eee; end
# end
#
# deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem')
#
# deprecator.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead')
# # => Fred
#
# Fred.new.aaa
# # DEPRECATION WARNING: aaa is deprecated and will be removed from MyGem next-release. (called from irb_binding at (irb):10)
# # => nil
#
# Fred.new.bbb
# # DEPRECATION WARNING: bbb is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):11)
# # => nil
#
# Fred.new.ccc
# # DEPRECATION WARNING: ccc is deprecated and will be removed from MyGem next-release (use Bar#ccc instead). (called from irb_binding at (irb):12)
# # => nil
#
# source://activesupport//lib/active_support/deprecation/method_wrappers.rb#35
def deprecate_methods(target_module, *method_names); end
end
# source://activesupport//lib/active_support/deprecation/reporting.rb#7
module ActiveSupport::Deprecation::Reporting
# Allow previously disallowed deprecation warnings within the block.
# <tt>allowed_warnings</tt> can be an array containing strings, symbols, or regular
# expressions. (Symbols are treated as strings). These are compared against
# the text of deprecation warning messages generated within the block.
# Matching warnings will be exempt from the rules set by
# ActiveSupport::Deprecation#disallowed_warnings.
#
# The optional <tt>if:</tt> argument accepts a truthy/falsy value or an object that
# responds to <tt>.call</tt>. If truthy, then matching warnings will be allowed.
# If falsey then the method yields to the block without allowing the warning.
#
# deprecator = ActiveSupport::Deprecation.new
# deprecator.disallowed_behavior = :raise
# deprecator.disallowed_warnings = [
# "something broke"
# ]
#
# deprecator.warn('something broke!')
# # => ActiveSupport::DeprecationException
#
# deprecator.allow ['something broke'] do
# deprecator.warn('something broke!')
# end
# # => nil
#
# deprecator.allow ['something broke'], if: Rails.env.production? do
# deprecator.warn('something broke!')
# end
# # => ActiveSupport::DeprecationException for dev/test, nil for production
#
# source://activesupport//lib/active_support/deprecation/reporting.rb#89
def allow(allowed_warnings = T.unsafe(nil), if: T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/deprecation/reporting.rb#48
def begin_silence; end
# source://activesupport//lib/active_support/deprecation/reporting.rb#99
def deprecation_warning(deprecated_method_name, message = T.unsafe(nil), caller_backtrace = T.unsafe(nil)); end
# source://activesupport//lib/active_support/deprecation/reporting.rb#52
def end_silence; end
# Name of gem where method is deprecated
#
# source://activesupport//lib/active_support/deprecation/reporting.rb#11
def gem_name; end
# Name of gem where method is deprecated
#
# source://activesupport//lib/active_support/deprecation/reporting.rb#11
def gem_name=(_arg0); end
# Silence deprecation warnings within the block.
#
# deprecator = ActiveSupport::Deprecation.new
# deprecator.warn('something broke!')
# # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
#
# deprecator.silence do
# deprecator.warn('something broke!')
# end
# # => nil
#
# source://activesupport//lib/active_support/deprecation/reporting.rb#41
def silence(&block); end
# source://activesupport//lib/active_support/deprecation/reporting.rb#56
def silenced; end
# Whether to print a message (silent mode)
#
# source://activesupport//lib/active_support/deprecation/reporting.rb#9
def silenced=(_arg0); end
# Outputs a deprecation warning to the output configured by
# ActiveSupport::Deprecation#behavior.
#
# ActiveSupport::Deprecation.new.warn('something broke!')
# # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
#
# source://activesupport//lib/active_support/deprecation/reporting.rb#18
def warn(message = T.unsafe(nil), callstack = T.unsafe(nil)); end
private
# source://activesupport//lib/active_support/deprecation/reporting.rb#153
def _extract_callstack(callstack); end
# Outputs a deprecation warning message
#
# deprecated_method_warning(:method_name)
# # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon}"
# deprecated_method_warning(:method_name, :another_method)
# # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (use another_method instead)"
# deprecated_method_warning(:method_name, "Optional message")
# # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (Optional message)"
#
# source://activesupport//lib/active_support/deprecation/reporting.rb#115
def deprecated_method_warning(method_name, message = T.unsafe(nil)); end
# source://activesupport//lib/active_support/deprecation/reporting.rb#129
def deprecation_caller_message(callstack); end
# source://activesupport//lib/active_support/deprecation/reporting.rb#124
def deprecation_message(callstack, message = T.unsafe(nil)); end
# source://activesupport//lib/active_support/deprecation/reporting.rb#140
def extract_callstack(callstack); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/deprecation/reporting.rb#174
def ignored_callstack?(path); end
end
# source://activesupport//lib/active_support/deprecation/reporting.rb#172
ActiveSupport::Deprecation::Reporting::LIB_DIR = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/deprecation/reporting.rb#171
ActiveSupport::Deprecation::Reporting::RAILS_GEM_ROOT = T.let(T.unsafe(nil), String)
# 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.
#
# source://activesupport//lib/active_support/deprecation/behaviors.rb#8
class ActiveSupport::DeprecationException < ::StandardError; end
# = Active Support Descendants Tracker
#
# This module provides an internal implementation to track descendants
# which is faster than iterating through +ObjectSpace+.
#
# However Ruby 3.1 provide a fast native +Class#subclasses+ method,
# so if you know your code won't be executed on older rubies, including
# +ActiveSupport::DescendantsTracker+ does not provide any benefit.
#
# source://activesupport//lib/active_support/descendants_tracker.rb#14
module ActiveSupport::DescendantsTracker
# source://activesupport//lib/active_support/descendants_tracker.rb#107
def descendants; end
class << self
# source://activesupport//lib/active_support/descendants_tracker.rb#78
def clear(classes); end
# source://activesupport//lib/active_support/descendants_tracker.rb#102
def descendants(klass); end
# source://activesupport//lib/active_support/descendants_tracker.rb#69
def disable_clear!; end
# source://activesupport//lib/active_support/descendants_tracker.rb#89
def reject!(classes); end
# source://activesupport//lib/active_support/descendants_tracker.rb#98
def subclasses(klass); end
end
end
# source://activesupport//lib/active_support/descendants_tracker.rb#58
module ActiveSupport::DescendantsTracker::ReloadedClassesFiltering
# source://activesupport//lib/active_support/descendants_tracker.rb#63
def descendants; end
# source://activesupport//lib/active_support/descendants_tracker.rb#59
def subclasses; end
end
# On TruffleRuby `ObjectSpace::WeakMap` keys are strong references.
# So we use `object_id` as a key and the actual object as a value.
#
# JRuby for now doesn't have Class#descendant, but when it will, it will likely
# have the same WeakMap semantic than Truffle so we future proof this as much as possible.
#
# source://activesupport//lib/active_support/descendants_tracker.rb#20
class ActiveSupport::DescendantsTracker::WeakSet < ::ObjectSpace::WeakMap
# source://activesupport//lib/active_support/descendants_tracker.rb#23
def <<(object); end
def to_a; end
end
# source://activesupport//lib/active_support/digest.rb#6
class ActiveSupport::Digest
class << self
# source://activesupport//lib/active_support/digest.rb#8
def hash_digest_class; end
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/digest.rb#12
def hash_digest_class=(klass); end
# source://activesupport//lib/active_support/digest.rb#17
def hexdigest(arg); end
end
end
# = Active Support \Duration
#
# Provides accurate date and time measurements using Date#advance and
# Time#advance, respectively. It mainly supports the methods on Numeric.
#
# 1.month.ago # equivalent to Time.now.advance(months: -1)
#
# source://activesupport//lib/active_support/duration.rb#14
class ActiveSupport::Duration
# @return [Duration] a new instance of Duration
#
# source://activesupport//lib/active_support/duration.rb#226
def initialize(value, parts, variable = T.unsafe(nil)); end
# Returns the modulo of this Duration by another Duration or Numeric.
# Numeric values are treated as seconds.
#
# source://activesupport//lib/active_support/duration.rb#312
def %(other); end
# Multiplies this Duration by a Numeric and returns a new Duration.
#
# source://activesupport//lib/active_support/duration.rb#287
def *(other); end
# Adds another Duration or a Numeric to this Duration. Numeric values
# are treated as seconds.
#
# source://activesupport//lib/active_support/duration.rb#268
def +(other); end
# source://activesupport//lib/active_support/duration.rb#326
def +@; end
# Subtracts another Duration or a Numeric from this Duration. Numeric
# values are treated as seconds.
#
# source://activesupport//lib/active_support/duration.rb#282
def -(other); end
# source://activesupport//lib/active_support/duration.rb#322
def -@; end
# Divides this Duration by a Numeric and returns a new Duration.
#
# source://activesupport//lib/active_support/duration.rb#298
def /(other); end
# Compares one Duration with another or a Numeric to this Duration.
# Numeric values are treated as seconds.
#
# source://activesupport//lib/active_support/duration.rb#258
def <=>(other); end
# Returns +true+ if +other+ is also a Duration instance with the
# same +value+, or if <tt>other == value</tt>.
#
# source://activesupport//lib/active_support/duration.rb#341
def ==(other); end
# source://activesupport//lib/active_support/duration.rb#481
def _parts; end
# source://activesupport//lib/active_support/duration.rb#224
def abs(&_arg0); end
# Calculates a new Time or Date that is as far in the future
# as this Duration represents.
#
# source://activesupport//lib/active_support/duration.rb#436
def after(time = T.unsafe(nil)); end
# Calculates a new Time or Date that is as far in the past
# as this Duration represents.
#
# source://activesupport//lib/active_support/duration.rb#444
def ago(time = T.unsafe(nil)); end
# source://activesupport//lib/active_support/duration.rb#459
def as_json(options = T.unsafe(nil)); end
# Calculates a new Time or Date that is as far in the past
# as this Duration represents.
#
# source://activesupport//lib/active_support/duration.rb#444
def before(time = T.unsafe(nil)); end
# source://activesupport//lib/active_support/duration.rb#245
def coerce(other); end
# source://activesupport//lib/active_support/duration.rb#467
def encode_with(coder); end
# Returns +true+ if +other+ is also a Duration instance, which has the
# same parts as this one.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/duration.rb#426
def eql?(other); end
# Calculates a new Time or Date that is as far in the future
# as this Duration represents.
#
# source://activesupport//lib/active_support/duration.rb#436
def from_now(time = T.unsafe(nil)); end
# source://activesupport//lib/active_support/duration.rb#430
def hash; end
# Returns the amount of days a duration covers as a float
#
# 12.hours.in_days # => 0.5
#
# source://activesupport//lib/active_support/duration.rb#399
def in_days; end
# Returns the amount of hours a duration covers as a float
#
# 1.day.in_hours # => 24.0
#
# source://activesupport//lib/active_support/duration.rb#392
def in_hours; end
# Returns the amount of minutes a duration covers as a float
#
# 1.day.in_minutes # => 1440.0
#
# source://activesupport//lib/active_support/duration.rb#385
def in_minutes; end
# Returns the amount of months a duration covers as a float
#
# 9.weeks.in_months # => 2.07
#
# source://activesupport//lib/active_support/duration.rb#413
def in_months; end
# Returns the number of seconds that this Duration represents.
#
# 1.minute.to_i # => 60
# 1.hour.to_i # => 3600
# 1.day.to_i # => 86400
#
# Note that this conversion makes some assumptions about the
# duration of some periods, e.g. months are always 1/12 of year
# and years are 365.2425 days:
#
# # equivalent to (1.year / 12).to_i
# 1.month.to_i # => 2629746
#
# # equivalent to 365.2425.days.to_i
# 1.year.to_i # => 31556952
#
# In such cases, Ruby's core
# Date[https://docs.ruby-lang.org/en/master/Date.html] and
# Time[https://docs.ruby-lang.org/en/master/Time.html] should be used for precision
# date and time arithmetic.
#
# source://activesupport//lib/active_support/duration.rb#377
def in_seconds; end
# Returns the amount of weeks a duration covers as a float
#
# 2.months.in_weeks # => 8.696
#
# source://activesupport//lib/active_support/duration.rb#406
def in_weeks; end
# Returns the amount of years a duration covers as a float
#
# 30.days.in_years # => 0.082
#
# source://activesupport//lib/active_support/duration.rb#420
def in_years; end
# source://activesupport//lib/active_support/duration.rb#463
def init_with(coder); end
# source://activesupport//lib/active_support/duration.rb#450
def inspect; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/duration.rb#335
def instance_of?(klass); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/duration.rb#330
def is_a?(klass); end
# Build ISO 8601 Duration string for this duration.
# The +precision+ parameter can be used to limit seconds' precision of duration.
#
# source://activesupport//lib/active_support/duration.rb#473
def iso8601(precision: T.unsafe(nil)); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/duration.rb#330
def kind_of?(klass); end
# source://activesupport//lib/active_support/duration.rb#224
def negative?(&_arg0); end
# Returns a copy of the parts hash that defines the duration.
#
# 5.minutes.parts # => {:minutes=>5}
# 3.years.parts # => {:years=>3}
#
# source://activesupport//lib/active_support/duration.rb#241
def parts; end
# source://activesupport//lib/active_support/duration.rb#224
def positive?(&_arg0); end
# Calculates a new Time or Date that is as far in the future
# as this Duration represents.
#
# source://activesupport//lib/active_support/duration.rb#436
def since(time = T.unsafe(nil)); end
# source://activesupport//lib/active_support/duration.rb#224
def to_f(&_arg0); end
# Returns the number of seconds that this Duration represents.
#
# 1.minute.to_i # => 60
# 1.hour.to_i # => 3600
# 1.day.to_i # => 86400
#
# Note that this conversion makes some assumptions about the
# duration of some periods, e.g. months are always 1/12 of year
# and years are 365.2425 days:
#
# # equivalent to (1.year / 12).to_i
# 1.month.to_i # => 2629746
#
# # equivalent to 365.2425.days.to_i
# 1.year.to_i # => 31556952
#
# In such cases, Ruby's core
# Date[https://docs.ruby-lang.org/en/master/Date.html] and
# Time[https://docs.ruby-lang.org/en/master/Time.html] should be used for precision
# date and time arithmetic.
#
# source://activesupport//lib/active_support/duration.rb#377
def to_i; end
# Returns the amount of seconds a duration covers as a string.
# For more information check to_i method.
#
# 1.day.to_s # => "86400"
#
# source://activesupport//lib/active_support/duration.rb#353
def to_s; end
# Calculates a new Time or Date that is as far in the past
# as this Duration represents.
#
# source://activesupport//lib/active_support/duration.rb#444
def until(time = T.unsafe(nil)); end
# Returns the value of attribute value.
#
# source://activesupport//lib/active_support/duration.rb#133
def value; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/duration.rb#477
def variable?; end
# source://activesupport//lib/active_support/duration.rb#224
def zero?(&_arg0); end
private
# source://activesupport//lib/active_support/duration.rb#512
def method_missing(*_arg0, **_arg1, &_arg2); end
# @raise [TypeError]
#
# source://activesupport//lib/active_support/duration.rb#516
def raise_type_error(other); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/duration.rb#508
def respond_to_missing?(method, _); end
# source://activesupport//lib/active_support/duration.rb#486
def sum(sign, time = T.unsafe(nil)); end
class << self
# source://activesupport//lib/active_support/duration.rb#149
def ===(other); end
# Creates a new Duration from a seconds value that is converted
# to the individual parts:
#
# ActiveSupport::Duration.build(31556952).parts # => {:years=>1}
# ActiveSupport::Duration.build(2716146).parts # => {:months=>1, :days=>1}
#
# source://activesupport//lib/active_support/duration.rb#189
def build(value); end
# source://activesupport//lib/active_support/duration.rb#167
def days(value); end
# source://activesupport//lib/active_support/duration.rb#163
def hours(value); end
# source://activesupport//lib/active_support/duration.rb#159
def minutes(value); end
# source://activesupport//lib/active_support/duration.rb#175
def months(value); end
# Creates a new Duration from string formatted according to ISO 8601 Duration.
#
# See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information.
# This method allows negative parts to be present in pattern.
# If invalid string is provided, it will raise +ActiveSupport::Duration::ISO8601Parser::ParsingError+.
#
# source://activesupport//lib/active_support/duration.rb#144
def parse(iso8601duration); end
# source://activesupport//lib/active_support/duration.rb#155
def seconds(value); end
# source://activesupport//lib/active_support/duration.rb#171
def weeks(value); end
# source://activesupport//lib/active_support/duration.rb#179
def years(value); end
private
# source://activesupport//lib/active_support/duration.rb#217
def calculate_total_seconds(parts); end
end
end
# 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 present in pattern.
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#12
class ActiveSupport::Duration::ISO8601Parser
# @return [ISO8601Parser] a new instance of ISO8601Parser
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#34
def initialize(string); end
# Returns the value of attribute mode.
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#32
def mode; end
# Sets the attribute mode
#
# @param value the value to set the attribute mode to.
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#32
def mode=(_arg0); end
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#41
def parse!; end
# Returns the value of attribute parts.
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#31
def parts; end
# Returns the value of attribute scanner.
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#31
def scanner; end
# Returns the value of attribute sign.
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#32
def sign; end
# Sets the attribute sign
#
# @param value the value to set the attribute sign to.
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#32
def sign=(_arg0); end
private
# @return [Boolean]
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#83
def finished?; end
# Parses number which can be a float with either comma or period.
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#88
def number; end
# @raise [ParsingError]
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#96
def raise_parsing_error(reason = T.unsafe(nil)); end
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#92
def scan(pattern); end
# Checks for various semantic errors as stated in ISO 8601 standard.
#
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#101
def validate!; end
end
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#17
ActiveSupport::Duration::ISO8601Parser::COMMA = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#22
ActiveSupport::Duration::ISO8601Parser::DATE_COMPONENT = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#28
ActiveSupport::Duration::ISO8601Parser::DATE_COMPONENTS = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#20
ActiveSupport::Duration::ISO8601Parser::DATE_MARKER = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#25
ActiveSupport::Duration::ISO8601Parser::DATE_TO_PART = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#16
ActiveSupport::Duration::ISO8601Parser::PERIOD = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#15
ActiveSupport::Duration::ISO8601Parser::PERIOD_OR_COMMA = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#13
class ActiveSupport::Duration::ISO8601Parser::ParsingError < ::ArgumentError; end
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#19
ActiveSupport::Duration::ISO8601Parser::SIGN_MARKER = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#23
ActiveSupport::Duration::ISO8601Parser::TIME_COMPONENT = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#29
ActiveSupport::Duration::ISO8601Parser::TIME_COMPONENTS = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#21
ActiveSupport::Duration::ISO8601Parser::TIME_MARKER = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/duration/iso8601_parser.rb#26
ActiveSupport::Duration::ISO8601Parser::TIME_TO_PART = T.let(T.unsafe(nil), Hash)
# Serializes duration to string according to ISO 8601 Duration format.
#
# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#6
class ActiveSupport::Duration::ISO8601Serializer
# @return [ISO8601Serializer] a new instance of ISO8601Serializer
#
# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#9
def initialize(duration, precision: T.unsafe(nil)); end
# Builds and returns output string.
#
# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#15
def serialize; end
private
# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#55
def format_seconds(seconds); end
# Return pair of duration's parts and whole duration sign.
# Parts are summarized (as they can become repetitive due to addition, etc).
# Zero parts are removed as not significant.
#
# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#38
def normalize; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#51
def week_mixed_with_date?(parts); end
end
# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#7
ActiveSupport::Duration::ISO8601Serializer::DATE_COMPONENTS = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/duration.rb#130
ActiveSupport::Duration::PARTS = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/duration.rb#120
ActiveSupport::Duration::PARTS_IN_SECONDS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/duration.rb#115
ActiveSupport::Duration::SECONDS_PER_DAY = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/duration.rb#114
ActiveSupport::Duration::SECONDS_PER_HOUR = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/duration.rb#113
ActiveSupport::Duration::SECONDS_PER_MINUTE = T.let(T.unsafe(nil), Integer)
# 1/12 of a gregorian year
#
# source://activesupport//lib/active_support/duration.rb#117
ActiveSupport::Duration::SECONDS_PER_MONTH = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/duration.rb#116
ActiveSupport::Duration::SECONDS_PER_WEEK = T.let(T.unsafe(nil), Integer)
# length of a gregorian year (365.2425 days)
#
# source://activesupport//lib/active_support/duration.rb#118
ActiveSupport::Duration::SECONDS_PER_YEAR = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/duration.rb#15
class ActiveSupport::Duration::Scalar < ::Numeric
# @return [Scalar] a new instance of Scalar
#
# source://activesupport//lib/active_support/duration.rb#19
def initialize(value); end
# source://activesupport//lib/active_support/duration.rb#85
def %(other); end
# source://activesupport//lib/active_support/duration.rb#66
def *(other); end
# source://activesupport//lib/active_support/duration.rb#41
def +(other); end
# source://activesupport//lib/active_support/duration.rb#53
def -(other); end
# source://activesupport//lib/active_support/duration.rb#27
def -@; end
# source://activesupport//lib/active_support/duration.rb#77
def /(other); end
# source://activesupport//lib/active_support/duration.rb#31
def <=>(other); end
# source://activesupport//lib/active_support/duration.rb#23
def coerce(other); end
# source://activesupport//lib/active_support/duration.rb#17
def to_f(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/duration.rb#17
def to_i(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/duration.rb#17
def to_s(*_arg0, **_arg1, &_arg2); end
# Returns the value of attribute value.
#
# source://activesupport//lib/active_support/duration.rb#16
def value; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/duration.rb#93
def variable?; end
private
# source://activesupport//lib/active_support/duration.rb#98
def calculate(op, other); end
# @raise [TypeError]
#
# source://activesupport//lib/active_support/duration.rb#108
def raise_type_error(other); end
end
# source://activesupport//lib/active_support/duration.rb#131
ActiveSupport::Duration::VARIABLE_PARTS = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/core_ext/enumerable.rb#4
module ActiveSupport::EnumerableCoreExt; end
# source://activesupport//lib/active_support/core_ext/enumerable.rb#5
module ActiveSupport::EnumerableCoreExt::Constants
private
# source://activesupport//lib/active_support/core_ext/enumerable.rb#7
def const_missing(name); end
end
# HACK: For performance reasons, Enumerable shouldn't have any constants of its own.
# So we move SoleItemExpectedError into ActiveSupport::EnumerableCoreExt.
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#25
ActiveSupport::EnumerableCoreExt::SoleItemExpectedError = Enumerable::SoleItemExpectedError
# source://activesupport//lib/active_support/environment_inquirer.rb#9
class ActiveSupport::EnvironmentInquirer < ::ActiveSupport::StringInquirer
# @raise [ArgumentError]
# @return [EnvironmentInquirer] a new instance of EnvironmentInquirer
#
# source://activesupport//lib/active_support/environment_inquirer.rb#15
def initialize(env); end
# source://activesupport//lib/active_support/environment_inquirer.rb#29
def development?; end
# Returns true if we're in the development or test environment.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/environment_inquirer.rb#36
def local?; end
# source://activesupport//lib/active_support/environment_inquirer.rb#29
def production?; end
# source://activesupport//lib/active_support/environment_inquirer.rb#29
def test?; end
end
# Optimization for the three default environments, so this inquirer doesn't need to rely on
# the slower delegation through method_missing that StringInquirer would normally entail.
#
# source://activesupport//lib/active_support/environment_inquirer.rb#10
ActiveSupport::EnvironmentInquirer::DEFAULT_ENVIRONMENTS = T.let(T.unsafe(nil), Array)
# Environments that'll respond true for #local?
#
# source://activesupport//lib/active_support/environment_inquirer.rb#13
ActiveSupport::EnvironmentInquirer::LOCAL_ENVIRONMENTS = T.let(T.unsafe(nil), Array)
# = Active Support \Error Reporter
#
# +ActiveSupport::ErrorReporter+ is a common interface for error reporting services.
#
# To rescue and report any unhandled error, you can use the #handle method:
#
# Rails.error.handle do
# do_something!
# end
#
# If an error is raised, it will be reported and swallowed.
#
# Alternatively, if you want to report the error but not swallow it, you can use #record:
#
# Rails.error.record do
# do_something!
# end
#
# Both methods can be restricted to handle only a specific error class:
#
# maybe_tags = Rails.error.handle(Redis::BaseError) { redis.get("tags") }
#
# source://activesupport//lib/active_support/error_reporter.rb#26
class ActiveSupport::ErrorReporter
# @return [ErrorReporter] a new instance of ErrorReporter
#
# source://activesupport//lib/active_support/error_reporter.rb#35
def initialize(*subscribers, logger: T.unsafe(nil)); end
# Returns the value of attribute debug_mode.
#
# source://activesupport//lib/active_support/error_reporter.rb#31
def debug_mode; end
# Sets the attribute debug_mode
#
# @param value the value to set the attribute debug_mode to.
#
# source://activesupport//lib/active_support/error_reporter.rb#31
def debug_mode=(_arg0); end
# Prevent a subscriber from being notified of errors for the
# duration of the block. You may pass in the subscriber itself, or its class.
#
# This can be helpful for error reporting service integrations, when they wish
# to handle any errors higher in the stack.
#
# source://activesupport//lib/active_support/error_reporter.rb#185
def disable(subscriber); end
# Evaluates the given block, reporting and swallowing any unhandled error.
# If no error is raised, returns the return value of the block. Otherwise,
# returns the result of +fallback.call+, or +nil+ if +fallback+ is not
# specified.
#
# # Will report a TypeError to all subscribers and return nil.
# Rails.error.handle do
# 1 + '1'
# end
#
# Can be restricted to handle only specific error classes:
#
# maybe_tags = Rails.error.handle(Redis::BaseError) { redis.get("tags") }
#
# ==== Options
#
# * +:severity+ - This value is passed along to subscribers to indicate how
# important the error report is. Can be +:error+, +:warning+, or +:info+.
# Defaults to +:warning+.
#
# * +:context+ - Extra information that is passed along to subscribers. For
# example:
#
# Rails.error.handle(context: { section: "admin" }) do
# # ...
# end
#
# * +:fallback+ - A callable that provides +handle+'s return value when an
# unhandled error is raised. For example:
#
# user = Rails.error.handle(fallback: -> { User.anonymous }) do
# User.find_by(params)
# end
#
# * +:source+ - This value is passed along to subscribers to indicate the
# source of the error. Subscribers can use this value to ignore certain
# errors. Defaults to <tt>"application"</tt>.
#
# source://activesupport//lib/active_support/error_reporter.rb#78
def handle(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), fallback: T.unsafe(nil), source: T.unsafe(nil)); end
# Returns the value of attribute logger.
#
# source://activesupport//lib/active_support/error_reporter.rb#31
def logger; end
# Sets the attribute logger
#
# @param value the value to set the attribute logger to.
#
# source://activesupport//lib/active_support/error_reporter.rb#31
def logger=(_arg0); end
# Evaluates the given block, reporting and re-raising any unhandled error.
# If no error is raised, returns the return value of the block.
#
# # Will report a TypeError to all subscribers and re-raise it.
# Rails.error.record do
# 1 + '1'
# end
#
# Can be restricted to handle only specific error classes:
#
# tags = Rails.error.record(Redis::BaseError) { redis.get("tags") }
#
# ==== Options
#
# * +:severity+ - This value is passed along to subscribers to indicate how
# important the error report is. Can be +:error+, +:warning+, or +:info+.
# Defaults to +:error+.
#
# * +:context+ - Extra information that is passed along to subscribers. For
# example:
#
# Rails.error.record(context: { section: "admin" }) do
# # ...
# end
#
# * +:source+ - This value is passed along to subscribers to indicate the
# source of the error. Subscribers can use this value to ignore certain
# errors. Defaults to <tt>"application"</tt>.
#
# source://activesupport//lib/active_support/error_reporter.rb#114
def record(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end
# Report an error directly to subscribers. You can use this method when the
# block-based #handle and #record methods are not suitable.
#
# Rails.error.report(error)
#
# source://activesupport//lib/active_support/error_reporter.rb#210
def report(error, handled: T.unsafe(nil), severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end
# Update the execution context that is accessible to error subscribers. Any
# context passed to #handle, #record, or #report will be merged with the
# context set here.
#
# Rails.error.set_context(section: "checkout", user_id: @user.id)
#
# source://activesupport//lib/active_support/error_reporter.rb#201
def set_context(*_arg0, **_arg1, &_arg2); end
# Register a new error subscriber. The subscriber must respond to
#
# report(Exception, handled: Boolean, severity: (:error OR :warning OR :info), context: Hash, source: String)
#
# The +report+ method <b>should never</b> raise an error.
#
# source://activesupport//lib/active_support/error_reporter.rb#161
def subscribe(subscriber); end
# Either report the given error when in production, or raise it when in development or test.
#
# When called in production, after the error is reported, this method will return
# nil and execution will continue.
#
# When called in development, the original error is wrapped in a different error class to ensure
# it's not being rescued higher in the stack and will be surfaced to the developer.
#
# This method is intended for reporting violated assertions about preconditions, or similar
# cases that can and should be gracefully handled in production, but that aren't supposed to happen.
#
# The error can be either an exception instance or a String.
#
# example:
#
# def edit
# if published?
# Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible")
# return false
# end
# # ...
# end
#
# source://activesupport//lib/active_support/error_reporter.rb#145
def unexpected(error, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end
# Unregister an error subscriber. Accepts either a subscriber or a class.
#
# subscriber = MyErrorSubscriber.new
# Rails.error.subscribe(subscriber)
#
# Rails.error.unsubscribe(subscriber)
# # or
# Rails.error.unsubscribe(MyErrorSubscriber)
#
# source://activesupport//lib/active_support/error_reporter.rb#176
def unsubscribe(subscriber); end
end
# source://activesupport//lib/active_support/error_reporter.rb#29
ActiveSupport::ErrorReporter::DEFAULT_RESCUE = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/error_reporter.rb#28
ActiveSupport::ErrorReporter::DEFAULT_SOURCE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/error_reporter.rb#27
ActiveSupport::ErrorReporter::SEVERITIES = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/error_reporter.rb#33
class ActiveSupport::ErrorReporter::UnexpectedError < ::Exception; end
# source://activesupport//lib/active_support/execution_context.rb#4
module ActiveSupport::ExecutionContext
class << self
# source://activesupport//lib/active_support/execution_context.rb#34
def []=(key, value); end
# source://activesupport//lib/active_support/execution_context.rb#7
def after_change(&block); end
# source://activesupport//lib/active_support/execution_context.rb#43
def clear; end
# Updates the execution context. If a block is given, it resets the provided keys to their
# previous value once the block exits.
#
# source://activesupport//lib/active_support/execution_context.rb#13
def set(**options); end
# source://activesupport//lib/active_support/execution_context.rb#39
def to_h; end
private
# source://activesupport//lib/active_support/execution_context.rb#48
def store; end
end
end
# source://activesupport//lib/active_support/execution_wrapper.rb#7
class ActiveSupport::ExecutionWrapper
include ::ActiveSupport::Callbacks
extend ::ActiveSupport::Callbacks::ClassMethods
extend ::ActiveSupport::DescendantsTracker
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks?; end
# source://activesupport//lib/active_support/callbacks.rb#924
def _complete_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#924
def _run_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#912
def _run_complete_callbacks(&block); end
# source://activesupport//lib/active_support/callbacks.rb#912
def _run_run_callbacks(&block); end
# source://activesupport//lib/active_support/execution_wrapper.rb#141
def complete; end
# Complete this in-flight execution. This method *must* be called
# exactly once on the result of any call to +run!+.
#
# Where possible, prefer +wrap+.
#
# source://activesupport//lib/active_support/execution_wrapper.rb#135
def complete!; end
# source://activesupport//lib/active_support/execution_wrapper.rb#127
def run; end
# source://activesupport//lib/active_support/execution_wrapper.rb#122
def run!; end
private
# source://activesupport//lib/active_support/execution_wrapper.rb#146
def hook_state; end
class << self
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks=(value); end
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks?; end
# source://activesupport//lib/active_support/callbacks.rb#916
def _complete_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#920
def _complete_callbacks=(value); end
# source://activesupport//lib/active_support/callbacks.rb#916
def _run_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#920
def _run_callbacks=(value); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/execution_wrapper.rb#118
def active?; end
# source://activesupport//lib/active_support/execution_wrapper.rb#114
def active_key; end
# source://activesupport//lib/active_support/execution_wrapper.rb#110
def error_reporter; end
# source://activesupport//lib/active_support/execution_wrapper.rb#100
def perform; end
# Register an object to be invoked during both the +run+ and
# +complete+ steps.
#
# +hook.complete+ will be passed the value returned from +hook.run+,
# and will only be invoked if +run+ has previously been called.
# (Mostly, this means it won't be invoked if an exception occurs in
# a preceding +to_run+ block; all ordinary +to_complete+ blocks are
# invoked in that situation.)
#
# source://activesupport//lib/active_support/execution_wrapper.rb#50
def register_hook(hook, outer: T.unsafe(nil)); end
# Run this execution.
#
# Returns an instance, whose +complete!+ method *must* be invoked
# after the work has been performed.
#
# Where possible, prefer +wrap+.
#
# source://activesupport//lib/active_support/execution_wrapper.rb#66
def run!(reset: T.unsafe(nil)); end
# source://activesupport//lib/active_support/execution_wrapper.rb#21
def to_complete(*args, &block); end
# source://activesupport//lib/active_support/execution_wrapper.rb#17
def to_run(*args, &block); end
# Perform the work in the supplied block as an execution.
#
# source://activesupport//lib/active_support/execution_wrapper.rb#86
def wrap(source: T.unsafe(nil)); end
end
end
# source://activesupport//lib/active_support/execution_wrapper.rb#32
class ActiveSupport::ExecutionWrapper::CompleteHook < ::Struct
# source://activesupport//lib/active_support/execution_wrapper.rb#33
def after(target); end
# source://activesupport//lib/active_support/execution_wrapper.rb#33
def before(target); end
# Returns the value of attribute hook
#
# @return [Object] the current value of hook
def hook; end
# Sets the attribute hook
#
# @param value [Object] the value to set the attribute hook to.
# @return [Object] the newly set value
def hook=(_); end
class << self
def [](*_arg0); end
def inspect; end
def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
# source://activesupport//lib/active_support/execution_wrapper.rb#10
ActiveSupport::ExecutionWrapper::Null = T.let(T.unsafe(nil), Object)
# source://activesupport//lib/active_support/execution_wrapper.rb#25
class ActiveSupport::ExecutionWrapper::RunHook < ::Struct
# source://activesupport//lib/active_support/execution_wrapper.rb#26
def before(target); end
# Returns the value of attribute hook
#
# @return [Object] the current value of hook
def hook; end
# Sets the attribute hook
#
# @param value [Object] the value to set the attribute hook to.
# @return [Object] the newly set value
def hook=(_); end
class << self
def [](*_arg0); end
def inspect; end
def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
# source://activesupport//lib/active_support/executor.rb#6
class ActiveSupport::Executor < ::ActiveSupport::ExecutionWrapper; end
# = \File Update Checker
#
# FileUpdateChecker specifies the API used by \Rails to watch files
# and control reloading. The API depends on four methods:
#
# * +initialize+ which expects two parameters and one block as
# described below.
#
# * +updated?+ which returns a boolean if there were updates in
# the filesystem or not.
#
# * +execute+ which executes the given block on initialization
# and updates the latest watched files and timestamp.
#
# * +execute_if_updated+ which just executes the block if it was updated.
#
# After initialization, a call to +execute_if_updated+ must execute
# the block only if there was really a change in the filesystem.
#
# This class is used by \Rails to reload the I18n framework whenever
# they are changed upon a new request.
#
# i18n_reloader = ActiveSupport::FileUpdateChecker.new(paths) do
# I18n.reload!
# end
#
# ActiveSupport::Reloader.to_prepare do
# i18n_reloader.execute_if_updated
# end
#
# source://activesupport//lib/active_support/file_update_checker.rb#35
class ActiveSupport::FileUpdateChecker
# It accepts two parameters on initialization. The first is an array
# of files and the second is an optional hash of directories. The hash must
# have directories as keys and the value is an array of extensions to be
# watched under that directory.
#
# This method must also receive a block that will be called once a path
# changes. The array of files and list of directories cannot be changed
# after FileUpdateChecker has been initialized.
#
# @return [FileUpdateChecker] a new instance of FileUpdateChecker
#
# source://activesupport//lib/active_support/file_update_checker.rb#44
def initialize(files, dirs = T.unsafe(nil), &block); end
# Executes the given block and updates the latest watched files and
# timestamp.
#
# source://activesupport//lib/active_support/file_update_checker.rb#82
def execute; end
# Execute the block given if updated.
#
# source://activesupport//lib/active_support/file_update_checker.rb#92
def execute_if_updated; end
# Check if any of the entries were updated. If so, the watched and/or
# updated_at values are cached until the block is executed via +execute+
# or +execute_if_updated+.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/file_update_checker.rb#63
def updated?; end
private
# source://activesupport//lib/active_support/file_update_checker.rb#158
def compile_ext(array); end
# source://activesupport//lib/active_support/file_update_checker.rb#144
def compile_glob(hash); end
# source://activesupport//lib/active_support/file_update_checker.rb#154
def escape(key); end
# This method returns the maximum mtime of the files in +paths+, or +nil+
# if the array is empty.
#
# Files with a mtime in the future are ignored. Such abnormal situation
# can happen for example if the user changes the clock by hand. It is
# healthy to consider this edge case because with mtimes in the future
# reloading is not triggered.
#
# source://activesupport//lib/active_support/file_update_checker.rb#122
def max_mtime(paths); end
# source://activesupport//lib/active_support/file_update_checker.rb#111
def updated_at(paths); end
# source://activesupport//lib/active_support/file_update_checker.rb#103
def watched; end
end
# source://activesupport//lib/active_support/fork_tracker.rb#4
module ActiveSupport::ForkTracker
class << self
# source://activesupport//lib/active_support/fork_tracker.rb#31
def after_fork(&block); end
# source://activesupport//lib/active_support/fork_tracker.rb#19
def after_fork_callback; end
# source://activesupport//lib/active_support/fork_tracker.rb#27
def hook!; end
# source://activesupport//lib/active_support/fork_tracker.rb#36
def unregister(callback); end
end
end
# source://activesupport//lib/active_support/fork_tracker.rb#5
module ActiveSupport::ForkTracker::CoreExt
# source://activesupport//lib/active_support/fork_tracker.rb#6
def _fork; end
end
# = Active Support \Gzip
#
# A convenient wrapper for the zlib standard library that allows
# compression/decompression of strings with gzip.
#
# gzip = ActiveSupport::Gzip.compress('compress me!')
# # => "\x1F\x8B\b\x00o\x8D\xCDO\x00\x03K\xCE\xCF-(J-.V\xC8MU\x04\x00R>n\x83\f\x00\x00\x00"
#
# ActiveSupport::Gzip.decompress(gzip)
# # => "compress me!"
#
# source://activesupport//lib/active_support/gzip.rb#17
module ActiveSupport::Gzip
class << self
# Compresses a string using gzip.
#
# source://activesupport//lib/active_support/gzip.rb#32
def compress(source, level = T.unsafe(nil), strategy = T.unsafe(nil)); end
# Decompresses a gzipped string.
#
# source://activesupport//lib/active_support/gzip.rb#27
def decompress(source); end
end
end
# source://activesupport//lib/active_support/gzip.rb#18
class ActiveSupport::Gzip::Stream < ::StringIO
# @return [Stream] a new instance of Stream
#
# source://activesupport//lib/active_support/gzip.rb#19
def initialize(*_arg0); end
# source://activesupport//lib/active_support/gzip.rb#23
def close; end
end
# = Active Support \Inflector
#
# The Inflector transforms words from singular to plural, class names to table
# names, modularized class names to ones without, and class names to foreign
# keys. The default inflections for pluralization, singularization, and
# uncountable words are kept in inflections.rb.
#
# The \Rails core team has stated patches for the inflections library will not
# be accepted in order to avoid breaking legacy applications which may be
# relying on errant inflections. If you discover an incorrect inflection and
# require it for your application or wish to define rules for languages other
# than English, please correct or add them yourself (explained below).
#
# source://activesupport//lib/active_support/inflector/inflections.rb#7
module ActiveSupport::Inflector
extend ::ActiveSupport::Inflector
# Converts strings to UpperCamelCase.
# If the +uppercase_first_letter+ parameter is set to false, then produces
# lowerCamelCase.
#
# Also converts '/' to '::' which is useful for converting
# paths to namespaces.
#
# camelize('active_model') # => "ActiveModel"
# camelize('active_model', false) # => "activeModel"
# camelize('active_model/errors') # => "ActiveModel::Errors"
# camelize('active_model/errors', false) # => "activeModel::Errors"
#
# As a rule of thumb you can think of +camelize+ as the inverse of
# #underscore, though there are cases where that does not hold:
#
# camelize(underscore('SSLError')) # => "SslError"
#
# source://activesupport//lib/active_support/inflector/methods.rb#70
def camelize(term, uppercase_first_letter = T.unsafe(nil)); end
# Creates a class name from a plural table name like \Rails does for table
# names to models. Note that this returns a string and not a Class. (To
# convert to an actual class follow +classify+ with #constantize.)
#
# classify('ham_and_eggs') # => "HamAndEgg"
# classify('posts') # => "Post"
#
# Singular names are not handled correctly:
#
# classify('calculus') # => "Calculu"
#
# source://activesupport//lib/active_support/inflector/methods.rb#218
def classify(table_name); end
# Tries to find a constant with the name specified in the argument string.
#
# constantize('Module') # => Module
# constantize('Foo::Bar') # => Foo::Bar
#
# The name is assumed to be the one of a top-level constant, no matter
# whether it starts with "::" or not. No lexical context is taken into
# account:
#
# C = 'outside'
# module M
# C = 'inside'
# C # => 'inside'
# constantize('C') # => 'outside', same as ::C
# end
#
# NameError is raised when the name is not in CamelCase or the constant is
# unknown.
#
# source://activesupport//lib/active_support/inflector/methods.rb#289
def constantize(camel_cased_word); end
# Replaces underscores with dashes in the string.
#
# dasherize('puni_puni') # => "puni-puni"
#
# source://activesupport//lib/active_support/inflector/methods.rb#226
def dasherize(underscored_word); end
# Removes the rightmost segment from the constant expression in the string.
#
# deconstantize('Net::HTTP') # => "Net"
# deconstantize('::Net::HTTP') # => "::Net"
# deconstantize('String') # => ""
# deconstantize('::String') # => ""
# deconstantize('') # => ""
#
# See also #demodulize.
#
# source://activesupport//lib/active_support/inflector/methods.rb#256
def deconstantize(path); end
# Removes the module part from the expression in the string.
#
# demodulize('ActiveSupport::Inflector::Inflections') # => "Inflections"
# demodulize('Inflections') # => "Inflections"
# demodulize('::Inflections') # => "Inflections"
# demodulize('') # => ""
#
# See also #deconstantize.
#
# source://activesupport//lib/active_support/inflector/methods.rb#238
def demodulize(path); end
# Converts the first character in the string to lowercase.
#
# downcase_first('If they enjoyed The Matrix') # => "if they enjoyed The Matrix"
# downcase_first('I') # => "i"
# downcase_first('') # => ""
#
# source://activesupport//lib/active_support/inflector/methods.rb#175
def downcase_first(string); end
# Creates a foreign key name from a class name.
# +separate_class_name_and_id_with_underscore+ sets whether
# the method should put '_' between the name and 'id'.
#
# foreign_key('Message') # => "message_id"
# foreign_key('Message', false) # => "messageid"
# foreign_key('Admin::Post') # => "post_id"
#
# source://activesupport//lib/active_support/inflector/methods.rb#267
def foreign_key(class_name, separate_class_name_and_id_with_underscore = T.unsafe(nil)); end
# Tweaks an attribute name for display to end users.
#
# Specifically, performs these transformations:
#
# * Applies human inflection rules to the argument.
# * Deletes leading underscores, if any.
# * Removes an "_id" suffix if present.
# * Replaces underscores with spaces, if any.
# * Downcases all words except acronyms.
# * Capitalizes the first word.
# The capitalization of the first word can be turned off by setting the
# +:capitalize+ option to false (default is true).
#
# The trailing '_id' can be kept and capitalized by setting the
# optional parameter +keep_id_suffix+ to true (default is false).
#
# humanize('employee_salary') # => "Employee salary"
# humanize('author_id') # => "Author"
# humanize('author_id', capitalize: false) # => "author"
# humanize('_id') # => "Id"
# humanize('author_id', keep_id_suffix: true) # => "Author id"
#
# If "SSL" was defined to be an acronym:
#
# humanize('ssl_error') # => "SSL error"
#
# source://activesupport//lib/active_support/inflector/methods.rb#135
def humanize(lower_case_and_underscored_word, capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end
# Yields a singleton instance of Inflector::Inflections so you can specify
# additional inflector rules. If passed an optional locale, rules for other
# languages can be specified. If not specified, defaults to <tt>:en</tt>.
# Only rules for English are provided.
#
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.uncountable 'rails'
# end
#
# source://activesupport//lib/active_support/inflector/inflections.rb#265
def inflections(locale = T.unsafe(nil)); end
# Returns the suffix that should be added to a number to denote the position
# in an ordered sequence such as 1st, 2nd, 3rd, 4th.
#
# ordinal(1) # => "st"
# ordinal(2) # => "nd"
# ordinal(1002) # => "nd"
# ordinal(1003) # => "rd"
# ordinal(-11) # => "th"
# ordinal(-1021) # => "st"
#
# source://activesupport//lib/active_support/inflector/methods.rb#334
def ordinal(number); end
# Turns a number into an ordinal string used to denote the position in an
# ordered sequence such as 1st, 2nd, 3rd, 4th.
#
# ordinalize(1) # => "1st"
# ordinalize(2) # => "2nd"
# ordinalize(1002) # => "1002nd"
# ordinalize(1003) # => "1003rd"
# ordinalize(-11) # => "-11th"
# ordinalize(-1021) # => "-1021st"
#
# source://activesupport//lib/active_support/inflector/methods.rb#347
def ordinalize(number); end
# Replaces special characters in a string so that it may be used as part of
# a 'pretty' URL.
#
# parameterize("Donald E. Knuth") # => "donald-e-knuth"
# parameterize("^très|Jolie-- ") # => "tres-jolie"
#
# To use a custom separator, override the +separator+ argument.
#
# parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth"
# parameterize("^très|Jolie__ ", separator: '_') # => "tres_jolie"
#
# To preserve the case of the characters in a string, use the +preserve_case+ argument.
#
# parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth"
# parameterize("^très|Jolie-- ", preserve_case: true) # => "tres-Jolie"
#
# It preserves dashes and underscores unless they are used as separators:
#
# parameterize("^très|Jolie__ ") # => "tres-jolie__"
# parameterize("^très|Jolie-- ", separator: "_") # => "tres_jolie--"
# parameterize("^très_Jolie-- ", separator: ".") # => "tres_jolie--"
#
# If the optional parameter +locale+ is specified,
# the word will be parameterized as a word of that language.
# By default, this parameter is set to <tt>nil</tt> and it will use
# the configured <tt>I18n.locale</tt>.
#
# source://activesupport//lib/active_support/inflector/transliterate.rb#123
def parameterize(string, separator: T.unsafe(nil), preserve_case: T.unsafe(nil), locale: T.unsafe(nil)); end
# Returns the plural form of the word in the string.
#
# If passed an optional +locale+ parameter, the word will be
# pluralized using rules defined for that language. By default,
# this parameter is set to <tt>:en</tt>.
#
# pluralize('post') # => "posts"
# pluralize('octopus') # => "octopi"
# pluralize('sheep') # => "sheep"
# pluralize('words') # => "words"
# pluralize('CamelOctopus') # => "CamelOctopi"
# pluralize('ley', :es) # => "leyes"
#
# source://activesupport//lib/active_support/inflector/methods.rb#33
def pluralize(word, locale = T.unsafe(nil)); end
# Tries to find a constant with the name specified in the argument string.
#
# safe_constantize('Module') # => Module
# safe_constantize('Foo::Bar') # => Foo::Bar
#
# The name is assumed to be the one of a top-level constant, no matter
# whether it starts with "::" or not. No lexical context is taken into
# account:
#
# C = 'outside'
# module M
# C = 'inside'
# C # => 'inside'
# safe_constantize('C') # => 'outside', same as ::C
# end
#
# +nil+ is returned when the name is not in CamelCase or the constant (or
# part of it) is unknown.
#
# safe_constantize('blargle') # => nil
# safe_constantize('UnknownModule') # => nil
# safe_constantize('UnknownModule::Foo::Bar') # => nil
#
# source://activesupport//lib/active_support/inflector/methods.rb#315
def safe_constantize(camel_cased_word); end
# The reverse of #pluralize, returns the singular form of a word in a
# string.
#
# If passed an optional +locale+ parameter, the word will be
# singularized using rules defined for that language. By default,
# this parameter is set to <tt>:en</tt>.
#
# singularize('posts') # => "post"
# singularize('octopi') # => "octopus"
# singularize('sheep') # => "sheep"
# singularize('word') # => "word"
# singularize('CamelOctopi') # => "CamelOctopus"
# singularize('leyes', :es) # => "ley"
#
# source://activesupport//lib/active_support/inflector/methods.rb#50
def singularize(word, locale = T.unsafe(nil)); end
# Creates the name of a table like \Rails does for models to table names.
# This method uses the #pluralize method on the last word in the string.
#
# tableize('RawScaledScorer') # => "raw_scaled_scorers"
# tableize('ham_and_egg') # => "ham_and_eggs"
# tableize('fancyCategory') # => "fancy_categories"
#
# source://activesupport//lib/active_support/inflector/methods.rb#204
def tableize(class_name); end
# Capitalizes all the words and replaces some characters in the string to
# create a nicer looking title. +titleize+ is meant for creating pretty
# output. It is not used in the \Rails internals.
#
# The trailing '_id','Id'.. can be kept and capitalized by setting the
# optional parameter +keep_id_suffix+ to true.
# By default, this parameter is false.
#
# titleize('man from the boondocks') # => "Man From The Boondocks"
# titleize('x-men: the last stand') # => "X Men: The Last Stand"
# titleize('TheManWithoutAPast') # => "The Man Without A Past"
# titleize('raiders_of_the_lost_ark') # => "Raiders Of The Lost Ark"
# titleize('string_ending_with_id', keep_id_suffix: true) # => "String Ending With Id"
#
# source://activesupport//lib/active_support/inflector/methods.rb#192
def titleize(word, keep_id_suffix: T.unsafe(nil)); end
# Replaces non-ASCII characters with an ASCII approximation, or if none
# exists, a replacement character which defaults to "?".
#
# transliterate('Ærøskøbing')
# # => "AEroskobing"
#
# Default approximations are provided for Western/Latin characters,
# e.g, "ø", "ñ", "é", "ß", etc.
#
# This method is I18n aware, so you can set up custom approximations for a
# locale. This can be useful, for example, to transliterate German's "ü"
# and "ö" to "ue" and "oe", or to add support for transliterating Russian
# to ASCII.
#
# In order to make your custom transliterations available, you must set
# them as the <tt>i18n.transliterate.rule</tt> i18n key:
#
# # Store the transliterations in locales/de.yml
# i18n:
# transliterate:
# rule:
# ü: "ue"
# ö: "oe"
#
# # Or set them using Ruby
# I18n.backend.store_translations(:de, i18n: {
# transliterate: {
# rule: {
# 'ü' => 'ue',
# 'ö' => 'oe'
# }
# }
# })
#
# The value for <tt>i18n.transliterate.rule</tt> can be a simple Hash that
# maps characters to ASCII approximations as shown above, or, for more
# complex requirements, a Proc:
#
# I18n.backend.store_translations(:de, i18n: {
# transliterate: {
# rule: ->(string) { MyTransliterator.transliterate(string) }
# }
# })
#
# Now you can have different transliterations for each locale:
#
# transliterate('Jürgen', locale: :en)
# # => "Jurgen"
#
# transliterate('Jürgen', locale: :de)
# # => "Juergen"
#
# Transliteration is restricted to UTF-8, US-ASCII, and GB18030 strings.
# Other encodings will raise an ArgumentError.
#
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/inflector/transliterate.rb#64
def transliterate(string, replacement = T.unsafe(nil), locale: T.unsafe(nil)); end
# Makes an underscored, lowercase form from the expression in the string.
#
# Changes '::' to '/' to convert namespaces to paths.
#
# underscore('ActiveModel') # => "active_model"
# underscore('ActiveModel::Errors') # => "active_model/errors"
#
# As a rule of thumb you can think of +underscore+ as the inverse of
# #camelize, though there are cases where that does not hold:
#
# camelize(underscore('SSLError')) # => "SslError"
#
# source://activesupport//lib/active_support/inflector/methods.rb#99
def underscore(camel_cased_word); end
# Converts the first character in the string to uppercase.
#
# upcase_first('what a Lovely Day') # => "What a Lovely Day"
# upcase_first('w') # => "W"
# upcase_first('') # => ""
#
# source://activesupport//lib/active_support/inflector/methods.rb#166
def upcase_first(string); end
private
# Applies inflection rules for +singularize+ and +pluralize+.
#
# If passed an optional +locale+ parameter, the uncountables will be
# found for that locale.
#
# apply_inflections('post', inflections.plurals, :en) # => "posts"
# apply_inflections('posts', inflections.singulars, :en) # => "post"
#
# source://activesupport//lib/active_support/inflector/methods.rb#376
def apply_inflections(word, rules, locale = T.unsafe(nil)); end
# Mounts a regular expression, returned as a string to ease interpolation,
# that will match part by part the given constant.
#
# const_regexp("Foo::Bar::Baz") # => "Foo(::Bar(::Baz)?)?"
# const_regexp("::") # => "::"
#
# source://activesupport//lib/active_support/inflector/methods.rb#357
def const_regexp(camel_cased_word); end
end
# source://activesupport//lib/active_support/inflector/transliterate.rb#8
ActiveSupport::Inflector::ALLOWED_ENCODINGS_FOR_TRANSLITERATE = T.let(T.unsafe(nil), Array)
# = Active Support \Inflections
#
# A singleton instance of this class is yielded by Inflector.inflections,
# which can then be used to specify additional inflection rules. If passed
# an optional locale, rules for other languages can be specified. The
# default locale is <tt>:en</tt>. Only rules for English are provided.
#
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, '\1\2en'
# inflect.singular /^(ox)en/i, '\1'
#
# inflect.irregular 'cactus', 'cacti'
#
# inflect.uncountable 'equipment'
# end
#
# New rules are added at the top. So in the example above, the irregular
# rule for cactus will now be the first of the pluralization and
# singularization rules that is runs. This guarantees that your rules run
# before any of the rules that may already have been loaded.
#
# source://activesupport//lib/active_support/inflector/inflections.rb#30
class ActiveSupport::Inflector::Inflections
# @return [Inflections] a new instance of Inflections
#
# source://activesupport//lib/active_support/inflector/inflections.rb#80
def initialize; end
# Specifies a new acronym. An acronym must be specified as it will appear
# in a camelized string. An underscore string that contains the acronym
# will retain the acronym when passed to +camelize+, +humanize+, or
# +titleize+. A camelized string that contains the acronym will maintain
# the acronym when titleized or humanized, and will convert the acronym
# into a non-delimited single lowercase word when passed to +underscore+.
#
# acronym 'HTML'
# titleize 'html' # => 'HTML'
# camelize 'html' # => 'HTML'
# underscore 'MyHTML' # => 'my_html'
#
# The acronym, however, must occur as a delimited unit and not be part of
# another word for conversions to recognize it:
#
# acronym 'HTTP'
# camelize 'my_http_delimited' # => 'MyHTTPDelimited'
# camelize 'https' # => 'Https', not 'HTTPs'
# underscore 'HTTPS' # => 'http_s', not 'https'
#
# acronym 'HTTPS'
# camelize 'https' # => 'HTTPS'
# underscore 'HTTPS' # => 'https'
#
# Note: Acronyms that are passed to +pluralize+ will no longer be
# recognized, since the acronym will not occur as a delimited unit in the
# pluralized result. To work around this, you must specify the pluralized
# form as an acronym as well:
#
# acronym 'API'
# camelize(pluralize('api')) # => 'Apis'
#
# acronym 'APIs'
# camelize(pluralize('api')) # => 'APIs'
#
# +acronym+ may be used to specify any word that contains an acronym or
# otherwise needs to maintain a non-standard capitalization. The only
# restriction is that the word must begin with a capital letter.
#
# acronym 'RESTful'
# underscore 'RESTful' # => 'restful'
# underscore 'RESTfulController' # => 'restful_controller'
# titleize 'RESTfulController' # => 'RESTful Controller'
# camelize 'restful' # => 'RESTful'
# camelize 'restful_controller' # => 'RESTfulController'
#
# acronym 'McDonald'
# underscore 'McDonald' # => 'mcdonald'
# camelize 'mcdonald' # => 'McDonald'
#
# source://activesupport//lib/active_support/inflector/inflections.rb#142
def acronym(word); end
# Returns the value of attribute acronyms.
#
# source://activesupport//lib/active_support/inflector/inflections.rb#76
def acronyms; end
# source://activesupport//lib/active_support/inflector/inflections.rb#78
def acronyms_camelize_regex; end
# source://activesupport//lib/active_support/inflector/inflections.rb#78
def acronyms_underscore_regex; end
# Clears the loaded inflections within a given scope (default is
# <tt>:all</tt>). Give the scope as a symbol of the inflection type, the
# options are: <tt>:plurals</tt>, <tt>:singulars</tt>, <tt>:uncountables</tt>,
# <tt>:humans</tt>, <tt>:acronyms</tt>.
#
# clear :all
# clear :plurals
#
# source://activesupport//lib/active_support/inflector/inflections.rb#231
def clear(scope = T.unsafe(nil)); end
# Specifies a humanized form of a string by a regular expression rule or
# by a string mapping. When using a regular expression based replacement,
# the normal humanize formatting is called after the replacement. When a
# string is used, the human form should be specified as desired (example:
# 'The name', not 'the_name').
#
# human /_cnt$/i, '\1_count'
# human 'legacy_col_person_name', 'Name'
#
# source://activesupport//lib/active_support/inflector/inflections.rb#220
def human(rule, replacement); end
# Returns the value of attribute humans.
#
# source://activesupport//lib/active_support/inflector/inflections.rb#76
def humans; end
# Specifies a new irregular that applies to both pluralization and
# singularization at the same time. This can only be used for strings, not
# regular expressions. You simply pass the irregular in singular and
# plural form.
#
# irregular 'cactus', 'cacti'
# irregular 'person', 'people'
#
# source://activesupport//lib/active_support/inflector/inflections.rb#174
def irregular(singular, plural); end
# Specifies a new pluralization rule and its replacement. The rule can
# either be a string or a regular expression. The replacement should
# always be a string that may include references to the matched data from
# the rule.
#
# source://activesupport//lib/active_support/inflector/inflections.rb#151
def plural(rule, replacement); end
# Returns the value of attribute plurals.
#
# source://activesupport//lib/active_support/inflector/inflections.rb#76
def plurals; end
# Specifies a new singularization rule and its replacement. The rule can
# either be a string or a regular expression. The replacement should
# always be a string that may include references to the matched data from
# the rule.
#
# source://activesupport//lib/active_support/inflector/inflections.rb#161
def singular(rule, replacement); end
# Returns the value of attribute singulars.
#
# source://activesupport//lib/active_support/inflector/inflections.rb#76
def singulars; end
# Specifies words that are uncountable and should not be inflected.
#
# uncountable 'money'
# uncountable 'money', 'information'
# uncountable %w( money information rice )
#
# source://activesupport//lib/active_support/inflector/inflections.rb#208
def uncountable(*words); end
# Returns the value of attribute uncountables.
#
# source://activesupport//lib/active_support/inflector/inflections.rb#76
def uncountables; end
private
# source://activesupport//lib/active_support/inflector/inflections.rb#250
def define_acronym_regex_patterns; end
# Private, for the test suite.
#
# source://activesupport//lib/active_support/inflector/inflections.rb#86
def initialize_dup(orig); end
class << self
# source://activesupport//lib/active_support/inflector/inflections.rb#65
def instance(locale = T.unsafe(nil)); end
# source://activesupport//lib/active_support/inflector/inflections.rb#69
def instance_or_fallback(locale); end
end
end
# source://activesupport//lib/active_support/inflector/inflections.rb#33
class ActiveSupport::Inflector::Inflections::Uncountables < ::Array
# @return [Uncountables] a new instance of Uncountables
#
# source://activesupport//lib/active_support/inflector/inflections.rb#34
def initialize; end
# source://activesupport//lib/active_support/inflector/inflections.rb#44
def <<(*word); end
# source://activesupport//lib/active_support/inflector/inflections.rb#48
def add(words); end
# source://activesupport//lib/active_support/inflector/inflections.rb#39
def delete(entry); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/inflector/inflections.rb#55
def uncountable?(str); end
private
# source://activesupport//lib/active_support/inflector/inflections.rb#60
def to_regex(string); end
end
# = Inheritable Options
#
# +InheritableOptions+ provides a constructor to build an OrderedOptions
# hash inherited from another hash.
#
# Use this if you already have some hash and you want to create a new one based on it.
#
# h = ActiveSupport::InheritableOptions.new({ girl: 'Mary', boy: 'John' })
# h.girl # => 'Mary'
# h.boy # => 'John'
#
# If the existing hash has string keys, call Hash#symbolize_keys on it.
#
# h = ActiveSupport::InheritableOptions.new({ 'girl' => 'Mary', 'boy' => 'John' }.symbolize_keys)
# h.girl # => 'Mary'
# h.boy # => 'John'
#
# source://activesupport//lib/active_support/ordered_options.rb#89
class ActiveSupport::InheritableOptions < ::ActiveSupport::OrderedOptions
# @return [InheritableOptions] a new instance of InheritableOptions
#
# source://activesupport//lib/active_support/ordered_options.rb#90
def initialize(parent = T.unsafe(nil)); end
# source://activesupport//lib/active_support/ordered_options.rb#107
def ==(other); end
# source://activesupport//lib/active_support/ordered_options.rb#142
def each(&block); end
# source://activesupport//lib/active_support/ordered_options.rb#134
def inheritable_copy; end
# source://activesupport//lib/active_support/ordered_options.rb#111
def inspect; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/ordered_options.rb#126
def key?(key); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/ordered_options.rb#130
def overridden?(key); end
# source://activesupport//lib/active_support/ordered_options.rb#119
def pretty_print(pp); end
# source://activesupport//lib/active_support/ordered_options.rb#138
def to_a; end
# source://activesupport//lib/active_support/ordered_options.rb#103
def to_h; end
# source://activesupport//lib/active_support/ordered_options.rb#115
def to_s; end
private
def own_key?(_arg0); end
end
# source://activesupport//lib/active_support/isolated_execution_state.rb#6
module ActiveSupport::IsolatedExecutionState
class << self
# source://activesupport//lib/active_support/isolated_execution_state.rb#37
def [](key); end
# source://activesupport//lib/active_support/isolated_execution_state.rb#41
def []=(key, value); end
# source://activesupport//lib/active_support/isolated_execution_state.rb#53
def clear; end
# source://activesupport//lib/active_support/isolated_execution_state.rb#57
def context; end
# source://activesupport//lib/active_support/isolated_execution_state.rb#49
def delete(key); end
# Returns the value of attribute isolation_level.
#
# source://activesupport//lib/active_support/isolated_execution_state.rb#13
def isolation_level; end
# source://activesupport//lib/active_support/isolated_execution_state.rb#15
def isolation_level=(level); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/isolated_execution_state.rb#45
def key?(key); end
# Returns the value of attribute scope.
#
# source://activesupport//lib/active_support/isolated_execution_state.rb#13
def scope; end
# source://activesupport//lib/active_support/isolated_execution_state.rb#61
def share_with(other); end
# source://activesupport//lib/active_support/isolated_execution_state.rb#33
def unique_id; end
private
# source://activesupport//lib/active_support/isolated_execution_state.rb#69
def state; end
end
end
# source://activesupport//lib/active_support/json/decoding.rb#11
module ActiveSupport::JSON
class << self
# Parses a JSON string (JavaScript Object Notation) into a hash.
# See http://www.json.org for more info.
#
# ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}")
# => {"team" => "rails", "players" => "36"}
#
# source://activesupport//lib/active_support/json/decoding.rb#22
def decode(json); end
# source://activesupport//lib/active_support/json/encoding.rb#22
def dump(value, options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/json/encoding.rb#22
def encode(value, options = T.unsafe(nil)); end
# Parses a JSON string (JavaScript Object Notation) into a hash.
# See http://www.json.org for more info.
#
# ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}")
# => {"team" => "rails", "players" => "36"}
#
# source://activesupport//lib/active_support/json/decoding.rb#22
def load(json); end
# Returns the class of the error that will be raised when there is an
# error in decoding JSON. Using this method means you won't directly
# depend on the ActiveSupport's JSON implementation, in case it changes
# in the future.
#
# begin
# obj = ActiveSupport::JSON.decode(some_string)
# rescue ActiveSupport::JSON.parse_error
# Rails.logger.warn("Attempted to decode invalid JSON: #{some_string}")
# end
#
# source://activesupport//lib/active_support/json/decoding.rb#43
def parse_error; end
private
# source://activesupport//lib/active_support/json/decoding.rb#48
def convert_dates_from(data); end
end
end
# source://activesupport//lib/active_support/json/decoding.rb#14
ActiveSupport::JSON::DATETIME_REGEX = T.let(T.unsafe(nil), Regexp)
# matches YAML-formatted dates
#
# source://activesupport//lib/active_support/json/decoding.rb#13
ActiveSupport::JSON::DATE_REGEX = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/json/encoding.rb#28
module ActiveSupport::JSON::Encoding
class << self
# If true, encode >, <, & as escaped unicode sequences (e.g. > as \u003e)
# as a safety measure.
#
# source://activesupport//lib/active_support/json/encoding.rb#103
def escape_html_entities_in_json; end
# If true, encode >, <, & as escaped unicode sequences (e.g. > as \u003e)
# as a safety measure.
#
# source://activesupport//lib/active_support/json/encoding.rb#103
def escape_html_entities_in_json=(_arg0); end
# Sets the encoder used by \Rails to encode Ruby objects into JSON strings
# in +Object#to_json+ and +ActiveSupport::JSON.encode+.
#
# source://activesupport//lib/active_support/json/encoding.rb#111
def json_encoder; end
# Sets the encoder used by \Rails to encode Ruby objects into JSON strings
# in +Object#to_json+ and +ActiveSupport::JSON.encode+.
#
# source://activesupport//lib/active_support/json/encoding.rb#111
def json_encoder=(_arg0); end
# Sets the precision of encoded time values.
# Defaults to 3 (equivalent to millisecond precision)
#
# source://activesupport//lib/active_support/json/encoding.rb#107
def time_precision; end
# Sets the precision of encoded time values.
# Defaults to 3 (equivalent to millisecond precision)
#
# source://activesupport//lib/active_support/json/encoding.rb#107
def time_precision=(_arg0); end
# If true, use ISO 8601 format for dates and times. Otherwise, fall back
# to the Active Support legacy format.
#
# source://activesupport//lib/active_support/json/encoding.rb#99
def use_standard_json_time_format; end
# If true, use ISO 8601 format for dates and times. Otherwise, fall back
# to the Active Support legacy format.
#
# source://activesupport//lib/active_support/json/encoding.rb#99
def use_standard_json_time_format=(_arg0); end
end
end
# source://activesupport//lib/active_support/json/encoding.rb#29
class ActiveSupport::JSON::Encoding::JSONGemEncoder
# @return [JSONGemEncoder] a new instance of JSONGemEncoder
#
# source://activesupport//lib/active_support/json/encoding.rb#32
def initialize(options = T.unsafe(nil)); end
# Encode the given object into a JSON string
#
# source://activesupport//lib/active_support/json/encoding.rb#37
def encode(value); end
# Returns the value of attribute options.
#
# source://activesupport//lib/active_support/json/encoding.rb#30
def options; end
private
# Convert an object into a "JSON-ready" representation composed of
# primitives like Hash, Array, String, Symbol, Numeric,
# and +true+/+false+/+nil+.
# Recursively calls #as_json to the object to recursively build a
# fully JSON-ready object.
#
# This allows developers to implement #as_json without having to
# worry about what base types of objects they are allowed to return
# or having to remember to call #as_json recursively.
#
# Note: the +options+ hash passed to +object.to_json+ is only passed
# to +object.as_json+, not any of this method's recursive +#as_json+
# calls.
#
# source://activesupport//lib/active_support/json/encoding.rb#70
def jsonify(value); end
# Encode a "jsonified" Ruby data structure using the JSON gem
#
# source://activesupport//lib/active_support/json/encoding.rb#91
def stringify(jsonified); end
end
# = Key Generator
#
# KeyGenerator is a simple wrapper around OpenSSL's implementation of PBKDF2.
# It can be used to derive a number of keys for various purposes from a given secret.
# This lets \Rails applications have a single secure secret, but avoid reusing that
# key in multiple incompatible contexts.
#
# source://activesupport//lib/active_support/key_generator.rb#13
class ActiveSupport::KeyGenerator
# @return [KeyGenerator] a new instance of KeyGenerator
#
# source://activesupport//lib/active_support/key_generator.rb#28
def initialize(secret, options = T.unsafe(nil)); end
# Returns a derived key suitable for use. The default +key_size+ is chosen
# to be compatible with the default settings of ActiveSupport::MessageVerifier.
# i.e. <tt>OpenSSL::Digest::SHA1#block_length</tt>
#
# source://activesupport//lib/active_support/key_generator.rb#41
def generate_key(salt, key_size = T.unsafe(nil)); end
# source://activesupport//lib/active_support/key_generator.rb#45
def inspect; end
class << self
# source://activesupport//lib/active_support/key_generator.rb#23
def hash_digest_class; end
# source://activesupport//lib/active_support/key_generator.rb#15
def hash_digest_class=(klass); end
end
end
# = Lazy Load Hooks
#
# LazyLoadHooks allows \Rails to lazily load a lot of components and thus
# making the app boot faster. Because of this feature now there is no need to
# require +ActiveRecord::Base+ at boot time purely to apply
# configuration. Instead a hook is registered that applies configuration once
# +ActiveRecord::Base+ is loaded. Here +ActiveRecord::Base+ is
# used as example but this feature can be applied elsewhere too.
#
# Here is an example where on_load method is called to register a hook.
#
# initializer 'active_record.initialize_timezone' do
# ActiveSupport.on_load(:active_record) do
# self.time_zone_aware_attributes = true
# self.default_timezone = :utc
# end
# end
#
# When the entirety of +ActiveRecord::Base+ has been
# evaluated then run_load_hooks is invoked. The very last line of
# +ActiveRecord::Base+ is:
#
# ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base)
#
# run_load_hooks will then execute all the hooks that were registered
# with the on_load method. In the case of the above example, it will
# execute the block of code that is in the +initializer+.
#
# Registering a hook that has already run results in that hook executing
# immediately. This allows hooks to be nested for code that relies on
# multiple lazily loaded components:
#
# initializer "action_text.renderer" do
# ActiveSupport.on_load(:action_controller_base) do
# ActiveSupport.on_load(:action_text_content) do
# self.default_renderer = Class.new(ActionController::Base).renderer
# end
# end
# end
#
# source://activesupport//lib/active_support/lazy_load_hooks.rb#43
module ActiveSupport::LazyLoadHooks
# Declares a block that will be executed when a \Rails component is fully
# loaded. If the component has already loaded, the block is executed
# immediately.
#
# Options:
#
# * <tt>:yield</tt> - Yields the object that run_load_hooks to +block+.
# * <tt>:run_once</tt> - Given +block+ will run only once.
#
# source://activesupport//lib/active_support/lazy_load_hooks.rb#60
def on_load(name, options = T.unsafe(nil), &block); end
# Executes all blocks registered to +name+ via on_load, using +base+ as the
# evaluation context.
#
# ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base)
#
# In the case of the above example, it will execute all hooks registered
# for +:active_record+ within the class +ActiveRecord::Base+.
#
# source://activesupport//lib/active_support/lazy_load_hooks.rb#75
def run_load_hooks(name, base = T.unsafe(nil)); end
private
# source://activesupport//lib/active_support/lazy_load_hooks.rb#91
def execute_hook(name, base, options, block); end
# source://activesupport//lib/active_support/lazy_load_hooks.rb#83
def with_execution_control(name, block, once); end
class << self
# source://activesupport//lib/active_support/lazy_load_hooks.rb#44
def extended(base); end
end
end
# = Active Support Log \Subscriber
#
# +ActiveSupport::LogSubscriber+ is an object set to consume
# ActiveSupport::Notifications with the sole purpose of logging them.
# The log subscriber dispatches notifications to a registered object based
# on its given namespace.
#
# An example would be Active Record log subscriber responsible for logging
# queries:
#
# module ActiveRecord
# class LogSubscriber < ActiveSupport::LogSubscriber
# attach_to :active_record
#
# def sql(event)
# info "#{event.payload[:name]} (#{event.duration}) #{event.payload[:sql]}"
# end
# end
# end
#
# ActiveRecord::LogSubscriber.logger must be set as well, but it is assigned
# automatically in a \Rails environment.
#
# After configured, whenever a <tt>"sql.active_record"</tt> notification is
# published, it will properly dispatch the event
# (ActiveSupport::Notifications::Event) to the +sql+ method.
#
# Being an ActiveSupport::Notifications consumer,
# +ActiveSupport::LogSubscriber+ exposes a simple interface to check if
# instrumented code raises an exception. It is common to log a different
# message in case of an error, and this can be achieved by extending
# the previous example:
#
# module ActiveRecord
# class LogSubscriber < ActiveSupport::LogSubscriber
# def sql(event)
# exception = event.payload[:exception]
#
# if exception
# exception_object = event.payload[:exception_object]
#
# error "[ERROR] #{event.payload[:name]}: #{exception.join(', ')} " \
# "(#{exception_object.backtrace.first})"
# else
# # standard logger code
# end
# end
# end
# end
#
# +ActiveSupport::LogSubscriber+ also has some helpers to deal with
# logging. For example, ActiveSupport::LogSubscriber.flush_all! will ensure
# that all logs are flushed, and it is called in Rails::Rack::Logger after a
# request finishes.
#
# source://activesupport//lib/active_support/log_subscriber.rb#64
class ActiveSupport::LogSubscriber < ::ActiveSupport::Subscriber
# @return [LogSubscriber] a new instance of LogSubscriber
#
# source://activesupport//lib/active_support/log_subscriber.rb#133
def initialize; end
# source://activesupport//lib/active_support/log_subscriber.rb#146
def call(event); end
# source://activesupport//lib/active_support/log_subscriber.rb#83
def colorize_logging; end
# source://activesupport//lib/active_support/log_subscriber.rb#83
def colorize_logging=(val); end
# source://activesupport//lib/active_support/log_subscriber.rb#163
def debug(progname = T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/log_subscriber.rb#163
def error(progname = T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/log_subscriber.rb#158
def event_levels=(_arg0); end
# source://activesupport//lib/active_support/log_subscriber.rb#163
def fatal(progname = T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/log_subscriber.rb#163
def info(progname = T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/log_subscriber.rb#138
def logger; end
# source://activesupport//lib/active_support/log_subscriber.rb#152
def publish_event(event); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/log_subscriber.rb#142
def silenced?(event); end
# source://activesupport//lib/active_support/log_subscriber.rb#163
def unknown(progname = T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/log_subscriber.rb#163
def warn(progname = T.unsafe(nil), &block); end
private
# Set color by using a symbol or one of the defined constants. Set modes
# by specifying bold, italic, or underline options. Inspired by Highline,
# this method will automatically clear formatting at the end of the returned String.
#
# source://activesupport//lib/active_support/log_subscriber.rb#172
def color(text, color, mode_options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/log_subscriber.rb#186
def log_exception(name, e); end
# source://activesupport//lib/active_support/log_subscriber.rb#180
def mode_from(options); end
class << self
# source://activesupport//lib/active_support/log_subscriber.rb#99
def attach_to(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/log_subscriber.rb#83
def colorize_logging; end
# source://activesupport//lib/active_support/log_subscriber.rb#83
def colorize_logging=(val); end
# Flush all log_subscribers' logger.
#
# source://activesupport//lib/active_support/log_subscriber.rb#112
def flush_all!; end
# source://activesupport//lib/active_support/log_subscriber.rb#84
def log_levels; end
# source://activesupport//lib/active_support/log_subscriber.rb#84
def log_levels=(value); end
# source://activesupport//lib/active_support/log_subscriber.rb#84
def log_levels?; end
# source://activesupport//lib/active_support/log_subscriber.rb#107
def log_subscribers; end
# source://activesupport//lib/active_support/log_subscriber.rb#93
def logger; end
# Sets the attribute logger
#
# @param value the value to set the attribute logger to.
#
# source://activesupport//lib/active_support/log_subscriber.rb#105
def logger=(_arg0); end
private
# source://activesupport//lib/active_support/log_subscriber.rb#117
def fetch_public_methods(subscriber, inherit_all); end
# source://activesupport//lib/active_support/log_subscriber.rb#121
def set_event_levels; end
# source://activesupport//lib/active_support/log_subscriber.rb#127
def subscribe_log_level(method, level); end
end
end
# ANSI sequence colors
#
# source://activesupport//lib/active_support/log_subscriber.rb#74
ActiveSupport::LogSubscriber::BLACK = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/log_subscriber.rb#78
ActiveSupport::LogSubscriber::BLUE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/log_subscriber.rb#80
ActiveSupport::LogSubscriber::CYAN = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/log_subscriber.rb#76
ActiveSupport::LogSubscriber::GREEN = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/log_subscriber.rb#86
ActiveSupport::LogSubscriber::LEVEL_CHECKS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/log_subscriber.rb#79
ActiveSupport::LogSubscriber::MAGENTA = T.let(T.unsafe(nil), String)
# ANSI sequence modes
#
# source://activesupport//lib/active_support/log_subscriber.rb#66
ActiveSupport::LogSubscriber::MODES = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/log_subscriber.rb#75
ActiveSupport::LogSubscriber::RED = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/log_subscriber.rb#81
ActiveSupport::LogSubscriber::WHITE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/log_subscriber.rb#77
ActiveSupport::LogSubscriber::YELLOW = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/logger.rb#8
class ActiveSupport::Logger < ::Logger
include ::ActiveSupport::LoggerSilence
include ::ActiveSupport::LoggerThreadSafeLevel
# @return [Logger] a new instance of Logger
#
# source://activesupport//lib/active_support/logger.rb#33
def initialize(*args, **kwargs); end
# source://activesupport//lib/active_support/logger_silence.rb#12
def silencer; end
# source://activesupport//lib/active_support/logger_silence.rb#12
def silencer=(val); end
class << self
# Returns true if the logger destination matches one of the sources
#
# logger = Logger.new(STDOUT)
# ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT)
# # => true
#
# logger = Logger.new('/var/log/rails.log')
# ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log')
# # => true
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/logger.rb#20
def logger_outputs_to?(logger, *sources); end
# source://activesupport//lib/active_support/logger.rb#47
def normalize_sources(sources); end
# source://activesupport//lib/active_support/logger_silence.rb#12
def silencer; end
# source://activesupport//lib/active_support/logger_silence.rb#12
def silencer=(val); end
end
end
# Simple formatter which only displays the message.
#
# source://activesupport//lib/active_support/logger.rb#39
class ActiveSupport::Logger::SimpleFormatter < ::Logger::Formatter
# This method is invoked when a log event occurs
#
# source://activesupport//lib/active_support/logger.rb#41
def call(severity, timestamp, progname, msg); end
end
# source://activesupport//lib/active_support/logger_silence.rb#8
module ActiveSupport::LoggerSilence
extend ::ActiveSupport::Concern
include ::ActiveSupport::LoggerThreadSafeLevel
# Silences the logger for the duration of the block.
#
# source://activesupport//lib/active_support/logger_silence.rb#17
def silence(severity = T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/logger_thread_safe_level.rb#7
module ActiveSupport::LoggerThreadSafeLevel
extend ::ActiveSupport::Concern
# source://activesupport//lib/active_support/logger_thread_safe_level.rb#30
def level; end
# source://activesupport//lib/active_support/logger_thread_safe_level.rb#10
def local_level; end
# source://activesupport//lib/active_support/logger_thread_safe_level.rb#14
def local_level=(level); end
# Change the thread-local level for the duration of the given block.
#
# source://activesupport//lib/active_support/logger_thread_safe_level.rb#35
def log_at(level); end
private
# source://activesupport//lib/active_support/logger_thread_safe_level.rb#43
def local_level_key; end
end
# = Active Support Message Encryptor
#
# MessageEncryptor is a simple way to encrypt values which get stored
# somewhere you don't trust.
#
# The cipher text and initialization vector are base64 encoded and returned
# to you.
#
# This can be used in situations similar to the MessageVerifier, but
# where you don't want users to be able to determine the value of the payload.
#
# len = ActiveSupport::MessageEncryptor.key_len
# salt = SecureRandom.random_bytes(len)
# key = ActiveSupport::KeyGenerator.new('password').generate_key(salt, len) # => "\x89\xE0\x156\xAC..."
# crypt = ActiveSupport::MessageEncryptor.new(key) # => #<ActiveSupport::MessageEncryptor ...>
# encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..."
# crypt.decrypt_and_verify(encrypted_data) # => "my secret data"
#
# The +decrypt_and_verify+ method will raise an
# +ActiveSupport::MessageEncryptor::InvalidMessage+ exception if the data
# provided cannot be decrypted or verified.
#
# crypt.decrypt_and_verify('not encrypted data') # => ActiveSupport::MessageEncryptor::InvalidMessage
#
# === Confining messages to a specific purpose
#
# By default any message can be used throughout your app. But they can also be
# confined to a specific +:purpose+.
#
# token = crypt.encrypt_and_sign("this is the chair", purpose: :login)
#
# Then that same purpose must be passed when verifying to get the data back out:
#
# crypt.decrypt_and_verify(token, purpose: :login) # => "this is the chair"
# crypt.decrypt_and_verify(token, purpose: :shipping) # => nil
# crypt.decrypt_and_verify(token) # => nil
#
# Likewise, if a message has no purpose it won't be returned when verifying with
# a specific purpose.
#
# token = crypt.encrypt_and_sign("the conversation is lively")
# crypt.decrypt_and_verify(token, purpose: :scare_tactics) # => nil
# crypt.decrypt_and_verify(token) # => "the conversation is lively"
#
# === Making messages expire
#
# By default messages last forever and verifying one year from now will still
# return the original value. But messages can be set to expire at a given
# time with +:expires_in+ or +:expires_at+.
#
# crypt.encrypt_and_sign(parcel, expires_in: 1.month)
# crypt.encrypt_and_sign(doowad, expires_at: Time.now.end_of_year)
#
# Then the messages can be verified and returned up to the expire time.
# Thereafter, verifying returns +nil+.
#
# === Rotating keys
#
# MessageEncryptor also supports rotating out old configurations by falling
# back to a stack of encryptors. Call +rotate+ to build and add an encryptor
# so +decrypt_and_verify+ will also try the fallback.
#
# By default any rotated encryptors use the values of the primary
# encryptor unless specified otherwise.
#
# You'd give your encryptor the new defaults:
#
# crypt = ActiveSupport::MessageEncryptor.new(@secret, cipher: "aes-256-gcm")
#
# Then gradually rotate the old values out by adding them as fallbacks. Any message
# generated with the old values will then work until the rotation is removed.
#
# crypt.rotate old_secret # Fallback to an old secret instead of @secret.
# crypt.rotate cipher: "aes-256-cbc" # Fallback to an old cipher instead of aes-256-gcm.
#
# Though if both the secret and the cipher was changed at the same time,
# the above should be combined into:
#
# crypt.rotate old_secret, cipher: "aes-256-cbc"
#
# source://activesupport//lib/active_support/message_encryptor.rb#90
class ActiveSupport::MessageEncryptor < ::ActiveSupport::Messages::Codec
include ::ActiveSupport::Messages::Rotator
# Initialize a new MessageEncryptor. +secret+ must be at least as long as
# the cipher key size. For the default 'aes-256-gcm' cipher, this is 256
# bits. If you are using a user-entered secret, you can generate a suitable
# key by using ActiveSupport::KeyGenerator or a similar key
# derivation function.
#
# The first additional parameter is used as the signature key for
# MessageVerifier. This allows you to specify keys to encrypt and sign
# data. Ignored when using an AEAD cipher like 'aes-256-gcm'.
#
# ActiveSupport::MessageEncryptor.new('secret', 'signature_secret')
#
# ==== Options
#
# [+:cipher+]
# Cipher to use. Can be any cipher returned by +OpenSSL::Cipher.ciphers+.
# Default is 'aes-256-gcm'.
#
# [+:digest+]
# Digest used for signing. Ignored when using an AEAD cipher like
# 'aes-256-gcm'.
#
# [+:serializer+]
# The serializer used to serialize message data. You can specify any
# object that responds to +dump+ and +load+, or you can choose from
# several preconfigured serializers: +:marshal+, +:json_allow_marshal+,
# +:json+, +:message_pack_allow_marshal+, +:message_pack+.
#
# The preconfigured serializers include a fallback mechanism to support
# multiple deserialization formats. For example, the +:marshal+ serializer
# will serialize using +Marshal+, but can deserialize using +Marshal+,
# ActiveSupport::JSON, or ActiveSupport::MessagePack. This makes it easy
# to migrate between serializers.
#
# The +:marshal+, +:json_allow_marshal+, and +:message_pack_allow_marshal+
# serializers support deserializing using +Marshal+, but the others do
# not. Beware that +Marshal+ is a potential vector for deserialization
# attacks in cases where a message signing secret has been leaked. <em>If
# possible, choose a serializer that does not support +Marshal+.</em>
#
# The +:message_pack+ and +:message_pack_allow_marshal+ serializers use
# ActiveSupport::MessagePack, which can roundtrip some Ruby types that are
# not supported by JSON, and may provide improved performance. However,
# these require the +msgpack+ gem.
#
# When using \Rails, the default depends on +config.active_support.message_serializer+.
# Otherwise, the default is +:marshal+.
#
# [+:url_safe+]
# By default, MessageEncryptor generates RFC 4648 compliant strings
# which are not URL-safe. In other words, they can contain "+" and "/".
# If you want to generate URL-safe strings (in compliance with "Base 64
# Encoding with URL and Filename Safe Alphabet" in RFC 4648), you can
# pass +true+.
#
# [+:force_legacy_metadata_serializer+]
# Whether to use the legacy metadata serializer, which serializes the
# message first, then wraps it in an envelope which is also serialized. This
# was the default in \Rails 7.0 and below.
#
# If you don't pass a truthy value, the default is set using
# +config.active_support.use_message_serializer_for_metadata+.
#
# @return [MessageEncryptor] a new instance of MessageEncryptor
#
# source://activesupport//lib/active_support/messages/rotator.rb#6
def initialize(*args, on_rotation: T.unsafe(nil), **options); end
# source://activesupport//lib/active_support/message_encryptor.rb#256
def create_message(value, **options); end
# Decrypt and verify a message. We need to verify the message in order to
# avoid padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/.
#
# ==== Options
#
# [+:purpose+]
# The purpose that the message was generated with. If the purpose does not
# match, +decrypt_and_verify+ will return +nil+.
#
# message = encryptor.encrypt_and_sign("hello", purpose: "greeting")
# encryptor.decrypt_and_verify(message, purpose: "greeting") # => "hello"
# encryptor.decrypt_and_verify(message) # => nil
#
# message = encryptor.encrypt_and_sign("bye")
# encryptor.decrypt_and_verify(message) # => "bye"
# encryptor.decrypt_and_verify(message, purpose: "greeting") # => nil
#
# source://activesupport//lib/active_support/message_encryptor.rb#241
def decrypt_and_verify(message, **options); end
# Encrypt and sign a message. We need to sign the message in order to avoid
# padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/.
#
# ==== Options
#
# [+:expires_at+]
# The datetime at which the message expires. After this datetime,
# verification of the message will fail.
#
# message = encryptor.encrypt_and_sign("hello", expires_at: Time.now.tomorrow)
# encryptor.decrypt_and_verify(message) # => "hello"
# # 24 hours later...
# encryptor.decrypt_and_verify(message) # => nil
#
# [+:expires_in+]
# The duration for which the message is valid. After this duration has
# elapsed, verification of the message will fail.
#
# message = encryptor.encrypt_and_sign("hello", expires_in: 24.hours)
# encryptor.decrypt_and_verify(message) # => "hello"
# # 24 hours later...
# encryptor.decrypt_and_verify(message) # => nil
#
# [+:purpose+]
# The purpose of the message. If specified, the same purpose must be
# specified when verifying the message; otherwise, verification will fail.
# (See #decrypt_and_verify.)
#
# source://activesupport//lib/active_support/message_encryptor.rb#220
def encrypt_and_sign(value, **options); end
# source://activesupport//lib/active_support/message_encryptor.rb#264
def inspect; end
# source://activesupport//lib/active_support/messages/rotator.rb#23
def read_message(message, on_rotation: T.unsafe(nil), **options); end
private
# Returns the value of attribute aead_mode.
#
# source://activesupport//lib/active_support/message_encryptor.rb#371
def aead_mode; end
# Returns the value of attribute aead_mode.
#
# source://activesupport//lib/active_support/message_encryptor.rb#371
def aead_mode?; end
# source://activesupport//lib/active_support/message_encryptor.rb#295
def decrypt(encrypted_message); end
# source://activesupport//lib/active_support/message_encryptor.rb#277
def encrypt(data); end
# source://activesupport//lib/active_support/message_encryptor.rb#340
def extract_part(encrypted_message, rindex, length); end
# source://activesupport//lib/active_support/message_encryptor.rb#350
def extract_parts(encrypted_message); end
# source://activesupport//lib/active_support/message_encryptor.rb#336
def join_parts(parts); end
# source://activesupport//lib/active_support/message_encryptor.rb#320
def length_after_encode(length_before_encode); end
# source://activesupport//lib/active_support/message_encryptor.rb#332
def length_of_encoded_auth_tag; end
# source://activesupport//lib/active_support/message_encryptor.rb#328
def length_of_encoded_iv; end
# source://activesupport//lib/active_support/message_encryptor.rb#367
def new_cipher; end
# source://activesupport//lib/active_support/message_encryptor.rb#269
def sign(data); end
# source://activesupport//lib/active_support/message_encryptor.rb#273
def verify(data); end
class << self
# source://activesupport//lib/active_support/message_encryptor.rb#96
def default_cipher; end
# Given a cipher, returns the key length of the cipher to help generate the key of desired size
#
# source://activesupport//lib/active_support/message_encryptor.rb#252
def key_len(cipher = T.unsafe(nil)); end
# source://activesupport//lib/active_support/message_encryptor.rb#93
def use_authenticated_message_encryption; end
# source://activesupport//lib/active_support/message_encryptor.rb#93
def use_authenticated_message_encryption=(val); end
end
end
# source://activesupport//lib/active_support/message_encryptor.rb#118
ActiveSupport::MessageEncryptor::AUTH_TAG_LENGTH = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/message_encryptor.rb#115
class ActiveSupport::MessageEncryptor::InvalidMessage < ::StandardError; end
# source://activesupport//lib/active_support/message_encryptor.rb#105
module ActiveSupport::MessageEncryptor::NullSerializer
class << self
# source://activesupport//lib/active_support/message_encryptor.rb#110
def dump(value); end
# source://activesupport//lib/active_support/message_encryptor.rb#106
def load(value); end
end
end
# source://activesupport//lib/active_support/message_encryptor.rb#116
ActiveSupport::MessageEncryptor::OpenSSLCipherError = OpenSSL::Cipher::CipherError
# source://activesupport//lib/active_support/message_encryptor.rb#119
ActiveSupport::MessageEncryptor::SEPARATOR = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/message_encryptors.rb#6
class ActiveSupport::MessageEncryptors < ::ActiveSupport::Messages::RotationCoordinator
private
# source://activesupport//lib/active_support/message_encryptors.rb#135
def build(salt, secret_generator:, secret_generator_options:, **options); end
end
# = Active Support Message Verifier
#
# +MessageVerifier+ makes it easy to generate and verify messages which are
# signed to prevent tampering.
#
# In a \Rails application, you can use +Rails.application.message_verifier+
# to manage unique instances of verifiers for each use case.
# {Learn more}[link:classes/Rails/Application.html#method-i-message_verifier].
#
# This is useful for cases like remember-me tokens and auto-unsubscribe links
# where the session store isn't suitable or available.
#
# First, generate a signed message:
# cookies[:remember_me] = Rails.application.message_verifier(:remember_me).generate([@user.id, 2.weeks.from_now])
#
# Later verify that message:
#
# id, time = Rails.application.message_verifier(:remember_me).verify(cookies[:remember_me])
# if time.future?
# self.current_user = User.find(id)
# end
#
# === Signing is not encryption
#
# The signed messages are not encrypted. The payload is merely encoded (Base64 by default) and can be decoded by
# anyone. The signature is just assuring that the message wasn't tampered with. For example:
#
# message = Rails.application.message_verifier('my_purpose').generate('never put secrets here')
# # => "BAhJIhtuZXZlciBwdXQgc2VjcmV0cyBoZXJlBjoGRVQ=--a0c1c0827919da5e949e989c971249355735e140"
# Base64.decode64(message.split("--").first) # no key needed
# # => 'never put secrets here'
#
# If you also need to encrypt the contents, you must use ActiveSupport::MessageEncryptor instead.
#
# === Confine messages to a specific purpose
#
# It's not recommended to use the same verifier for different purposes in your application.
# Doing so could allow a malicious actor to re-use a signed message to perform an unauthorized
# action.
# You can reduce this risk by confining signed messages to a specific +:purpose+.
#
# token = @verifier.generate("signed message", purpose: :login)
#
# Then that same purpose must be passed when verifying to get the data back out:
#
# @verifier.verified(token, purpose: :login) # => "signed message"
# @verifier.verified(token, purpose: :shipping) # => nil
# @verifier.verified(token) # => nil
#
# @verifier.verify(token, purpose: :login) # => "signed message"
# @verifier.verify(token, purpose: :shipping) # => raises ActiveSupport::MessageVerifier::InvalidSignature
# @verifier.verify(token) # => raises ActiveSupport::MessageVerifier::InvalidSignature
#
# Likewise, if a message has no purpose it won't be returned when verifying with
# a specific purpose.
#
# token = @verifier.generate("signed message")
# @verifier.verified(token, purpose: :redirect) # => nil
# @verifier.verified(token) # => "signed message"
#
# @verifier.verify(token, purpose: :redirect) # => raises ActiveSupport::MessageVerifier::InvalidSignature
# @verifier.verify(token) # => "signed message"
#
# === Expiring messages
#
# By default messages last forever and verifying one year from now will still
# return the original value. But messages can be set to expire at a given
# time with +:expires_in+ or +:expires_at+.
#
# @verifier.generate("signed message", expires_in: 1.month)
# @verifier.generate("signed message", expires_at: Time.now.end_of_year)
#
# Messages can then be verified and returned until expiry.
# Thereafter, the +verified+ method returns +nil+ while +verify+ raises
# +ActiveSupport::MessageVerifier::InvalidSignature+.
#
# === Rotating keys
#
# MessageVerifier also supports rotating out old configurations by falling
# back to a stack of verifiers. Call +rotate+ to build and add a verifier so
# either +verified+ or +verify+ will also try verifying with the fallback.
#
# By default any rotated verifiers use the values of the primary
# verifier unless specified otherwise.
#
# You'd give your verifier the new defaults:
#
# verifier = ActiveSupport::MessageVerifier.new(@secret, digest: "SHA512", serializer: JSON)
#
# Then gradually rotate the old values out by adding them as fallbacks. Any message
# generated with the old values will then work until the rotation is removed.
#
# verifier.rotate(old_secret) # Fallback to an old secret instead of @secret.
# verifier.rotate(digest: "SHA256") # Fallback to an old digest instead of SHA512.
# verifier.rotate(serializer: Marshal) # Fallback to an old serializer instead of JSON.
#
# Though the above would most likely be combined into one rotation:
#
# verifier.rotate(old_secret, digest: "SHA256", serializer: Marshal)
#
# source://activesupport//lib/active_support/message_verifier.rb#110
class ActiveSupport::MessageVerifier < ::ActiveSupport::Messages::Codec
include ::ActiveSupport::Messages::Rotator
# Initialize a new MessageVerifier with a secret for the signature.
#
# ==== Options
#
# [+:digest+]
# Digest used for signing. The default is <tt>"SHA1"</tt>. See
# +OpenSSL::Digest+ for alternatives.
#
# [+:serializer+]
# The serializer used to serialize message data. You can specify any
# object that responds to +dump+ and +load+, or you can choose from
# several preconfigured serializers: +:marshal+, +:json_allow_marshal+,
# +:json+, +:message_pack_allow_marshal+, +:message_pack+.
#
# The preconfigured serializers include a fallback mechanism to support
# multiple deserialization formats. For example, the +:marshal+ serializer
# will serialize using +Marshal+, but can deserialize using +Marshal+,
# ActiveSupport::JSON, or ActiveSupport::MessagePack. This makes it easy
# to migrate between serializers.
#
# The +:marshal+, +:json_allow_marshal+, and +:message_pack_allow_marshal+
# serializers support deserializing using +Marshal+, but the others do
# not. Beware that +Marshal+ is a potential vector for deserialization
# attacks in cases where a message signing secret has been leaked. <em>If
# possible, choose a serializer that does not support +Marshal+.</em>
#
# The +:message_pack+ and +:message_pack_allow_marshal+ serializers use
# ActiveSupport::MessagePack, which can roundtrip some Ruby types that are
# not supported by JSON, and may provide improved performance. However,
# these require the +msgpack+ gem.
#
# When using \Rails, the default depends on +config.active_support.message_serializer+.
# Otherwise, the default is +:marshal+.
#
# [+:url_safe+]
# By default, MessageVerifier generates RFC 4648 compliant strings which are
# not URL-safe. In other words, they can contain "+" and "/". If you want to
# generate URL-safe strings (in compliance with "Base 64 Encoding with URL
# and Filename Safe Alphabet" in RFC 4648), you can pass +true+.
#
# [+:force_legacy_metadata_serializer+]
# Whether to use the legacy metadata serializer, which serializes the
# message first, then wraps it in an envelope which is also serialized. This
# was the default in \Rails 7.0 and below.
#
# If you don't pass a truthy value, the default is set using
# +config.active_support.use_message_serializer_for_metadata+.
#
# @raise [ArgumentError]
# @return [MessageVerifier] a new instance of MessageVerifier
#
# source://activesupport//lib/active_support/messages/rotator.rb#6
def initialize(*args, on_rotation: T.unsafe(nil), **options); end
# source://activesupport//lib/active_support/message_verifier.rb#308
def create_message(value, **options); end
# Generates a signed message for the provided value.
#
# The message is signed with the +MessageVerifier+'s secret.
# Returns Base64-encoded message joined with the generated signature.
#
# verifier = ActiveSupport::MessageVerifier.new("secret")
# verifier.generate("signed message") # => "BAhJIhNzaWduZWQgbWVzc2FnZQY6BkVU--f67d5f27c3ee0b8483cebf2103757455e947493b"
#
# ==== Options
#
# [+:expires_at+]
# The datetime at which the message expires. After this datetime,
# verification of the message will fail.
#
# message = verifier.generate("hello", expires_at: Time.now.tomorrow)
# verifier.verified(message) # => "hello"
# # 24 hours later...
# verifier.verified(message) # => nil
# verifier.verify(message) # => raises ActiveSupport::MessageVerifier::InvalidSignature
#
# [+:expires_in+]
# The duration for which the message is valid. After this duration has
# elapsed, verification of the message will fail.
#
# message = verifier.generate("hello", expires_in: 24.hours)
# verifier.verified(message) # => "hello"
# # 24 hours later...
# verifier.verified(message) # => nil
# verifier.verify(message) # => raises ActiveSupport::MessageVerifier::InvalidSignature
#
# [+:purpose+]
# The purpose of the message. If specified, the same purpose must be
# specified when verifying the message; otherwise, verification will fail.
# (See #verified and #verify.)
#
# source://activesupport//lib/active_support/message_verifier.rb#304
def generate(value, **options); end
# source://activesupport//lib/active_support/message_verifier.rb#316
def inspect; end
# source://activesupport//lib/active_support/messages/rotator.rb#23
def read_message(message, on_rotation: T.unsafe(nil), **options); end
# Checks if a signed message could have been generated by signing an object
# with the +MessageVerifier+'s secret.
#
# verifier = ActiveSupport::MessageVerifier.new("secret")
# signed_message = verifier.generate("signed message")
# verifier.valid_message?(signed_message) # => true
#
# tampered_message = signed_message.chop # editing the message invalidates the signature
# verifier.valid_message?(tampered_message) # => false
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/message_verifier.rb#181
def valid_message?(message); end
# Decodes the signed message using the +MessageVerifier+'s secret.
#
# verifier = ActiveSupport::MessageVerifier.new("secret")
#
# signed_message = verifier.generate("signed message")
# verifier.verified(signed_message) # => "signed message"
#
# Returns +nil+ if the message was not signed with the same secret.
#
# other_verifier = ActiveSupport::MessageVerifier.new("different_secret")
# other_verifier.verified(signed_message) # => nil
#
# Returns +nil+ if the message is not Base64-encoded.
#
# invalid_message = "f--46a0120593880c733a53b6dad75b42ddc1c8996d"
# verifier.verified(invalid_message) # => nil
#
# Raises any error raised while decoding the signed message.
#
# incompatible_message = "test--dad7b06c94abba8d46a15fafaef56c327665d5ff"
# verifier.verified(incompatible_message) # => TypeError: incompatible marshal file format
#
# ==== Options
#
# [+:purpose+]
# The purpose that the message was generated with. If the purpose does not
# match, +verified+ will return +nil+.
#
# message = verifier.generate("hello", purpose: "greeting")
# verifier.verified(message, purpose: "greeting") # => "hello"
# verifier.verified(message, purpose: "chatting") # => nil
# verifier.verified(message) # => nil
#
# message = verifier.generate("bye")
# verifier.verified(message) # => "bye"
# verifier.verified(message, purpose: "greeting") # => nil
#
# source://activesupport//lib/active_support/message_verifier.rb#222
def verified(message, **options); end
# Decodes the signed message using the +MessageVerifier+'s secret.
#
# verifier = ActiveSupport::MessageVerifier.new("secret")
# signed_message = verifier.generate("signed message")
#
# verifier.verify(signed_message) # => "signed message"
#
# Raises +InvalidSignature+ if the message was not signed with the same
# secret or was not Base64-encoded.
#
# other_verifier = ActiveSupport::MessageVerifier.new("different_secret")
# other_verifier.verify(signed_message) # => ActiveSupport::MessageVerifier::InvalidSignature
#
# ==== Options
#
# [+:purpose+]
# The purpose that the message was generated with. If the purpose does not
# match, +verify+ will raise ActiveSupport::MessageVerifier::InvalidSignature.
#
# message = verifier.generate("hello", purpose: "greeting")
# verifier.verify(message, purpose: "greeting") # => "hello"
# verifier.verify(message, purpose: "chatting") # => raises InvalidSignature
# verifier.verify(message) # => raises InvalidSignature
#
# message = verifier.generate("bye")
# verifier.verify(message) # => "bye"
# verifier.verify(message, purpose: "greeting") # => raises InvalidSignature
#
# source://activesupport//lib/active_support/message_verifier.rb#260
def verify(message, **options); end
private
# source://activesupport//lib/active_support/message_verifier.rb#347
def digest_length_in_hex; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/message_verifier.rb#364
def digest_matches_data?(digest, data); end
# source://activesupport//lib/active_support/message_verifier.rb#326
def extract_encoded(signed); end
# source://activesupport//lib/active_support/message_verifier.rb#343
def generate_digest(data); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/message_verifier.rb#355
def separator_at?(signed_message, index); end
# source://activesupport//lib/active_support/message_verifier.rb#359
def separator_index_for(signed_message); end
# source://activesupport//lib/active_support/message_verifier.rb#321
def sign_encoded(encoded); end
end
# source://activesupport//lib/active_support/message_verifier.rb#113
class ActiveSupport::MessageVerifier::InvalidSignature < ::StandardError; end
# source://activesupport//lib/active_support/message_verifier.rb#115
ActiveSupport::MessageVerifier::SEPARATOR = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/message_verifier.rb#116
ActiveSupport::MessageVerifier::SEPARATOR_LENGTH = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/message_verifiers.rb#6
class ActiveSupport::MessageVerifiers < ::ActiveSupport::Messages::RotationCoordinator
private
# source://activesupport//lib/active_support/message_verifiers.rb#131
def build(salt, secret_generator:, secret_generator_options:, **options); end
end
# source://activesupport//lib/active_support/messages/rotator.rb#4
module ActiveSupport::Messages; end
# source://activesupport//lib/active_support/messages/codec.rb#9
class ActiveSupport::Messages::Codec
include ::ActiveSupport::Messages::Metadata
# @return [Codec] a new instance of Codec
#
# source://activesupport//lib/active_support/messages/codec.rb#15
def initialize(**options); end
private
# source://activesupport//lib/active_support/messages/codec.rb#45
def catch_and_ignore(throwable, &block); end
# source://activesupport//lib/active_support/messages/codec.rb#52
def catch_and_raise(throwable, as: T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/messages/codec.rb#29
def decode(encoded, url_safe: T.unsafe(nil)); end
# source://activesupport//lib/active_support/messages/codec.rb#39
def deserialize(serialized); end
# source://activesupport//lib/active_support/messages/codec.rb#25
def encode(data, url_safe: T.unsafe(nil)); end
# source://activesupport//lib/active_support/messages/codec.rb#35
def serialize(data); end
# Returns the value of attribute serializer.
#
# source://activesupport//lib/active_support/messages/codec.rb#23
def serializer; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/messages/codec.rb#60
def use_message_serializer_for_metadata?; end
class << self
# source://activesupport//lib/active_support/messages/codec.rb#12
def default_serializer; end
# source://activesupport//lib/active_support/messages/codec.rb#12
def default_serializer=(value); end
end
end
# source://activesupport//lib/active_support/messages/metadata.rb#9
module ActiveSupport::Messages::Metadata
private
# source://activesupport//lib/active_support/messages/metadata.rb#128
def deserialize_from_json(serialized); end
# source://activesupport//lib/active_support/messages/metadata.rb#141
def deserialize_from_json_safe_string(string); end
# source://activesupport//lib/active_support/messages/metadata.rb#43
def deserialize_with_metadata(message, **expected_metadata); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/messages/metadata.rb#96
def dual_serialized_metadata_envelope_json?(string); end
# source://activesupport//lib/active_support/messages/metadata.rb#78
def extract_from_metadata_envelope(envelope, purpose: T.unsafe(nil)); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/messages/metadata.rb#92
def metadata_envelope?(object); end
# source://activesupport//lib/active_support/messages/metadata.rb#114
def parse_expiry(expires_at); end
# source://activesupport//lib/active_support/messages/metadata.rb#100
def pick_expiry(expires_at, expires_in); end
# source://activesupport//lib/active_support/messages/metadata.rb#124
def serialize_to_json(data); end
# source://activesupport//lib/active_support/messages/metadata.rb#137
def serialize_to_json_safe_string(data); end
# source://activesupport//lib/active_support/messages/metadata.rb#30
def serialize_with_metadata(data, **metadata); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/messages/metadata.rb#60
def use_message_serializer_for_metadata?; end
# source://activesupport//lib/active_support/messages/metadata.rb#64
def wrap_in_metadata_envelope(hash, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end
# source://activesupport//lib/active_support/messages/metadata.rb#71
def wrap_in_metadata_legacy_envelope(hash, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end
class << self
# source://activesupport//lib/active_support/messages/metadata.rb#10
def use_message_serializer_for_metadata; end
# source://activesupport//lib/active_support/messages/metadata.rb#10
def use_message_serializer_for_metadata=(_arg0); end
end
end
# source://activesupport//lib/active_support/messages/metadata.rb#12
ActiveSupport::Messages::Metadata::ENVELOPE_SERIALIZERS = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/messages/metadata.rb#19
ActiveSupport::Messages::Metadata::TIMESTAMP_SERIALIZERS = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#7
class ActiveSupport::Messages::RotationCoordinator
# @raise [ArgumentError]
# @return [RotationCoordinator] a new instance of RotationCoordinator
#
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#10
def initialize(&secret_generator); end
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#18
def [](salt); end
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#22
def []=(salt, codec); end
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#39
def clear_rotations; end
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#45
def on_rotation(&callback); end
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#26
def rotate(**options, &block); end
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#35
def rotate_defaults; end
# Returns the value of attribute transitional.
#
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#8
def transitional; end
# Sets the attribute transitional
#
# @param value the value to set the attribute transitional to.
#
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#8
def transitional=(_arg0); end
private
# @raise [NotImplementedError]
#
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#88
def build(salt, secret_generator:, secret_generator_options:, **options); end
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#76
def build_with_rotations(salt); end
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#51
def changing_configuration!; end
# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#62
def normalize_options(options); end
end
# source://activesupport//lib/active_support/messages/rotator.rb#5
module ActiveSupport::Messages::Rotator
# source://activesupport//lib/active_support/messages/rotator.rb#6
def initialize(*args, on_rotation: T.unsafe(nil), **options); end
# source://activesupport//lib/active_support/messages/rotator.rb#18
def fall_back_to(fallback); end
# source://activesupport//lib/active_support/messages/rotator.rb#23
def read_message(message, on_rotation: T.unsafe(nil), **options); end
# source://activesupport//lib/active_support/messages/rotator.rb#14
def rotate(*args, **options); end
private
# source://activesupport//lib/active_support/messages/rotator.rb#44
def build_rotation(*args, **options); end
# source://activesupport//lib/active_support/messages/rotator.rb#48
def catch_rotation_error(&block); end
end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#8
module ActiveSupport::Messages::SerializerWithFallback
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#17
def load(dumped); end
private
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#33
def detect_format(dumped); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#44
def fallback?(format); end
class << self
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#9
def [](format); end
end
end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#48
module ActiveSupport::Messages::SerializerWithFallback::AllowMarshal
private
# @return [Boolean]
#
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#50
def fallback?(format); end
end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#78
module ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback
include ::ActiveSupport::Messages::SerializerWithFallback
extend ::ActiveSupport::Messages::SerializerWithFallback
extend ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#90
def _load(dumped); end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#86
def dump(object); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#96
def dumped?(dumped); end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#82
def format; end
private
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#101
def detect_format(dumped); end
end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#94
ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback::JSON_START_WITH = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#107
module ActiveSupport::Messages::SerializerWithFallback::JsonWithFallbackAllowMarshal
include ::ActiveSupport::Messages::SerializerWithFallback
include ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback
include ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal
extend ::ActiveSupport::Messages::SerializerWithFallback
extend ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback
extend ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal
extend ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallbackAllowMarshal
end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#55
module ActiveSupport::Messages::SerializerWithFallback::MarshalWithFallback
include ::ActiveSupport::Messages::SerializerWithFallback
extend ::ActiveSupport::Messages::SerializerWithFallback
extend ::ActiveSupport::Messages::SerializerWithFallback::MarshalWithFallback
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#67
def _load(dumped); end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#63
def dump(object); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#73
def dumped?(dumped); end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#59
def format; end
end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#71
ActiveSupport::Messages::SerializerWithFallback::MarshalWithFallback::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#113
module ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback
include ::ActiveSupport::Messages::SerializerWithFallback
extend ::ActiveSupport::Messages::SerializerWithFallback
extend ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#125
def _load(dumped); end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#121
def dump(object); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#129
def dumped?(dumped); end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#117
def format; end
private
# @return [Boolean]
#
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#134
def available?; end
end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#143
module ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallbackAllowMarshal
include ::ActiveSupport::Messages::SerializerWithFallback
include ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback
include ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal
extend ::ActiveSupport::Messages::SerializerWithFallback
extend ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback
extend ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal
extend ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallbackAllowMarshal
end
# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#149
ActiveSupport::Messages::SerializerWithFallback::SERIALIZERS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/multibyte.rb#4
module ActiveSupport::Multibyte
class << self
# Returns the current proxy class.
#
# source://activesupport//lib/active_support/multibyte.rb#19
def proxy_class; end
# The proxy class returned when calling mb_chars. You can use this accessor
# to configure your own proxy class so you can support other encodings. See
# the ActiveSupport::Multibyte::Chars implementation for an example how to
# do this.
#
# ActiveSupport::Multibyte.proxy_class = CharsForUTF32
#
# source://activesupport//lib/active_support/multibyte.rb#14
def proxy_class=(klass); end
end
end
# = Active Support \Multibyte \Chars
#
# Chars enables you to work transparently with UTF-8 encoding in the Ruby
# String class without having extensive knowledge about the encoding. A
# Chars object accepts a string upon initialization and proxies String
# methods in an encoding safe manner. All the normal String methods are also
# implemented on the proxy.
#
# String methods are proxied through the Chars object, and can be accessed
# through the +mb_chars+ method. Methods which would normally return a
# String object now return a Chars object so methods can be chained.
#
# 'The Perfect String '.mb_chars.downcase.strip
# # => #<ActiveSupport::Multibyte::Chars:0x007fdc434ccc10 @wrapped_string="the perfect string">
#
# Chars objects are perfectly interchangeable with String objects as long as
# no explicit class checks are made. If certain methods do explicitly check
# the class, call +to_s+ before you pass chars objects to them.
#
# bad.explicit_checking_method 'T'.mb_chars.downcase.to_s
#
# The default Chars implementation assumes that the encoding of the string
# is UTF-8, if you want to handle different encodings you can write your own
# multibyte string handler and configure it through
# ActiveSupport::Multibyte.proxy_class.
#
# class CharsForUTF32
# def size
# @wrapped_string.size / 4
# end
#
# def self.accepts?(string)
# string.length % 4 == 0
# end
# end
#
# ActiveSupport::Multibyte.proxy_class = CharsForUTF32
#
# source://activesupport//lib/active_support/multibyte/chars.rb#47
class ActiveSupport::Multibyte::Chars
include ::Comparable
# Creates a new Chars instance by wrapping _string_.
#
# @return [Chars] a new instance of Chars
#
# source://activesupport//lib/active_support/multibyte/chars.rb#56
def initialize(string); end
# source://activesupport//lib/active_support/multibyte/chars.rb#53
def <=>(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/multibyte/chars.rb#53
def =~(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/multibyte/chars.rb#53
def acts_like_string?(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/multibyte/chars.rb#161
def as_json(options = T.unsafe(nil)); end
# Performs composition on all the characters.
#
# 'é'.length # => 1
# 'é'.mb_chars.compose.to_s.length # => 1
#
# source://activesupport//lib/active_support/multibyte/chars.rb#140
def compose; end
# Performs canonical decomposition on all the characters.
#
# 'é'.length # => 1
# 'é'.mb_chars.decompose.to_s.length # => 2
#
# source://activesupport//lib/active_support/multibyte/chars.rb#132
def decompose; end
# Returns the number of grapheme clusters in the string.
#
# 'क्षि'.mb_chars.length # => 4
# 'क्षि'.mb_chars.grapheme_length # => 2
#
# source://activesupport//lib/active_support/multibyte/chars.rb#148
def grapheme_length; end
# Limits the byte size of the string to a number of bytes without breaking
# characters. Usable when the storage for a string is limited for some
# reason.
#
# 'こんにちは'.mb_chars.limit(7).to_s # => "こん"
#
# source://activesupport//lib/active_support/multibyte/chars.rb#115
def limit(limit); end
# source://activesupport//lib/active_support/multibyte/chars.rb#53
def match?(*_arg0, **_arg1, &_arg2); end
# Forward all undefined methods to the wrapped string.
#
# source://activesupport//lib/active_support/multibyte/chars.rb#62
def method_missing(method, *_arg1, **_arg2, &_arg3); end
# Reverses all characters in the string.
#
# 'Café'.mb_chars.reverse.to_s # => 'éfaC'
#
# source://activesupport//lib/active_support/multibyte/chars.rb#106
def reverse; end
# source://activesupport//lib/active_support/multibyte/chars.rb#166
def reverse!(*args); end
# Works like <tt>String#slice!</tt>, but returns an instance of
# Chars, or +nil+ if the string was not modified. The string will not be
# modified if the range given is out of bounds
#
# string = 'Welcome'
# string.mb_chars.slice!(3) # => #<ActiveSupport::Multibyte::Chars:0x000000038109b8 @wrapped_string="c">
# string # => 'Welome'
# string.mb_chars.slice!(0..3) # => #<ActiveSupport::Multibyte::Chars:0x00000002eb80a0 @wrapped_string="Welo">
# string # => 'me'
#
# source://activesupport//lib/active_support/multibyte/chars.rb#96
def slice!(*args); end
# Works just like <tt>String#split</tt>, with the exception that the items
# in the resulting list are Chars instances instead of String. This makes
# chaining methods easier.
#
# 'Café périferôl'.mb_chars.split(/é/).map { |part| part.upcase.to_s } # => ["CAF", " P", "RIFERÔL"]
#
# source://activesupport//lib/active_support/multibyte/chars.rb#83
def split(*args); end
# Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent
# resulting in a valid UTF-8 string.
#
# Passing +true+ will forcibly tidy all bytes, assuming that the string's
# encoding is entirely CP1252 or ISO-8859-1.
#
# source://activesupport//lib/active_support/multibyte/chars.rb#157
def tidy_bytes(force = T.unsafe(nil)); end
# source://activesupport//lib/active_support/multibyte/chars.rb#166
def tidy_bytes!(*args); end
# Capitalizes the first letter of every word, when possible.
#
# "ÉL QUE SE ENTERÓ".mb_chars.titleize.to_s # => "Él Que Se Enteró"
# "日本語".mb_chars.titleize.to_s # => "日本語"
#
# source://activesupport//lib/active_support/multibyte/chars.rb#123
def titlecase; end
# Capitalizes the first letter of every word, when possible.
#
# "ÉL QUE SE ENTERÓ".mb_chars.titleize.to_s # => "Él Que Se Enteró"
# "日本語".mb_chars.titleize.to_s # => "日本語"
#
# source://activesupport//lib/active_support/multibyte/chars.rb#123
def titleize; end
# Returns the value of attribute wrapped_string.
#
# source://activesupport//lib/active_support/multibyte/chars.rb#49
def to_s; end
# Returns the value of attribute wrapped_string.
#
# source://activesupport//lib/active_support/multibyte/chars.rb#49
def to_str; end
# Returns the value of attribute wrapped_string.
#
# source://activesupport//lib/active_support/multibyte/chars.rb#49
def wrapped_string; end
private
# source://activesupport//lib/active_support/multibyte/chars.rb#173
def chars(string); end
# Returns +true+ if _obj_ responds to the given method. Private methods
# are included in the search only if the optional second parameter
# evaluates to +true+.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/multibyte/chars.rb#74
def respond_to_missing?(method, include_private); end
end
# source://activesupport//lib/active_support/multibyte/unicode.rb#5
module ActiveSupport::Multibyte::Unicode
extend ::ActiveSupport::Multibyte::Unicode
# Compose decomposed characters to the composed form.
#
# source://activesupport//lib/active_support/multibyte/unicode.rb#21
def compose(codepoints); end
# Decompose composed characters to the decomposed form.
#
# source://activesupport//lib/active_support/multibyte/unicode.rb#12
def decompose(type, codepoints); end
# Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent
# resulting in a valid UTF-8 string.
#
# Passing +true+ will forcibly tidy all bytes, assuming that the string's
# encoding is entirely CP1252 or ISO-8859-1.
#
# source://activesupport//lib/active_support/multibyte/unicode.rb#30
def tidy_bytes(string, force = T.unsafe(nil)); end
private
# source://activesupport//lib/active_support/multibyte/unicode.rb#37
def recode_windows1252_chars(string); end
end
# The Unicode version that is supported by the implementation
#
# source://activesupport//lib/active_support/multibyte/unicode.rb#9
ActiveSupport::Multibyte::Unicode::UNICODE_VERSION = T.let(T.unsafe(nil), String)
# = \Notifications
#
# +ActiveSupport::Notifications+ provides an instrumentation API for
# Ruby.
#
# == Instrumenters
#
# To instrument an event you just need to do:
#
# ActiveSupport::Notifications.instrument('render', extra: :information) do
# render plain: 'Foo'
# end
#
# That first executes the block and then notifies all subscribers once done.
#
# In the example above +render+ is the name of the event, and the rest is called
# the _payload_. The payload is a mechanism that allows instrumenters to pass
# extra information to subscribers. Payloads consist of a hash whose contents
# are arbitrary and generally depend on the event.
#
# == Subscribers
#
# You can consume those events and the information they provide by registering
# a subscriber.
#
# ActiveSupport::Notifications.subscribe('render') do |event|
# event.name # => "render"
# event.duration # => 10 (in milliseconds)
# event.payload # => { extra: :information }
# event.allocations # => 1826 (objects)
# end
#
# +Event+ objects record CPU time and allocations. If you don't need this
# it's also possible to pass a block that accepts five arguments:
#
# ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload|
# name # => String, name of the event (such as 'render' from above)
# start # => Time, when the instrumented block started execution
# finish # => Time, when the instrumented block ended execution
# id # => String, unique ID for the instrumenter that fired the event
# payload # => Hash, the payload
# end
#
# Here, the +start+ and +finish+ values represent wall-clock time. If you are
# concerned about accuracy, you can register a monotonic subscriber.
#
# ActiveSupport::Notifications.monotonic_subscribe('render') do |name, start, finish, id, payload|
# name # => String, name of the event (such as 'render' from above)
# start # => Float, monotonic time when the instrumented block started execution
# finish # => Float, monotonic time when the instrumented block ended execution
# id # => String, unique ID for the instrumenter that fired the event
# payload # => Hash, the payload
# end
#
# For instance, let's store all "render" events in an array:
#
# events = []
#
# ActiveSupport::Notifications.subscribe('render') do |event|
# events << event
# end
#
# That code returns right away, you are just subscribing to "render" events.
# The block is saved and will be called whenever someone instruments "render":
#
# ActiveSupport::Notifications.instrument('render', extra: :information) do
# render plain: 'Foo'
# end
#
# event = events.first
# event.name # => "render"
# event.duration # => 10 (in milliseconds)
# event.payload # => { extra: :information }
# event.allocations # => 1826 (objects)
#
# If an exception happens during that particular instrumentation the payload will
# have a key <tt>:exception</tt> with an array of two elements as value: a string with
# the name of the exception class, and the exception message.
# The <tt>:exception_object</tt> key of the payload will have the exception
# itself as the value:
#
# event.payload[:exception] # => ["ArgumentError", "Invalid value"]
# event.payload[:exception_object] # => #<ArgumentError: Invalid value>
#
# As the earlier example depicts, the class ActiveSupport::Notifications::Event
# is able to take the arguments as they come and provide an object-oriented
# interface to that data.
#
# It is also possible to pass an object which responds to <tt>call</tt> method
# as the second parameter to the <tt>subscribe</tt> method instead of a block:
#
# module ActionController
# class PageRequest
# def call(name, started, finished, unique_id, payload)
# Rails.logger.debug ['notification:', name, started, finished, unique_id, payload].join(' ')
# end
# end
# end
#
# ActiveSupport::Notifications.subscribe('process_action.action_controller', ActionController::PageRequest.new)
#
# resulting in the following output within the logs including a hash with the payload:
#
# notification: process_action.action_controller 2012-04-13 01:08:35 +0300 2012-04-13 01:08:35 +0300 af358ed7fab884532ec7 {
# controller: "Devise::SessionsController",
# action: "new",
# params: {"action"=>"new", "controller"=>"devise/sessions"},
# format: :html,
# method: "GET",
# path: "/login/sign_in",
# status: 200,
# view_runtime: 279.3080806732178,
# db_runtime: 40.053
# }
#
# You can also subscribe to all events whose name matches a certain regexp:
#
# ActiveSupport::Notifications.subscribe(/render/) do |*args|
# ...
# end
#
# and even pass no argument to <tt>subscribe</tt>, in which case you are subscribing
# to all events.
#
# == Temporary Subscriptions
#
# Sometimes you do not want to subscribe to an event for the entire life of
# the application. There are two ways to unsubscribe.
#
# WARNING: The instrumentation framework is designed for long-running subscribers,
# use this feature sparingly because it wipes some internal caches and that has
# a negative impact on performance.
#
# === Subscribe While a Block Runs
#
# You can subscribe to some event temporarily while some block runs. For
# example, in
#
# callback = lambda {|event| ... }
# ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do
# ...
# end
#
# the callback will be called for all "sql.active_record" events instrumented
# during the execution of the block. The callback is unsubscribed automatically
# after that.
#
# To record +started+ and +finished+ values with monotonic time,
# specify the optional <tt>:monotonic</tt> option to the
# <tt>subscribed</tt> method. The <tt>:monotonic</tt> option is set
# to +false+ by default.
#
# callback = lambda {|name, started, finished, unique_id, payload| ... }
# ActiveSupport::Notifications.subscribed(callback, "sql.active_record", monotonic: true) do
# ...
# end
#
# === Manual Unsubscription
#
# The +subscribe+ method returns a subscriber object:
#
# subscriber = ActiveSupport::Notifications.subscribe("render") do |event|
# ...
# end
#
# To prevent that block from being called anymore, just unsubscribe passing
# that reference:
#
# ActiveSupport::Notifications.unsubscribe(subscriber)
#
# You can also unsubscribe by passing the name of the subscriber object. Note
# that this will unsubscribe all subscriptions with the given name:
#
# ActiveSupport::Notifications.unsubscribe("render")
#
# Subscribers using a regexp or other pattern-matching object will remain subscribed
# to all events that match their original pattern, unless those events match a string
# passed to +unsubscribe+:
#
# subscriber = ActiveSupport::Notifications.subscribe(/render/) { }
# ActiveSupport::Notifications.unsubscribe('render_template.action_view')
# subscriber.matches?('render_template.action_view') # => false
# subscriber.matches?('render_partial.action_view') # => true
#
# == Default Queue
#
# Notifications ships with a queue implementation that consumes and publishes events
# to all log subscribers. You can use any queue implementation you want.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#7
module ActiveSupport::Notifications
class << self
# source://activesupport//lib/active_support/notifications.rb#208
def instrument(name, payload = T.unsafe(nil)); end
# source://activesupport//lib/active_support/notifications.rb#269
def instrumenter; end
# Performs the same functionality as #subscribe, but the +start+ and
# +finish+ block arguments are in monotonic time instead of wall-clock
# time. Monotonic time will not jump forward or backward (due to NTP or
# Daylights Savings). Use +monotonic_subscribe+ when accuracy of time
# duration is important. For example, computing elapsed time between
# two events.
#
# source://activesupport//lib/active_support/notifications.rb#254
def monotonic_subscribe(pattern = T.unsafe(nil), callback = T.unsafe(nil), &block); end
# Returns the value of attribute notifier.
#
# source://activesupport//lib/active_support/notifications.rb#198
def notifier; end
# Sets the attribute notifier
#
# @param value the value to set the attribute notifier to.
#
# source://activesupport//lib/active_support/notifications.rb#198
def notifier=(_arg0); end
# source://activesupport//lib/active_support/notifications.rb#200
def publish(name, *args); end
# source://activesupport//lib/active_support/notifications.rb#204
def publish_event(event); end
# Subscribe to a given event name with the passed +block+.
#
# You can subscribe to events by passing a String to match exact event
# names, or by passing a Regexp to match all events that match a pattern.
#
# If the block passed to the method only takes one argument,
# it will yield an +Event+ object to the block:
#
# ActiveSupport::Notifications.subscribe(/render/) do |event|
# @event = event
# end
#
# Otherwise the +block+ will receive five arguments with information
# about the event:
#
# ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload|
# name # => String, name of the event (such as 'render' from above)
# start # => Time, when the instrumented block started execution
# finish # => Time, when the instrumented block ended execution
# id # => String, unique ID for the instrumenter that fired the event
# payload # => Hash, the payload
# end
#
# Raises an error if invalid event name type is passed:
#
# ActiveSupport::Notifications.subscribe(:render) {|event| ...}
# #=> ArgumentError (pattern must be specified as a String, Regexp or empty)
#
# source://activesupport//lib/active_support/notifications.rb#244
def subscribe(pattern = T.unsafe(nil), callback = T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/notifications.rb#258
def subscribed(callback, pattern = T.unsafe(nil), monotonic: T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/notifications.rb#265
def unsubscribe(subscriber_or_name); end
private
# source://activesupport//lib/active_support/notifications.rb#274
def registry; end
end
end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#106
class ActiveSupport::Notifications::Event
# @return [Event] a new instance of Event
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#110
def initialize(name, start, ending, transaction_id, payload); end
# Returns the number of allocations made between the call to #start! and
# the call to #finish!.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#176
def allocations; end
# Returns the CPU time (in milliseconds) passed between the call to
# #start! and the call to #finish!.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#163
def cpu_time; end
# Returns the difference in milliseconds between when the execution of the
# event started and when it ended.
#
# ActiveSupport::Notifications.subscribe('wait') do |event|
# @event = event
# end
#
# ActiveSupport::Notifications.instrument('wait') do
# sleep 1
# end
#
# @event.duration # => 1000.138
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#198
def duration; end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#128
def end; end
# Record information at the time this event finishes
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#154
def finish!; end
# Returns the time spent in GC (in milliseconds) between the call to #start!
# and the call to #finish!
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#182
def gc_time; end
# Returns the idle time time (in milliseconds) passed between the call to
# #start! and the call to #finish!.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#169
def idle_time; end
# Returns the value of attribute name.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#107
def name; end
# Returns the value of attribute payload.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#108
def payload; end
# Sets the attribute payload
#
# @param value the value to set the attribute payload to.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#108
def payload=(_arg0); end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#132
def record; end
# Record information at the time this event starts
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#146
def start!; end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#124
def time; end
# Returns the value of attribute transaction_id.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#107
def transaction_id; end
private
# source://activesupport//lib/active_support/notifications/instrumenter.rb#203
def now; end
# Likely on JRuby, TruffleRuby
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#230
def now_allocations; end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#210
def now_cpu; end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#220
def now_gc; end
end
# This is a default queue implementation that ships with Notifications.
# It just pushes events to all registered log subscribers.
#
# This class is thread safe. All methods are reentrant.
#
# source://activesupport//lib/active_support/notifications/fanout.rb#50
class ActiveSupport::Notifications::Fanout
include ::ActiveSupport::Notifications::FanoutIteration
# @return [Fanout] a new instance of Fanout
#
# source://activesupport//lib/active_support/notifications/fanout.rb#51
def initialize; end
# source://activesupport//lib/active_support/notifications/fanout.rb#298
def all_listeners_for(name); end
# source://activesupport//lib/active_support/notifications/fanout.rb#273
def build_handle(name, id, payload); end
# source://activesupport//lib/active_support/notifications/fanout.rb#102
def clear_cache(key = T.unsafe(nil)); end
# source://activesupport//lib/active_support/notifications/fanout.rb#284
def finish(name, id, payload, listeners = T.unsafe(nil)); end
# source://activesupport//lib/active_support/notifications/fanout.rb#188
def groups_for(name); end
# source://activesupport//lib/active_support/notifications/fanout.rb#60
def inspect; end
# source://activesupport//lib/active_support/notifications/fanout.rb#307
def listeners_for(name); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/notifications/fanout.rb#311
def listening?(name); end
# source://activesupport//lib/active_support/notifications/fanout.rb#290
def publish(name, *args); end
# source://activesupport//lib/active_support/notifications/fanout.rb#294
def publish_event(event); end
# source://activesupport//lib/active_support/notifications/fanout.rb#277
def start(name, id, payload); end
# source://activesupport//lib/active_support/notifications/fanout.rb#65
def subscribe(pattern = T.unsafe(nil), callable = T.unsafe(nil), monotonic: T.unsafe(nil), &block); end
# source://activesupport//lib/active_support/notifications/fanout.rb#82
def unsubscribe(subscriber_or_name); end
# This is a sync queue, so there is no waiting.
#
# source://activesupport//lib/active_support/notifications/fanout.rb#316
def wait; end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#114
class ActiveSupport::Notifications::Fanout::BaseGroup
include ::ActiveSupport::Notifications::FanoutIteration
# @return [BaseGroup] a new instance of BaseGroup
#
# source://activesupport//lib/active_support/notifications/fanout.rb#117
def initialize(listeners, name, id, payload); end
# source://activesupport//lib/active_support/notifications/fanout.rb#121
def each(&block); end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#126
class ActiveSupport::Notifications::Fanout::BaseTimeGroup < ::ActiveSupport::Notifications::Fanout::BaseGroup
# source://activesupport//lib/active_support/notifications/fanout.rb#131
def finish(name, id, payload); end
# source://activesupport//lib/active_support/notifications/fanout.rb#127
def start(name, id, payload); end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#167
class ActiveSupport::Notifications::Fanout::EventObjectGroup < ::ActiveSupport::Notifications::Fanout::BaseGroup
# source://activesupport//lib/active_support/notifications/fanout.rb#173
def finish(name, id, payload); end
# source://activesupport//lib/active_support/notifications/fanout.rb#168
def start(name, id, payload); end
private
# source://activesupport//lib/active_support/notifications/fanout.rb#183
def build_event(name, id, payload); end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#153
class ActiveSupport::Notifications::Fanout::EventedGroup < ::ActiveSupport::Notifications::Fanout::BaseGroup
# source://activesupport//lib/active_support/notifications/fanout.rb#160
def finish(name, id, payload); end
# source://activesupport//lib/active_support/notifications/fanout.rb#154
def start(name, id, payload); end
end
# A +Handle+ is used to record the start and finish time of event.
#
# Both #start and #finish must each be called exactly once.
#
# Where possible, it's best to use the block form: ActiveSupport::Notifications.instrument.
# +Handle+ is a low-level API intended for cases where the block form can't be used.
#
# handle = ActiveSupport::Notifications.instrumenter.build_handle("my.event", {})
# begin
# handle.start
# # work to be instrumented
# ensure
# handle.finish
# end
#
# source://activesupport//lib/active_support/notifications/fanout.rb#228
class ActiveSupport::Notifications::Fanout::Handle
include ::ActiveSupport::Notifications::FanoutIteration
# @return [Handle] a new instance of Handle
#
# source://activesupport//lib/active_support/notifications/fanout.rb#231
def initialize(notifier, name, id, payload); end
# source://activesupport//lib/active_support/notifications/fanout.rb#250
def finish; end
# source://activesupport//lib/active_support/notifications/fanout.rb#254
def finish_with_values(name, id, payload); end
# source://activesupport//lib/active_support/notifications/fanout.rb#241
def start; end
private
# source://activesupport//lib/active_support/notifications/fanout.rb#264
def ensure_state!(expected); end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#139
class ActiveSupport::Notifications::Fanout::MonotonicTimedGroup < ::ActiveSupport::Notifications::Fanout::BaseTimeGroup
private
# source://activesupport//lib/active_support/notifications/fanout.rb#141
def now; end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#319
module ActiveSupport::Notifications::Fanout::Subscribers
class << self
# source://activesupport//lib/active_support/notifications/fanout.rb#320
def new(pattern, listener, monotonic); end
end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#434
class ActiveSupport::Notifications::Fanout::Subscribers::EventObject < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented
# source://activesupport//lib/active_support/notifications/fanout.rb#435
def group_class; end
# source://activesupport//lib/active_support/notifications/fanout.rb#439
def publish_event(event); end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#376
class ActiveSupport::Notifications::Fanout::Subscribers::Evented
# @return [Evented] a new instance of Evented
#
# source://activesupport//lib/active_support/notifications/fanout.rb#379
def initialize(pattern, delegate); end
# Returns the value of attribute delegate.
#
# source://activesupport//lib/active_support/notifications/fanout.rb#377
def delegate; end
# source://activesupport//lib/active_support/notifications/fanout.rb#387
def group_class; end
# Returns the value of attribute pattern.
#
# source://activesupport//lib/active_support/notifications/fanout.rb#377
def pattern; end
# source://activesupport//lib/active_support/notifications/fanout.rb#391
def publish(name, *args); end
# source://activesupport//lib/active_support/notifications/fanout.rb#397
def publish_event(event); end
# Returns the value of attribute silenceable.
#
# source://activesupport//lib/active_support/notifications/fanout.rb#377
def silenceable; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/notifications/fanout.rb#405
def silenced?(name); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/notifications/fanout.rb#409
def subscribed_to?(name); end
# source://activesupport//lib/active_support/notifications/fanout.rb#413
def unsubscribe!(name); end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#339
class ActiveSupport::Notifications::Fanout::Subscribers::Matcher
# @return [Matcher] a new instance of Matcher
#
# source://activesupport//lib/active_support/notifications/fanout.rb#352
def initialize(pattern); end
# source://activesupport//lib/active_support/notifications/fanout.rb#361
def ===(name); end
# Returns the value of attribute exclusions.
#
# source://activesupport//lib/active_support/notifications/fanout.rb#340
def exclusions; end
# Returns the value of attribute pattern.
#
# source://activesupport//lib/active_support/notifications/fanout.rb#340
def pattern; end
# source://activesupport//lib/active_support/notifications/fanout.rb#357
def unsubscribe!(name); end
class << self
# source://activesupport//lib/active_support/notifications/fanout.rb#342
def wrap(pattern); end
end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#365
class ActiveSupport::Notifications::Fanout::Subscribers::Matcher::AllMessages
# source://activesupport//lib/active_support/notifications/fanout.rb#366
def ===(name); end
# source://activesupport//lib/active_support/notifications/fanout.rb#370
def unsubscribe!(*_arg0); end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#428
class ActiveSupport::Notifications::Fanout::Subscribers::MonotonicTimed < ::ActiveSupport::Notifications::Fanout::Subscribers::Timed
# source://activesupport//lib/active_support/notifications/fanout.rb#429
def group_class; end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#418
class ActiveSupport::Notifications::Fanout::Subscribers::Timed < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented
# source://activesupport//lib/active_support/notifications/fanout.rb#419
def group_class; end
# source://activesupport//lib/active_support/notifications/fanout.rb#423
def publish(name, *args); end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#146
class ActiveSupport::Notifications::Fanout::TimedGroup < ::ActiveSupport::Notifications::Fanout::BaseTimeGroup
private
# source://activesupport//lib/active_support/notifications/fanout.rb#148
def now; end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#19
module ActiveSupport::Notifications::FanoutIteration
private
# source://activesupport//lib/active_support/notifications/fanout.rb#21
def iterate_guarding_exceptions(collection); end
end
# source://activesupport//lib/active_support/notifications/fanout.rb#9
class ActiveSupport::Notifications::InstrumentationSubscriberError < ::RuntimeError
# @return [InstrumentationSubscriberError] a new instance of InstrumentationSubscriberError
#
# source://activesupport//lib/active_support/notifications/fanout.rb#12
def initialize(exceptions); end
# Returns the value of attribute exceptions.
#
# source://activesupport//lib/active_support/notifications/fanout.rb#10
def exceptions; end
end
# Instrumenters are stored in a thread local.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#9
class ActiveSupport::Notifications::Instrumenter
# @return [Instrumenter] a new instance of Instrumenter
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#12
def initialize(notifier); end
# Returns a "handle" for an event with the given +name+ and +payload+.
#
# #start and #finish must each be called exactly once on the returned object.
#
# Where possible, it's best to use #instrument, which will record the
# start and finish of the event and correctly handle any exceptions.
# +build_handle+ is a low-level API intended for cases where using
# +instrument+ isn't possible.
#
# See ActiveSupport::Notifications::Fanout::Handle.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#78
def build_handle(name, payload); end
# Send a finish notification with +name+ and +payload+.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#92
def finish(name, payload); end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#96
def finish_with_state(listeners_state, name, payload); end
# Returns the value of attribute id.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#10
def id; end
# Given a block, instrument it by measuring the time taken to execute
# and publish it. Without a block, simply send a message via the
# notifier. Notice that events get sent even if an error occurs in the
# passed-in block.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#54
def instrument(name, payload = T.unsafe(nil)); end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#82
def new_event(name, payload = T.unsafe(nil)); end
# Send a start notification with +name+ and +payload+.
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#87
def start(name, payload); end
private
# source://activesupport//lib/active_support/notifications/instrumenter.rb#101
def unique_id; end
end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#21
class ActiveSupport::Notifications::Instrumenter::LegacyHandle
# @return [LegacyHandle] a new instance of LegacyHandle
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#34
def initialize(notifier, name, id, payload); end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#45
def finish; end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#41
def start; end
end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#22
class ActiveSupport::Notifications::Instrumenter::LegacyHandle::Wrapper
# @return [Wrapper] a new instance of Wrapper
#
# source://activesupport//lib/active_support/notifications/instrumenter.rb#23
def initialize(notifier); end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#27
def build_handle(name, id, payload); end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#31
def finish(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/notifications/instrumenter.rb#31
def start(*_arg0, **_arg1, &_arg2); end
end
# source://activesupport//lib/active_support/number_helper.rb#4
module ActiveSupport::NumberHelper
extend ::ActiveSupport::Autoload
extend ::ActiveSupport::NumberHelper
# Formats a +number+ into a currency string.
#
# number_to_currency(1234567890.50) # => "$1,234,567,890.50"
# number_to_currency(1234567890.506) # => "$1,234,567,890.51"
# number_to_currency("12x34") # => "$12x34"
#
# number_to_currency(1234567890.50, unit: "£", separator: ",", delimiter: "")
# # => "£1234567890,50"
#
# The currency unit and number formatting of the current locale will be used
# unless otherwise specified via options. No currency conversion is
# performed. If the user is given a way to change their locale, they will
# also be able to change the relative value of the currency displayed with
# this helper. If your application will ever support multiple locales, you
# may want to specify a constant +:locale+ option or consider using a
# library capable of currency conversion.
#
# ==== Options
#
# [+:locale+]
# The locale to use for formatting. Defaults to the current locale.
#
# number_to_currency(1234567890.506, locale: :fr)
# # => "1 234 567 890,51 €"
#
# [+:precision+]
# The level of precision. Defaults to 2.
#
# number_to_currency(1234567890.123, precision: 3) # => "$1,234,567,890.123"
# number_to_currency(0.456789, precision: 0) # => "$0"
#
# [+:round_mode+]
# Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to
# +:default+.
#
# number_to_currency(1234567890.01, precision: 0, round_mode: :up)
# # => "$1,234,567,891"
#
# [+:unit+]
# The denomination of the currency. Defaults to <tt>"$"</tt>.
#
# [+:separator+]
# The decimal separator. Defaults to <tt>"."</tt>.
#
# [+:delimiter+]
# The thousands delimiter. Defaults to <tt>","</tt>.
#
# [+:format+]
# The format for non-negative numbers. <tt>%u</tt> represents the currency,
# and <tt>%n</tt> represents the number. Defaults to <tt>"%u%n"</tt>.
#
# number_to_currency(1234567890.50, format: "%n %u")
# # => "1,234,567,890.50 $"
#
# [+:negative_format+]
# The format for negative numbers. <tt>%u</tt> and <tt>%n</tt> behave the
# same as in +:format+, but <tt>%n</tt> represents the absolute value of
# the number. Defaults to the value of +:format+ prepended with <tt>-</tt>.
#
# number_to_currency(-1234567890.50, negative_format: "(%u%n)")
# # => "($1,234,567,890.50)"
#
# [+:strip_insignificant_zeros+]
# Whether to remove insignificant zeros after the decimal separator.
# Defaults to false.
#
# number_to_currency(1234567890.50, strip_insignificant_zeros: true)
# # => "$1,234,567,890.5"
#
# source://activesupport//lib/active_support/number_helper.rb#139
def number_to_currency(number, options = T.unsafe(nil)); end
# Formats +number+ by grouping thousands with a delimiter.
#
# number_to_delimited(12345678) # => "12,345,678"
# number_to_delimited("123456") # => "123,456"
# number_to_delimited(12345678.9876) # => "12,345,678.9876"
# number_to_delimited("12x34") # => "12x34"
#
# number_to_delimited(12345678.9876, delimiter: ".", separator: ",")
# # => "12.345.678,9876"
#
# ==== Options
#
# [+:locale+]
# The locale to use for formatting. Defaults to the current locale.
#
# number_to_delimited(12345678.05, locale: :fr)
# # => "12 345 678,05"
#
# [+:delimiter+]
# The thousands delimiter. Defaults to <tt>","</tt>.
#
# number_to_delimited(12345678, delimiter: ".")
# # => "12.345.678"
#
# [+:separator+]
# The decimal separator. Defaults to <tt>"."</tt>.
#
# number_to_delimited(12345678.05, separator: " ")
# # => "12,345,678 05"
#
# [+:delimiter_pattern+]
# A regexp to determine the placement of delimiters. Helpful when using
# currency formats like INR.
#
# number_to_delimited("123456.78", delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/)
# # => "1,23,456.78"
#
# source://activesupport//lib/active_support/number_helper.rb#242
def number_to_delimited(number, options = T.unsafe(nil)); end
# Formats +number+ into a more human-friendly representation. Useful for
# numbers that can become very large and too hard to read.
#
# number_to_human(123) # => "123"
# number_to_human(1234) # => "1.23 Thousand"
# number_to_human(12345) # => "12.3 Thousand"
# number_to_human(1234567) # => "1.23 Million"
# number_to_human(1234567890) # => "1.23 Billion"
# number_to_human(1234567890123) # => "1.23 Trillion"
# number_to_human(1234567890123456) # => "1.23 Quadrillion"
# number_to_human(1234567890123456789) # => "1230 Quadrillion"
#
# See #number_to_human_size if you want to pretty-print a file size.
#
# ==== Options
#
# [+:locale+]
# The locale to use for formatting. Defaults to the current locale.
#
# [+:precision+]
# The level of precision. Defaults to 3.
#
# number_to_human(123456, precision: 2) # => "120 Thousand"
# number_to_human(123456, precision: 4) # => "123.5 Thousand"
#
# [+:round_mode+]
# Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to
# +:default+.
#
# number_to_human(123456, precision: 2, round_mode: :up)
# # => "130 Thousand"
#
# [+:significant+]
# Whether +:precision+ should be applied to significant digits instead of
# fractional digits. Defaults to true.
#
# [+:separator+]
# The decimal separator. Defaults to <tt>"."</tt>.
#
# number_to_human(123456, precision: 4, separator: ",")
# # => "123,5 Thousand"
#
# [+:delimiter+]
# The thousands delimiter. Defaults to <tt>","</tt>.
#
# [+:strip_insignificant_zeros+]
# Whether to remove insignificant zeros after the decimal separator.
# Defaults to true.
#
# number_to_human(1000000) # => "1 Million"
# number_to_human(1000000, strip_insignificant_zeros: false) # => "1.00 Million"
# number_to_human(10.01) # => "10"
# number_to_human(10.01, strip_insignificant_zeros: false) # => "10.0"
#
# [+:format+]
# The format of the output. <tt>%n</tt> represents the number, and
# <tt>%u</tt> represents the quantifier (e.g., "Thousand"). Defaults to
# <tt>"%n %u"</tt>.
#
# [+:units+]
# A Hash of custom unit quantifier names.
#
# number_to_human(1, units: { unit: "m", thousand: "km" }) # => "1 m"
# number_to_human(100, units: { unit: "m", thousand: "km" }) # => "100 m"
# number_to_human(1000, units: { unit: "m", thousand: "km" }) # => "1 km"
# number_to_human(100000, units: { unit: "m", thousand: "km" }) # => "100 km"
# number_to_human(10000000, units: { unit: "m", thousand: "km" }) # => "10000 km"
#
# The following keys are supported for integer units: +:unit+, +:ten+,
# +:hundred+, +:thousand+, +:million+, +:billion+, +:trillion+,
# +:quadrillion+. Additionally, the following keys are supported for
# fractional units: +:deci+, +:centi+, +:mili+, +:micro+, +:nano+,
# +:pico+, +:femto+.
#
# The Hash can also be defined as a scope in an I18n locale. For example:
#
# en:
# distance:
# centi:
# one: "centimeter"
# other: "centimeters"
# unit:
# one: "meter"
# other: "meters"
# thousand:
# one: "kilometer"
# other: "kilometers"
#
# Then it can be specified by name:
#
# number_to_human(1, units: :distance) # => "1 meter"
# number_to_human(100, units: :distance) # => "100 meters"
# number_to_human(1000, units: :distance) # => "1 kilometer"
# number_to_human(100000, units: :distance) # => "100 kilometers"
# number_to_human(10000000, units: :distance) # => "10000 kilometers"
# number_to_human(0.1, units: :distance) # => "10 centimeters"
# number_to_human(0.01, units: :distance) # => "1 centimeter"
#
# source://activesupport//lib/active_support/number_helper.rb#453
def number_to_human(number, options = T.unsafe(nil)); end
# Formats +number+ as bytes into a more human-friendly representation.
# Useful for reporting file sizes to users.
#
# number_to_human_size(123) # => "123 Bytes"
# number_to_human_size(1234) # => "1.21 KB"
# number_to_human_size(12345) # => "12.1 KB"
# number_to_human_size(1234567) # => "1.18 MB"
# number_to_human_size(1234567890) # => "1.15 GB"
# number_to_human_size(1234567890123) # => "1.12 TB"
# number_to_human_size(1234567890123456) # => "1.1 PB"
# number_to_human_size(1234567890123456789) # => "1.07 EB"
#
# See #number_to_human if you want to pretty-print a generic number.
#
# ==== Options
#
# [+:locale+]
# The locale to use for formatting. Defaults to the current locale.
#
# [+:precision+]
# The level of precision. Defaults to 3.
#
# number_to_human_size(123456, precision: 2) # => "120 KB"
# number_to_human_size(1234567, precision: 2) # => "1.2 MB"
#
# [+:round_mode+]
# Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to
# +:default+.
#
# number_to_human_size(123456, precision: 2, round_mode: :up)
# # => "130 KB"
#
# [+:significant+]
# Whether +:precision+ should be applied to significant digits instead of
# fractional digits. Defaults to true.
#
# [+:separator+]
# The decimal separator. Defaults to <tt>"."</tt>.
#
# number_to_human_size(1234567, separator: ",")
# # => "1,18 MB"
#
# [+:delimiter+]
# The thousands delimiter. Defaults to <tt>","</tt>.
#
# [+:strip_insignificant_zeros+]
# Whether to remove insignificant zeros after the decimal separator.
# Defaults to true.
#
# source://activesupport//lib/active_support/number_helper.rb#351
def number_to_human_size(number, options = T.unsafe(nil)); end
# Formats +number+ as a percentage string.
#
# number_to_percentage(100) # => "100.000%"
# number_to_percentage("99") # => "99.000%"
# number_to_percentage("99x") # => "99x%"
#
# number_to_percentage(12345.6789, delimiter: ".", separator: ",", precision: 2)
# # => "12.345,68%"
#
# ==== Options
#
# [+:locale+]
# The locale to use for formatting. Defaults to the current locale.
#
# number_to_percentage(1000, locale: :fr)
# # => "1000,000%"
#
# [+:precision+]
# The level of precision, or +nil+ to preserve +number+'s precision.
# Defaults to 2.
#
# number_to_percentage(12.3456789, precision: 4) # => "12.3457%"
# number_to_percentage(99.999, precision: 0) # => "100%"
# number_to_percentage(99.999, precision: nil) # => "99.999%"
#
# [+:round_mode+]
# Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to
# +:default+.
#
# number_to_percentage(12.3456789, precision: 4, round_mode: :down)
# # => "12.3456%"
#
# [+:significant+]
# Whether +:precision+ should be applied to significant digits instead of
# fractional digits. Defaults to false.
#
# number_to_percentage(12345.6789) # => "12345.679%"
# number_to_percentage(12345.6789, significant: true) # => "12300%"
# number_to_percentage(12345.6789, precision: 2) # => "12345.68%"
# number_to_percentage(12345.6789, precision: 2, significant: true) # => "12000%"
#
# [+:separator+]
# The decimal separator. Defaults to <tt>"."</tt>.
#
# [+:delimiter+]
# The thousands delimiter. Defaults to <tt>","</tt>.
#
# [+:strip_insignificant_zeros+]
# Whether to remove insignificant zeros after the decimal separator.
# Defaults to false.
#
# [+:format+]
# The format of the output. <tt>%n</tt> represents the number. Defaults to
# <tt>"%n%"</tt>.
#
# number_to_percentage(100, format: "%n %")
# # => "100.000 %"
#
# source://activesupport//lib/active_support/number_helper.rb#201
def number_to_percentage(number, options = T.unsafe(nil)); end
# Formats +number+ into a phone number.
#
# number_to_phone(5551234) # => "555-1234"
# number_to_phone("5551234") # => "555-1234"
# number_to_phone(1235551234) # => "123-555-1234"
# number_to_phone("12x34") # => "12x34"
#
# number_to_phone(1235551234, delimiter: ".", country_code: 1, extension: 1343)
# # => "+1.123.555.1234 x 1343"
#
# ==== Options
#
# [+:area_code+]
# Whether to use parentheses for the area code. Defaults to false.
#
# number_to_phone(1235551234, area_code: true)
# # => "(123) 555-1234"
#
# [+:delimiter+]
# The digit group delimiter to use. Defaults to <tt>"-"</tt>.
#
# number_to_phone(1235551234, delimiter: " ")
# # => "123 555 1234"
#
# [+:country_code+]
# A country code to prepend.
#
# number_to_phone(1235551234, country_code: 1)
# # => "+1-123-555-1234"
#
# [+:extension+]
# An extension to append.
#
# number_to_phone(1235551234, extension: 555)
# # => "123-555-1234 x 555"
#
# [+:pattern+]
# A regexp that specifies how the digits should be grouped. The first
# three captures from the regexp are treated as digit groups.
#
# number_to_phone(13312345678, pattern: /(\d{3})(\d{4})(\d{4})$/)
# # => "133-1234-5678"
# number_to_phone(75561234567, pattern: /(\d{1,4})(\d{4})(\d{4})$/, area_code: true)
# # => "(755) 6123-4567"
#
# source://activesupport//lib/active_support/number_helper.rb#66
def number_to_phone(number, options = T.unsafe(nil)); end
# Formats +number+ to a specific level of precision.
#
# number_to_rounded(12345.6789) # => "12345.679"
# number_to_rounded(12345.6789, precision: 2) # => "12345.68"
# number_to_rounded(12345.6789, precision: 0) # => "12345"
# number_to_rounded(12345, precision: 5) # => "12345.00000"
#
# ==== Options
#
# [+:locale+]
# The locale to use for formatting. Defaults to the current locale.
#
# number_to_rounded(111.234, locale: :fr)
# # => "111,234"
#
# [+:precision+]
# The level of precision, or +nil+ to preserve +number+'s precision.
# Defaults to 3.
#
# number_to_rounded(12345.6789, precision: nil)
# # => "12345.6789"
#
# [+:round_mode+]
# Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to
# +:default+.
#
# number_to_rounded(12.34, precision: 0, round_mode: :up)
# # => "13"
#
# [+:significant+]
# Whether +:precision+ should be applied to significant digits instead of
# fractional digits. Defaults to false.
#
# number_to_rounded(12345.6789) # => "12345.679"
# number_to_rounded(12345.6789, significant: true) # => "12300"
# number_to_rounded(12345.6789, precision: 2) # => "12345.68"
# number_to_rounded(12345.6789, precision: 2, significant: true) # => "12000"
#
# [+:separator+]
# The decimal separator. Defaults to <tt>"."</tt>.
#
# [+:delimiter+]
# The thousands delimiter. Defaults to <tt>","</tt>.
#
# [+:strip_insignificant_zeros+]
# Whether to remove insignificant zeros after the decimal separator.
# Defaults to false.
#
# number_to_rounded(12.34, strip_insignificant_zeros: false) # => "12.340"
# number_to_rounded(12.34, strip_insignificant_zeros: true) # => "12.34"
# number_to_rounded(12.3456, strip_insignificant_zeros: true) # => "12.346"
#
# source://activesupport//lib/active_support/number_helper.rb#298
def number_to_rounded(number, options = T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#12
class ActiveSupport::NumberHelper::NumberConverter
# @return [NumberConverter] a new instance of NumberConverter
#
# source://activesupport//lib/active_support/number_helper/number_converter.rb#124
def initialize(number, options); end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#130
def execute; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#14
def namespace; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#14
def namespace=(_arg0); end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#14
def namespace?; end
# Returns the value of attribute number.
#
# source://activesupport//lib/active_support/number_helper/number_converter.rb#19
def number; end
# Returns the value of attribute opts.
#
# source://activesupport//lib/active_support/number_helper/number_converter.rb#19
def opts; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#17
def validate_float; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#17
def validate_float=(_arg0); end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#17
def validate_float?; end
private
# source://activesupport//lib/active_support/number_helper/number_converter.rb#149
def default_format_options; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#174
def default_value(key); end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#145
def format_options; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#155
def i18n_format_options; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#141
def options; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#170
def translate_in_locale(key, **i18n_options); end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#166
def translate_number_value_with_default(key, **i18n_options); end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#178
def valid_bigdecimal; end
class << self
# source://activesupport//lib/active_support/number_helper/number_converter.rb#120
def convert(number, options); end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#14
def namespace; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#14
def namespace=(value); end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#14
def namespace?; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#17
def validate_float; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#17
def validate_float=(value); end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#17
def validate_float?; end
end
end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#21
ActiveSupport::NumberHelper::NumberConverter::DEFAULTS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#7
class ActiveSupport::NumberHelper::NumberToCurrencyConverter < ::ActiveSupport::NumberHelper::NumberConverter
# source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#10
def convert; end
private
# source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#38
def i18n_opts; end
# source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#29
def options; end
class << self
# source://activesupport//lib/active_support/number_helper/number_converter.rb#14
def namespace; end
end
end
# source://activesupport//lib/active_support/number_helper/number_to_delimited_converter.rb#7
class ActiveSupport::NumberHelper::NumberToDelimitedConverter < ::ActiveSupport::NumberHelper::NumberConverter
# source://activesupport//lib/active_support/number_helper/number_to_delimited_converter.rb#12
def convert; end
private
# source://activesupport//lib/active_support/number_helper/number_to_delimited_converter.rb#25
def delimiter_pattern; end
# source://activesupport//lib/active_support/number_helper/number_to_delimited_converter.rb#17
def parts; end
class << self
# source://activesupport//lib/active_support/number_helper/number_converter.rb#17
def validate_float; end
end
end
# source://activesupport//lib/active_support/number_helper/number_to_delimited_converter.rb#10
ActiveSupport::NumberHelper::NumberToDelimitedConverter::DEFAULT_DELIMITER_REGEX = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#7
class ActiveSupport::NumberHelper::NumberToHumanConverter < ::ActiveSupport::NumberHelper::NumberConverter
# source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#15
def convert; end
private
# source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#50
def calculate_exponent(units); end
# source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#38
def determine_unit(units, exponent); end
# source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#34
def format; end
# source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#55
def unit_exponents(units); end
class << self
# source://activesupport//lib/active_support/number_helper/number_converter.rb#14
def namespace; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#17
def validate_float; end
end
end
# source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#8
ActiveSupport::NumberHelper::NumberToHumanConverter::DECIMAL_UNITS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#10
ActiveSupport::NumberHelper::NumberToHumanConverter::INVERTED_DECIMAL_UNITS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#7
class ActiveSupport::NumberHelper::NumberToHumanSizeConverter < ::ActiveSupport::NumberHelper::NumberConverter
# source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#13
def convert; end
private
# source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#55
def base; end
# source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#31
def conversion_format; end
# source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#44
def exponent; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#51
def smaller_than_base?; end
# source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#39
def storage_unit_key; end
# source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#35
def unit; end
class << self
# source://activesupport//lib/active_support/number_helper/number_converter.rb#14
def namespace; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#17
def validate_float; end
end
end
# source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#8
ActiveSupport::NumberHelper::NumberToHumanSizeConverter::STORAGE_UNITS = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/number_helper/number_to_percentage_converter.rb#7
class ActiveSupport::NumberHelper::NumberToPercentageConverter < ::ActiveSupport::NumberHelper::NumberConverter
# source://activesupport//lib/active_support/number_helper/number_to_percentage_converter.rb#10
def convert; end
class << self
# source://activesupport//lib/active_support/number_helper/number_converter.rb#14
def namespace; end
end
end
# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#8
class ActiveSupport::NumberHelper::NumberToPhoneConverter < ::ActiveSupport::NumberHelper::NumberConverter
# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#9
def convert; end
private
# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#16
def convert_to_phone_number(number); end
# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#24
def convert_with_area_code(number); end
# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#31
def convert_without_area_code(number); end
# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#47
def country_code(code); end
# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#43
def delimiter; end
# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#51
def phone_ext(ext); end
# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#55
def regexp_pattern(default_pattern); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#39
def start_with_delimiter?(number); end
end
# source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#7
class ActiveSupport::NumberHelper::NumberToRoundedConverter < ::ActiveSupport::NumberHelper::NumberConverter
# source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#11
def convert; end
private
# source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#49
def format_number(number); end
# source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#45
def strip_insignificant_zeros; end
class << self
# source://activesupport//lib/active_support/number_helper/number_converter.rb#14
def namespace; end
# source://activesupport//lib/active_support/number_helper/number_converter.rb#17
def validate_float; end
end
end
# source://activesupport//lib/active_support/number_helper/rounding_helper.rb#5
class ActiveSupport::NumberHelper::RoundingHelper
# @return [RoundingHelper] a new instance of RoundingHelper
#
# source://activesupport//lib/active_support/number_helper/rounding_helper.rb#8
def initialize(options); end
# source://activesupport//lib/active_support/number_helper/rounding_helper.rb#20
def digit_count(number); end
# Returns the value of attribute options.
#
# source://activesupport//lib/active_support/number_helper/rounding_helper.rb#6
def options; end
# source://activesupport//lib/active_support/number_helper/rounding_helper.rb#12
def round(number); end
private
# source://activesupport//lib/active_support/number_helper/rounding_helper.rb#37
def absolute_precision(number); end
# source://activesupport//lib/active_support/number_helper/rounding_helper.rb#26
def convert_to_decimal(number); end
end
# source://activesupport//lib/active_support/option_merger.rb#6
class ActiveSupport::OptionMerger
# @return [OptionMerger] a new instance of OptionMerger
#
# source://activesupport//lib/active_support/option_merger.rb#11
def initialize(context, options); end
private
# source://activesupport//lib/active_support/option_merger.rb#16
def method_missing(method, *arguments, &block); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/option_merger.rb#34
def respond_to_missing?(*_arg0, **_arg1, &_arg2); end
end
# DEPRECATED: +ActiveSupport::OrderedHash+ implements a hash that preserves
# insertion order.
#
# oh = ActiveSupport::OrderedHash.new
# oh[:a] = 1
# oh[:b] = 2
# oh.keys # => [:a, :b], this order is guaranteed
#
# Also, maps the +omap+ feature for YAML files
# (See https://yaml.org/type/omap.html) to support ordered items
# when loading from YAML.
#
# +ActiveSupport::OrderedHash+ is namespaced to prevent conflicts
# with other implementations.
#
# source://activesupport//lib/active_support/ordered_hash.rb#24
class ActiveSupport::OrderedHash < ::Hash
# source://activesupport//lib/active_support/ordered_hash.rb#29
def encode_with(coder); end
# Returns true to make sure that this hash is extractable via <tt>Array#extract_options!</tt>
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/ordered_hash.rb#46
def extractable_options?; end
# source://activesupport//lib/active_support/ordered_hash.rb#41
def nested_under_indifferent_access; end
# source://activesupport//lib/active_support/ordered_hash.rb#37
def reject(*args, &block); end
# source://activesupport//lib/active_support/ordered_hash.rb#33
def select(*args, &block); end
# source://activesupport//lib/active_support/ordered_hash.rb#25
def to_yaml_type; end
end
# = Ordered Options
#
# +OrderedOptions+ inherits from +Hash+ and provides dynamic accessor methods.
#
# With a +Hash+, key-value pairs are typically managed like this:
#
# h = {}
# h[:boy] = 'John'
# h[:girl] = 'Mary'
# h[:boy] # => 'John'
# h[:girl] # => 'Mary'
# h[:dog] # => nil
#
# Using +OrderedOptions+, the above code can be written as:
#
# h = ActiveSupport::OrderedOptions.new
# h.boy = 'John'
# h.girl = 'Mary'
# h.boy # => 'John'
# h.girl # => 'Mary'
# h.dog # => nil
#
# To raise an exception when the value is blank, append a
# bang to the key name, like:
#
# h.dog! # => raises KeyError: :dog is blank
#
# source://activesupport//lib/active_support/ordered_options.rb#33
class ActiveSupport::OrderedOptions < ::Hash
# source://activesupport//lib/active_support/ordered_options.rb#41
def [](key); end
# source://activesupport//lib/active_support/ordered_options.rb#37
def []=(key, value); end
# source://activesupport//lib/active_support/ordered_options.rb#45
def dig(key, *identifiers); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/ordered_options.rb#64
def extractable_options?; end
# source://activesupport//lib/active_support/ordered_options.rb#68
def inspect; end
# source://activesupport//lib/active_support/ordered_options.rb#49
def method_missing(method, *args); end
protected
# preserve the original #[] method
def _get(_arg0); end
private
# @return [Boolean]
#
# source://activesupport//lib/active_support/ordered_options.rb#60
def respond_to_missing?(name, include_private); end
end
# source://activesupport//lib/active_support/proxy_object.rb#4
class ActiveSupport::ProxyObject < ::BasicObject
# Let ActiveSupport::ProxyObject at least raise exceptions.
#
# source://activesupport//lib/active_support/proxy_object.rb#9
def raise(*args); end
class << self
# @private
#
# source://activesupport//lib/active_support/proxy_object.rb#13
def inherited(_subclass); end
end
end
# = Active Support \Reloader
#
# This class defines several callbacks:
#
# to_prepare -- Run once at application startup, and also from
# +to_run+.
#
# to_run -- Run before a work run that is reloading. If
# +reload_classes_only_on_change+ is true (the default), the class
# unload will have already occurred.
#
# to_complete -- Run after a work run that has reloaded. If
# +reload_classes_only_on_change+ is false, the class unload will
# have occurred after the work run, but before this callback.
#
# before_class_unload -- Run immediately before the classes are
# unloaded.
#
# after_class_unload -- Run immediately after the classes are
# unloaded.
#
# source://activesupport//lib/active_support/reloader.rb#28
class ActiveSupport::Reloader < ::ActiveSupport::ExecutionWrapper
# @return [Reloader] a new instance of Reloader
#
# source://activesupport//lib/active_support/reloader.rb#99
def initialize; end
# source://activesupport//lib/active_support/callbacks.rb#924
def _class_unload_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#924
def _prepare_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#912
def _run_class_unload_callbacks(&block); end
# source://activesupport//lib/active_support/callbacks.rb#912
def _run_prepare_callbacks(&block); end
# source://activesupport//lib/active_support/reloader.rb#85
def check; end
# source://activesupport//lib/active_support/reloader.rb#85
def check=(_arg0); end
# source://activesupport//lib/active_support/reloader.rb#85
def check?; end
# source://activesupport//lib/active_support/reloader.rb#126
def class_unload!(&block); end
# source://activesupport//lib/active_support/reloader.rb#131
def complete!; end
# source://activesupport//lib/active_support/reloader.rb#84
def executor; end
# source://activesupport//lib/active_support/reloader.rb#84
def executor=(_arg0); end
# source://activesupport//lib/active_support/reloader.rb#84
def executor?; end
# Release the unload lock if it has been previously obtained
#
# source://activesupport//lib/active_support/reloader.rb#114
def release_unload_lock!; end
# Acquire the ActiveSupport::Dependencies::Interlock unload lock,
# ensuring it will be released automatically
#
# source://activesupport//lib/active_support/reloader.rb#106
def require_unload_lock!; end
# source://activesupport//lib/active_support/reloader.rb#121
def run!; end
class << self
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#916
def _class_unload_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#920
def _class_unload_callbacks=(value); end
# source://activesupport//lib/active_support/callbacks.rb#916
def _prepare_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#920
def _prepare_callbacks=(value); end
# Registers a callback that will run immediately after the classes are unloaded.
#
# source://activesupport//lib/active_support/reloader.rb#44
def after_class_unload(*args, &block); end
# Registers a callback that will run immediately before the classes are unloaded.
#
# source://activesupport//lib/active_support/reloader.rb#39
def before_class_unload(*args, &block); end
# source://activesupport//lib/active_support/reloader.rb#85
def check; end
# source://activesupport//lib/active_support/reloader.rb#87
def check!; end
# source://activesupport//lib/active_support/reloader.rb#85
def check=(value); end
# source://activesupport//lib/active_support/reloader.rb#85
def check?; end
# source://activesupport//lib/active_support/reloader.rb#84
def executor; end
# source://activesupport//lib/active_support/reloader.rb#84
def executor=(value); end
# source://activesupport//lib/active_support/reloader.rb#84
def executor?; end
# source://activesupport//lib/active_support/reloader.rb#95
def prepare!; end
# Initiate a manual reload
#
# source://activesupport//lib/active_support/reloader.rb#51
def reload!; end
# source://activesupport//lib/active_support/reloader.rb#91
def reloaded!; end
# source://activesupport//lib/active_support/reloader.rb#62
def run!(reset: T.unsafe(nil)); end
# Registers a callback that will run once at application startup and every time the code is reloaded.
#
# source://activesupport//lib/active_support/reloader.rb#34
def to_prepare(*args, &block); end
# Run the supplied block as a work unit, reloading code as needed
#
# source://activesupport//lib/active_support/reloader.rb#71
def wrap(**kwargs); end
end
end
# = Active Support \Rescuable
#
# Rescuable module adds support for easier exception handling.
#
# source://activesupport//lib/active_support/rescuable.rb#11
module ActiveSupport::Rescuable
extend ::ActiveSupport::Concern
include GeneratedInstanceMethods
mixes_in_class_methods GeneratedClassMethods
mixes_in_class_methods ::ActiveSupport::Rescuable::ClassMethods
# Internal handler lookup. Delegates to class method. Some libraries call
# this directly, so keeping it around for compatibility.
#
# source://activesupport//lib/active_support/rescuable.rb#172
def handler_for_rescue(exception); end
# Delegates to the class method, but uses the instance as the subject for
# rescue_from handlers (method calls, +instance_exec+ blocks).
#
# source://activesupport//lib/active_support/rescuable.rb#166
def rescue_with_handler(exception); end
module GeneratedClassMethods
def rescue_handlers; end
def rescue_handlers=(value); end
def rescue_handlers?; end
end
module GeneratedInstanceMethods
def rescue_handlers; end
def rescue_handlers=(value); end
def rescue_handlers?; end
end
end
# source://activesupport//lib/active_support/rescuable.rb#18
module ActiveSupport::Rescuable::ClassMethods
# source://activesupport//lib/active_support/rescuable.rb#105
def handler_for_rescue(exception, object: T.unsafe(nil)); end
# Registers exception classes with a handler to be called by <tt>rescue_with_handler</tt>.
#
# <tt>rescue_from</tt> receives a series of exception classes or class
# names, and an exception handler specified by a trailing <tt>:with</tt>
# option containing the name of a method or a Proc object. Alternatively, a block
# can be given as the handler.
#
# Handlers that take one argument will be called with the exception, so
# that the exception can be inspected when dealing with it.
#
# Handlers are inherited. They are searched from right to left, from
# bottom to top, and up the hierarchy. The handler of the first class for
# which <tt>exception.is_a?(klass)</tt> holds true is the one invoked, if
# any.
#
# class ApplicationController < ActionController::Base
# rescue_from User::NotAuthorized, with: :deny_access
# rescue_from ActiveRecord::RecordInvalid, with: :show_record_errors
#
# rescue_from "MyApp::BaseError" do |exception|
# redirect_to root_url, alert: exception.message
# end
#
# private
# def deny_access
# head :forbidden
# end
#
# def show_record_errors(exception)
# redirect_back_or_to root_url, alert: exception.record.errors.full_messages.to_sentence
# end
# end
#
# Exceptions raised inside exception handlers are not propagated up.
#
# source://activesupport//lib/active_support/rescuable.rb#53
def rescue_from(*klasses, with: T.unsafe(nil), &block); end
# Matches an exception to a handler based on the exception class.
#
# If no handler matches the exception, check for a handler matching the
# (optional) +exception.cause+. If no handler matches the exception or its
# cause, this returns +nil+, so you can deal with unhandled exceptions.
# Be sure to re-raise unhandled exceptions if this is what you expect.
#
# begin
# # ...
# rescue => exception
# rescue_with_handler(exception) || raise
# end
#
# Returns the exception if it was handled and +nil+ if it was not.
#
# source://activesupport//lib/active_support/rescuable.rb#90
def rescue_with_handler(exception, object: T.unsafe(nil), visited_exceptions: T.unsafe(nil)); end
private
# source://activesupport//lib/active_support/rescuable.rb#139
def constantize_rescue_handler_class(class_or_name); end
# source://activesupport//lib/active_support/rescuable.rb#124
def find_rescue_handler(exception); end
end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#19
class ActiveSupport::SafeBuffer < ::String
# @return [SafeBuffer] a new instance of SafeBuffer
#
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#70
def initialize(str = T.unsafe(nil)); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#123
def %(args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#116
def *(_); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#112
def +(other); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#80
def <<(value); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#38
def [](*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#104
def []=(arg1, arg2, arg3 = T.unsafe(nil)); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#88
def bytesplice(*args, value); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def capitalize(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def capitalize!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def chomp(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def chomp!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def chop(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def chop!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#59
def chr; end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#80
def concat(value); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def delete(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def delete!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def delete_prefix(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def delete_prefix!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def delete_suffix(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def delete_suffix!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def downcase(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def downcase!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#146
def encode_with(coder); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#167
def gsub(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#178
def gsub!(*args, &block); end
# Returns the value of attribute html_safe.
#
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#134
def html_safe?; end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#92
def insert(index, value); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def lstrip(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def lstrip!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def next(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def next!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#96
def prepend(value); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#100
def replace(value); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def reverse(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def reverse!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def rstrip(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def rstrip!(*args); end
# @raise [SafeConcatError]
#
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#65
def safe_concat(value); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def scrub(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def scrub!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#38
def slice(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#51
def slice!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def squeeze(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def squeeze!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def strip(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def strip!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#167
def sub(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#178
def sub!(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def succ(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def succ!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def swapcase(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def swapcase!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#142
def to_param; end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#138
def to_s; end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def tr(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def tr!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def tr_s(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def tr_s!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def unicode_normalize(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def unicode_normalize!(*args); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153
def upcase(*args, &block); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157
def upcase!(*args); end
private
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#193
def explicit_html_escape_interpolated_argument(arg); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#197
def implicit_html_escape_interpolated_argument(arg); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#75
def initialize_copy(other); end
def original_concat(*_arg0); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#205
def set_block_back_references(block, match_data); end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#211
def string_into_safe_buffer(new_string, is_html_safe); end
end
# Raised when ActiveSupport::SafeBuffer#safe_concat is called on unsafe buffers.
#
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#32
class ActiveSupport::SafeBuffer::SafeConcatError < ::StandardError
# @return [SafeConcatError] a new instance of SafeConcatError
#
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#33
def initialize; end
end
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#20
ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#26
ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS_WITH_BACKREF = T.let(T.unsafe(nil), Array)
# = Secure Compare Rotator
#
# The ActiveSupport::SecureCompareRotator is a wrapper around ActiveSupport::SecurityUtils.secure_compare
# and allows you to rotate a previously defined value to a new one.
#
# It can be used as follow:
#
# rotator = ActiveSupport::SecureCompareRotator.new('new_production_value')
# rotator.rotate('previous_production_value')
# rotator.secure_compare!('previous_production_value')
#
# One real use case example would be to rotate a basic auth credentials:
#
# class MyController < ApplicationController
# def authenticate_request
# rotator = ActiveSupport::SecureCompareRotator.new('new_password')
# rotator.rotate('old_password')
#
# authenticate_or_request_with_http_basic do |username, password|
# rotator.secure_compare!(password)
# rescue ActiveSupport::SecureCompareRotator::InvalidMatch
# false
# end
# end
# end
#
# source://activesupport//lib/active_support/secure_compare_rotator.rb#32
class ActiveSupport::SecureCompareRotator
include ::ActiveSupport::SecurityUtils
# @return [SecureCompareRotator] a new instance of SecureCompareRotator
#
# source://activesupport//lib/active_support/secure_compare_rotator.rb#37
def initialize(value, on_rotation: T.unsafe(nil)); end
# source://activesupport//lib/active_support/secure_compare_rotator.rb#43
def rotate(previous_value); end
# source://activesupport//lib/active_support/secure_compare_rotator.rb#47
def secure_compare!(other_value, on_rotation: T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/secure_compare_rotator.rb#35
class ActiveSupport::SecureCompareRotator::InvalidMatch < ::StandardError; end
# source://activesupport//lib/active_support/security_utils.rb#4
module ActiveSupport::SecurityUtils
private
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/security_utils.rb#11
def fixed_length_secure_compare(a, b); end
# Secure string comparison for strings of variable length.
#
# While a timing attack would not be able to discern the content of
# a secret compared via secure_compare, it is possible to determine
# the secret length. This should be considered when using secure_compare
# to compare weak, short secrets to user input.
#
# source://activesupport//lib/active_support/security_utils.rb#33
def secure_compare(a, b); end
class << self
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/security_utils.rb#11
def fixed_length_secure_compare(a, b); end
# Secure string comparison for strings of variable length.
#
# While a timing attack would not be able to discern the content of
# a secret compared via secure_compare, it is possible to determine
# the secret length. This should be considered when using secure_compare
# to compare weak, short secrets to user input.
#
# source://activesupport//lib/active_support/security_utils.rb#33
def secure_compare(a, b); end
end
end
# = \String Inquirer
#
# Wrapping a string in this class gives you a prettier way to test
# for equality. The value returned by <tt>Rails.env</tt> is wrapped
# in a StringInquirer object, so instead of calling this:
#
# Rails.env == 'production'
#
# you can call this:
#
# Rails.env.production?
#
# == Instantiating a new \StringInquirer
#
# vehicle = ActiveSupport::StringInquirer.new('car')
# vehicle.car? # => true
# vehicle.bike? # => false
#
# source://activesupport//lib/active_support/string_inquirer.rb#21
class ActiveSupport::StringInquirer < ::String
private
# source://activesupport//lib/active_support/string_inquirer.rb#27
def method_missing(method_name, *_arg1, **_arg2, &_arg3); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/string_inquirer.rb#23
def respond_to_missing?(method_name, include_private = T.unsafe(nil)); end
end
# = Active Support \Subscriber
#
# +ActiveSupport::Subscriber+ is an object set to consume
# ActiveSupport::Notifications. The subscriber dispatches notifications to
# a registered object based on its given namespace.
#
# An example would be an Active Record subscriber responsible for collecting
# statistics about queries:
#
# module ActiveRecord
# class StatsSubscriber < ActiveSupport::Subscriber
# attach_to :active_record
#
# def sql(event)
# Statsd.timing("sql.#{event.payload[:name]}", event.duration)
# end
# end
# end
#
# After configured, whenever a <tt>"sql.active_record"</tt> notification is
# published, it will properly dispatch the event
# (ActiveSupport::Notifications::Event) to the +sql+ method.
#
# We can detach a subscriber as well:
#
# ActiveRecord::StatsSubscriber.detach_from(:active_record)
#
# source://activesupport//lib/active_support/subscriber.rb#32
class ActiveSupport::Subscriber
# @return [Subscriber] a new instance of Subscriber
#
# source://activesupport//lib/active_support/subscriber.rb#131
def initialize; end
# source://activesupport//lib/active_support/subscriber.rb#136
def call(event); end
# source://activesupport//lib/active_support/subscriber.rb#129
def patterns; end
# source://activesupport//lib/active_support/subscriber.rb#141
def publish_event(event); end
class << self
# Attach the subscriber to a namespace.
#
# source://activesupport//lib/active_support/subscriber.rb#35
def attach_to(namespace, subscriber = T.unsafe(nil), notifier = T.unsafe(nil), inherit_all: T.unsafe(nil)); end
# Detach the subscriber from a namespace.
#
# source://activesupport//lib/active_support/subscriber.rb#50
def detach_from(namespace, notifier = T.unsafe(nil)); end
# Adds event subscribers for all new methods added to the class.
#
# source://activesupport//lib/active_support/subscriber.rb#69
def method_added(event); end
# source://activesupport//lib/active_support/subscriber.rb#79
def subscribers; end
private
# source://activesupport//lib/active_support/subscriber.rb#86
def add_event_subscriber(event); end
# source://activesupport//lib/active_support/subscriber.rb#124
def fetch_public_methods(subscriber, inherit_all); end
# source://activesupport//lib/active_support/subscriber.rb#108
def find_attached_subscriber; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/subscriber.rb#112
def invalid_event?(event); end
# Returns the value of attribute namespace.
#
# source://activesupport//lib/active_support/subscriber.rb#84
def namespace; end
# Returns the value of attribute notifier.
#
# source://activesupport//lib/active_support/subscriber.rb#84
def notifier; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/subscriber.rb#120
def pattern_subscribed?(pattern); end
# source://activesupport//lib/active_support/subscriber.rb#116
def prepare_pattern(event); end
# source://activesupport//lib/active_support/subscriber.rb#97
def remove_event_subscriber(event); end
# Returns the value of attribute subscriber.
#
# source://activesupport//lib/active_support/subscriber.rb#84
def subscriber; end
end
end
# = Active Support Tagged Logging
#
# Wraps any standard Logger object to provide tagging capabilities.
#
# May be called with a block:
#
# logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
# logger.tagged('BCX') { logger.info 'Stuff' } # Logs "[BCX] Stuff"
# logger.tagged('BCX', "Jason") { |tagged_logger| tagged_logger.info 'Stuff' } # Logs "[BCX] [Jason] Stuff"
# logger.tagged('BCX') { logger.tagged('Jason') { logger.info 'Stuff' } } # Logs "[BCX] [Jason] Stuff"
#
# If called without a block, a new logger will be returned with applied tags:
#
# logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
# logger.tagged("BCX").info "Stuff" # Logs "[BCX] Stuff"
# logger.tagged("BCX", "Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff"
# logger.tagged("BCX").tagged("Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff"
#
# This is used by the default Rails.logger as configured by Railties to make
# it easy to stamp log lines with subdomains, request ids, and anything else
# to aid debugging of multi-user production applications.
#
# source://activesupport//lib/active_support/tagged_logging.rb#29
module ActiveSupport::TaggedLogging
# source://activesupport//lib/active_support/tagged_logging.rb#134
def clear_tags!(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/tagged_logging.rb#147
def flush; end
# source://activesupport//lib/active_support/tagged_logging.rb#134
def pop_tags(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/tagged_logging.rb#134
def push_tags(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/tagged_logging.rb#136
def tagged(*tags); end
class << self
# source://activesupport//lib/active_support/tagged_logging.rb#116
def new(logger); end
end
end
# source://activesupport//lib/active_support/tagged_logging.rb#30
module ActiveSupport::TaggedLogging::Formatter
# This method is invoked when a log event occurs.
#
# source://activesupport//lib/active_support/tagged_logging.rb#32
def call(severity, timestamp, progname, msg); end
# source://activesupport//lib/active_support/tagged_logging.rb#51
def clear_tags!; end
# source://activesupport//lib/active_support/tagged_logging.rb#61
def current_tags; end
# source://activesupport//lib/active_support/tagged_logging.rb#47
def pop_tags(count = T.unsafe(nil)); end
# source://activesupport//lib/active_support/tagged_logging.rb#43
def push_tags(*tags); end
# source://activesupport//lib/active_support/tagged_logging.rb#55
def tag_stack; end
# source://activesupport//lib/active_support/tagged_logging.rb#36
def tagged(*tags); end
# source://activesupport//lib/active_support/tagged_logging.rb#65
def tags_text; end
end
# source://activesupport//lib/active_support/tagged_logging.rb#108
module ActiveSupport::TaggedLogging::LocalTagStorage
# Returns the value of attribute tag_stack.
#
# source://activesupport//lib/active_support/tagged_logging.rb#109
def tag_stack; end
# Sets the attribute tag_stack
#
# @param value the value to set the attribute tag_stack to.
#
# source://activesupport//lib/active_support/tagged_logging.rb#109
def tag_stack=(_arg0); end
class << self
# @private
#
# source://activesupport//lib/active_support/tagged_logging.rb#111
def extended(base); end
end
end
# source://activesupport//lib/active_support/tagged_logging.rb#70
class ActiveSupport::TaggedLogging::TagStack
# @return [TagStack] a new instance of TagStack
#
# source://activesupport//lib/active_support/tagged_logging.rb#73
def initialize; end
# source://activesupport//lib/active_support/tagged_logging.rb#91
def clear; end
# source://activesupport//lib/active_support/tagged_logging.rb#96
def format_message(message); end
# source://activesupport//lib/active_support/tagged_logging.rb#86
def pop_tags(count); end
# source://activesupport//lib/active_support/tagged_logging.rb#78
def push_tags(tags); end
# Returns the value of attribute tags.
#
# source://activesupport//lib/active_support/tagged_logging.rb#71
def tags; end
end
# source://activesupport//lib/active_support/test_case.rb#21
class ActiveSupport::TestCase < ::Minitest::Test
include ::ActiveSupport::Testing::SetupAndTeardown
include ::ActiveSupport::Testing::TestsWithoutAssertions
include ::ActiveSupport::Testing::TaggedLogging
include ::ActiveSupport::Callbacks
include ::ActiveSupport::Testing::Assertions
include ::ActiveSupport::Testing::ErrorReporterAssertions
include ::ActiveSupport::Testing::Deprecation
include ::ActiveSupport::Testing::ConstantStubbing
include ::ActiveSupport::Testing::TimeHelpers
include ::ActiveSupport::Testing::FileFixtures
extend ::ActiveSupport::Callbacks::ClassMethods
extend ::ActiveSupport::DescendantsTracker
extend ::ActiveSupport::Testing::SetupAndTeardown::ClassMethods
extend ::ActiveSupport::Testing::Declarative
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks?; end
# source://activesupport//lib/active_support/callbacks.rb#912
def _run_setup_callbacks(&block); end
# source://activesupport//lib/active_support/callbacks.rb#912
def _run_teardown_callbacks(&block); end
# source://activesupport//lib/active_support/callbacks.rb#924
def _setup_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#924
def _teardown_callbacks; end
# source://minitest/5.25.1/lib/minitest/assertions.rb#731
def assert_no_match(matcher, obj, msg = T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#660
def assert_not_empty(obj, msg = T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#671
def assert_not_equal(exp, act, msg = T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#683
def assert_not_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#695
def assert_not_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#702
def assert_not_includes(collection, obj, msg = T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#713
def assert_not_instance_of(cls, obj, msg = T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#723
def assert_not_kind_of(cls, obj, msg = T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#741
def assert_not_nil(obj, msg = T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#776
def assert_not_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#799
def assert_not_predicate(o1, op, msg = T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#808
def assert_not_respond_to(obj, meth, msg = T.unsafe(nil), include_all: T.unsafe(nil)); end
# source://minitest/5.25.1/lib/minitest/assertions.rb#817
def assert_not_same(exp, act, msg = T.unsafe(nil)); end
# source://activesupport//lib/active_support/testing/file_fixtures.rb#20
def file_fixture_path; end
# source://activesupport//lib/active_support/testing/file_fixtures.rb#20
def file_fixture_path?; end
# source://activesupport//lib/active_support/test_case.rb#300
def inspect; end
# source://minitest/5.25.1/lib/minitest.rb#375
def method_name; end
class << self
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks=(value); end
# source://activesupport//lib/active_support/callbacks.rb#70
def __callbacks?; end
# source://activesupport//lib/active_support/callbacks.rb#916
def _setup_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#920
def _setup_callbacks=(value); end
# source://activesupport//lib/active_support/callbacks.rb#916
def _teardown_callbacks; end
# source://activesupport//lib/active_support/callbacks.rb#920
def _teardown_callbacks=(value); end
# source://activesupport//lib/active_support/testing/file_fixtures.rb#20
def file_fixture_path; end
# source://activesupport//lib/active_support/testing/file_fixtures.rb#20
def file_fixture_path=(value); end
# source://activesupport//lib/active_support/testing/file_fixtures.rb#20
def file_fixture_path?; end
# Parallelizes the test suite.
#
# Takes a +workers+ argument that controls how many times the process
# is forked. For each process a new database will be created suffixed
# with the worker number.
#
# test-database-0
# test-database-1
#
# If <tt>ENV["PARALLEL_WORKERS"]</tt> is set the workers argument will be ignored
# and the environment variable will be used instead. This is useful for CI
# environments, or other environments where you may need more workers than
# you do for local testing.
#
# If the number of workers is set to +1+ or fewer, the tests will not be
# parallelized.
#
# If +workers+ is set to +:number_of_processors+, the number of workers will be
# set to the actual core count on the machine you are on.
#
# The default parallelization method is to fork processes. If you'd like to
# use threads instead you can pass <tt>with: :threads</tt> to the +parallelize+
# method. Note the threaded parallelization does not create multiple
# databases and will not work with system tests.
#
# parallelize(workers: :number_of_processors, with: :threads)
#
# The threaded parallelization uses minitest's parallel executor directly.
# The processes parallelization uses a Ruby DRb server.
#
# Because parallelization presents an overhead, it is only enabled when the
# number of tests to run is above the +threshold+ param. The default value is
# 50, and it's configurable via +config.active_support.test_parallelization_threshold+.
#
# source://activesupport//lib/active_support/test_case.rb#81
def parallelize(workers: T.unsafe(nil), with: T.unsafe(nil), threshold: T.unsafe(nil)); end
# Set up hook for parallel testing. This can be used if you have multiple
# databases or any behavior that needs to be run after the process is forked
# but before the tests run.
#
# Note: this feature is not available with the threaded parallelization.
#
# In your +test_helper.rb+ add the following:
#
# class ActiveSupport::TestCase
# parallelize_setup do
# # create databases
# end
# end
#
# source://activesupport//lib/active_support/test_case.rb#101
def parallelize_setup(&block); end
# Clean up hook for parallel testing. This can be used to drop databases
# if your app uses multiple write/read databases or other clean up before
# the tests finish. This runs before the forked process is closed.
#
# Note: this feature is not available with the threaded parallelization.
#
# In your +test_helper.rb+ add the following:
#
# class ActiveSupport::TestCase
# parallelize_teardown do
# # drop databases
# end
# end
#
# source://activesupport//lib/active_support/test_case.rb#118
def parallelize_teardown(&block); end
# Returns the order in which test cases are run.
#
# ActiveSupport::TestCase.test_order # => :random
#
# Possible values are +:random+, +:parallel+, +:alpha+, +:sorted+.
# Defaults to +:random+.
#
# source://activesupport//lib/active_support/test_case.rb#44
def test_order; end
# Sets the order in which test cases are run.
#
# ActiveSupport::TestCase.test_order = :random # => :random
#
# Valid values are:
# * +:random+ (to run tests in random order)
# * +:parallel+ (to run tests in parallel)
# * +:sorted+ (to run tests alphabetically by method name)
# * +:alpha+ (equivalent to +:sorted+)
#
# source://activesupport//lib/active_support/test_case.rb#34
def test_order=(new_order); end
end
end
# source://activesupport//lib/active_support/test_case.rb#22
ActiveSupport::TestCase::Assertion = Minitest::Assertion
# source://activesupport//lib/active_support/testing/tagged_logging.rb#4
module ActiveSupport::Testing; end
# source://activesupport//lib/active_support/testing/assertions.rb#7
module ActiveSupport::Testing::Assertions
# Assertion that the result of evaluating an expression is changed before
# and after invoking the passed in block.
#
# assert_changes 'Status.all_good?' do
# post :create, params: { status: { ok: false } }
# end
#
# You can pass the block as a string to be evaluated in the context of
# the block. A lambda can be passed for the block as well.
#
# assert_changes -> { Status.all_good? } do
# post :create, params: { status: { ok: false } }
# end
#
# The assertion is useful to test side effects. The passed block can be
# anything that can be converted to string with #to_s.
#
# assert_changes :@object do
# @object = 42
# end
#
# The keyword arguments +:from+ and +:to+ can be given to specify the
# expected initial value and the expected value after the block was
# executed.
#
# assert_changes :@object, from: nil, to: :foo do
# @object = :foo
# end
#
# An error message can be specified.
#
# assert_changes -> { Status.all_good? }, 'Expected the status to be bad' do
# post :create, params: { status: { incident: true } }
# end
#
# source://activesupport//lib/active_support/testing/assertions.rb#191
def assert_changes(expression, message = T.unsafe(nil), from: T.unsafe(nil), to: T.unsafe(nil), &block); end
# Test numeric difference between the return value of an expression as a
# result of what is evaluated in the yielded block.
#
# assert_difference 'Article.count' do
# post :create, params: { article: {...} }
# end
#
# An arbitrary expression is passed in and evaluated.
#
# assert_difference 'Article.last.comments(:reload).size' do
# post :create, params: { comment: {...} }
# end
#
# An arbitrary positive or negative difference can be specified.
# The default is +1+.
#
# assert_difference 'Article.count', -1 do
# post :delete, params: { id: ... }
# end
#
# An array of expressions can also be passed in and evaluated.
#
# assert_difference [ 'Article.count', 'Post.count' ], 2 do
# post :create, params: { article: {...} }
# end
#
# A hash of expressions/numeric differences can also be passed in and evaluated.
#
# assert_difference ->{ Article.count } => 1, ->{ Notification.count } => 2 do
# post :create, params: { article: {...} }
# end
#
# A lambda or a list of lambdas can be passed in and evaluated:
#
# assert_difference ->{ Article.count }, 2 do
# post :create, params: { article: {...} }
# end
#
# assert_difference [->{ Article.count }, ->{ Post.count }], 2 do
# post :create, params: { article: {...} }
# end
#
# An error message can be specified.
#
# assert_difference 'Article.count', -1, 'An Article should be destroyed' do
# post :delete, params: { id: ... }
# end
#
# source://activesupport//lib/active_support/testing/assertions.rb#101
def assert_difference(expression, *args, &block); end
# Assertion that the result of evaluating an expression is not changed before
# and after invoking the passed in block.
#
# assert_no_changes 'Status.all_good?' do
# post :create, params: { status: { ok: true } }
# end
#
# Provide the optional keyword argument +:from+ to specify the expected
# initial value.
#
# assert_no_changes -> { Status.all_good? }, from: true do
# post :create, params: { status: { ok: true } }
# end
#
# An error message can be specified.
#
# assert_no_changes -> { Status.all_good? }, 'Expected the status to be good' do
# post :create, params: { status: { ok: false } }
# end
#
# source://activesupport//lib/active_support/testing/assertions.rb#238
def assert_no_changes(expression, message = T.unsafe(nil), from: T.unsafe(nil), &block); end
# Assertion that the numeric result of evaluating an expression is not
# changed before and after invoking the passed in block.
#
# assert_no_difference 'Article.count' do
# post :create, params: { article: invalid_attributes }
# end
#
# A lambda can be passed in and evaluated.
#
# assert_no_difference -> { Article.count } do
# post :create, params: { article: invalid_attributes }
# end
#
# An error message can be specified.
#
# assert_no_difference 'Article.count', 'An Article should not be created' do
# post :create, params: { article: invalid_attributes }
# end
#
# An array of expressions can also be passed in and evaluated.
#
# assert_no_difference [ 'Article.count', -> { Post.count } ] do
# post :create, params: { article: invalid_attributes }
# end
#
# source://activesupport//lib/active_support/testing/assertions.rb#153
def assert_no_difference(expression, message = T.unsafe(nil), &block); end
# Asserts that an expression is not truthy. Passes if +object+ is +nil+ or
# +false+. "Truthy" means "considered true in a conditional" like <tt>if
# foo</tt>.
#
# assert_not nil # => true
# assert_not false # => true
# assert_not 'foo' # => Expected "foo" to be nil or false
#
# An error message can be specified.
#
# assert_not foo, 'foo should be false'
#
# source://activesupport//lib/active_support/testing/assertions.rb#21
def assert_not(object, message = T.unsafe(nil)); end
# Assertion that the block should not raise an exception.
#
# Passes if evaluated code in the yielded block raises no exception.
#
# assert_nothing_raised do
# perform_service(param: 'no_exception')
# end
#
# source://activesupport//lib/active_support/testing/assertions.rb#48
def assert_nothing_raised; end
# Asserts that a block raises one of +exp+. This is an enhancement of the
# standard Minitest assertion method with the ability to test error
# messages.
#
# assert_raises(ArgumentError, match: /incorrect param/i) do
# perform_service(param: 'exception')
# end
#
# source://activesupport//lib/active_support/testing/assertions.rb#34
def assert_raise(*exp, match: T.unsafe(nil), &block); end
# Asserts that a block raises one of +exp+. This is an enhancement of the
# standard Minitest assertion method with the ability to test error
# messages.
#
# assert_raises(ArgumentError, match: /incorrect param/i) do
# perform_service(param: 'exception')
# end
#
# source://activesupport//lib/active_support/testing/assertions.rb#34
def assert_raises(*exp, match: T.unsafe(nil), &block); end
private
# source://activesupport//lib/active_support/testing/assertions.rb#265
def _assert_nothing_raised_or_warn(assertion, &block); end
end
# source://activesupport//lib/active_support/testing/assertions.rb#8
ActiveSupport::Testing::Assertions::UNTRACKED = T.let(T.unsafe(nil), Object)
# Resolves a constant from a minitest spec name.
#
# Given the following spec-style test:
#
# describe WidgetsController, :index do
# describe "authenticated user" do
# describe "returns widgets" do
# it "has a controller that exists" do
# assert_kind_of WidgetsController, @controller
# end
# end
# end
# end
#
# The test will have the following name:
#
# "WidgetsController::index::authenticated user::returns widgets"
#
# The constant WidgetsController can be resolved from the name.
# The following code will resolve the constant:
#
# controller = determine_constant_from_test_name(name) do |constant|
# Class === constant && constant < ::ActionController::Metal
# end
#
# source://activesupport//lib/active_support/testing/constant_lookup.rb#32
module ActiveSupport::Testing::ConstantLookup
extend ::ActiveSupport::Concern
mixes_in_class_methods ::ActiveSupport::Testing::ConstantLookup::ClassMethods
end
# source://activesupport//lib/active_support/testing/constant_lookup.rb#35
module ActiveSupport::Testing::ConstantLookup::ClassMethods
# source://activesupport//lib/active_support/testing/constant_lookup.rb#36
def determine_constant_from_test_name(test_name); end
end
# source://activesupport//lib/active_support/testing/constant_stubbing.rb#5
module ActiveSupport::Testing::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
# assert_equal 1, World::List::Import::LARGE_IMPORT_THRESHOLD
# end
#
# assert_equal 5000, World::List::Import::LARGE_IMPORT_THRESHOLD
#
# Using this method rather than forcing <tt>World::List::Import::LARGE_IMPORT_THRESHOLD = 5000</tt> prevents
# warnings from being thrown, and ensures that the old value is returned after the test has completed.
#
# If the constant doesn't already exists, but you need it set for the duration of the block
# you can do so by passing `exists: false`.
#
# stub_const(object, :SOME_CONST, 1, exists: false) do
# assert_equal 1, SOME_CONST
# end
#
# Note: Stubbing a const will stub it across all threads. So if you have concurrent threads
# (like separate test suites running in parallel) that all depend on the same constant, it's possible
# divergent stubbing will trample on each other.
#
# source://activesupport//lib/active_support/testing/constant_stubbing.rb#28
def stub_const(mod, constant, new_value, exists: T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/testing/declarative.rb#5
module ActiveSupport::Testing::Declarative
# 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
# ...
# end
#
# source://activesupport//lib/active_support/testing/declarative.rb#13
def test(name, &block); end
end
# source://activesupport//lib/active_support/testing/deprecation.rb#7
module ActiveSupport::Testing::Deprecation
# :call-seq:
# assert_deprecated(deprecator, &block)
# assert_deprecated(match, deprecator, &block)
#
# Asserts that a matching deprecation warning was emitted by the given deprecator during the execution of the yielded block.
#
# assert_deprecated(/foo/, CustomDeprecator) do
# CustomDeprecator.warn "foo should no longer be used"
# end
#
# The +match+ object may be a +Regexp+, or +String+ appearing in the message.
#
# assert_deprecated('foo', CustomDeprecator) do
# CustomDeprecator.warn "foo should no longer be used"
# end
#
# If the +match+ is omitted (or explicitly +nil+), any deprecation warning will match.
#
# assert_deprecated(CustomDeprecator) do
# CustomDeprecator.warn "foo should no longer be used"
# end
#
# source://activesupport//lib/active_support/testing/deprecation.rb#30
def assert_deprecated(match = T.unsafe(nil), deprecator = T.unsafe(nil), &block); end
# Asserts that no deprecation warnings are emitted by the given deprecator during the execution of the yielded block.
#
# assert_not_deprecated(CustomDeprecator) do
# CustomDeprecator.warn "message" # fails assertion
# end
#
# assert_not_deprecated(ActiveSupport::Deprecation.new) do
# CustomDeprecator.warn "message" # passes assertion, different deprecator
# end
#
# source://activesupport//lib/active_support/testing/deprecation.rb#55
def assert_not_deprecated(deprecator, &block); end
# Returns the return value of the block and an array of all the deprecation warnings emitted by the given
# +deprecator+ during the execution of the yielded block.
#
# collect_deprecations(CustomDeprecator) do
# CustomDeprecator.warn "message"
# ActiveSupport::Deprecation.new.warn "other message"
# :result
# end # => [:result, ["message"]]
#
# source://activesupport//lib/active_support/testing/deprecation.rb#69
def collect_deprecations(deprecator); end
end
# source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#5
module ActiveSupport::Testing::ErrorReporterAssertions
# Assertion that the block should cause at least one exception to be reported
# to +Rails.error+.
#
# Passes if the evaluated code in the yielded block reports a matching exception.
#
# assert_error_reported(IOError) do
# Rails.error.report(IOError.new("Oops"))
# end
#
# To test further details about the reported exception, you can use the return
# value.
#
# report = assert_error_reported(IOError) do
# # ...
# end
# assert_equal "Oops", report.error.message
# assert_equal "admin", report.context[:section]
# assert_equal :warning, report.severity
# assert_predicate report, :handled?
#
# source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#88
def assert_error_reported(error_class = T.unsafe(nil), &block); end
# Assertion that the block should not cause an exception to be reported
# to +Rails.error+.
#
# Passes if evaluated code in the yielded block reports no exception.
#
# assert_no_error_reported do
# perform_service(param: 'no_exception')
# end
#
# source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#62
def assert_no_error_reported(&block); end
end
# source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#6
module ActiveSupport::Testing::ErrorReporterAssertions::ErrorCollector
class << self
# source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#16
def record; end
# source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#29
def report(error, **kwargs); end
private
# source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#38
def subscribe; end
end
end
# source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#10
class ActiveSupport::Testing::ErrorReporterAssertions::ErrorCollector::Report < ::Struct
# Returns the value of attribute context
#
# @return [Object] the current value of context
def context; end
# Sets the attribute context
#
# @param value [Object] the value to set the attribute context to.
# @return [Object] the newly set value
def context=(_); end
# Returns the value of attribute error
#
# @return [Object] the current value of error
def error; end
# Sets the attribute error
#
# @param value [Object] the value to set the attribute error to.
# @return [Object] the newly set value
def error=(_); end
# Returns the value of attribute handled
#
# @return [Object] the current value of handled
def handled; end
# Sets the attribute handled
#
# @param value [Object] the value to set the attribute handled to.
# @return [Object] the newly set value
def handled=(_); end
# Returns the value of attribute handled
#
# @return [Object] the current value of handled
def handled?; end
# Returns the value of attribute severity
#
# @return [Object] the current value of severity
def severity; end
# Sets the attribute severity
#
# @param value [Object] the value to set the attribute severity to.
# @return [Object] the newly set value
def severity=(_); end
# Returns the value of attribute source
#
# @return [Object] the current value of source
def source; end
# Sets the attribute source
#
# @param value [Object] the value to set the attribute source to.
# @return [Object] the newly set value
def source=(_); end
class << self
def [](*_arg0); end
def inspect; end
def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
# 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 +Pathname+ objects.
# This makes it easy to extract specific information:
#
# file_fixture("example.txt").read # get the file's content
# file_fixture("example.mp3").size # get the file size
#
# source://activesupport//lib/active_support/testing/file_fixtures.rb#16
module ActiveSupport::Testing::FileFixtures
extend ::ActiveSupport::Concern
include GeneratedInstanceMethods
mixes_in_class_methods GeneratedClassMethods
# Returns a +Pathname+ to the fixture file named +fixture_name+.
#
# Raises +ArgumentError+ if +fixture_name+ can't be found.
#
# source://activesupport//lib/active_support/testing/file_fixtures.rb#26
def file_fixture(fixture_name); end
module GeneratedClassMethods
def file_fixture_path; end
def file_fixture_path=(value); end
def file_fixture_path?; end
end
module GeneratedInstanceMethods
def file_fixture_path; end
def file_fixture_path?; end
end
end
# source://activesupport//lib/active_support/testing/isolation.rb#7
module ActiveSupport::Testing::Isolation
include ::ActiveSupport::Testing::Isolation::Forking
# source://activesupport//lib/active_support/testing/isolation.rb#22
def run; end
class << self
# @return [Boolean]
#
# source://activesupport//lib/active_support/testing/isolation.rb#18
def forking_env?; end
# source://activesupport//lib/active_support/testing/isolation.rb#12
def included(klass); end
end
end
# source://activesupport//lib/active_support/testing/isolation.rb#37
module ActiveSupport::Testing::Isolation::Forking
# source://activesupport//lib/active_support/testing/isolation.rb#38
def run_in_isolation(&blk); end
end
# source://activesupport//lib/active_support/testing/isolation.rb#75
module ActiveSupport::Testing::Isolation::Subprocess
# Complicated H4X to get this working in Windows / JRuby with
# no forking.
#
# source://activesupport//lib/active_support/testing/isolation.rb#80
def run_in_isolation(&blk); end
end
# source://activesupport//lib/active_support/testing/isolation.rb#76
ActiveSupport::Testing::Isolation::Subprocess::ORIG_ARGV = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/testing/isolation.rb#10
class ActiveSupport::Testing::Isolation::SubprocessCrashed < ::StandardError; end
# source://activesupport//lib/active_support/testing/parallelization/server.rb#8
class ActiveSupport::Testing::Parallelization
# @return [Parallelization] a new instance of Parallelization
#
# source://activesupport//lib/active_support/testing/parallelization.rb#28
def initialize(worker_count); end
# source://activesupport//lib/active_support/testing/parallelization.rb#41
def <<(work); end
# source://activesupport//lib/active_support/testing/parallelization.rb#18
def after_fork_hooks; end
# source://activesupport//lib/active_support/testing/parallelization.rb#26
def run_cleanup_hooks; end
# source://activesupport//lib/active_support/testing/parallelization.rb#49
def shutdown; end
# source://activesupport//lib/active_support/testing/parallelization.rb#45
def size; end
# source://activesupport//lib/active_support/testing/parallelization.rb#35
def start; end
class << self
# source://activesupport//lib/active_support/testing/parallelization.rb#14
def after_fork_hook(&blk); end
# source://activesupport//lib/active_support/testing/parallelization.rb#18
def after_fork_hooks; end
# source://activesupport//lib/active_support/testing/parallelization.rb#22
def run_cleanup_hook(&blk); end
# source://activesupport//lib/active_support/testing/parallelization.rb#26
def run_cleanup_hooks; end
end
end
# source://activesupport//lib/active_support/testing/parallelization/server.rb#9
class ActiveSupport::Testing::Parallelization::PrerecordResultClass < ::Struct
# Returns the value of attribute name
#
# @return [Object] the current value of name
def name; end
# Sets the attribute name
#
# @param value [Object] the value to set the attribute name to.
# @return [Object] the newly set value
def name=(_); end
class << self
def [](*_arg0); end
def inspect; end
def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
# source://activesupport//lib/active_support/testing/parallelization/server.rb#11
class ActiveSupport::Testing::Parallelization::Server
include ::DRb::DRbUndumped
# @return [Server] a new instance of Server
#
# source://activesupport//lib/active_support/testing/parallelization/server.rb#14
def initialize; end
# source://activesupport//lib/active_support/testing/parallelization/server.rb#31
def <<(o); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/testing/parallelization/server.rb#51
def active_workers?; end
# source://activesupport//lib/active_support/testing/parallelization/server.rb#55
def interrupt; end
# source://activesupport//lib/active_support/testing/parallelization/server.rb#36
def pop; end
# @raise [DRb::DRbConnError]
#
# source://activesupport//lib/active_support/testing/parallelization/server.rb#20
def record(reporter, result); end
# source://activesupport//lib/active_support/testing/parallelization/server.rb#59
def shutdown; end
# source://activesupport//lib/active_support/testing/parallelization/server.rb#43
def start_worker(worker_id); end
# source://activesupport//lib/active_support/testing/parallelization/server.rb#47
def stop_worker(worker_id); end
end
# source://activesupport//lib/active_support/testing/parallelization/worker.rb#6
class ActiveSupport::Testing::Parallelization::Worker
# @return [Worker] a new instance of Worker
#
# source://activesupport//lib/active_support/testing/parallelization/worker.rb#7
def initialize(number, url); end
# source://activesupport//lib/active_support/testing/parallelization/worker.rb#80
def after_fork; end
# source://activesupport//lib/active_support/testing/parallelization/worker.rb#42
def perform_job(job); end
# source://activesupport//lib/active_support/testing/parallelization/worker.rb#86
def run_cleanup; end
# source://activesupport//lib/active_support/testing/parallelization/worker.rb#56
def safe_record(reporter, result); end
# source://activesupport//lib/active_support/testing/parallelization/worker.rb#14
def start; end
# source://activesupport//lib/active_support/testing/parallelization/worker.rb#36
def work_from_queue; end
private
# source://activesupport//lib/active_support/testing/parallelization/worker.rb#93
def add_setup_exception(result); end
# source://activesupport//lib/active_support/testing/parallelization/worker.rb#97
def set_process_title(status); end
end
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#5
class ActiveSupport::Testing::ParallelizeExecutor
# @return [ParallelizeExecutor] a new instance of ParallelizeExecutor
#
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#8
def initialize(size:, with:, threshold: T.unsafe(nil)); end
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#22
def <<(work); end
# Returns the value of attribute parallelize_with.
#
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#6
def parallelize_with; end
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#26
def shutdown; end
# Returns the value of attribute size.
#
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#6
def size; end
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#15
def start; end
# Returns the value of attribute threshold.
#
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#6
def threshold; end
private
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#35
def build_parallel_executor; end
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#72
def execution_info; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#60
def many_workers?; end
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#31
def parallel_executor; end
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#47
def parallelize; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#52
def parallelized?; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#56
def should_parallelize?; end
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#68
def show_execution_info; end
# source://activesupport//lib/active_support/testing/parallelize_executor.rb#64
def tests_count; end
end
# 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 ExampleTest < ActiveSupport::TestCase
# setup do
# # ...
# end
#
# teardown do
# # ...
# end
# end
#
# source://activesupport//lib/active_support/testing/setup_and_teardown.rb#20
module ActiveSupport::Testing::SetupAndTeardown
# source://activesupport//lib/active_support/testing/setup_and_teardown.rb#44
def after_teardown; end
# source://activesupport//lib/active_support/testing/setup_and_teardown.rb#39
def before_setup; end
class << self
# source://activesupport//lib/active_support/testing/setup_and_teardown.rb#21
def prepended(klass); end
end
end
# source://activesupport//lib/active_support/testing/setup_and_teardown.rb#27
module ActiveSupport::Testing::SetupAndTeardown::ClassMethods
# Add a callback, which runs before <tt>TestCase#setup</tt>.
#
# source://activesupport//lib/active_support/testing/setup_and_teardown.rb#29
def setup(*args, &block); end
# Add a callback, which runs after <tt>TestCase#teardown</tt>.
#
# source://activesupport//lib/active_support/testing/setup_and_teardown.rb#34
def teardown(*args, &block); end
end
# Manages stubs for TimeHelpers
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#9
class ActiveSupport::Testing::SimpleStubs
# @return [SimpleStubs] a new instance of SimpleStubs
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#12
def initialize; end
# Stubs object.method_name with the given block
# If the method is already stubbed, remove that stub
# so that removing this stub will restore the original implementation.
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
# target = Time.zone.local(2004, 11, 24, 1, 4, 44)
# simple_stubs.stub_object(Time, :now) { at(target.to_i) }
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#23
def stub_object(object, method_name, &block); end
# Returns true if any stubs are set, false if there are none
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#53
def stubbed?; end
# Returns the Stub for object#method_name
# (nil if it is not stubbed)
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#48
def stubbing(object, method_name); end
# Remove all object-method stubs held by this instance
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#37
def unstub_all!; end
private
# Restores the original object.method described by the Stub
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#59
def unstub_object(stub); end
end
# source://activesupport//lib/active_support/testing/time_helpers.rb#10
class ActiveSupport::Testing::SimpleStubs::Stub < ::Struct
# Returns the value of attribute method_name
#
# @return [Object] the current value of method_name
def method_name; end
# Sets the attribute method_name
#
# @param value [Object] the value to set the attribute method_name to.
# @return [Object] the newly set value
def method_name=(_); end
# Returns the value of attribute object
#
# @return [Object] the current value of object
def object; end
# Sets the attribute object
#
# @param value [Object] the value to set the attribute object to.
# @return [Object] the newly set value
def object=(_); end
# Returns the value of attribute original_method
#
# @return [Object] the current value of original_method
def original_method; end
# Sets the attribute original_method
#
# @param value [Object] the value to set the attribute original_method to.
# @return [Object] the newly set value
def original_method=(_); end
class << self
def [](*_arg0); end
def inspect; end
def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
# Logs a "PostsControllerTest: test name" heading before each test to
# make test.log easier to search and follow along with.
#
# source://activesupport//lib/active_support/testing/tagged_logging.rb#7
module ActiveSupport::Testing::TaggedLogging
# source://activesupport//lib/active_support/testing/tagged_logging.rb#10
def before_setup; end
# source://activesupport//lib/active_support/testing/tagged_logging.rb#8
def tagged_logger=(_arg0); end
private
# source://activesupport//lib/active_support/testing/tagged_logging.rb#22
def tagged_logger; end
end
# Warns when a test case does not perform any assertions.
#
# This is helpful in detecting broken tests that do not perform intended assertions.
#
# source://activesupport//lib/active_support/testing/tests_without_assertions.rb#8
module ActiveSupport::Testing::TestsWithoutAssertions
# source://activesupport//lib/active_support/testing/tests_without_assertions.rb#9
def after_teardown; end
end
# Contains helpers that help you test passage of time.
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#68
module ActiveSupport::Testing::TimeHelpers
# source://activesupport//lib/active_support/testing/time_helpers.rb#69
def after_teardown; end
# Calls +travel_to+ with +Time.now+. Forwards optional <tt>with_usec</tt> argument.
#
# Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00
# freeze_time
# sleep(1)
# Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00
#
# This method also accepts a block, which will return the current time back to its original
# state at the end of the block:
#
# Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00
# freeze_time do
# sleep(1)
# User.create.created_at # => Sun, 09 Jul 2017 15:34:49 EST -05:00
# end
# Time.current # => Sun, 09 Jul 2017 15:34:50 EST -05:00
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#256
def freeze_time(with_usec: T.unsafe(nil), &block); end
# Changes current time to the time in the future or in the past by a given time difference by
# stubbing +Time.now+, +Date.today+, and +DateTime.now+. The stubs are automatically removed
# at the end of the test.
#
# Note that the usec for the resulting time will be set to 0 to prevent rounding
# errors with external services, like MySQL (which will round instead of floor,
# leading to off-by-one-second errors), unless the <tt>with_usec</tt> argument
# is set to <tt>true</tt>.
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
# travel 1.day
# Time.current # => Sun, 10 Nov 2013 15:34:49 EST -05:00
# Date.current # => Sun, 10 Nov 2013
# DateTime.current # => Sun, 10 Nov 2013 15:34:49 -0500
#
# This method also accepts a block, which will return the current time back to its original
# state at the end of the block:
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
# travel 1.day do
# User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00
# end
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#97
def travel(duration, with_usec: T.unsafe(nil), &block); end
# Returns the current time back to its original state, by removing the stubs added by
# +travel+, +travel_to+, and +freeze_time+.
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
#
# travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
#
# travel_back
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
#
# This method also accepts a block, which brings the stubs back at the end of the block:
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
#
# travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
#
# travel_back do
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
# end
#
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#230
def travel_back; end
# Changes current time to the given time by stubbing +Time.now+, +Time.new+,
# +Date.today+, and +DateTime.now+ to return the time or date passed into this method.
# The stubs are automatically removed at the end of the test.
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
# travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
# Date.current # => Wed, 24 Nov 2004
# DateTime.current # => Wed, 24 Nov 2004 01:04:44 -0500
#
# Dates are taken as their timestamp at the beginning of the day in the
# application time zone. <tt>Time.current</tt> returns said timestamp,
# and <tt>Time.now</tt> its equivalent in the system time zone. Similarly,
# <tt>Date.current</tt> returns a date equal to the argument, and
# <tt>Date.today</tt> the date according to <tt>Time.now</tt>, which may
# be different. (Note that you rarely want to deal with <tt>Time.now</tt>,
# or <tt>Date.today</tt>, in order to honor the application time zone
# please always use <tt>Time.current</tt> and <tt>Date.current</tt>.)
#
# Note that the usec for the time passed will be set to 0 to prevent rounding
# errors with external services, like MySQL (which will round instead of floor,
# leading to off-by-one-second errors), unless the <tt>with_usec</tt> argument
# is set to <tt>true</tt>.
#
# This method also accepts a block, which will return the current time back to its original
# state at the end of the block:
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
# travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) do
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
# end
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#133
def travel_to(date_or_time, with_usec: T.unsafe(nil)); end
# Returns the current time back to its original state, by removing the stubs added by
# +travel+, +travel_to+, and +freeze_time+.
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
#
# travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
#
# travel_back
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
#
# This method also accepts a block, which brings the stubs back at the end of the block:
#
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
#
# travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
#
# travel_back do
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
# end
#
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#230
def unfreeze_time; end
private
# Returns the value of attribute in_block.
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#265
def in_block; end
# Sets the attribute in_block
#
# @param value the value to set the attribute in_block to.
#
# source://activesupport//lib/active_support/testing/time_helpers.rb#265
def in_block=(_arg0); end
# source://activesupport//lib/active_support/testing/time_helpers.rb#261
def simple_stubs; end
end
# = Active Support \Time With Zone
#
# A Time-like class that can represent a time in any time zone. Necessary
# because standard Ruby Time instances are limited to UTC and the
# system's <tt>ENV['TZ']</tt> zone.
#
# You shouldn't ever need to create a TimeWithZone instance directly via +new+.
# Instead use methods +local+, +parse+, +at+, and +now+ on TimeZone instances,
# and +in_time_zone+ on Time and DateTime instances.
#
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# Time.zone.local(2007, 2, 10, 15, 30, 45) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00
# Time.zone.parse('2007-02-10 15:30:45') # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00
# Time.zone.at(1171139445) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00
# Time.zone.now # => Sun, 18 May 2008 13:07:55.754107581 EDT -04:00
# Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00
#
# See Time and TimeZone for further documentation of these methods.
#
# TimeWithZone instances implement the same API as Ruby Time instances, so
# that Time and TimeWithZone instances are interchangeable.
#
# t = Time.zone.now # => Sun, 18 May 2008 13:27:25.031505668 EDT -04:00
# t.hour # => 13
# t.dst? # => true
# t.utc_offset # => -14400
# t.zone # => "EDT"
# t.to_fs(:rfc822) # => "Sun, 18 May 2008 13:27:25 -0400"
# t + 1.day # => Mon, 19 May 2008 13:27:25.031505668 EDT -04:00
# t.beginning_of_year # => Tue, 01 Jan 2008 00:00:00.000000000 EST -05:00
# t > Time.utc(1999) # => true
# t.is_a?(Time) # => true
# t.is_a?(ActiveSupport::TimeWithZone) # => true
#
# source://activesupport//lib/active_support/time_with_zone.rb#44
class ActiveSupport::TimeWithZone
include ::DateAndTime::Compatibility
include ::Comparable
# @return [TimeWithZone] a new instance of TimeWithZone
#
# source://activesupport//lib/active_support/time_with_zone.rb#51
def initialize(utc_time, time_zone, local_time = T.unsafe(nil), period = T.unsafe(nil)); end
# Adds an interval of time to the current object's time and returns that
# value as a new TimeWithZone object.
#
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00
# now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00
#
# If we're adding a Duration of variable length (i.e., years, months, days),
# move forward from #time, otherwise move forward from #utc, for accuracy
# when moving across DST boundaries.
#
# For instance, a time + 24.hours will advance exactly 24 hours, while a
# time + 1.day will advance 23-25 hours, depending on the day.
#
# now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00
# now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00
#
# source://activesupport//lib/active_support/time_with_zone.rb#299
def +(other); end
# Subtracts an interval of time and returns a new TimeWithZone object unless
# the other value +acts_like?+ time. In which case, it will subtract the
# other time and return the difference in seconds as a Float.
#
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00
# now - 1000 # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00
#
# If subtracting a Duration of variable length (i.e., years, months, days),
# move backward from #time, otherwise move backward from #utc, for accuracy
# when moving across DST boundaries.
#
# For instance, a time - 24.hours will go subtract exactly 24 hours, while a
# time - 1.day will subtract 23-25 hours, depending on the day.
#
# now - 24.hours # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00
# now - 1.day # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00
#
# If both the TimeWithZone object and the other value act like Time, a Float
# will be returned.
#
# Time.zone.now - 1.day.ago # => 86399.999967
#
# source://activesupport//lib/active_support/time_with_zone.rb#333
def -(other); end
# Use the time in UTC for comparisons.
#
# source://activesupport//lib/active_support/time_with_zone.rb#232
def <=>(other); end
# So that +self+ <tt>acts_like?(:time)</tt>.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#494
def acts_like_time?; end
# Uses Date to provide precise Time calculations for years, months, and days
# according to the proleptic Gregorian calendar. The result is returned as a
# new TimeWithZone object.
#
# The +options+ parameter takes a hash with any of these keys:
# <tt>:years</tt>, <tt>:months</tt>, <tt>:weeks</tt>, <tt>:days</tt>,
# <tt>:hours</tt>, <tt>:minutes</tt>, <tt>:seconds</tt>.
#
# If advancing by a value of variable length (i.e., years, weeks, months,
# days), move forward from #time, otherwise move forward from #utc, for
# accuracy when moving across DST boundaries.
#
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.558049687 EDT -04:00
# now.advance(seconds: 1) # => Sun, 02 Nov 2014 01:26:29.558049687 EDT -04:00
# now.advance(minutes: 1) # => Sun, 02 Nov 2014 01:27:28.558049687 EDT -04:00
# now.advance(hours: 1) # => Sun, 02 Nov 2014 01:26:28.558049687 EST -05:00
# now.advance(days: 1) # => Mon, 03 Nov 2014 01:26:28.558049687 EST -05:00
# now.advance(weeks: 1) # => Sun, 09 Nov 2014 01:26:28.558049687 EST -05:00
# now.advance(months: 1) # => Tue, 02 Dec 2014 01:26:28.558049687 EST -05:00
# now.advance(years: 1) # => Mon, 02 Nov 2015 01:26:28.558049687 EST -05:00
#
# source://activesupport//lib/active_support/time_with_zone.rb#422
def advance(options); end
def after?(_arg0); end
# Subtracts an interval of time from the current object's time and returns
# the result as a new TimeWithZone object.
#
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00
# now.ago(1000) # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00
#
# If we're subtracting a Duration of variable length (i.e., years, months,
# days), move backward from #time, otherwise move backward from #utc, for
# accuracy when moving across DST boundaries.
#
# For instance, <tt>time.ago(24.hours)</tt> will move back exactly 24 hours,
# while <tt>time.ago(1.day)</tt> will move back 23-25 hours, depending on
# the day.
#
# now.ago(24.hours) # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00
# now.ago(1.day) # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00
#
# source://activesupport//lib/active_support/time_with_zone.rb#361
def ago(other); end
# Coerces time to a string for JSON encoding. The default format is ISO 8601.
# You can get %Y/%m/%d %H:%M:%S +offset style by setting
# <tt>ActiveSupport::JSON::Encoding.use_standard_json_time_format</tt>
# to +false+.
#
# # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = true
# Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").to_json
# # => "2005-02-01T05:15:10.000-10:00"
#
# # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = false
# Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").to_json
# # => "2005/02/01 05:15:10 -1000"
#
# source://activesupport//lib/active_support/time_with_zone.rb#166
def as_json(options = T.unsafe(nil)); end
def before?(_arg0); end
# Returns true if the current object's time is within the specified
# +min+ and +max+ time.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#240
def between?(min, max); end
# An instance of ActiveSupport::TimeWithZone is never blank
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#505
def blank?; end
# Returns a new +ActiveSupport::TimeWithZone+ where one or more of the elements have
# been changed according to the +options+ parameter. The time options (<tt>:hour</tt>,
# <tt>:min</tt>, <tt>:sec</tt>, <tt>:usec</tt>, <tt>:nsec</tt>) reset cascadingly,
# so if only the hour is passed, then minute, sec, usec, and nsec is set to 0. If the
# hour and minute is passed, then sec, usec, and nsec is set to 0. The +options+
# parameter takes a hash with any of these keys: <tt>:year</tt>, <tt>:month</tt>,
# <tt>:day</tt>, <tt>:hour</tt>, <tt>:min</tt>, <tt>:sec</tt>, <tt>:usec</tt>,
# <tt>:nsec</tt>, <tt>:offset</tt>, <tt>:zone</tt>. Pass either <tt>:usec</tt>
# or <tt>:nsec</tt>, not both. Similarly, pass either <tt>:zone</tt> or
# <tt>:offset</tt>, not both.
#
# t = Time.zone.now # => Fri, 14 Apr 2017 11:45:15.116992711 EST -05:00
# t.change(year: 2020) # => Tue, 14 Apr 2020 11:45:15.116992711 EST -05:00
# t.change(hour: 12) # => Fri, 14 Apr 2017 12:00:00.000000000 EST -05:00
# t.change(min: 30) # => Fri, 14 Apr 2017 11:30:00.000000000 EST -05:00
# t.change(offset: "-10:00") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00
# t.change(zone: "Hawaii") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00
#
# source://activesupport//lib/active_support/time_with_zone.rb#382
def change(options); end
# Returns a <tt>Time</tt> instance of the simultaneous time in the UTC timezone.
#
# source://activesupport//lib/active_support/time_with_zone.rb#63
def comparable_time; end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def day; end
# Returns true if the current time is within Daylight Savings \Time for the
# specified time zone.
#
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# Time.zone.parse("2012-5-30").dst? # => true
# Time.zone.parse("2012-11-30").dst? # => false
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#94
def dst?; end
# source://activesupport//lib/active_support/time_with_zone.rb#178
def encode_with(coder); end
# Returns +true+ if +other+ is equal to current object.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#275
def eql?(other); end
# Returns a formatted string of the offset from UTC, or an alternative
# string if the time zone is already UTC.
#
# Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)"
# Time.zone.now.formatted_offset(true) # => "-05:00"
# Time.zone.now.formatted_offset(false) # => "-0500"
# Time.zone = 'UTC' # => "UTC"
# Time.zone.now.formatted_offset(true, "0") # => "0"
#
# source://activesupport//lib/active_support/time_with_zone.rb#125
def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end
# source://activesupport//lib/active_support/time_with_zone.rb#513
def freeze; end
# Returns true if the current object's time is in the future.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#270
def future?; end
# Returns a <tt>Time</tt> instance of the simultaneous time in the UTC timezone.
#
# source://activesupport//lib/active_support/time_with_zone.rb#63
def getgm; end
# Returns a <tt>Time</tt> instance of the simultaneous time in the system timezone.
#
# source://activesupport//lib/active_support/time_with_zone.rb#83
def getlocal(utc_offset = T.unsafe(nil)); end
# Returns a <tt>Time</tt> instance of the simultaneous time in the UTC timezone.
#
# source://activesupport//lib/active_support/time_with_zone.rb#63
def getutc; end
# Returns true if the current time zone is set to UTC.
#
# Time.zone = 'UTC' # => 'UTC'
# Time.zone.now.utc? # => true
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# Time.zone.now.utc? # => false
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#105
def gmt?; end
# Returns the offset from current time to UTC time in seconds.
#
# source://activesupport//lib/active_support/time_with_zone.rb#111
def gmt_offset; end
# Returns a <tt>Time</tt> instance of the simultaneous time in the UTC timezone.
#
# source://activesupport//lib/active_support/time_with_zone.rb#63
def gmtime; end
# Returns the offset from current time to UTC time in seconds.
#
# source://activesupport//lib/active_support/time_with_zone.rb#111
def gmtoff; end
# source://activesupport//lib/active_support/time_with_zone.rb#279
def hash; end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def hour; end
# Returns a string of the object's date and time in the format used by
# HTTP requests.
#
# Time.zone.now.httpdate # => "Tue, 01 Jan 2013 04:39:43 GMT"
#
# source://activesupport//lib/active_support/time_with_zone.rb#186
def httpdate; end
# Adds an interval of time to the current object's time and returns that
# value as a new TimeWithZone object.
#
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00
# now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00
#
# If we're adding a Duration of variable length (i.e., years, months, days),
# move forward from #time, otherwise move forward from #utc, for accuracy
# when moving across DST boundaries.
#
# For instance, a time + 24.hours will advance exactly 24 hours, while a
# time + 1.day will advance 23-25 hours, depending on the day.
#
# now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00
# now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00
#
# source://activesupport//lib/active_support/time_with_zone.rb#299
def in(other); end
# Returns the simultaneous time in <tt>Time.zone</tt>, or the specified zone.
#
# source://activesupport//lib/active_support/time_with_zone.rb#77
def in_time_zone(new_zone = T.unsafe(nil)); end
# source://activesupport//lib/active_support/time_with_zone.rb#174
def init_with(coder); end
# Returns a string of the object's date, time, zone, and offset from UTC.
#
# Time.zone.now.inspect # => "Thu, 04 Dec 2014 11:00:25.624541392 EST -05:00"
#
# source://activesupport//lib/active_support/time_with_zone.rb#140
def inspect; end
# Say we're a Time to thwart type checking.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#499
def is_a?(klass); end
# Returns true if the current time is within Daylight Savings \Time for the
# specified time zone.
#
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# Time.zone.parse("2012-5-30").dst? # => true
# Time.zone.parse("2012-11-30").dst? # => false
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#94
def isdst; end
# Returns a string of the object's date and time in the ISO 8601 standard
# format.
#
# Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00"
#
# source://activesupport//lib/active_support/time_with_zone.rb#148
def iso8601(fraction_digits = T.unsafe(nil)); end
# Say we're a Time to thwart type checking.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#499
def kind_of?(klass); end
# Returns a <tt>Time</tt> instance of the simultaneous time in the system timezone.
#
# source://activesupport//lib/active_support/time_with_zone.rb#83
def localtime(utc_offset = T.unsafe(nil)); end
# source://activesupport//lib/active_support/time_with_zone.rb#519
def marshal_dump; end
# source://activesupport//lib/active_support/time_with_zone.rb#523
def marshal_load(variables); end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def mday; end
# Send the missing method to +time+ instance, and wrap result in a new
# TimeWithZone with the existing +time_zone+.
#
# source://activesupport//lib/active_support/time_with_zone.rb#544
def method_missing(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def min; end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def mon; end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def month; end
# Returns true if the current object's time falls within
# the next day (tomorrow).
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#257
def next_day?; end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def nsec; end
# Returns true if the current object's time is in the past.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#245
def past?; end
# Returns the underlying +TZInfo::TimezonePeriod+.
#
# source://activesupport//lib/active_support/time_with_zone.rb#72
def period; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#509
def present?; end
# Returns true if the current object's time falls within
# the previous day (yesterday).
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#264
def prev_day?; end
# respond_to_missing? is not called in some cases, such as when type conversion is
# performed with Kernel#String
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#529
def respond_to?(sym, include_priv = T.unsafe(nil)); end
# Returns a string of the object's date and time in the RFC 2822 standard
# format.
#
# Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000"
#
# source://activesupport//lib/active_support/time_with_zone.rb#194
def rfc2822; end
# Returns a string of the object's date and time in the ISO 8601 standard
# format.
#
# Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00"
#
# source://activesupport//lib/active_support/time_with_zone.rb#148
def rfc3339(fraction_digits = T.unsafe(nil)); end
# Returns a string of the object's date and time in the RFC 2822 standard
# format.
#
# Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000"
#
# source://activesupport//lib/active_support/time_with_zone.rb#194
def rfc822; end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def sec; end
# Adds an interval of time to the current object's time and returns that
# value as a new TimeWithZone object.
#
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00
# now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00
#
# If we're adding a Duration of variable length (i.e., years, months, days),
# move forward from #time, otherwise move forward from #utc, for accuracy
# when moving across DST boundaries.
#
# For instance, a time + 24.hours will advance exactly 24 hours, while a
# time + 1.day will advance 23-25 hours, depending on the day.
#
# now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00
# now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00
#
# source://activesupport//lib/active_support/time_with_zone.rb#299
def since(other); end
# Replaces <tt>%Z</tt> directive with +zone before passing to Time#strftime,
# so that zone information is correct.
#
# source://activesupport//lib/active_support/time_with_zone.rb#226
def strftime(format); end
# Returns a <tt>Time</tt> instance that represents the time in +time_zone+.
#
# source://activesupport//lib/active_support/time_with_zone.rb#58
def time; end
# Returns the value of attribute time_zone.
#
# source://activesupport//lib/active_support/time_with_zone.rb#49
def time_zone; end
# Returns Array of parts of Time in sequence of
# [seconds, minutes, hours, day, month, year, weekday, yearday, dst?, zone].
#
# now = Time.zone.now # => Tue, 18 Aug 2015 02:29:27.485278555 UTC +00:00
# now.to_a # => [27, 29, 2, 18, 8, 2015, 2, 230, false, "UTC"]
#
# source://activesupport//lib/active_support/time_with_zone.rb#445
def to_a; end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def to_date; end
# Returns an instance of DateTime with the timezone's UTC offset
#
# Time.zone.now.to_datetime # => Tue, 18 Aug 2015 02:32:20 +0000
# Time.current.in_time_zone('Hawaii').to_datetime # => Mon, 17 Aug 2015 16:32:20 -1000
#
# source://activesupport//lib/active_support/time_with_zone.rb#478
def to_datetime; end
# Returns the object's date and time as a floating-point number of seconds
# since the Epoch (January 1, 1970 00:00 UTC).
#
# Time.zone.now.to_f # => 1417709320.285418
#
# source://activesupport//lib/active_support/time_with_zone.rb#453
def to_f; end
# Returns a string of the object's date and time.
#
# This method is aliased to <tt>to_formatted_s</tt>.
#
# Accepts an optional <tt>format</tt>:
# * <tt>:default</tt> - default value, mimics Ruby Time#to_s format.
# * <tt>:db</tt> - format outputs time in UTC :db time. See Time#to_fs(:db).
# * Any key in +Time::DATE_FORMATS+ can be used. See active_support/core_ext/time/conversions.rb.
#
# source://activesupport//lib/active_support/time_with_zone.rb#212
def to_formatted_s(format = T.unsafe(nil)); end
# Returns a string of the object's date and time.
#
# This method is aliased to <tt>to_formatted_s</tt>.
#
# Accepts an optional <tt>format</tt>:
# * <tt>:default</tt> - default value, mimics Ruby Time#to_s format.
# * <tt>:db</tt> - format outputs time in UTC :db time. See Time#to_fs(:db).
# * Any key in +Time::DATE_FORMATS+ can be used. See active_support/core_ext/time/conversions.rb.
#
# source://activesupport//lib/active_support/time_with_zone.rb#212
def to_fs(format = T.unsafe(nil)); end
# Returns the object's date and time as an integer number of seconds
# since the Epoch (January 1, 1970 00:00 UTC).
#
# Time.zone.now.to_i # => 1417709320
#
# source://activesupport//lib/active_support/time_with_zone.rb#461
def to_i; end
# Returns the object's date and time as a rational number of seconds
# since the Epoch (January 1, 1970 00:00 UTC).
#
# Time.zone.now.to_r # => (708854548642709/500000)
#
# source://activesupport//lib/active_support/time_with_zone.rb#470
def to_r; end
# Returns a string of the object's date and time.
#
# source://activesupport//lib/active_support/time_with_zone.rb#200
def to_s; end
# Returns an instance of +Time+, either with the same UTC offset
# as +self+ or in the local system timezone depending on the setting
# of +ActiveSupport.to_time_preserves_timezone+.
#
# source://activesupport//lib/active_support/time_with_zone.rb#485
def to_time; end
# Returns true if the current object's time falls within
# the current day.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#251
def today?; end
# Returns true if the current object's time falls within
# the next day (tomorrow).
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#257
def tomorrow?; end
# Returns the object's date and time as an integer number of seconds
# since the Epoch (January 1, 1970 00:00 UTC).
#
# Time.zone.now.to_i # => 1417709320
#
# source://activesupport//lib/active_support/time_with_zone.rb#461
def tv_sec; end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def usec; end
# Returns a <tt>Time</tt> instance of the simultaneous time in the UTC timezone.
#
# source://activesupport//lib/active_support/time_with_zone.rb#63
def utc; end
# Returns true if the current time zone is set to UTC.
#
# Time.zone = 'UTC' # => 'UTC'
# Time.zone.now.utc? # => true
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
# Time.zone.now.utc? # => false
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#105
def utc?; end
# Returns the offset from current time to UTC time in seconds.
#
# source://activesupport//lib/active_support/time_with_zone.rb#111
def utc_offset; end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def wday; end
# Returns a string of the object's date and time in the ISO 8601 standard
# format.
#
# Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00"
#
# source://activesupport//lib/active_support/time_with_zone.rb#148
def xmlschema(fraction_digits = T.unsafe(nil)); end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def yday; end
# source://activesupport//lib/active_support/time_with_zone.rb#434
def year; end
# Returns true if the current object's time falls within
# the previous day (yesterday).
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#264
def yesterday?; end
# Returns the time zone abbreviation.
#
# Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)"
# Time.zone.now.zone # => "EST"
#
# source://activesupport//lib/active_support/time_with_zone.rb#133
def zone; end
private
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#580
def duration_of_variable_length?(obj); end
# source://activesupport//lib/active_support/time_with_zone.rb#561
def get_period_and_ensure_valid_local_time(period); end
# source://activesupport//lib/active_support/time_with_zone.rb#553
def incorporate_utc_offset(time, offset); end
# Ensure proxy class responds to all methods that underlying time instance
# responds to.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/time_with_zone.rb#537
def respond_to_missing?(sym, include_priv); end
# source://activesupport//lib/active_support/time_with_zone.rb#574
def transfer_time_values_to_utc_constructor(time); end
# source://activesupport//lib/active_support/time_with_zone.rb#584
def wrap_with_time_zone(time); end
end
# source://activesupport//lib/active_support/time_with_zone.rb#45
ActiveSupport::TimeWithZone::PRECISIONS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/time_with_zone.rb#551
ActiveSupport::TimeWithZone::SECONDS_PER_DAY = T.let(T.unsafe(nil), Integer)
# = 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 subset of 134
# zones.
# * Retrieve and display zones with a friendlier name
# (e.g., "Eastern \Time (US & Canada)" instead of "America/New_York").
# * Lazily load +TZInfo::Timezone+ instances only when they're needed.
# * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+,
# +parse+, +at+, and +now+ methods.
#
# If you set <tt>config.time_zone</tt> in the \Rails Application, you can
# access this TimeZone object via <tt>Time.zone</tt>:
#
# # application.rb:
# class Application < Rails::Application
# config.time_zone = 'Eastern Time (US & Canada)'
# end
#
# Time.zone # => #<ActiveSupport::TimeZone:0x514834...>
# Time.zone.name # => "Eastern Time (US & Canada)"
# Time.zone.now # => Sun, 18 May 2008 14:30:44 EDT -04:00
#
# source://activesupport//lib/active_support/values/time_zone.rb#31
class ActiveSupport::TimeZone
include ::Comparable
# :stopdoc:
#
# @return [TimeZone] a new instance of TimeZone
#
# source://activesupport//lib/active_support/values/time_zone.rb#311
def initialize(name, utc_offset = T.unsafe(nil), tzinfo = T.unsafe(nil)); end
# Compare this time zone to the parameter. The two are compared first on
# their offsets, and then by name.
#
# source://activesupport//lib/active_support/values/time_zone.rb#335
def <=>(zone); end
# Compare #name and TZInfo identifier to a supplied regexp, returning +true+
# if a match is found.
#
# source://activesupport//lib/active_support/values/time_zone.rb#344
def =~(re); end
# \Method for creating new ActiveSupport::TimeWithZone instance in time zone
# of +self+ from number of seconds since the Unix epoch.
#
# Time.zone = 'Hawaii' # => "Hawaii"
# Time.utc(2000).to_f # => 946684800.0
# Time.zone.at(946684800.0) # => Fri, 31 Dec 1999 14:00:00 HST -10:00
#
# A second argument can be supplied to specify sub-second precision.
#
# Time.zone = 'Hawaii' # => "Hawaii"
# Time.at(946684800, 123456.789).nsec # => 123456789
#
# source://activesupport//lib/active_support/values/time_zone.rb#381
def at(*args); end
# source://activesupport//lib/active_support/values/time_zone.rb#577
def encode_with(coder); end
# Returns a formatted string of the offset from UTC, or an alternative
# string if the time zone is already UTC.
#
# zone = ActiveSupport::TimeZone['Central Time (US & Canada)']
# zone.formatted_offset # => "-06:00"
# zone.formatted_offset(false) # => "-0600"
#
# source://activesupport//lib/active_support/values/time_zone.rb#329
def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end
# source://activesupport//lib/active_support/values/time_zone.rb#573
def init_with(coder); end
# \Method for creating new ActiveSupport::TimeWithZone instance in time zone
# of +self+ from an ISO 8601 string.
#
# Time.zone = 'Hawaii' # => "Hawaii"
# Time.zone.iso8601('1999-12-31T14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
#
# If the time components are missing then they will be set to zero.
#
# Time.zone = 'Hawaii' # => "Hawaii"
# Time.zone.iso8601('1999-12-31') # => Fri, 31 Dec 1999 00:00:00 HST -10:00
#
# If the string is invalid then an +ArgumentError+ will be raised unlike +parse+
# which usually returns +nil+ when given an invalid date string.
#
# source://activesupport//lib/active_support/values/time_zone.rb#398
def iso8601(str); end
# \Method for creating new ActiveSupport::TimeWithZone instance in time zone
# of +self+ from given values.
#
# Time.zone = 'Hawaii' # => "Hawaii"
# Time.zone.local(2007, 2, 1, 15, 30, 45) # => Thu, 01 Feb 2007 15:30:45 HST -10:00
#
# source://activesupport//lib/active_support/values/time_zone.rb#365
def local(*args); end
# Adjust the given time to the simultaneous time in UTC. Returns a
# Time.utc() instance.
#
# source://activesupport//lib/active_support/values/time_zone.rb#553
def local_to_utc(time, dst = T.unsafe(nil)); end
# Compare #name and TZInfo identifier to a supplied regexp, returning +true+
# if a match is found.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/values/time_zone.rb#350
def match?(re); end
# Returns the value of attribute name.
#
# source://activesupport//lib/active_support/values/time_zone.rb#298
def name; end
# Returns an ActiveSupport::TimeWithZone instance representing the current
# time in the time zone represented by +self+.
#
# Time.zone = 'Hawaii' # => "Hawaii"
# Time.zone.now # => Wed, 23 Jan 2008 20:24:27 HST -10:00
#
# source://activesupport//lib/active_support/values/time_zone.rb#518
def now; end
# \Method for creating new ActiveSupport::TimeWithZone instance in time zone
# of +self+ from parsed string.
#
# Time.zone = 'Hawaii' # => "Hawaii"
# Time.zone.parse('1999-12-31 14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
#
# If upper components are missing from the string, they are supplied from
# TimeZone#now:
#
# Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00
# Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00
#
# However, if the date component is not provided, but any other upper
# components are supplied, then the day of the month defaults to 1:
#
# Time.zone.parse('Mar 2000') # => Wed, 01 Mar 2000 00:00:00 HST -10:00
#
# If the string is invalid then an +ArgumentError+ could be raised.
#
# source://activesupport//lib/active_support/values/time_zone.rb#455
def parse(str, now = T.unsafe(nil)); end
# Available so that TimeZone instances respond like +TZInfo::Timezone+
# instances.
#
# source://activesupport//lib/active_support/values/time_zone.rb#565
def period_for_local(time, dst = T.unsafe(nil)); end
# Available so that TimeZone instances respond like +TZInfo::Timezone+
# instances.
#
# source://activesupport//lib/active_support/values/time_zone.rb#559
def period_for_utc(time); end
# source://activesupport//lib/active_support/values/time_zone.rb#569
def periods_for_local(time); end
# \Method for creating new ActiveSupport::TimeWithZone instance in time zone
# of +self+ from an RFC 3339 string.
#
# Time.zone = 'Hawaii' # => "Hawaii"
# Time.zone.rfc3339('2000-01-01T00:00:00Z') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
#
# If the time or zone components are missing then an +ArgumentError+ will
# be raised. This is much stricter than either +parse+ or +iso8601+ which
# allow for missing components.
#
# Time.zone = 'Hawaii' # => "Hawaii"
# Time.zone.rfc3339('1999-12-31') # => ArgumentError: invalid date
#
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/values/time_zone.rb#471
def rfc3339(str); end
# Parses +str+ according to +format+ and returns an ActiveSupport::TimeWithZone.
#
# Assumes that +str+ is a time in the time zone +self+,
# unless +format+ includes an explicit time zone.
# (This is the same behavior as +parse+.)
# In either case, the returned TimeWithZone has the timezone of +self+.
#
# Time.zone = 'Hawaii' # => "Hawaii"
# Time.zone.strptime('1999-12-31 14:00:00', '%Y-%m-%d %H:%M:%S') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
#
# If upper components are missing from the string, they are supplied from
# TimeZone#now:
#
# Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00
# Time.zone.strptime('22:30:00', '%H:%M:%S') # => Fri, 31 Dec 1999 22:30:00 HST -10:00
#
# However, if the date component is not provided, but any other upper
# components are supplied, then the day of the month defaults to 1:
#
# Time.zone.strptime('Mar 2000', '%b %Y') # => Wed, 01 Mar 2000 00:00:00 HST -10:00
#
# source://activesupport//lib/active_support/values/time_zone.rb#509
def strptime(str, format, now = T.unsafe(nil)); end
# Returns a textual representation of this time zone.
#
# source://activesupport//lib/active_support/values/time_zone.rb#356
def to_s; end
# Returns the current date in this time zone.
#
# source://activesupport//lib/active_support/values/time_zone.rb#523
def today; end
# Returns the next date in this time zone.
#
# source://activesupport//lib/active_support/values/time_zone.rb#528
def tomorrow; end
# Returns the value of attribute tzinfo.
#
# source://activesupport//lib/active_support/values/time_zone.rb#299
def tzinfo; end
# Returns the offset of this time zone from UTC in seconds.
#
# source://activesupport//lib/active_support/values/time_zone.rb#319
def utc_offset; end
# Adjust the given time to the simultaneous time in the time zone
# represented by +self+. Returns a local time with the appropriate offset
# -- if you want an ActiveSupport::TimeWithZone instance, use
# Time#in_time_zone() instead.
#
# As of tzinfo 2, utc_to_local returns a Time with a non-zero utc_offset.
# See the +utc_to_local_returns_utc_offset_times+ config for more info.
#
# source://activesupport//lib/active_support/values/time_zone.rb#544
def utc_to_local(time); end
# Returns the previous date in this time zone.
#
# source://activesupport//lib/active_support/values/time_zone.rb#533
def yesterday; end
private
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/values/time_zone.rb#583
def parts_to_time(parts, now); end
# source://activesupport//lib/active_support/values/time_zone.rb#608
def time_now; end
class << self
# Locate a specific time zone object. If the argument is a string, it
# is interpreted to mean the name of the timezone to locate. If it is a
# numeric value it is either the hour offset, or the second offset, of the
# timezone to find. (The first one with that offset will be returned.)
# Returns +nil+ if no such time zone is known to the system.
#
# source://activesupport//lib/active_support/values/time_zone.rb#234
def [](arg); end
# Returns an array of all TimeZone objects. There are multiple
# TimeZone objects per time zone, in many cases, to make it easier
# for users to find their own time zone.
#
# source://activesupport//lib/active_support/values/time_zone.rb#225
def all; end
# source://activesupport//lib/active_support/values/time_zone.rb#267
def clear; end
# A convenience method for returning a collection of TimeZone objects
# for time zones in the country specified by its ISO 3166-1 Alpha2 code.
#
# source://activesupport//lib/active_support/values/time_zone.rb#262
def country_zones(country_code); end
# :stopdoc:
def create(*_arg0); end
# source://activesupport//lib/active_support/values/time_zone.rb#207
def find_tzinfo(name); end
# Returns a TimeZone instance with the given name, or +nil+ if no
# such TimeZone instance exists. (This exists to support the use of
# this class with the +composed_of+ macro.)
#
# source://activesupport//lib/active_support/values/time_zone.rb#218
def new(name); end
# Assumes self represents an offset from UTC in seconds (as returned from
# Time#utc_offset) and turns this into an +HH:MM formatted string.
#
# ActiveSupport::TimeZone.seconds_to_utc_offset(-21_600) # => "-06:00"
#
# source://activesupport//lib/active_support/values/time_zone.rb#199
def seconds_to_utc_offset(seconds, colon = T.unsafe(nil)); end
# A convenience method for returning a collection of TimeZone objects
# for time zones in the USA.
#
# source://activesupport//lib/active_support/values/time_zone.rb#256
def us_zones; end
private
# source://activesupport//lib/active_support/values/time_zone.rb#275
def load_country_zones(code); end
# source://activesupport//lib/active_support/values/time_zone.rb#289
def zones_map; end
end
end
# Keys are \Rails TimeZone names, values are TZInfo identifiers.
#
# source://activesupport//lib/active_support/values/time_zone.rb#33
ActiveSupport::TimeZone::MAPPING = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/values/time_zone.rb#188
ActiveSupport::TimeZone::UTC_OFFSET_WITHOUT_COLON = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/values/time_zone.rb#187
ActiveSupport::TimeZone::UTC_OFFSET_WITH_COLON = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/core_ext/object/json.rb#35
module ActiveSupport::ToJsonWithActiveSupportEncoder
# source://activesupport//lib/active_support/core_ext/object/json.rb#36
def to_json(options = T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/core_ext/object/try.rb#6
module ActiveSupport::Tryable
# source://activesupport//lib/active_support/core_ext/object/try.rb#7
def try(*args, **_arg1, &block); end
# source://activesupport//lib/active_support/core_ext/object/try.rb#20
def try!(*args, **_arg1, &block); end
end
# source://activesupport//lib/active_support/gem_version.rb#9
module ActiveSupport::VERSION; end
# source://activesupport//lib/active_support/gem_version.rb#10
ActiveSupport::VERSION::MAJOR = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/gem_version.rb#11
ActiveSupport::VERSION::MINOR = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/gem_version.rb#13
ActiveSupport::VERSION::PRE = T.let(T.unsafe(nil), T.untyped)
# source://activesupport//lib/active_support/gem_version.rb#15
ActiveSupport::VERSION::STRING = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/gem_version.rb#12
ActiveSupport::VERSION::TINY = T.let(T.unsafe(nil), Integer)
# = \XmlMini
#
# To use the much faster libxml parser:
# gem "libxml-ruby"
# XmlMini.backend = 'LibXML'
#
# source://activesupport//lib/active_support/xml_mini.rb#17
module ActiveSupport::XmlMini
extend ::ActiveSupport::XmlMini
# source://activesupport//lib/active_support/xml_mini.rb#101
def backend; end
# source://activesupport//lib/active_support/xml_mini.rb#105
def backend=(name); end
# Returns the value of attribute depth.
#
# source://activesupport//lib/active_support/xml_mini.rb#96
def depth; end
# Sets the attribute depth
#
# @param value the value to set the attribute depth to.
#
# source://activesupport//lib/active_support/xml_mini.rb#96
def depth=(_arg0); end
# source://activesupport//lib/active_support/xml_mini.rb#99
def parse(*_arg0, **_arg1, &_arg2); end
# source://activesupport//lib/active_support/xml_mini.rb#152
def rename_key(key, options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/xml_mini.rb#119
def to_tag(key, value, options); end
# source://activesupport//lib/active_support/xml_mini.rb#111
def with_backend(name); end
private
# source://activesupport//lib/active_support/xml_mini.rb#163
def _dasherize(key); end
# source://activesupport//lib/active_support/xml_mini.rb#169
def _parse_binary(bin, entity); end
# source://activesupport//lib/active_support/xml_mini.rb#180
def _parse_file(file, entity); end
# source://activesupport//lib/active_support/xml_mini.rb#188
def _parse_hex_binary(bin); end
# source://activesupport//lib/active_support/xml_mini.rb#200
def cast_backend_name_to_module(name); end
# source://activesupport//lib/active_support/xml_mini.rb#192
def current_thread_backend; end
# source://activesupport//lib/active_support/xml_mini.rb#196
def current_thread_backend=(name); end
end
# source://activesupport//lib/active_support/xml_mini.rb#34
ActiveSupport::XmlMini::DEFAULT_ENCODINGS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/xml_mini.rb#56
ActiveSupport::XmlMini::FORMATTING = T.let(T.unsafe(nil), Hash)
# This module decorates files deserialized using Hash.from_xml with
# the <tt>original_filename</tt> and <tt>content_type</tt> methods.
#
# source://activesupport//lib/active_support/xml_mini.rb#22
module ActiveSupport::XmlMini::FileLike
# source://activesupport//lib/active_support/xml_mini.rb#29
def content_type; end
# source://activesupport//lib/active_support/xml_mini.rb#23
def content_type=(_arg0); end
# source://activesupport//lib/active_support/xml_mini.rb#25
def original_filename; end
# source://activesupport//lib/active_support/xml_mini.rb#23
def original_filename=(_arg0); end
end
# source://activesupport//lib/active_support/xml_mini.rb#67
ActiveSupport::XmlMini::PARSING = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/xml_mini.rb#39
ActiveSupport::XmlMini::TYPE_NAMES = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/xml_mini/rexml.rb#8
module ActiveSupport::XmlMini_REXML
extend ::ActiveSupport::XmlMini_REXML
# Parse an XML Document string or IO into a simple hash.
#
# Same as XmlSimple::xml_in but doesn't shoot itself in the foot,
# and uses the defaults from Active Support.
#
# data::
# XML Document string or IO to parse
#
# source://activesupport//lib/active_support/xml_mini/rexml.rb#20
def parse(data); end
private
# Actually converts an XML document element into a data structure.
#
# element::
# The document element to be collapsed.
#
# source://activesupport//lib/active_support/xml_mini/rexml.rb#63
def collapse(element, depth); end
# Determines if a document element has text content
#
# element::
# XML element to be checked.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/xml_mini/rexml.rb#133
def empty_content?(element); end
# Converts the attributes array of an XML element into a hash.
# Returns an empty Hash if node has no attributes.
#
# element::
# XML element to extract attributes from.
#
# source://activesupport//lib/active_support/xml_mini/rexml.rb#123
def get_attributes(element); end
# Adds a new key/value pair to an existing Hash. If the key to be added
# already exists and the existing value associated with key is not
# an Array, it will be wrapped in an Array. Then the new value is
# appended to that Array.
#
# hash::
# Hash to add key/value pair to.
# key::
# Key to be added.
# value::
# Value to be associated with key.
#
# source://activesupport//lib/active_support/xml_mini/rexml.rb#103
def merge!(hash, key, value); end
# Convert an XML element and merge into the hash
#
# hash::
# Hash to merge the converted element into.
# element::
# XML element to merge into hash
#
# @raise [REXML::ParseException]
#
# source://activesupport//lib/active_support/xml_mini/rexml.rb#54
def merge_element!(hash, element, depth); end
# Merge all the texts of an element into the hash
#
# hash::
# Hash to add the converted element to.
# element::
# XML element whose texts are to me merged into the hash
#
# source://activesupport//lib/active_support/xml_mini/rexml.rb#81
def merge_texts!(hash, element); end
# source://activesupport//lib/active_support/xml_mini/rexml.rb#41
def require_rexml; end
end
# source://activesupport//lib/active_support/xml_mini/rexml.rb#11
ActiveSupport::XmlMini_REXML::CONTENT_KEY = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/core_ext/object/blank.rb#95
class Array
include ::Enumerable
# source://activesupport//lib/active_support/core_ext/object/json.rb#166
def as_json(options = T.unsafe(nil)); end
# Removes all blank elements from the +Array+ in place and returns self.
# Uses Object#blank? for determining if an item is blank.
#
# a = [1, "", nil, 2, " ", [], {}, false, true]
# a.compact_blank!
# # => [1, 2, true]
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#258
def compact_blank!; end
# Extracts options from a set of arguments. Removes and returns the last
# element in the array if it's a hash, otherwise returns a blank hash.
#
# def options(*args)
# args.extract_options!
# end
#
# options(1, 2) # => {}
# options(1, 2, a: :b) # => {:a=>:b}
#
# source://activesupport//lib/active_support/core_ext/array/extract_options.rb#24
def extract_options!; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#104
def present?; end
# Extends <tt>Array#to_s</tt> to convert a collection of elements into a
# comma separated id list if <tt>:db</tt> argument is given as the format.
#
# This method is aliased to <tt>to_formatted_s</tt>.
#
# Blog.all.to_fs(:db) # => "1,2,3"
# Blog.none.to_fs(:db) # => "null"
# [1,2].to_fs # => "[1, 2]"
#
# source://activesupport//lib/active_support/core_ext/array/conversions.rb#94
def to_formatted_s(format = T.unsafe(nil)); end
# Extends <tt>Array#to_s</tt> to convert a collection of elements into a
# comma separated id list if <tt>:db</tt> argument is given as the format.
#
# This method is aliased to <tt>to_formatted_s</tt>.
#
# Blog.all.to_fs(:db) # => "1,2,3"
# Blog.none.to_fs(:db) # => "null"
# [1,2].to_fs # => "[1, 2]"
#
# source://activesupport//lib/active_support/core_ext/array/conversions.rb#94
def to_fs(format = T.unsafe(nil)); end
# Calls <tt>to_param</tt> on all its elements and joins the result with
# slashes. This is used by <tt>url_for</tt> in Action Pack.
#
# source://activesupport//lib/active_support/core_ext/object/to_query.rb#42
def to_param; end
# Converts an array into a string suitable for use as a URL query string,
# using the given +key+ as the param name.
#
# ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding"
#
# source://activesupport//lib/active_support/core_ext/object/to_query.rb#50
def to_query(key); end
# Converts the array to a comma-separated sentence where the last element is
# joined by the connector word.
#
# You can pass the following options to change the default behavior. If you
# pass an option key that doesn't exist in the list below, it will raise an
# <tt>ArgumentError</tt>.
#
# ==== Options
#
# * <tt>:words_connector</tt> - The sign or word used to join all but the last
# element in arrays with three or more elements (default: ", ").
# * <tt>:last_word_connector</tt> - The sign or word used to join the last element
# in arrays with three or more elements (default: ", and ").
# * <tt>:two_words_connector</tt> - The sign or word used to join the elements
# in arrays with two elements (default: " and ").
# * <tt>:locale</tt> - If +i18n+ is available, you can set a locale and use
# the connector options defined on the 'support.array' namespace in the
# corresponding dictionary file.
#
# ==== Examples
#
# [].to_sentence # => ""
# ['one'].to_sentence # => "one"
# ['one', 'two'].to_sentence # => "one and two"
# ['one', 'two', 'three'].to_sentence # => "one, two, and three"
#
# ['one', 'two'].to_sentence(passing: 'invalid option')
# # => ArgumentError: Unknown key: :passing. Valid keys are: :words_connector, :two_words_connector, :last_word_connector, :locale
#
# ['one', 'two'].to_sentence(two_words_connector: '-')
# # => "one-two"
#
# ['one', 'two', 'three'].to_sentence(words_connector: ' or ', last_word_connector: ' or at least ')
# # => "one or two or at least three"
#
# Using <tt>:locale</tt> option:
#
# # Given this locale dictionary:
# #
# # es:
# # support:
# # array:
# # words_connector: " o "
# # two_words_connector: " y "
# # last_word_connector: " o al menos "
#
# ['uno', 'dos'].to_sentence(locale: :es)
# # => "uno y dos"
#
# ['uno', 'dos', 'tres'].to_sentence(locale: :es)
# # => "uno o dos o al menos tres"
#
# source://activesupport//lib/active_support/core_ext/array/conversions.rb#60
def to_sentence(options = T.unsafe(nil)); end
# Returns a string that represents the array in XML by invoking +to_xml+
# on each element. Active Record collections delegate their representation
# in XML to this method.
#
# All elements are expected to respond to +to_xml+, if any of them does
# not then an exception is raised.
#
# The root node reflects the class name of the first element in plural
# if all elements belong to the same type and that's not Hash:
#
# customer.projects.to_xml
#
# <?xml version="1.0" encoding="UTF-8"?>
# <projects type="array">
# <project>
# <amount type="decimal">20000.0</amount>
# <customer-id type="integer">1567</customer-id>
# <deal-date type="date">2008-04-09</deal-date>
# ...
# </project>
# <project>
# <amount type="decimal">57230.0</amount>
# <customer-id type="integer">1567</customer-id>
# <deal-date type="date">2008-04-15</deal-date>
# ...
# </project>
# </projects>
#
# Otherwise the root element is "objects":
#
# [{ foo: 1, bar: 2}, { baz: 3}].to_xml
#
# <?xml version="1.0" encoding="UTF-8"?>
# <objects type="array">
# <object>
# <bar type="integer">2</bar>
# <foo type="integer">1</foo>
# </object>
# <object>
# <baz type="integer">3</baz>
# </object>
# </objects>
#
# If the collection is empty the root element is "nil-classes" by default:
#
# [].to_xml
#
# <?xml version="1.0" encoding="UTF-8"?>
# <nil-classes type="array"/>
#
# To ensure a meaningful root element use the <tt>:root</tt> option:
#
# customer_with_no_projects.projects.to_xml(root: 'projects')
#
# <?xml version="1.0" encoding="UTF-8"?>
# <projects type="array"/>
#
# By default name of the node for the children of root is <tt>root.singularize</tt>.
# You can change it with the <tt>:children</tt> option.
#
# The +options+ hash is passed downwards:
#
# Message.all.to_xml(skip_types: true)
#
# <?xml version="1.0" encoding="UTF-8"?>
# <messages>
# <message>
# <created-at>2008-03-07T09:58:18+01:00</created-at>
# <id>1</id>
# <name>1</name>
# <updated-at>2008-03-07T09:58:18+01:00</updated-at>
# <user-id>1</user-id>
# </message>
# </messages>
#
# source://activesupport//lib/active_support/core_ext/array/conversions.rb#183
def to_xml(options = T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/core_ext/object/json.rb#126
class BigDecimal < ::Numeric
include ::ActiveSupport::BigDecimalWithDefaultFormat
# A BigDecimal would be naturally represented as a JSON number. Most libraries,
# however, parse non-integer JSON numbers directly as floats. Clients using
# those libraries would get in general a wrong number and no way to recover
# other than manually inspecting the string with the JSON code itself.
#
# That's why a JSON string is returned. The JSON literal is not numeric, but
# if the other end knows by contract that the data is supposed to be a
# BigDecimal, it still has the chance to post-process the string and get the
# real value.
#
# source://activesupport//lib/active_support/core_ext/object/json.rb#136
def as_json(options = T.unsafe(nil)); end
# source://activesupport//lib/active_support/core_ext/big_decimal/conversions.rb#8
def to_s(format = T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/core_ext/class/attribute.rb#5
class Class < ::Module
# 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
#
# * <tt>:instance_reader</tt> - Sets the instance reader method (defaults to true).
# * <tt>:instance_writer</tt> - Sets the instance writer method (defaults to true).
# * <tt>:instance_accessor</tt> - Sets both instance methods (defaults to true).
# * <tt>:instance_predicate</tt> - Sets a predicate method (defaults to true).
# * <tt>:default</tt> - Sets a default value for the attribute (defaults to nil).
#
# ==== Examples
#
# class Base
# class_attribute :setting
# end
#
# class Subclass < Base
# end
#
# Base.setting = true
# Subclass.setting # => true
# Subclass.setting = false
# Subclass.setting # => false
# Base.setting # => true
#
# In the above case as long as Subclass does not assign a value to setting
# by performing <tt>Subclass.setting = _something_</tt>, <tt>Subclass.setting</tt>
# would read value assigned to parent class. Once Subclass assigns a value then
# the value assigned by Subclass would be returned.
#
# This matches normal Ruby method inheritance: think of writing an attribute
# on a subclass as overriding the reader method. However, you need to be aware
# when using +class_attribute+ with mutable structures as +Array+ or +Hash+.
# In such cases, you don't want to do changes in place. Instead use setters:
#
# Base.setting = []
# Base.setting # => []
# Subclass.setting # => []
#
# # Appending in child changes both parent and child because it is the same object:
# Subclass.setting << :foo
# Base.setting # => [:foo]
# Subclass.setting # => [:foo]
#
# # Use setters to not propagate changes:
# Base.setting = []
# Subclass.setting += [:foo]
# Base.setting # => []
# Subclass.setting # => [:foo]
#
# For convenience, an instance predicate method is defined as well.
# To skip it, pass <tt>instance_predicate: false</tt>.
#
# Subclass.setting? # => false
#
# Instances may overwrite the class value in the same way:
#
# Base.setting = true
# object = Base.new
# object.setting # => true
# object.setting = false
# object.setting # => false
# Base.setting # => true
#
# To opt out of the instance reader method, pass <tt>instance_reader: false</tt>.
#
# object.setting # => NoMethodError
# object.setting? # => NoMethodError
#
# To opt out of the instance writer method, pass <tt>instance_writer: false</tt>.
#
# object.setting = false # => NoMethodError
#
# To opt out of both instance methods, pass <tt>instance_accessor: false</tt>.
#
# To set a default value for the attribute, pass <tt>default:</tt>, like so:
#
# class_attribute :settings, default: {}
#
# source://activesupport//lib/active_support/core_ext/class/attribute.rb#85
def class_attribute(*attrs, instance_accessor: T.unsafe(nil), instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_predicate: T.unsafe(nil), default: T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/core_ext/object/json.rb#69
class Data
# source://activesupport//lib/active_support/core_ext/object/json.rb#70
def as_json(options = T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/core_ext/date/zones.rb#6
class Date
include ::Comparable
include ::DateAndTime::Zones
include ::DateAndTime::Calculations
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#90
def +(other); end
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#100
def -(other); end
# Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there.
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#152
def <=>(other); end
# Duck-types as a Date-like class. See Object#acts_like?.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date/acts_like.rb#7
def acts_like_date?; end
# Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with
# any of these keys: <tt>:years</tt>, <tt>:months</tt>, <tt>:weeks</tt>, <tt>:days</tt>.
#
# The increments are applied in order of time units from largest to smallest.
# In other words, the date is incremented first by +:years+, then by
# +:months+, then by +:weeks+, then by +:days+. This order can affect the
# result around the end of a month. For example, incrementing first by months
# then by days:
#
# Date.new(2004, 9, 30).advance(months: 1, days: 1)
# # => Sun, 31 Oct 2004
#
# Whereas incrementing first by days then by months yields a different result:
#
# Date.new(2004, 9, 30).advance(days: 1).advance(months: 1)
# # => Mon, 01 Nov 2004
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#127
def advance(options); end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
# and then subtracts the specified number of seconds.
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#55
def ago(seconds); end
# source://activesupport//lib/active_support/core_ext/object/json.rb#205
def as_json(options = T.unsafe(nil)); end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#67
def at_beginning_of_day; end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the end of the day (23:59:59)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#85
def at_end_of_day; end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def at_midday; end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def at_middle_of_day; end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#67
def at_midnight; end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def at_noon; end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#67
def beginning_of_day; end
# Returns a new Date where one or more of the elements have been changed according to the +options+ parameter.
# The +options+ parameter is a hash with a combination of these keys: <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>.
#
# Date.new(2007, 5, 12).change(day: 1) # => Date.new(2007, 5, 1)
# Date.new(2007, 5, 12).change(year: 2005, month: 1) # => Date.new(2005, 1, 12)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#143
def change(options); end
# Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there.
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#152
def compare_with_coercion(other); end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the end of the day (23:59:59)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#85
def end_of_day; end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
# and then adds the specified number of seconds
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#61
def in(seconds); end
# Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005"
#
# source://activesupport//lib/active_support/core_ext/date/conversions.rb#61
def inspect; end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def midday; end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def middle_of_day; end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#67
def midnight; end
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#100
def minus_with_duration(other); end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def noon; end
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#90
def plus_with_duration(other); end
# Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005"
#
# source://activesupport//lib/active_support/core_ext/date/conversions.rb#61
def readable_inspect; end
# Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
# and then adds the specified number of seconds
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#61
def since(seconds); end
# Convert to a formatted string. See DATE_FORMATS for predefined formats.
#
# This method is aliased to <tt>to_formatted_s</tt>.
#
# date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007
#
# date.to_fs(:db) # => "2007-11-10"
# date.to_formatted_s(:db) # => "2007-11-10"
#
# date.to_fs(:short) # => "10 Nov"
# date.to_fs(:number) # => "20071110"
# date.to_fs(:long) # => "November 10, 2007"
# date.to_fs(:long_ordinal) # => "November 10th, 2007"
# date.to_fs(:rfc822) # => "10 Nov 2007"
# date.to_fs(:iso8601) # => "2007-11-10"
#
# == Adding your own date formats to to_fs
# You can add your own formats to the Date::DATE_FORMATS hash.
# Use the format name as the hash key and either a strftime string
# or Proc instance that takes a date argument as the value.
#
# # config/initializers/date_formats.rb
# Date::DATE_FORMATS[:month_and_year] = '%B %Y'
# Date::DATE_FORMATS[:short_ordinal] = ->(date) { date.strftime("%B #{date.day.ordinalize}") }
#
# source://activesupport//lib/active_support/core_ext/date/conversions.rb#47
def to_formatted_s(format = T.unsafe(nil)); end
# Convert to a formatted string. See DATE_FORMATS for predefined formats.
#
# This method is aliased to <tt>to_formatted_s</tt>.
#
# date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007
#
# date.to_fs(:db) # => "2007-11-10"
# date.to_formatted_s(:db) # => "2007-11-10"
#
# date.to_fs(:short) # => "10 Nov"
# date.to_fs(:number) # => "20071110"
# date.to_fs(:long) # => "November 10, 2007"
# date.to_fs(:long_ordinal) # => "November 10th, 2007"
# date.to_fs(:rfc822) # => "10 Nov 2007"
# date.to_fs(:iso8601) # => "2007-11-10"
#
# == Adding your own date formats to to_fs
# You can add your own formats to the Date::DATE_FORMATS hash.
# Use the format name as the hash key and either a strftime string
# or Proc instance that takes a date argument as the value.
#
# # config/initializers/date_formats.rb
# Date::DATE_FORMATS[:month_and_year] = '%B %Y'
# Date::DATE_FORMATS[:short_ordinal] = ->(date) { date.strftime("%B #{date.day.ordinalize}") }
#
# source://activesupport//lib/active_support/core_ext/date/conversions.rb#47
def to_fs(format = T.unsafe(nil)); end
# Converts a Date instance to a Time, where the time is set to the beginning of the day.
# The timezone can be either +:local+ or +:utc+ (default +:local+).
#
# date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007
#
# date.to_time # => 2007-11-10 00:00:00 0800
# date.to_time(:local) # => 2007-11-10 00:00:00 0800
#
# date.to_time(:utc) # => 2007-11-10 00:00:00 UTC
#
# NOTE: The +:local+ timezone is Ruby's *process* timezone, i.e. <tt>ENV['TZ']</tt>.
# If the <b>application's</b> timezone is needed, then use +in_time_zone+ instead.
#
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/core_ext/date/conversions.rb#81
def to_time(form = T.unsafe(nil)); end
# Returns a string which represents the time in used time zone as DateTime
# defined by XML Schema:
#
# date = Date.new(2015, 05, 23) # => Sat, 23 May 2015
# date.xmlschema # => "2015-05-23T00:00:00+04:00"
#
# source://activesupport//lib/active_support/core_ext/date/conversions.rb#93
def xmlschema; end
class << self
# Returns the week start (e.g. +:monday+) for the current request, if this has been set (via Date.beginning_of_week=).
# If <tt>Date.beginning_of_week</tt> has not been set for the current request, returns the week start specified in <tt>config.beginning_of_week</tt>.
# If no +config.beginning_of_week+ was specified, returns +:monday+.
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#19
def beginning_of_week; end
# Sets <tt>Date.beginning_of_week</tt> to a week start (e.g. +:monday+) for current request/thread.
#
# This method accepts any of the following day symbols:
# +:monday+, +:tuesday+, +:wednesday+, +:thursday+, +:friday+, +:saturday+, +:sunday+
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#27
def beginning_of_week=(week_start); end
# Returns the value of attribute beginning_of_week_default.
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#14
def beginning_of_week_default; end
# Sets the attribute beginning_of_week_default
#
# @param value the value to set the attribute beginning_of_week_default to.
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#14
def beginning_of_week_default=(_arg0); end
# Returns Time.zone.today when <tt>Time.zone</tt> or <tt>config.time_zone</tt> are set, otherwise just returns Date.today.
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#48
def current; end
# Returns week start day symbol (e.g. +:monday+), or raises an +ArgumentError+ for invalid day symbol.
#
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#32
def find_beginning_of_week!(week_start); end
# Returns a new Date representing the date 1 day after today (i.e. tomorrow's date).
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#43
def tomorrow; end
# Returns a new Date representing the date 1 day ago (i.e. yesterday's date).
#
# source://activesupport//lib/active_support/core_ext/date/calculations.rb#38
def yesterday; end
end
end
# source://activesupport//lib/active_support/core_ext/date/conversions.rb#9
Date::DATE_FORMATS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#6
module DateAndTime; end
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#7
module DateAndTime::Calculations
# Returns true if the date/time falls after <tt>date_or_time</tt>.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#72
def after?(date_or_time); end
# Returns a Range representing the whole day of the current date/time.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#310
def all_day; end
# Returns a Range representing the whole month of the current date/time.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#321
def all_month; end
# Returns a Range representing the whole quarter of the current date/time.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#326
def all_quarter; end
# Returns a Range representing the whole week of the current date/time.
# Week starts on start_day, default is <tt>Date.beginning_of_week</tt> or <tt>config.beginning_of_week</tt> when set.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#316
def all_week(start_day = T.unsafe(nil)); end
# Returns a Range representing the whole year of the current date/time.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#331
def all_year; end
# Returns a new date/time at the start of the month.
#
# today = Date.today # => Thu, 18 Jun 2015
# today.beginning_of_month # => Mon, 01 Jun 2015
#
# +DateTime+ objects will have a time set to 0:00.
#
# now = DateTime.current # => Thu, 18 Jun 2015 15:23:13 +0000
# now.beginning_of_month # => Mon, 01 Jun 2015 00:00:00 +0000
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#125
def at_beginning_of_month; end
# Returns a new date/time at the start of the quarter.
#
# today = Date.today # => Fri, 10 Jul 2015
# today.beginning_of_quarter # => Wed, 01 Jul 2015
#
# +DateTime+ objects will have a time set to 0:00.
#
# now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
# now.beginning_of_quarter # => Wed, 01 Jul 2015 00:00:00 +0000
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#139
def at_beginning_of_quarter; end
# Returns a new date/time representing the start of this week on the given day.
# Week is assumed to start on +start_day+, default is
# +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
# +DateTime+ objects have their time set to 0:00.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#267
def at_beginning_of_week(start_day = T.unsafe(nil)); end
# Returns a new date/time at the beginning of the year.
#
# today = Date.today # => Fri, 10 Jul 2015
# today.beginning_of_year # => Thu, 01 Jan 2015
#
# +DateTime+ objects will have a time set to 0:00.
#
# now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
# now.beginning_of_year # => Thu, 01 Jan 2015 00:00:00 +0000
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#179
def at_beginning_of_year; end
# Returns a new date/time representing the end of the month.
# DateTime objects will have a time set to 23:59:59.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#296
def at_end_of_month; end
# Returns a new date/time at the end of the quarter.
#
# today = Date.today # => Fri, 10 Jul 2015
# today.end_of_quarter # => Wed, 30 Sep 2015
#
# +DateTime+ objects will have a time set to 23:59:59.
#
# now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
# now.end_of_quarter # => Wed, 30 Sep 2015 23:59:59 +0000
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#154
def at_end_of_quarter; end
# Returns a new date/time representing the end of this week on the given day.
# Week is assumed to start on +start_day+, default is
# +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
# DateTime objects have their time set to 23:59:59.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#283
def at_end_of_week(start_day = T.unsafe(nil)); end
# Returns a new date/time representing the end of the year.
# DateTime objects will have a time set to 23:59:59.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#304
def at_end_of_year; end
# Returns true if the date/time falls before <tt>date_or_time</tt>.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#67
def before?(date_or_time); end
# Returns a new date/time at the start of the month.
#
# today = Date.today # => Thu, 18 Jun 2015
# today.beginning_of_month # => Mon, 01 Jun 2015
#
# +DateTime+ objects will have a time set to 0:00.
#
# now = DateTime.current # => Thu, 18 Jun 2015 15:23:13 +0000
# now.beginning_of_month # => Mon, 01 Jun 2015 00:00:00 +0000
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#125
def beginning_of_month; end
# Returns a new date/time at the start of the quarter.
#
# today = Date.today # => Fri, 10 Jul 2015
# today.beginning_of_quarter # => Wed, 01 Jul 2015
#
# +DateTime+ objects will have a time set to 0:00.
#
# now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
# now.beginning_of_quarter # => Wed, 01 Jul 2015 00:00:00 +0000
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#139
def beginning_of_quarter; end
# Returns a new date/time representing the start of this week on the given day.
# Week is assumed to start on +start_day+, default is
# +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
# +DateTime+ objects have their time set to 0:00.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#267
def beginning_of_week(start_day = T.unsafe(nil)); end
# Returns a new date/time at the beginning of the year.
#
# today = Date.today # => Fri, 10 Jul 2015
# today.beginning_of_year # => Thu, 01 Jan 2015
#
# +DateTime+ objects will have a time set to 0:00.
#
# now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
# now.beginning_of_year # => Thu, 01 Jan 2015 00:00:00 +0000
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#179
def beginning_of_year; end
# Returns a new date/time the specified number of days ago.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#77
def days_ago(days); end
# Returns a new date/time the specified number of days in the future.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#82
def days_since(days); end
# Returns the number of days to the start of the week on the given day.
# Week is assumed to start on +start_day+, default is
# +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#258
def days_to_week_start(start_day = T.unsafe(nil)); end
# Returns a new date/time representing the end of the month.
# DateTime objects will have a time set to 23:59:59.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#296
def end_of_month; end
# Returns a new date/time at the end of the quarter.
#
# today = Date.today # => Fri, 10 Jul 2015
# today.end_of_quarter # => Wed, 30 Sep 2015
#
# +DateTime+ objects will have a time set to 23:59:59.
#
# now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
# now.end_of_quarter # => Wed, 30 Sep 2015 23:59:59 +0000
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#154
def end_of_quarter; end
# Returns a new date/time representing the end of this week on the given day.
# Week is assumed to start on +start_day+, default is
# +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
# DateTime objects have their time set to 23:59:59.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#283
def end_of_week(start_day = T.unsafe(nil)); end
# Returns a new date/time representing the end of the year.
# DateTime objects will have a time set to 23:59:59.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#304
def end_of_year; end
# Returns true if the date/time is in the future.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#52
def future?; end
# Short-hand for <tt>months_ago(1)</tt>.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#240
def last_month; end
# Short-hand for <tt>months_ago(3)</tt>.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#245
def last_quarter; end
# Returns a new date/time representing the given day in the previous week.
# Week is assumed to start on +start_day+, default is
# +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
# DateTime objects have their time set to 0:00 unless +same_time+ is true.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#223
def last_week(start_day = T.unsafe(nil), same_time: T.unsafe(nil)); end
# Returns a new date/time representing the previous weekday.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#230
def last_weekday; end
# Short-hand for <tt>years_ago(1)</tt>.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#251
def last_year; end
# Returns Monday of this week assuming that week starts on Monday.
# +DateTime+ objects have their time set to 0:00.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#275
def monday; end
# Returns a new date/time the specified number of months ago.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#97
def months_ago(months); end
# Returns a new date/time the specified number of months in the future.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#102
def months_since(months); end
# Returns true if the date/time is tomorrow.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#35
def next_day?; end
# Returns a new date/time representing the next occurrence of the specified day of week.
#
# today = Date.today # => Thu, 14 Dec 2017
# today.next_occurring(:monday) # => Mon, 18 Dec 2017
# today.next_occurring(:thursday) # => Thu, 21 Dec 2017
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#340
def next_occurring(day_of_week); end
# Short-hand for <tt>months_since(3)</tt>.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#215
def next_quarter; end
# Returns a new date/time representing the given day in the next week.
#
# today = Date.today # => Thu, 07 May 2015
# today.next_week # => Mon, 11 May 2015
#
# The +given_day_in_next_week+ defaults to the beginning of the week
# which is determined by +Date.beginning_of_week+ or +config.beginning_of_week+
# when set.
#
# today = Date.today # => Thu, 07 May 2015
# today.next_week(:friday) # => Fri, 15 May 2015
#
# +DateTime+ objects have their time set to 0:00 unless +same_time+ is true.
#
# now = DateTime.current # => Thu, 07 May 2015 13:31:16 +0000
# now.next_week # => Mon, 11 May 2015 00:00:00 +0000
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#200
def next_week(given_day_in_next_week = T.unsafe(nil), same_time: T.unsafe(nil)); end
# Returns a new date/time representing the next weekday.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#206
def next_weekday; end
# Returns true if the date/time does not fall on a Saturday or Sunday.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#62
def on_weekday?; end
# Returns true if the date/time falls on a Saturday or Sunday.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#57
def on_weekend?; end
# Returns true if the date/time is in the past.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#47
def past?; end
# Returns true if the date/time is yesterday.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#41
def prev_day?; end
# Returns a new date/time representing the previous occurrence of the specified day of week.
#
# today = Date.today # => Thu, 14 Dec 2017
# today.prev_occurring(:monday) # => Mon, 11 Dec 2017
# today.prev_occurring(:thursday) # => Thu, 07 Dec 2017
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#351
def prev_occurring(day_of_week); end
# Short-hand for <tt>months_ago(3)</tt>.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#245
def prev_quarter; end
# Returns a new date/time representing the given day in the previous week.
# Week is assumed to start on +start_day+, default is
# +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
# DateTime objects have their time set to 0:00 unless +same_time+ is true.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#223
def prev_week(start_day = T.unsafe(nil), same_time: T.unsafe(nil)); end
# Returns a new date/time representing the previous weekday.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#230
def prev_weekday; end
# Returns the quarter for a date/time.
#
# Date.new(2010, 1, 31).quarter # => 1
# Date.new(2010, 4, 12).quarter # => 2
# Date.new(2010, 9, 15).quarter # => 3
# Date.new(2010, 12, 25).quarter # => 4
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#166
def quarter; end
# Returns Sunday of this week assuming that week starts on Monday.
# +DateTime+ objects have their time set to 23:59:59.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#290
def sunday; end
# Returns true if the date/time is today.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#30
def today?; end
# Returns a new date/time representing tomorrow.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#25
def tomorrow; end
# Returns true if the date/time is tomorrow.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#35
def tomorrow?; end
# Returns a new date/time the specified number of weeks ago.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#87
def weeks_ago(weeks); end
# Returns a new date/time the specified number of weeks in the future.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#92
def weeks_since(weeks); end
# Returns a new date/time the specified number of years ago.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#107
def years_ago(years); end
# Returns a new date/time the specified number of years in the future.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#112
def years_since(years); end
# Returns a new date/time representing yesterday.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#20
def yesterday; end
# Returns true if the date/time is yesterday.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#41
def yesterday?; end
private
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#370
def copy_time_to(other); end
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#366
def days_span(day); end
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#358
def first_hour(date_or_time); end
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#362
def last_hour(date_or_time); end
end
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#8
DateAndTime::Calculations::DAYS_INTO_WEEK = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#17
DateAndTime::Calculations::WEEKEND_DAYS = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#7
module DateAndTime::Compatibility
# source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#39
def preserve_timezone; end
# source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#56
def utc_to_local_returns_utc_offset_times; end
class << self
# --
# This re-implements the behaviour of the mattr_reader, instead
# of prepending on to it, to avoid overcomplicating a module that
# is in turn included in several places. This will all go away in
# Rails 8.0 anyway.
#
# source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#24
def preserve_timezone; end
# source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#15
def preserve_timezone=(val); end
# source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#56
def utc_to_local_returns_utc_offset_times; end
# source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#56
def utc_to_local_returns_utc_offset_times=(val); end
end
end
# source://activesupport//lib/active_support/core_ext/date_and_time/zones.rb#4
module DateAndTime::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, 31 Dec 1999 14:00:00 HST -10:00
# Date.new(2000).in_time_zone # => Sat, 01 Jan 2000 00:00:00 HST -10:00
#
# This method is similar to Time#localtime, except that it uses <tt>Time.zone</tt> as the local zone
# instead of the operating system's time zone.
#
# You can also pass in a TimeZone instance or string that identifies a TimeZone as an argument,
# and the conversion will be based on that zone instead of <tt>Time.zone</tt>.
#
# Time.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00
# Date.new(2000).in_time_zone('Alaska') # => Sat, 01 Jan 2000 00:00:00 AKST -09:00
#
# source://activesupport//lib/active_support/core_ext/date_and_time/zones.rb#20
def in_time_zone(zone = T.unsafe(nil)); end
private
# source://activesupport//lib/active_support/core_ext/date_and_time/zones.rb#32
def time_with_zone(time, zone); end
end
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#5
class DateTime < ::Date
# Layers additional behavior on DateTime#<=> so that Time and
# ActiveSupport::TimeWithZone instances can be compared with a DateTime.
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#208
def <=>(other); end
# Uses Date to provide precise Time calculations for years, months, and days.
# The +options+ parameter takes a hash with any of these keys: <tt>:years</tt>,
# <tt>:months</tt>, <tt>:weeks</tt>, <tt>:days</tt>, <tt>:hours</tt>,
# <tt>:minutes</tt>, <tt>:seconds</tt>.
#
# Just like Date#advance, increments are applied in order of time units from
# largest to smallest. This order can affect the result around the end of a
# month.
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#82
def advance(options); end
# Returns a new DateTime representing the time a number of seconds ago.
# Do not use this method in combination with x.months, use months_ago instead!
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#109
def ago(seconds); end
# source://activesupport//lib/active_support/core_ext/object/json.rb#215
def as_json(options = T.unsafe(nil)); end
# Returns a new DateTime representing the start of the day (0:00).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#122
def at_beginning_of_day; end
# Returns a new DateTime representing the start of the hour (hh:00:00).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#146
def at_beginning_of_hour; end
# Returns a new DateTime representing the start of the minute (hh:mm:00).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#158
def at_beginning_of_minute; end
# Returns a new DateTime representing the end of the day (23:59:59).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#140
def at_end_of_day; end
# Returns a new DateTime representing the end of the hour (hh:59:59).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#152
def at_end_of_hour; end
# Returns a new DateTime representing the end of the minute (hh:mm:59).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#164
def at_end_of_minute; end
# Returns a new DateTime representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130
def at_midday; end
# Returns a new DateTime representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130
def at_middle_of_day; end
# Returns a new DateTime representing the start of the day (0:00).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#122
def at_midnight; end
# Returns a new DateTime representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130
def at_noon; end
# Returns a new DateTime representing the start of the day (0:00).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#122
def beginning_of_day; end
# Returns a new DateTime representing the start of the hour (hh:00:00).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#146
def beginning_of_hour; end
# Returns a new DateTime representing the start of the minute (hh:mm:00).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#158
def beginning_of_minute; end
# Returns a new DateTime where one or more of the elements have been changed
# according to the +options+ parameter. The time options (<tt>:hour</tt>,
# <tt>:min</tt>, <tt>:sec</tt>) reset cascadingly, so if only the hour is
# passed, then minute and sec is set to 0. If the hour and minute is passed,
# then sec is set to 0. The +options+ parameter takes a hash with any of these
# keys: <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>, <tt>:hour</tt>,
# <tt>:min</tt>, <tt>:sec</tt>, <tt>:offset</tt>, <tt>:start</tt>.
#
# DateTime.new(2012, 8, 29, 22, 35, 0).change(day: 1) # => DateTime.new(2012, 8, 1, 22, 35, 0)
# DateTime.new(2012, 8, 29, 22, 35, 0).change(year: 1981, day: 1) # => DateTime.new(1981, 8, 1, 22, 35, 0)
# DateTime.new(2012, 8, 29, 22, 35, 0).change(year: 1981, hour: 0) # => DateTime.new(1981, 8, 29, 0, 0, 0)
#
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#51
def change(options); end
# Returns a new DateTime representing the end of the day (23:59:59).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#140
def end_of_day; end
# Returns a new DateTime representing the end of the hour (hh:59:59).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#152
def end_of_hour; end
# Returns a new DateTime representing the end of the minute (hh:mm:59).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#164
def end_of_minute; end
# Returns a formatted string of the offset from UTC, or an alternative
# string if the time zone is already UTC.
#
# datetime = DateTime.civil(2000, 1, 1, 0, 0, 0, Rational(-6, 24))
# datetime.formatted_offset # => "-06:00"
# datetime.formatted_offset(false) # => "-0600"
#
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#51
def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end
# Returns a <tt>Time</tt> instance of the simultaneous time in the UTC timezone.
#
# DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600
# DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#184
def getgm; end
# Returns a <tt>Time</tt> instance of the simultaneous time in the system timezone.
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#170
def getlocal(utc_offset = T.unsafe(nil)); end
# Returns a <tt>Time</tt> instance of the simultaneous time in the UTC timezone.
#
# DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600
# DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#184
def getutc; end
# Returns a <tt>Time</tt> instance of the simultaneous time in the UTC timezone.
#
# DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600
# DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#184
def gmtime; end
# Returns a new DateTime representing the time a number of seconds since the
# instance time. Do not use this method in combination with x.months, use
# months_since instead!
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#116
def in(seconds); end
# Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000".
#
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#56
def inspect; end
# Returns a <tt>Time</tt> instance of the simultaneous time in the system timezone.
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#170
def localtime(utc_offset = T.unsafe(nil)); end
# Returns a new DateTime representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130
def midday; end
# Returns a new DateTime representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130
def middle_of_day; end
# Returns a new DateTime representing the start of the day (0:00).
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#122
def midnight; end
# Returns a new DateTime representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130
def noon; end
# Returns the fraction of a second as nanoseconds
#
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#94
def nsec; end
# Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000".
#
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#56
def readable_inspect; end
# Returns the number of seconds since 00:00:00.
#
# DateTime.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0
# DateTime.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296
# DateTime.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#20
def seconds_since_midnight; end
# Returns the number of seconds until 23:59:59.
#
# DateTime.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399
# DateTime.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103
# DateTime.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#29
def seconds_until_end_of_day; end
# Returns a new DateTime representing the time a number of seconds since the
# instance time. Do not use this method in combination with x.months, use
# months_since instead!
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#116
def since(seconds); end
# Returns the fraction of a second as a +Rational+
#
# DateTime.new(2012, 8, 29, 0, 0, 0.5).subsec # => (1/2)
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#36
def subsec; end
# Converts +self+ to a floating-point number of seconds, including fractional microseconds, since the Unix epoch.
#
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#79
def to_f; end
# Convert to a formatted string. See Time::DATE_FORMATS for predefined formats.
#
# This method is aliased to <tt>to_formatted_s</tt>.
#
# === Examples
# datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000
#
# datetime.to_fs(:db) # => "2007-12-04 00:00:00"
# datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00"
# datetime.to_fs(:number) # => "20071204000000"
# datetime.to_fs(:short) # => "04 Dec 00:00"
# datetime.to_fs(:long) # => "December 04, 2007 00:00"
# datetime.to_fs(:long_ordinal) # => "December 4th, 2007 00:00"
# datetime.to_fs(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000"
# datetime.to_fs(:iso8601) # => "2007-12-04T00:00:00+00:00"
#
# == Adding your own datetime formats to to_fs
# DateTime formats are shared with Time. You can add your own to the
# Time::DATE_FORMATS hash. Use the format name as the hash key and
# either a strftime string or Proc instance that takes a time or
# datetime argument as the value.
#
# # config/initializers/time_formats.rb
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
# Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") }
#
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#35
def to_formatted_s(format = T.unsafe(nil)); end
# Convert to a formatted string. See Time::DATE_FORMATS for predefined formats.
#
# This method is aliased to <tt>to_formatted_s</tt>.
#
# === Examples
# datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000
#
# datetime.to_fs(:db) # => "2007-12-04 00:00:00"
# datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00"
# datetime.to_fs(:number) # => "20071204000000"
# datetime.to_fs(:short) # => "04 Dec 00:00"
# datetime.to_fs(:long) # => "December 04, 2007 00:00"
# datetime.to_fs(:long_ordinal) # => "December 4th, 2007 00:00"
# datetime.to_fs(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000"
# datetime.to_fs(:iso8601) # => "2007-12-04T00:00:00+00:00"
#
# == Adding your own datetime formats to to_fs
# DateTime formats are shared with Time. You can add your own to the
# Time::DATE_FORMATS hash. Use the format name as the hash key and
# either a strftime string or Proc instance that takes a time or
# datetime argument as the value.
#
# # config/initializers/time_formats.rb
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
# Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") }
#
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#35
def to_fs(format = T.unsafe(nil)); end
# Converts +self+ to an integer number of seconds since the Unix epoch.
#
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#84
def to_i; end
# Returns the fraction of a second as microseconds
#
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#89
def usec; end
# Returns a <tt>Time</tt> instance of the simultaneous time in the UTC timezone.
#
# DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600
# DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#184
def utc; end
# Returns +true+ if <tt>offset == 0</tt>.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#197
def utc?; end
# Returns the offset value in seconds.
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#202
def utc_offset; end
private
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#99
def offset_in_seconds; end
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#103
def seconds_since_unix_epoch; end
class << self
# Returns DateTime with local offset for given year if format is local else
# offset is zero.
#
# DateTime.civil_from_format :local, 2012
# # => Sun, 01 Jan 2012 00:00:00 +0300
# DateTime.civil_from_format :local, 2012, 12, 17
# # => Mon, 17 Dec 2012 00:00:00 +0000
#
# source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#69
def civil_from_format(utc_or_local, year, month = T.unsafe(nil), day = T.unsafe(nil), hour = T.unsafe(nil), min = T.unsafe(nil), sec = T.unsafe(nil)); end
# 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>.
#
# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#10
def current; end
end
end
# source://activesupport//lib/active_support/core_ext/object/try.rb#117
class Delegator < ::BasicObject
include ::ActiveSupport::Tryable
end
# source://activesupport//lib/active_support/core_ext/erb/util.rb#39
module ERB::Util
include ::ActiveSupport::CoreExt::ERBUtil
include ::ActiveSupport::CoreExt::ERBUtilPrivate
extend ::ActiveSupport::CoreExt::ERBUtil
private
# A utility method for escaping HTML without affecting existing escaped entities.
#
# html_escape_once('1 < 2 & 3')
# # => "1 < 2 & 3"
#
# html_escape_once('<< Accept & Checkout')
# # => "<< Accept & Checkout"
#
# source://activesupport//lib/active_support/core_ext/erb/util.rb#63
def html_escape_once(s); end
# A utility method for escaping HTML entities in JSON strings. Specifically, the
# &, > and < characters are replaced with their equivalent unicode escaped form -
# \u0026, \u003e, and \u003c. The Unicode sequences \u2028 and \u2029 are also
# escaped as they are treated as newline characters in some JavaScript engines.
# These sequences have identical meaning as the original characters inside the
# context of a JSON string, so assuming the input is a valid and well-formed
# JSON value, the output will have equivalent meaning when parsed:
#
# json = JSON.generate({ name: "</script><script>alert('PWNED!!!')</script>"})
# # => "{\"name\":\"</script><script>alert('PWNED!!!')</script>\"}"
#
# json_escape(json)
# # => "{\"name\":\"\\u003C/script\\u003E\\u003Cscript\\u003Ealert('PWNED!!!')\\u003C/script\\u003E\"}"
#
# JSON.parse(json) == JSON.parse(json_escape(json))
# # => true
#
# The intended use case for this method is to escape JSON strings before including
# them inside a script tag to avoid XSS vulnerability:
#
# <script>
# var currentUser = <%= raw json_escape(current_user.to_json) %>;
# </script>
#
# It is necessary to +raw+ the result of +json_escape+, so that quotation marks
# don't get converted to <tt>"</tt> entities. +json_escape+ doesn't
# automatically flag the result as HTML safe, since the raw value is unsafe to
# use inside HTML attributes.
#
# If your JSON is being used downstream for insertion into the DOM, be aware of
# whether or not it is being inserted via <tt>html()</tt>. Most jQuery plugins do this.
# If that is the case, be sure to +html_escape+ or +sanitize+ any user-generated
# content returned by your JSON.
#
# If you need to output JSON elsewhere in your HTML, you can just do something
# like this, as any unsafe characters (including quotation marks) will be
# automatically escaped for you:
#
# <div data-user-info="<%= current_user.to_json %>">...</div>
#
# WARNING: this helper only works with valid JSON. Using this on non-JSON values
# will open up serious XSS vulnerabilities. For example, if you replace the
# +current_user.to_json+ in the example above with user input instead, the browser
# will happily <tt>eval()</tt> that string as JavaScript.
#
# The escaping performed in this method is identical to those performed in the
# Active Support JSON encoder when +ActiveSupport.escape_html_entities_in_json+ is
# set to true. Because this transformation is idempotent, this helper can be
# applied even if +ActiveSupport.escape_html_entities_in_json+ is already true.
#
# Therefore, when you are unsure if +ActiveSupport.escape_html_entities_in_json+
# is enabled, or if you are unsure where your JSON string originated from, it
# is recommended that you always apply this helper (other libraries, such as the
# JSON gem, do not provide this kind of protection by default; also some gems
# might override +to_json+ to bypass Active Support's encoder).
#
# source://activesupport//lib/active_support/core_ext/erb/util.rb#124
def json_escape(s); end
# A utility method for escaping XML names of tags and names of attributes.
#
# xml_name_escape('1 < 2 & 3')
# # => "1___2___3"
#
# It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name
#
# source://activesupport//lib/active_support/core_ext/erb/util.rb#142
def xml_name_escape(name); end
class << self
# source://activesupport//lib/active_support/core_ext/erb/util.rb#25
def h(s); end
# source://activesupport//lib/active_support/core_ext/erb/util.rb#25
def html_escape(s); end
# A utility method for escaping HTML without affecting existing escaped entities.
#
# html_escape_once('1 < 2 & 3')
# # => "1 < 2 & 3"
#
# html_escape_once('<< Accept & Checkout')
# # => "<< Accept & Checkout"
#
# source://activesupport//lib/active_support/core_ext/erb/util.rb#63
def html_escape_once(s); end
# A utility method for escaping HTML entities in JSON strings. Specifically, the
# &, > and < characters are replaced with their equivalent unicode escaped form -
# \u0026, \u003e, and \u003c. The Unicode sequences \u2028 and \u2029 are also
# escaped as they are treated as newline characters in some JavaScript engines.
# These sequences have identical meaning as the original characters inside the
# context of a JSON string, so assuming the input is a valid and well-formed
# JSON value, the output will have equivalent meaning when parsed:
#
# json = JSON.generate({ name: "</script><script>alert('PWNED!!!')</script>"})
# # => "{\"name\":\"</script><script>alert('PWNED!!!')</script>\"}"
#
# json_escape(json)
# # => "{\"name\":\"\\u003C/script\\u003E\\u003Cscript\\u003Ealert('PWNED!!!')\\u003C/script\\u003E\"}"
#
# JSON.parse(json) == JSON.parse(json_escape(json))
# # => true
#
# The intended use case for this method is to escape JSON strings before including
# them inside a script tag to avoid XSS vulnerability:
#
# <script>
# var currentUser = <%= raw json_escape(current_user.to_json) %>;
# </script>
#
# It is necessary to +raw+ the result of +json_escape+, so that quotation marks
# don't get converted to <tt>"</tt> entities. +json_escape+ doesn't
# automatically flag the result as HTML safe, since the raw value is unsafe to
# use inside HTML attributes.
#
# If your JSON is being used downstream for insertion into the DOM, be aware of
# whether or not it is being inserted via <tt>html()</tt>. Most jQuery plugins do this.
# If that is the case, be sure to +html_escape+ or +sanitize+ any user-generated
# content returned by your JSON.
#
# If you need to output JSON elsewhere in your HTML, you can just do something
# like this, as any unsafe characters (including quotation marks) will be
# automatically escaped for you:
#
# <div data-user-info="<%= current_user.to_json %>">...</div>
#
# WARNING: this helper only works with valid JSON. Using this on non-JSON values
# will open up serious XSS vulnerabilities. For example, if you replace the
# +current_user.to_json+ in the example above with user input instead, the browser
# will happily <tt>eval()</tt> that string as JavaScript.
#
# The escaping performed in this method is identical to those performed in the
# Active Support JSON encoder when +ActiveSupport.escape_html_entities_in_json+ is
# set to true. Because this transformation is idempotent, this helper can be
# applied even if +ActiveSupport.escape_html_entities_in_json+ is already true.
#
# Therefore, when you are unsure if +ActiveSupport.escape_html_entities_in_json+
# is enabled, or if you are unsure where your JSON string originated from, it
# is recommended that you always apply this helper (other libraries, such as the
# JSON gem, do not provide this kind of protection by default; also some gems
# might override +to_json+ to bypass Active Support's encoder).
#
# source://activesupport//lib/active_support/core_ext/erb/util.rb#124
def json_escape(s); end
# Tokenizes a line of ERB. This is really just for error reporting and
# nobody should use it.
#
# source://activesupport//lib/active_support/core_ext/erb/util.rb#161
def tokenize(source); end
# source://activesupport//lib/active_support/core_ext/erb/util.rb#10
def unwrapped_html_escape(s); end
# A utility method for escaping XML names of tags and names of attributes.
#
# xml_name_escape('1 < 2 & 3')
# # => "1___2___3"
#
# It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name
#
# source://activesupport//lib/active_support/core_ext/erb/util.rb#142
def xml_name_escape(name); end
end
end
# source://activesupport//lib/active_support/core_ext/erb/util.rb#40
ERB::Util::HTML_ESCAPE = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/core_ext/erb/util.rb#41
ERB::Util::HTML_ESCAPE_ONCE_REGEXP = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/core_ext/erb/util.rb#49
ERB::Util::INVALID_TAG_NAME_FOLLOWING_REGEXP = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/core_ext/erb/util.rb#47
ERB::Util::INVALID_TAG_NAME_START_REGEXP = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/core_ext/erb/util.rb#50
ERB::Util::SAFE_XML_TAG_NAME_REGEXP = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/core_ext/erb/util.rb#48
ERB::Util::TAG_NAME_FOLLOWING_CODEPOINTS = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/core_ext/erb/util.rb#51
ERB::Util::TAG_NAME_REPLACEMENT_CHAR = T.let(T.unsafe(nil), String)
# Following XML requirements: https://www.w3.org/TR/REC-xml/#NT-Name
#
# source://activesupport//lib/active_support/core_ext/erb/util.rb#44
ERB::Util::TAG_NAME_START_CODEPOINTS = T.let(T.unsafe(nil), String)
# source://activesupport//lib/active_support/core_ext/object/json.rb#147
module Enumerable
include ::ActiveSupport::ToJsonWithActiveSupportEncoder
extend ::ActiveSupport::EnumerableCoreExt::Constants
# source://activesupport//lib/active_support/core_ext/object/json.rb#148
def as_json(options = T.unsafe(nil)); end
# Returns a new +Array+ without the blank items.
# Uses Object#blank? for determining if an item is blank.
#
# [1, "", nil, 2, " ", [], {}, false, true].compact_blank
# # => [1, 2, true]
#
# Set.new([nil, "", 1, false]).compact_blank
# # => [1]
#
# When called on a +Hash+, returns a new +Hash+ without the blank values.
#
# { a: "", b: 1, c: nil, d: [], e: false, f: true }.compact_blank
# # => { b: 1, f: true }
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#184
def compact_blank; end
# The negative of the <tt>Enumerable#include?</tt>. Returns +true+ if the
# collection does not include the object.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#118
def exclude?(object); end
# Returns a copy of the enumerable excluding the specified elements.
#
# ["David", "Rafael", "Aaron", "Todd"].excluding "Aaron", "Todd"
# # => ["David", "Rafael"]
#
# ["David", "Rafael", "Aaron", "Todd"].excluding %w[ Aaron Todd ]
# # => ["David", "Rafael"]
#
# {foo: 1, bar: 2, baz: 3}.excluding :bar
# # => {foo: 1, baz: 3}
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#132
def excluding(*elements); end
# Returns a new +Array+ where the order has been set to that provided in the +series+, based on the +key+ of the
# objects in the original enumerable.
#
# [ Person.find(5), Person.find(3), Person.find(1) ].in_order_of(:id, [ 1, 5, 3 ])
# # => [ Person.find(1), Person.find(5), Person.find(3) ]
#
# If the +series+ include keys that have no corresponding element in the Enumerable, these are ignored.
# If the Enumerable has additional elements that aren't named in the +series+, these are not included in the result.
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#196
def in_order_of(key, series); end
# Returns a new array that includes the passed elements.
#
# [ 1, 2, 3 ].including(4, 5)
# # => [ 1, 2, 3, 4, 5 ]
#
# ["David", "Rafael"].including %w[ Aaron Todd ]
# # => ["David", "Rafael", "Aaron", "Todd"]
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#112
def including(*elements); end
# Convert an enumerable to a hash, using the block result as the key and the
# element as the value.
#
# people.index_by(&:login)
# # => { "nextangle" => <Person ...>, "chade-" => <Person ...>, ...}
#
# people.index_by { |person| "#{person.first_name} #{person.last_name}" }
# # => { "Chade- Fowlersburg-e" => <Person ...>, "David Heinemeier Hansson" => <Person ...>, ...}
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#52
def index_by; end
# Convert an enumerable to a hash, using the element as the key and the block
# result as the value.
#
# post = Post.new(title: "hey there", body: "what's up?")
#
# %i( title body ).index_with { |attr_name| post.public_send(attr_name) }
# # => { title: "hey there", body: "what's up?" }
#
# If an argument is passed instead of a block, it will be used as the value
# for all elements:
#
# %i( created_at updated_at ).index_with(Time.now)
# # => { created_at: 2020-03-09 22:31:47, updated_at: 2020-03-09 22:31:47 }
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#75
def index_with(default = T.unsafe(nil)); end
# Returns +true+ if the enumerable has more than 1 element. Functionally
# equivalent to <tt>enum.to_a.size > 1</tt>. Can be called with a block too,
# much like any?, so <tt>people.many? { |p| p.age > 26 }</tt> returns +true+
# if more than one person is over 26.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#93
def many?; end
# Calculates the maximum from the extracted elements.
#
# payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
# payments.maximum(:price) # => 15
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#40
def maximum(key); end
# Calculates the minimum from the extracted elements.
#
# payments = [Payment.new(5), Payment.new(15), Payment.new(10)]
# payments.minimum(:price) # => 5
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#32
def minimum(key); end
# Extract the given key from the first element in the enumerable.
#
# [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pick(:name)
# # => "David"
#
# [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pick(:id, :name)
# # => [1, "David"]
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#161
def pick(*keys); end
# Extract the given key from each element in the enumerable.
#
# [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pluck(:name)
# # => ["David", "Rafael", "Aaron"]
#
# [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pluck(:id, :name)
# # => [[1, "David"], [2, "Rafael"]]
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#145
def pluck(*keys); end
# Returns the sole item in the enumerable. If there are no items, or more
# than one item, raises +Enumerable::SoleItemExpectedError+.
#
# ["x"].sole # => "x"
# Set.new.sole # => Enumerable::SoleItemExpectedError: no item found
# { a: 1, b: 2 }.sole # => Enumerable::SoleItemExpectedError: multiple items found
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#206
def sole; end
# Returns a copy of the enumerable excluding the specified elements.
#
# ["David", "Rafael", "Aaron", "Todd"].excluding "Aaron", "Todd"
# # => ["David", "Rafael"]
#
# ["David", "Rafael", "Aaron", "Todd"].excluding %w[ Aaron Todd ]
# # => ["David", "Rafael"]
#
# {foo: 1, bar: 2, baz: 3}.excluding :bar
# # => {foo: 1, baz: 3}
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#132
def without(*elements); end
end
# Error generated by +sole+ when called on an enumerable that doesn't have
# exactly one item.
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#21
class Enumerable::SoleItemExpectedError < ::StandardError; end
# source://activesupport//lib/active_support/core_ext/object/json.rb#250
class Exception
# source://activesupport//lib/active_support/core_ext/object/json.rb#251
def as_json(options = T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/core_ext/object/blank.rb#65
class FalseClass
# source://activesupport//lib/active_support/core_ext/object/json.rb#89
def as_json(options = T.unsafe(nil)); end
# +false+ is blank:
#
# false.blank? # => true
#
# @return [true]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#71
def blank?; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#75
def present?; end
# Returns +self+.
#
# source://activesupport//lib/active_support/core_ext/object/to_query.rb#34
def to_param; end
end
# source://activesupport//lib/active_support/core_ext/file/atomic.rb#5
class File < ::IO
class << self
# Write to a file atomically. Useful for situations where you don't
# want other processes or threads to see half-written files.
#
# File.atomic_write('important.file') do |file|
# file.write('hello')
# end
#
# This method needs to create a temporary file. By default it will create it
# in the same directory as the destination file. If you don't like this
# behavior you can provide a different directory but it must be on the
# same physical filesystem as the file you're trying to write.
#
# File.atomic_write('/data/something.important', '/data/tmp') do |file|
# file.write('hello')
# end
#
# source://activesupport//lib/active_support/core_ext/file/atomic.rb#21
def atomic_write(file_name, temp_dir = T.unsafe(nil)); end
# Private utility method.
#
# source://activesupport//lib/active_support/core_ext/file/atomic.rb#56
def probe_stat_in(dir); end
end
end
# source://activesupport//lib/active_support/core_ext/object/json.rb#118
class Float < ::Numeric
# Encoding Infinity or NaN to JSON should return "null". The default returns
# "Infinity" or "NaN" which are not valid JSON.
#
# source://activesupport//lib/active_support/core_ext/object/json.rb#121
def as_json(options = T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/core_ext/hash/deep_merge.rb#5
class Hash
include ::Enumerable
include ::ActiveSupport::DeepMergeable
# source://activesupport//lib/active_support/core_ext/object/json.rb#172
def as_json(options = T.unsafe(nil)); end
# Validates all keys in a hash match <tt>*valid_keys</tt>, raising
# +ArgumentError+ on a mismatch.
#
# Note that keys are treated differently than HashWithIndifferentAccess,
# meaning that string and symbol keys will not match.
#
# { name: 'Rob', years: '28' }.assert_valid_keys(:name, :age) # => raises "ArgumentError: Unknown key: :years. Valid keys are: :name, :age"
# { name: 'Rob', age: '28' }.assert_valid_keys('name', 'age') # => raises "ArgumentError: Unknown key: :name. Valid keys are: 'name', 'age'"
# { name: 'Rob', age: '28' }.assert_valid_keys(:name, :age) # => passes, raises nothing
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#48
def assert_valid_keys(*valid_keys); end
# Hash#reject has its own definition, so this needs one too.
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#217
def compact_blank; end
# Removes all blank values from the +Hash+ in place and returns self.
# Uses Object#blank? for determining if a value is blank.
#
# h = { a: "", b: 1, c: nil, d: [], e: false, f: true }
# h.compact_blank!
# # => { b: 1, f: true }
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#227
def compact_blank!; end
# :method: deep_merge!
# :call-seq: deep_merge!(other_hash, &block)
#
# Same as #deep_merge, but modifies +self+.
#
# --
# Implemented by ActiveSupport::DeepMergeable#deep_merge!.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/hash/deep_merge.rb#39
def deep_merge?(other); end
# Returns a new hash with all keys converted to strings.
# This includes the keys from the root hash and from all
# nested hashes and arrays.
#
# hash = { person: { name: 'Rob', age: '28' } }
#
# hash.deep_stringify_keys
# # => {"person"=>{"name"=>"Rob", "age"=>"28"}}
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#84
def deep_stringify_keys; end
# Destructively converts all keys to strings.
# This includes the keys from the root hash and from all
# nested hashes and arrays.
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#91
def deep_stringify_keys!; end
# Returns a new hash with all keys converted to symbols, as long as
# they respond to +to_sym+. This includes the keys from the root hash
# and from all nested hashes and arrays.
#
# hash = { 'person' => { 'name' => 'Rob', 'age' => '28' } }
#
# hash.deep_symbolize_keys
# # => {:person=>{:name=>"Rob", :age=>"28"}}
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#103
def deep_symbolize_keys; end
# Destructively converts all keys to symbols, as long as they respond
# to +to_sym+. This includes the keys from the root hash and from all
# nested hashes and arrays.
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#110
def deep_symbolize_keys!; end
# Returns a new hash with all keys converted by the block operation.
# This includes the keys from the root hash and from all
# nested hashes and arrays.
#
# hash = { person: { name: 'Rob', age: '28' } }
#
# hash.deep_transform_keys{ |key| key.to_s.upcase }
# # => {"PERSON"=>{"NAME"=>"Rob", "AGE"=>"28"}}
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#65
def deep_transform_keys(&block); end
# Destructively converts all keys by using the block operation.
# This includes the keys from the root hash and from all
# nested hashes and arrays.
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#72
def deep_transform_keys!(&block); end
# Removes the given keys from hash and returns it.
# hash = { a: true, b: false, c: nil }
# hash.except!(:c) # => { a: true, b: false }
# hash # => { a: true, b: false }
#
# source://activesupport//lib/active_support/core_ext/hash/except.rb#20
def except!(*keys); end
# Removes and returns the key/value pairs matching the given keys.
#
# hash = { a: 1, b: 2, c: 3, d: 4 }
# hash.extract!(:a, :b) # => {:a=>1, :b=>2}
# hash # => {:c=>3, :d=>4}
#
# source://activesupport//lib/active_support/core_ext/hash/slice.rb#24
def extract!(*keys); end
# 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 of the Array.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/array/extract_options.rb#9
def extractable_options?; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#118
def present?; end
# Replaces the hash with only the given keys.
# Returns a hash containing the removed key/value pairs.
#
# hash = { a: 1, b: 2, c: 3, d: 4 }
# hash.slice!(:a, :b) # => {:c=>3, :d=>4}
# hash # => {:a=>1, :b=>2}
#
# source://activesupport//lib/active_support/core_ext/hash/slice.rb#10
def slice!(*keys); end
# Returns a new hash with all keys converted to strings.
#
# hash = { name: 'Rob', age: '28' }
#
# hash.stringify_keys
# # => {"name"=>"Rob", "age"=>"28"}
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#10
def stringify_keys; end
# Destructively converts all keys to strings. Same as
# +stringify_keys+, but modifies +self+.
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#16
def stringify_keys!; end
# Returns a new hash with all keys converted to symbols, as long as
# they respond to +to_sym+.
#
# hash = { 'name' => 'Rob', 'age' => '28' }
#
# hash.symbolize_keys
# # => {:name=>"Rob", :age=>"28"}
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#27
def symbolize_keys; end
# Destructively converts all keys to symbols, as long as they respond
# to +to_sym+. Same as +symbolize_keys+, but modifies +self+.
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#34
def symbolize_keys!; end
# Returns a new hash with all keys converted to symbols, as long as
# they respond to +to_sym+.
#
# hash = { 'name' => 'Rob', 'age' => '28' }
#
# hash.symbolize_keys
# # => {:name=>"Rob", :age=>"28"}
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#27
def to_options; end
# Destructively converts all keys to symbols, as long as they respond
# to +to_sym+. Same as +symbolize_keys+, but modifies +self+.
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#34
def to_options!; end
# Returns a string representation of the receiver suitable for use as a URL
# query string:
#
# {name: 'David', nationality: 'Danish'}.to_query
# # => "name=David&nationality=Danish"
#
# An optional namespace can be passed to enclose key names:
#
# {name: 'David', nationality: 'Danish'}.to_query('user')
# # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
#
# The string pairs "key=value" that conform the query string
# are sorted lexicographically in ascending order.
#
# source://activesupport//lib/active_support/core_ext/object/to_query.rb#75
def to_param(namespace = T.unsafe(nil)); end
# Returns a string representation of the receiver suitable for use as a URL
# query string:
#
# {name: 'David', nationality: 'Danish'}.to_query
# # => "name=David&nationality=Danish"
#
# An optional namespace can be passed to enclose key names:
#
# {name: 'David', nationality: 'Danish'}.to_query('user')
# # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
#
# The string pairs "key=value" that conform the query string
# are sorted lexicographically in ascending order.
#
# source://activesupport//lib/active_support/core_ext/object/to_query.rb#75
def to_query(namespace = T.unsafe(nil)); end
private
# Support methods for deep transforming nested hashes and arrays.
#
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#116
def _deep_transform_keys_in_object(object, &block); end
# source://activesupport//lib/active_support/core_ext/hash/keys.rb#129
def _deep_transform_keys_in_object!(object, &block); end
end
# source://activesupport//lib/active_support/core_ext/object/json.rb#153
class IO
include ::Enumerable
include ::File::Constants
# source://activesupport//lib/active_support/core_ext/object/json.rb#154
def as_json(options = T.unsafe(nil)); end
end
class IO::Buffer
include ::Comparable
def initialize(*_arg0); end
def &(_arg0); end
def <=>(_arg0); end
def ^(_arg0); end
def and!(_arg0); end
def clear(*_arg0); end
def copy(*_arg0); end
def each(*_arg0); end
def each_byte(*_arg0); end
def empty?; end
def external?; end
def free; end
def get_string(*_arg0); end
def get_value(_arg0, _arg1); end
def get_values(_arg0, _arg1); end
def hexdump(*_arg0); end
def inspect; end
def internal?; end
def locked; end
def locked?; end
def mapped?; end
def not!; end
def null?; end
def or!(_arg0); end
def pread(*_arg0); end
def private?; end
def pwrite(*_arg0); end
def read(*_arg0); end
def readonly?; end
def resize(_arg0); end
def set_string(*_arg0); end
def set_value(_arg0, _arg1, _arg2); end
def set_values(_arg0, _arg1, _arg2); end
def shared?; end
def size; end
def slice(*_arg0); end
def to_s; end
def transfer; end
def valid?; end
def values(*_arg0); end
def write(*_arg0); end
def xor!(_arg0); end
def |(_arg0); end
def ~; end
private
def initialize_copy(_arg0); end
class << self
def for(_arg0); end
def map(*_arg0); end
def size_of(_arg0); end
def string(_arg0); end
end
end
class IO::Buffer::AccessError < ::RuntimeError; end
class IO::Buffer::AllocationError < ::RuntimeError; end
IO::Buffer::BIG_ENDIAN = T.let(T.unsafe(nil), Integer)
IO::Buffer::DEFAULT_SIZE = T.let(T.unsafe(nil), Integer)
IO::Buffer::EXTERNAL = T.let(T.unsafe(nil), Integer)
IO::Buffer::HOST_ENDIAN = T.let(T.unsafe(nil), Integer)
IO::Buffer::INTERNAL = T.let(T.unsafe(nil), Integer)
class IO::Buffer::InvalidatedError < ::RuntimeError; end
IO::Buffer::LITTLE_ENDIAN = T.let(T.unsafe(nil), Integer)
IO::Buffer::LOCKED = T.let(T.unsafe(nil), Integer)
class IO::Buffer::LockedError < ::RuntimeError; end
IO::Buffer::MAPPED = T.let(T.unsafe(nil), Integer)
class IO::Buffer::MaskError < ::ArgumentError; end
IO::Buffer::NETWORK_ENDIAN = T.let(T.unsafe(nil), Integer)
IO::Buffer::PAGE_SIZE = T.let(T.unsafe(nil), Integer)
IO::Buffer::PRIVATE = T.let(T.unsafe(nil), Integer)
IO::Buffer::READONLY = T.let(T.unsafe(nil), Integer)
IO::Buffer::SHARED = T.let(T.unsafe(nil), Integer)
class IO::ConsoleMode
def echo=(_arg0); end
def raw(*_arg0); end
def raw!(*_arg0); end
private
def initialize_copy(_arg0); end
end
class IO::EAGAINWaitReadable < ::Errno::EAGAIN
include ::IO::WaitReadable
end
class IO::EAGAINWaitWritable < ::Errno::EAGAIN
include ::IO::WaitWritable
end
class IO::EINPROGRESSWaitReadable < ::Errno::EINPROGRESS
include ::IO::WaitReadable
end
class IO::EINPROGRESSWaitWritable < ::Errno::EINPROGRESS
include ::IO::WaitWritable
end
IO::EWOULDBLOCKWaitReadable = IO::EAGAINWaitReadable
IO::EWOULDBLOCKWaitWritable = IO::EAGAINWaitWritable
IO::PRIORITY = T.let(T.unsafe(nil), Integer)
IO::READABLE = T.let(T.unsafe(nil), Integer)
class IO::TimeoutError < ::IOError; end
IO::WRITABLE = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/core_ext/object/json.rb#237
class IPAddr
# source://activesupport//lib/active_support/core_ext/object/json.rb#238
def as_json(options = T.unsafe(nil)); end
end
class Integer < ::Numeric; end
# source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#3
module Kernel
private
# Sets $VERBOSE to +true+ for the duration of the block and back to its
# original value afterwards.
#
# source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#20
def enable_warnings(&block); end
# Sets $VERBOSE to +nil+ for the duration of the block and back to its original
# value afterwards.
#
# silence_warnings do
# value = noisy_call # no warning voiced
# end
#
# noisy_call # warning voiced
#
# source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#14
def silence_warnings(&block); end
# Blocks and ignores any exception passed as argument if raised within the block.
#
# suppress(ZeroDivisionError) do
# 1/0
# puts 'This code is NOT reached'
# end
#
# puts 'This code gets executed and nothing related to ZeroDivisionError was seen'
#
# source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#41
def suppress(*exception_classes); end
# Sets $VERBOSE for the duration of the block and back to its original
# value afterwards.
#
# source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#26
def with_warnings(flag); end
class << self
# Sets $VERBOSE to +true+ for the duration of the block and back to its
# original value afterwards.
#
# source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#20
def enable_warnings(&block); end
# Sets $VERBOSE to +nil+ for the duration of the block and back to its original
# value afterwards.
#
# silence_warnings do
# value = noisy_call # no warning voiced
# end
#
# noisy_call # warning voiced
#
# source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#14
def silence_warnings(&block); end
# Blocks and ignores any exception passed as argument if raised within the block.
#
# suppress(ZeroDivisionError) do
# 1/0
# puts 'This code is NOT reached'
# end
#
# puts 'This code gets executed and nothing related to ZeroDivisionError was seen'
#
# source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#41
def suppress(*exception_classes); end
# Sets $VERBOSE for the duration of the block and back to its original
# value afterwards.
#
# source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#26
def with_warnings(flag); end
end
end
# == 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.current space under the class name
# of the module.
#
# Note that it can also be scoped per-fiber if +Rails.application.config.active_support.isolation_level+
# is set to +:fiber+.
#
# source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#8
class Module
# source://activesupport//lib/active_support/core_ext/object/json.rb#53
def as_json(options = T.unsafe(nil)); end
# Defines both class and instance accessors for class attributes.
# All class and instance methods created will be public, even if
# this method is called with a private or protected access modifier.
#
# module HairColors
# mattr_accessor :hair_colors
# end
#
# class Person
# include HairColors
# end
#
# HairColors.hair_colors = [:brown, :black, :blonde, :red]
# HairColors.hair_colors # => [:brown, :black, :blonde, :red]
# Person.new.hair_colors # => [:brown, :black, :blonde, :red]
#
# If a subclass changes the value then that would also change the value for
# parent class. Similarly if parent class changes the value then that would
# change the value of subclasses too.
#
# class Citizen < Person
# end
#
# Citizen.new.hair_colors << :blue
# Person.new.hair_colors # => [:brown, :black, :blonde, :red, :blue]
#
# To omit the instance writer method, pass <tt>instance_writer: false</tt>.
# To omit the instance reader method, pass <tt>instance_reader: false</tt>.
#
# module HairColors
# mattr_accessor :hair_colors, instance_writer: false, instance_reader: false
# end
#
# class Person
# include HairColors
# end
#
# Person.new.hair_colors = [:brown] # => NoMethodError
# Person.new.hair_colors # => NoMethodError
#
# Or pass <tt>instance_accessor: false</tt>, to omit both instance methods.
#
# module HairColors
# mattr_accessor :hair_colors, instance_accessor: false
# end
#
# class Person
# include HairColors
# end
#
# Person.new.hair_colors = [:brown] # => NoMethodError
# Person.new.hair_colors # => NoMethodError
#
# You can set a default value for the attribute.
#
# module HairColors
# mattr_accessor :hair_colors, default: [:brown, :black, :blonde, :red]
# mattr_accessor(:hair_styles) { [:long, :short] }
# end
#
# class Person
# include HairColors
# end
#
# Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red]
# Person.class_variable_get("@@hair_styles") # => [:long, :short]
#
# source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#208
def cattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), &blk); end
# Defines a class attribute and creates a class and instance reader methods.
# The underlying class variable is set to +nil+, if it is not previously
# defined. All class and instance methods created will be public, even if
# this method is called with a private or protected access modifier.
#
# module HairColors
# mattr_reader :hair_colors
# end
#
# HairColors.hair_colors # => nil
# HairColors.class_variable_set("@@hair_colors", [:brown, :black])
# HairColors.hair_colors # => [:brown, :black]
#
# The attribute name must be a valid method name in Ruby.
#
# module Foo
# mattr_reader :"1_Badname"
# end
# # => NameError: invalid attribute name: 1_Badname
#
# To omit the instance reader method, pass
# <tt>instance_reader: false</tt> or <tt>instance_accessor: false</tt>.
#
# module HairColors
# mattr_reader :hair_colors, instance_reader: false
# end
#
# class Person
# include HairColors
# end
#
# Person.new.hair_colors # => NoMethodError
#
# You can set a default value for the attribute.
#
# module HairColors
# mattr_reader :hair_colors, default: [:brown, :black, :blonde, :red]
# mattr_reader(:hair_styles) { [:long, :short] }
# end
#
# class Person
# include HairColors
# end
#
# Person.new.hair_colors # => [:brown, :black, :blonde, :red]
# Person.new.hair_styles # => [:long, :short]
#
# @raise [TypeError]
#
# source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#55
def cattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end
# Defines a class attribute and creates a class and instance writer methods to
# allow assignment to the attribute. All class and instance methods created
# will be public, even if this method is called with a private or protected
# access modifier.
#
# module HairColors
# mattr_writer :hair_colors
# end
#
# class Person
# include HairColors
# end
#
# HairColors.hair_colors = [:brown, :black]
# Person.class_variable_get("@@hair_colors") # => [:brown, :black]
# Person.new.hair_colors = [:blonde, :red]
# HairColors.class_variable_get("@@hair_colors") # => [:blonde, :red]
#
# To omit the instance writer method, pass
# <tt>instance_writer: false</tt> or <tt>instance_accessor: false</tt>.
#
# module HairColors
# mattr_writer :hair_colors, instance_writer: false
# end
#
# class Person
# include HairColors
# end
#
# Person.new.hair_colors = [:blonde, :red] # => NoMethodError
#
# You can set a default value for the attribute.
#
# module HairColors
# mattr_writer :hair_colors, default: [:brown, :black, :blonde, :red]
# mattr_writer(:hair_styles) { [:long, :short] }
# end
#
# class Person
# include HairColors
# end
#
# Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red]
# Person.class_variable_get("@@hair_styles") # => [:long, :short]
#
# @raise [TypeError]
#
# source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#121
def cattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end
# Provides a +delegate+ class method to easily expose contained objects'
# public methods as your own.
#
# ==== Options
# * <tt>:to</tt> - Specifies the target object name as a symbol or string
# * <tt>:prefix</tt> - Prefixes the new method with the target name or a custom prefix
# * <tt>:allow_nil</tt> - If set to true, prevents a +ActiveSupport::DelegationError+
# from being raised
# * <tt>:private</tt> - If set to true, changes method visibility to private
#
# The macro receives one or more method names (specified as symbols or
# strings) and the name of the target object via the <tt>:to</tt> option
# (also a symbol or string).
#
# Delegation is particularly useful with Active Record associations:
#
# class Greeter < ActiveRecord::Base
# def hello
# 'hello'
# end
#
# def goodbye
# 'goodbye'
# end
# end
#
# class Foo < ActiveRecord::Base
# belongs_to :greeter
# delegate :hello, to: :greeter
# end
#
# Foo.new.hello # => "hello"
# Foo.new.goodbye # => NoMethodError: undefined method `goodbye' for #<Foo:0x1af30c>
#
# Multiple delegates to the same target are allowed:
#
# class Foo < ActiveRecord::Base
# belongs_to :greeter
# delegate :hello, :goodbye, to: :greeter
# end
#
# Foo.new.goodbye # => "goodbye"
#
# Methods can be delegated to instance variables, class variables, or constants
# by providing them as a symbols:
#
# class Foo
# CONSTANT_ARRAY = [0,1,2,3]
# @@class_array = [4,5,6,7]
#
# def initialize
# @instance_array = [8,9,10,11]
# end
# delegate :sum, to: :CONSTANT_ARRAY
# delegate :min, to: :@@class_array
# delegate :max, to: :@instance_array
# end
#
# Foo.new.sum # => 6
# Foo.new.min # => 4
# Foo.new.max # => 11
#
# It's also possible to delegate a method to the class by using +:class+:
#
# class Foo
# def self.hello
# "world"
# end
#
# delegate :hello, to: :class
# end
#
# Foo.new.hello # => "world"
#
# Delegates can optionally be prefixed using the <tt>:prefix</tt> option. If the value
# is <tt>true</tt>, the delegate methods are prefixed with the name of the object being
# delegated to.
#
# Person = Struct.new(:name, :address)
#
# class Invoice < Struct.new(:client)
# delegate :name, :address, to: :client, prefix: true
# end
#
# john_doe = Person.new('John Doe', 'Vimmersvej 13')
# invoice = Invoice.new(john_doe)
# invoice.client_name # => "John Doe"
# invoice.client_address # => "Vimmersvej 13"
#
# It is also possible to supply a custom prefix.
#
# class Invoice < Struct.new(:client)
# delegate :name, :address, to: :client, prefix: :customer
# end
#
# invoice = Invoice.new(john_doe)
# invoice.customer_name # => 'John Doe'
# invoice.customer_address # => 'Vimmersvej 13'
#
# The delegated methods are public by default.
# Pass <tt>private: true</tt> to change that.
#
# class User < ActiveRecord::Base
# has_one :profile
# delegate :first_name, to: :profile
# delegate :date_of_birth, to: :profile, private: true
#
# def age
# Date.today.year - date_of_birth.year
# end
# end
#
# User.new.first_name # => "Tomas"
# User.new.date_of_birth # => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
# User.new.age # => 2
#
# If the target is +nil+ and does not respond to the delegated method a
# +ActiveSupport::DelegationError+ is raised. If you wish to instead return +nil+,
# use the <tt>:allow_nil</tt> option.
#
# class User < ActiveRecord::Base
# has_one :profile
# delegate :age, to: :profile
# end
#
# User.new.age
# # => ActiveSupport::DelegationError: User#age delegated to profile.age, but profile is nil
#
# But if not having a profile yet is fine and should not be an error
# condition:
#
# class User < ActiveRecord::Base
# has_one :profile
# delegate :age, to: :profile, allow_nil: true
# end
#
# User.new.age # nil
#
# Note that if the target is not +nil+ then the call is attempted regardless of the
# <tt>:allow_nil</tt> option, and thus an exception is still raised if said object
# does not respond to the method:
#
# class Foo
# def initialize(bar)
# @bar = bar
# end
#
# delegate :name, to: :@bar, allow_nil: true
# end
#
# Foo.new("Bar").name # raises NoMethodError: undefined method `name'
#
# The target method must be public, otherwise it will raise +NoMethodError+.
#
# source://activesupport//lib/active_support/core_ext/module/delegation.rb#160
def delegate(*methods, to: T.unsafe(nil), prefix: T.unsafe(nil), allow_nil: T.unsafe(nil), private: T.unsafe(nil)); end
# When building decorators, a common pattern may emerge:
#
# class Partition
# def initialize(event)
# @event = event
# end
#
# def person
# detail.person || creator
# end
#
# private
# def respond_to_missing?(name, include_private = false)
# @event.respond_to?(name, include_private)
# end
#
# def method_missing(method, *args, &block)
# @event.send(method, *args, &block)
# end
# end
#
# With <tt>Module#delegate_missing_to</tt>, the above is condensed to:
#
# class Partition
# delegate_missing_to :@event
#
# def initialize(event)
# @event = event
# end
#
# def person
# detail.person || creator
# end
# end
#
# The target can be anything callable within the object, e.g. instance
# variables, methods, constants, etc.
#
# The delegated method must be public on the target, otherwise it will
# raise +ActiveSupport::DelegationError+. If you wish to instead return +nil+,
# use the <tt>:allow_nil</tt> option.
#
# The <tt>marshal_dump</tt> and <tt>_dump</tt> methods are exempt from
# delegation due to possible interference when calling
# <tt>Marshal.dump(object)</tt>, should the delegation target method
# of <tt>object</tt> add or remove instance variables.
#
# source://activesupport//lib/active_support/core_ext/module/delegation.rb#218
def delegate_missing_to(target, allow_nil: T.unsafe(nil)); end
# 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(deprecated_method_name, message, caller_backtrace)</tt> where you can implement your
# custom warning behavior.
#
# class MyLib::Deprecator
# def deprecation_warning(deprecated_method_name, message, caller_backtrace = nil)
# message = "#{deprecated_method_name} is deprecated and will be removed from MyLibrary | #{message}"
# Kernel.warn message
# end
# end
#
# source://activesupport//lib/active_support/core_ext/module/deprecation.rb#17
def deprecate(*method_names, deprecator:, **options); end
# Defines both class and instance accessors for class attributes.
# All class and instance methods created will be public, even if
# this method is called with a private or protected access modifier.
#
# module HairColors
# mattr_accessor :hair_colors
# end
#
# class Person
# include HairColors
# end
#
# HairColors.hair_colors = [:brown, :black, :blonde, :red]
# HairColors.hair_colors # => [:brown, :black, :blonde, :red]
# Person.new.hair_colors # => [:brown, :black, :blonde, :red]
#
# If a subclass changes the value then that would also change the value for
# parent class. Similarly if parent class changes the value then that would
# change the value of subclasses too.
#
# class Citizen < Person
# end
#
# Citizen.new.hair_colors << :blue
# Person.new.hair_colors # => [:brown, :black, :blonde, :red, :blue]
#
# To omit the instance writer method, pass <tt>instance_writer: false</tt>.
# To omit the instance reader method, pass <tt>instance_reader: false</tt>.
#
# module HairColors
# mattr_accessor :hair_colors, instance_writer: false, instance_reader: false
# end
#
# class Person
# include HairColors
# end
#
# Person.new.hair_colors = [:brown] # => NoMethodError
# Person.new.hair_colors # => NoMethodError
#
# Or pass <tt>instance_accessor: false</tt>, to omit both instance methods.
#
# module HairColors
# mattr_accessor :hair_colors, instance_accessor: false
# end
#
# class Person
# include HairColors
# end
#
# Person.new.hair_colors = [:brown] # => NoMethodError
# Person.new.hair_colors # => NoMethodError
#
# You can set a default value for the attribute.
#
# module HairColors
# mattr_accessor :hair_colors, default: [:brown, :black, :blonde, :red]
# mattr_accessor(:hair_styles) { [:long, :short] }
# end
#
# class Person
# include HairColors
# end
#
# Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red]
# Person.class_variable_get("@@hair_styles") # => [:long, :short]
#
# source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#208
def mattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), &blk); end
# Defines a class attribute and creates a class and instance reader methods.
# The underlying class variable is set to +nil+, if it is not previously
# defined. All class and instance methods created will be public, even if
# this method is called with a private or protected access modifier.
#
# module HairColors
# mattr_reader :hair_colors
# end
#
# HairColors.hair_colors # => nil
# HairColors.class_variable_set("@@hair_colors", [:brown, :black])
# HairColors.hair_colors # => [:brown, :black]
#
# The attribute name must be a valid method name in Ruby.
#
# module Foo
# mattr_reader :"1_Badname"
# end
# # => NameError: invalid attribute name: 1_Badname
#
# To omit the instance reader method, pass
# <tt>instance_reader: false</tt> or <tt>instance_accessor: false</tt>.
#
# module HairColors
# mattr_reader :hair_colors, instance_reader: false
# end
#
# class Person
# include HairColors
# end
#
# Person.new.hair_colors # => NoMethodError
#
# You can set a default value for the attribute.
#
# module HairColors
# mattr_reader :hair_colors, default: [:brown, :black, :blonde, :red]
# mattr_reader(:hair_styles) { [:long, :short] }
# end
#
# class Person
# include HairColors
# end
#
# Person.new.hair_colors # => [:brown, :black, :blonde, :red]
# Person.new.hair_styles # => [:long, :short]
#
# @raise [TypeError]
#
# source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#55
def mattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end
# Defines a class attribute and creates a class and instance writer methods to
# allow assignment to the attribute. All class and instance methods created
# will be public, even if this method is called with a private or protected
# access modifier.
#
# module HairColors
# mattr_writer :hair_colors
# end
#
# class Person
# include HairColors
# end
#
# HairColors.hair_colors = [:brown, :black]
# Person.class_variable_get("@@hair_colors") # => [:brown, :black]
# Person.new.hair_colors = [:blonde, :red]
# HairColors.class_variable_get("@@hair_colors") # => [:blonde, :red]
#
# To omit the instance writer method, pass
# <tt>instance_writer: false</tt> or <tt>instance_accessor: false</tt>.
#
# module HairColors
# mattr_writer :hair_colors, instance_writer: false
# end
#
# class Person
# include HairColors
# end
#
# Person.new.hair_colors = [:blonde, :red] # => NoMethodError
#
# You can set a default value for the attribute.
#
# module HairColors
# mattr_writer :hair_colors, default: [:brown, :black, :blonde, :red]
# mattr_writer(:hair_styles) { [:long, :short] }
# end
#
# class Person
# include HairColors
# end
#
# Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red]
# Person.class_variable_get("@@hair_styles") # => [:long, :short]
#
# @raise [TypeError]
#
# source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#121
def mattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end
# source://activesupport//lib/active_support/core_ext/module/redefine_method.rb#30
def method_visibility(method); end
# Replaces the existing method definition, if there is one, with the passed
# block as its body.
#
# source://activesupport//lib/active_support/core_ext/module/redefine_method.rb#17
def redefine_method(method, &block); end
# Replaces the existing singleton method definition, if there is one, with
# the passed block as its body.
#
# source://activesupport//lib/active_support/core_ext/module/redefine_method.rb#26
def redefine_singleton_method(method, &block); end
# Removes the named method, if it exists.
#
# source://activesupport//lib/active_support/core_ext/module/remove_method.rb#7
def remove_possible_method(method); end
# Removes the named singleton method, if it exists.
#
# source://activesupport//lib/active_support/core_ext/module/remove_method.rb#14
def remove_possible_singleton_method(method); end
# Marks the named method as intended to be redefined, if it exists.
# Suppresses the Ruby method redefinition warning. Prefer
# #redefine_method where possible.
#
# source://activesupport//lib/active_support/core_ext/module/redefine_method.rb#7
def silence_redefinition_of_method(method); end
end
# source://activesupport//lib/active_support/core_ext/module/delegation.rb#5
Module::DelegationError = ActiveSupport::DelegationError
class NameError < ::StandardError
include ::ErrorHighlight::CoreExt
include ::DidYouMean::Correctable
end
# source://activesupport//lib/active_support/core_ext/object/blank.rb#50
class NilClass
# source://activesupport//lib/active_support/core_ext/object/json.rb#95
def as_json(options = T.unsafe(nil)); end
# +nil+ is blank:
#
# nil.blank? # => true
#
# @return [true]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#56
def blank?; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#60
def present?; end
# Returns +self+.
#
# source://activesupport//lib/active_support/core_ext/object/to_query.rb#20
def to_param; end
# Calling +try+ on +nil+ always returns +nil+.
# It becomes especially helpful when navigating through associations that may return +nil+.
#
# nil.try(:name) # => nil
#
# Without +try+
# @person && @person.children.any? && @person.children.first.name
#
# With +try+
# @person.try(:children).try(:first).try(:name)
#
# source://activesupport//lib/active_support/core_ext/object/try.rb#148
def try(*_arg0); end
# Calling +try!+ on +nil+ always returns +nil+.
#
# nil.try!(:name) # => nil
#
# source://activesupport//lib/active_support/core_ext/object/try.rb#155
def try!(*_arg0); end
end
# source://activesupport//lib/active_support/core_ext/object/blank.rb#170
class Numeric
include ::Comparable
# source://activesupport//lib/active_support/core_ext/object/json.rb#113
def as_json(options = T.unsafe(nil)); end
# No number is blank:
#
# 1.blank? # => false
# 0.blank? # => false
#
# @return [false]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#177
def blank?; end
# Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
#
# 2.bytes # => 2
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#15
def byte; end
# Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
#
# 2.bytes # => 2
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#15
def bytes; end
# Returns a Duration instance matching the number of days provided.
#
# 2.days # => 2 days
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#37
def day; end
# Returns a Duration instance matching the number of days provided.
#
# 2.days # => 2 days
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#37
def days; end
# Returns the number of bytes equivalent to the exabytes provided.
#
# 2.exabytes # => 2_305_843_009_213_693_952
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#63
def exabyte; end
# Returns the number of bytes equivalent to the exabytes provided.
#
# 2.exabytes # => 2_305_843_009_213_693_952
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#63
def exabytes; end
# Returns a Duration instance matching the number of fortnights provided.
#
# 2.fortnights # => 4 weeks
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#53
def fortnight; end
# Returns a Duration instance matching the number of fortnights provided.
#
# 2.fortnights # => 4 weeks
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#53
def fortnights; end
# Returns the number of bytes equivalent to the gigabytes provided.
#
# 2.gigabytes # => 2_147_483_648
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#39
def gigabyte; end
# Returns the number of bytes equivalent to the gigabytes provided.
#
# 2.gigabytes # => 2_147_483_648
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#39
def gigabytes; end
# Returns a Duration instance matching the number of hours provided.
#
# 2.hours # => 2 hours
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#29
def hour; end
# Returns a Duration instance matching the number of hours provided.
#
# 2.hours # => 2 hours
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#29
def hours; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#13
def html_safe?; end
# Returns the number of milliseconds equivalent to the seconds provided.
# Used with the standard time durations.
#
# 2.in_milliseconds # => 2000
# 1.hour.in_milliseconds # => 3600000
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#63
def in_milliseconds; end
# Returns the number of bytes equivalent to the kilobytes provided.
#
# 2.kilobytes # => 2048
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#23
def kilobyte; end
# Returns the number of bytes equivalent to the kilobytes provided.
#
# 2.kilobytes # => 2048
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#23
def kilobytes; end
# Returns the number of bytes equivalent to the megabytes provided.
#
# 2.megabytes # => 2_097_152
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#31
def megabyte; end
# Returns the number of bytes equivalent to the megabytes provided.
#
# 2.megabytes # => 2_097_152
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#31
def megabytes; end
# Returns a Duration instance matching the number of minutes provided.
#
# 2.minutes # => 2 minutes
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#21
def minute; end
# Returns a Duration instance matching the number of minutes provided.
#
# 2.minutes # => 2 minutes
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#21
def minutes; end
# Returns the number of bytes equivalent to the petabytes provided.
#
# 2.petabytes # => 2_251_799_813_685_248
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#55
def petabyte; end
# Returns the number of bytes equivalent to the petabytes provided.
#
# 2.petabytes # => 2_251_799_813_685_248
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#55
def petabytes; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#181
def present?; end
# Returns a Duration instance matching the number of seconds provided.
#
# 2.seconds # => 2 seconds
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#13
def second; end
# Returns a Duration instance matching the number of seconds provided.
#
# 2.seconds # => 2 seconds
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#13
def seconds; end
# Returns the number of bytes equivalent to the terabytes provided.
#
# 2.terabytes # => 2_199_023_255_552
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#47
def terabyte; end
# Returns the number of bytes equivalent to the terabytes provided.
#
# 2.terabytes # => 2_199_023_255_552
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#47
def terabytes; end
# Returns a Duration instance matching the number of weeks provided.
#
# 2.weeks # => 2 weeks
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#45
def week; end
# Returns a Duration instance matching the number of weeks provided.
#
# 2.weeks # => 2 weeks
#
# source://activesupport//lib/active_support/core_ext/numeric/time.rb#45
def weeks; end
# Returns the number of bytes equivalent to the zettabytes provided.
#
# 2.zettabytes # => 2_361_183_241_434_822_606_848
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#71
def zettabyte; end
# Returns the number of bytes equivalent to the zettabytes provided.
#
# 2.zettabytes # => 2_361_183_241_434_822_606_848
#
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#71
def zettabytes; end
end
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#9
Numeric::EXABYTE = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#6
Numeric::GIGABYTE = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#4
Numeric::KILOBYTE = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#5
Numeric::MEGABYTE = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#8
Numeric::PETABYTE = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#7
Numeric::TERABYTE = T.let(T.unsafe(nil), Integer)
# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#10
Numeric::ZETTABYTE = T.let(T.unsafe(nil), Integer)
# --
# 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 arbitrary object you normally
# use an optimistic approach and are ready to catch an exception, say:
#
# arbitrary_object.dup rescue object
#
# Rails dups objects in a few critical spots where they are not that arbitrary.
# That rescue is very expensive (like 40 times slower than a predicate), and it
# is often triggered.
#
# That's why we hardcode the following cases and check duplicable? instead of
# using that rescue idiom.
# ++
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#5
class Object < ::BasicObject
include ::ActiveSupport::Dependencies::RequireDependency
include ::Kernel
include ::PP::ObjectMixin
include ::ActiveSupport::Tryable
include ::ActiveSupport::ToJsonWithActiveSupportEncoder
# 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?</tt> to signal its compatibility to callers of
# <tt>acts_like?(:some_class)</tt>.
#
# For example, Active Support extends <tt>Date</tt> to define an <tt>acts_like_date?</tt> method,
# and extends <tt>Time</tt> to define <tt>acts_like_time?</tt>. As a result, developers can call
# <tt>x.acts_like?(:time)</tt> and <tt>x.acts_like?(:date)</tt> to test duck-type compatibility,
# and classes that are able to act like <tt>Time</tt> can also define an <tt>acts_like_time?</tt>
# method to interoperate.
#
# Note that the marker method is only expected to exist. It isn't called, so its body or return
# value are irrelevant.
#
# ==== Example: A class that provides the same interface as <tt>String</tt>
#
# This class may define:
#
# class Stringish
# def acts_like_string?
# end
# end
#
# Then client code can query for duck-type-safeness this way:
#
# Stringish.new.acts_like?(:string) # => true
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/object/acts_like.rb#33
def acts_like?(duck); end
# source://activesupport//lib/active_support/core_ext/object/json.rb#59
def as_json(options = T.unsafe(nil)); end
# 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?
#
# @return [true, false]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#18
def blank?; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#7
def html_safe?; end
# 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 = ["Konata", "Kagami", "Tsukasa"]
# "Konata".in?(characters) # => true
#
# For non +Range+ arguments, this will throw an +ArgumentError+ if the argument
# doesn't respond to +#include?+.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/object/inclusion.rb#15
def in?(another_object); end
# 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}
#
# source://activesupport//lib/active_support/core_ext/object/instance_variables.rb#14
def instance_values; end
# Returns an array of instance variable names as strings including "@".
#
# class C
# def initialize(x, y)
# @x, @y = x, y
# end
# end
#
# C.new(0, 1).instance_variable_names # => ["@y", "@x"]
#
# source://activesupport//lib/active_support/core_ext/object/instance_variables.rb#29
def instance_variable_names; end
# Returns the receiver if it's present otherwise returns +nil+.
# <tt>object.presence</tt> is equivalent to
#
# object.present? ? object : nil
#
# For example, something like
#
# state = params[:state] if params[:state].present?
# country = params[:country] if params[:country].present?
# region = state || country || 'US'
#
# becomes
#
# region = params[:state].presence || params[:country].presence || 'US'
#
# @return [Object]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#45
def presence; end
# Returns the receiver if it's included in the argument otherwise returns +nil+.
# Argument must be any object which responds to +#include?+. Usage:
#
# params[:bucket_type].presence_in %w( project calendar )
#
# This will throw an +ArgumentError+ if the argument doesn't respond to +#include?+.
#
# @return [Object]
#
# source://activesupport//lib/active_support/core_ext/object/inclusion.rb#34
def presence_in(another_object); end
# An object is present if it's not blank.
#
# @return [true, false]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#25
def present?; end
# Alias of <tt>to_s</tt>.
#
# source://activesupport//lib/active_support/core_ext/object/to_query.rb#7
def to_param; 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.
#
# source://activesupport//lib/active_support/core_ext/object/to_query.rb#13
def to_query(key); end
# 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 for the common begin/ensure pattern:
#
# old_value = object.attribute
# begin
# object.attribute = new_value
# # do things
# ensure
# object.attribute = old_value
# end
#
# It can be used on any object as long as both the reader and writer methods
# are public.
#
# source://activesupport//lib/active_support/core_ext/object/with.rb#26
def with(**attributes); end
end
# source://activesupport//lib/active_support/core_ext/object/json.rb#230
class Pathname
# source://activesupport//lib/active_support/core_ext/object/json.rb#231
def as_json(options = T.unsafe(nil)); end
end
module Process
extend ::ActiveSupport::ForkTracker::CoreExt
class << self
# source://activesupport//lib/active_support/fork_tracker.rb#6
def _fork; end
end
end
# source://activesupport//lib/active_support/core_ext/object/json.rb#244
class Process::Status
# source://activesupport//lib/active_support/core_ext/object/json.rb#245
def as_json(options = T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/core_ext/object/json.rb#159
class Range
include ::Enumerable
# source://activesupport//lib/active_support/core_ext/object/json.rb#160
def as_json(options = T.unsafe(nil)); end
# Optimize range sum to use arithmetic progression if a block is not given and
# we have a range of numeric values.
#
# source://activesupport//lib/active_support/core_ext/enumerable.rb#236
def sum(initial_value = T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/core_ext/object/json.rb#141
class Regexp
# source://activesupport//lib/active_support/core_ext/object/json.rb#142
def as_json(options = T.unsafe(nil)); end
end
# String inflections define new methods on the String class to transform names for different purposes.
# For instance, you can figure out the name of a table from the name of a class.
#
# 'ScaleScore'.tableize # => "scale_scores"
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#135
class String
include ::Comparable
# Enables more predictable duck-typing on String-like classes. See <tt>Object#acts_like?</tt>.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/string/behavior.rb#5
def acts_like_string?; end
# source://activesupport//lib/active_support/core_ext/object/json.rb#101
def as_json(options = T.unsafe(nil)); end
# If you pass a single integer, returns a substring of one character at that
# position. The first character of the string is at position 0, the next at
# position 1, and so on. If a range is supplied, a substring containing
# characters at offsets given by the range is returned. In both cases, if an
# offset is negative, it is counted from the end of the string. Returns +nil+
# if the initial offset falls outside the string. Returns an empty string if
# the beginning of the range is greater than the end of the string.
#
# str = "hello"
# str.at(0) # => "h"
# str.at(1..3) # => "ell"
# str.at(-2) # => "l"
# str.at(-2..-1) # => "lo"
# str.at(5) # => nil
# str.at(5..-1) # => ""
#
# If a Regexp is given, the matching portion of the string is returned.
# If a String is given, that given string is returned if it occurs in
# the string. In both cases, +nil+ is returned if there is no match.
#
# str = "hello"
# str.at(/lo/) # => "lo"
# str.at(/ol/) # => nil
# str.at("lo") # => "lo"
# str.at("ol") # => nil
#
# source://activesupport//lib/active_support/core_ext/string/access.rb#29
def at(position); end
# A string is blank if it's empty or contains whitespaces only:
#
# ''.blank? # => true
# ' '.blank? # => true
# "\t\n\r".blank? # => true
# ' blah '.blank? # => false
#
# Unicode whitespace is supported:
#
# "\u00a0".blank? # => true
#
# @return [true, false]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#153
def blank?; end
# By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize
# is set to <tt>:lower</tt> then camelize produces lowerCamelCase.
#
# +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
#
# 'active_record'.camelize # => "ActiveRecord"
# 'active_record'.camelize(:lower) # => "activeRecord"
# 'active_record/errors'.camelize # => "ActiveRecord::Errors"
# 'active_record/errors'.camelize(:lower) # => "activeRecord::Errors"
#
# See ActiveSupport::Inflector.camelize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#101
def camelcase(first_letter = T.unsafe(nil)); end
# By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize
# is set to <tt>:lower</tt> then camelize produces lowerCamelCase.
#
# +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
#
# 'active_record'.camelize # => "ActiveRecord"
# 'active_record'.camelize(:lower) # => "activeRecord"
# 'active_record/errors'.camelize # => "ActiveRecord::Errors"
# 'active_record/errors'.camelize(:lower) # => "activeRecord::Errors"
#
# See ActiveSupport::Inflector.camelize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#101
def camelize(first_letter = T.unsafe(nil)); end
# Creates a class name from a plural table name like \Rails does for table names to models.
# Note that this returns a string and not a class. (To convert to an actual class
# follow +classify+ with +constantize+.)
#
# 'ham_and_eggs'.classify # => "HamAndEgg"
# 'posts'.classify # => "Post"
#
# See ActiveSupport::Inflector.classify.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#239
def classify; end
# +constantize+ tries to find a declared constant with the name specified
# in the string. It raises a NameError when the name is not in CamelCase
# or is not initialized.
#
# 'Module'.constantize # => Module
# 'Class'.constantize # => Class
# 'blargle'.constantize # => NameError: wrong constant name blargle
#
# See ActiveSupport::Inflector.constantize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#73
def constantize; end
# Replaces underscores with dashes in the string.
#
# 'puni_puni'.dasherize # => "puni-puni"
#
# See ActiveSupport::Inflector.dasherize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#148
def dasherize; end
# Removes the rightmost segment from the constant expression in the string.
#
# 'Net::HTTP'.deconstantize # => "Net"
# '::Net::HTTP'.deconstantize # => "::Net"
# 'String'.deconstantize # => ""
# '::String'.deconstantize # => ""
# ''.deconstantize # => ""
#
# See ActiveSupport::Inflector.deconstantize.
#
# See also +demodulize+.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#177
def deconstantize; end
# Removes the module part from the constant expression in the string.
#
# 'ActiveSupport::Inflector::Inflections'.demodulize # => "Inflections"
# 'Inflections'.demodulize # => "Inflections"
# '::Inflections'.demodulize # => "Inflections"
# ''.demodulize # => ''
#
# See ActiveSupport::Inflector.demodulize.
#
# See also +deconstantize+.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#162
def demodulize; end
# Converts the first character to lowercase.
#
# 'If they enjoyed The Matrix'.downcase_first # => "if they enjoyed The Matrix"
# 'I'.downcase_first # => "i"
# ''.downcase_first # => ""
#
# See ActiveSupport::Inflector.downcase_first.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#284
def downcase_first; end
# Returns the first character. If a limit is supplied, returns a substring
# from the beginning of the string until it reaches the limit value. If the
# given limit is greater than or equal to the string length, returns a copy of self.
#
# str = "hello"
# str.first # => "h"
# str.first(1) # => "h"
# str.first(2) # => "he"
# str.first(0) # => ""
# str.first(6) # => "hello"
#
# source://activesupport//lib/active_support/core_ext/string/access.rb#78
def first(limit = T.unsafe(nil)); end
# Creates a foreign key name from a class name.
# +separate_class_name_and_id_with_underscore+ sets whether
# the method should put '_' between the name and 'id'.
#
# 'Message'.foreign_key # => "message_id"
# 'Message'.foreign_key(false) # => "messageid"
# 'Admin::Post'.foreign_key # => "post_id"
#
# See ActiveSupport::Inflector.foreign_key.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#297
def foreign_key(separate_class_name_and_id_with_underscore = T.unsafe(nil)); end
# Returns a substring from the given position to the end of the string.
# If the position is negative, it is counted from the end of the string.
#
# str = "hello"
# str.from(0) # => "hello"
# str.from(3) # => "lo"
# str.from(-2) # => "lo"
#
# You can mix it with +to+ method and do fun things like:
#
# str = "hello"
# str.from(0).to(-1) # => "hello"
# str.from(1).to(-2) # => "ell"
#
# source://activesupport//lib/active_support/core_ext/string/access.rb#46
def from(position); end
# Marks a string as trusted safe. It will be inserted into HTML with no
# additional escaping performed. It is your responsibility to ensure that the
# string contains no malicious content. This method is equivalent to the
# +raw+ helper in views. It is recommended that you use +sanitize+ instead of
# this method. It should never be called on user input.
#
# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#225
def html_safe; end
# Capitalizes the first word, turns underscores into spaces, and (by default) strips a
# trailing '_id' if present.
# Like +titleize+, this is meant for creating pretty output.
#
# The capitalization of the first word can be turned off by setting the
# optional parameter +capitalize+ to false.
# By default, this parameter is true.
#
# The trailing '_id' can be kept and capitalized by setting the
# optional parameter +keep_id_suffix+ to true.
# By default, this parameter is false.
#
# 'employee_salary'.humanize # => "Employee salary"
# 'author_id'.humanize # => "Author"
# 'author_id'.humanize(capitalize: false) # => "author"
# '_id'.humanize # => "Id"
# 'author_id'.humanize(keep_id_suffix: true) # => "Author id"
#
# See ActiveSupport::Inflector.humanize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#262
def humanize(capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end
# Returns +true+ if string has utf_8 encoding.
#
# utf_8_str = "some string".encode "UTF-8"
# iso_str = "some string".encode "ISO-8859-1"
#
# utf_8_str.is_utf8? # => true
# iso_str.is_utf8? # => false
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/string/multibyte.rb#48
def is_utf8?; end
# Returns the last character of the string. If a limit is supplied, returns a substring
# from the end of the string until it reaches the limit value (counting backwards). If
# the given limit is greater than or equal to the string length, returns a copy of self.
#
# str = "hello"
# str.last # => "o"
# str.last(1) # => "o"
# str.last(2) # => "lo"
# str.last(0) # => ""
# str.last(6) # => "hello"
#
# source://activesupport//lib/active_support/core_ext/string/access.rb#92
def last(limit = T.unsafe(nil)); end
# == Multibyte proxy
#
# +mb_chars+ is a multibyte safe proxy for string methods.
#
# It creates and returns an instance of the ActiveSupport::Multibyte::Chars class which
# encapsulates the original string. A Unicode safe version of all the String methods are defined on this proxy
# class. If the proxy class doesn't respond to a certain method, it's forwarded to the encapsulated string.
#
# >> "lj".mb_chars.upcase.to_s
# => "LJ"
#
# NOTE: Ruby 2.4 and later support native Unicode case mappings:
#
# >> "lj".upcase
# => "LJ"
#
# == \Method chaining
#
# All the methods on the Chars proxy which normally return a string will return a Chars object. This allows
# method chaining on the result of any of these methods.
#
# name.mb_chars.reverse.length # => 12
#
# == Interoperability and configuration
#
# The Chars object tries to be as interchangeable with String objects as possible: sorting and comparing between
# String and Char work like expected. The bang! methods change the internal string representation in the Chars
# object. Interoperability problems can be resolved easily with a +to_s+ call.
#
# For more information about the methods defined on the Chars proxy see ActiveSupport::Multibyte::Chars. For
# information about how to change the default Multibyte behavior see ActiveSupport::Multibyte.
#
# source://activesupport//lib/active_support/core_ext/string/multibyte.rb#37
def mb_chars; end
# Replaces special characters in a string so that it may be used as part of a 'pretty' URL.
#
# If the optional parameter +locale+ is specified,
# the word will be parameterized as a word of that language.
# By default, this parameter is set to <tt>nil</tt> and it will use
# the configured <tt>I18n.locale</tt>.
#
# class Person
# def to_param
# "#{id}-#{name.parameterize}"
# end
# end
#
# @person = Person.find(1)
# # => #<Person id: 1, name: "Donald E. Knuth">
#
# <%= link_to(@person.name, person_path) %>
# # => <a href="/person/1-donald-e-knuth">Donald E. Knuth</a>
#
# To preserve the case of the characters in a string, use the +preserve_case+ argument.
#
# class Person
# def to_param
# "#{id}-#{name.parameterize(preserve_case: true)}"
# end
# end
#
# @person = Person.find(1)
# # => #<Person id: 1, name: "Donald E. Knuth">
#
# <%= link_to(@person.name, person_path) %>
# # => <a href="/person/1-Donald-E-Knuth">Donald E. Knuth</a>
#
# See ActiveSupport::Inflector.parameterize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#215
def parameterize(separator: T.unsafe(nil), preserve_case: T.unsafe(nil), locale: T.unsafe(nil)); end
# Returns the plural form of the word in the string.
#
# If the optional parameter +count+ is specified,
# the singular form will be returned if <tt>count == 1</tt>.
# For any other value of +count+ the plural will be returned.
#
# If the optional parameter +locale+ is specified,
# the word will be pluralized as a word of that language.
# By default, this parameter is set to <tt>:en</tt>.
# You must define your own inflection rules for languages other than English.
#
# 'post'.pluralize # => "posts"
# 'octopus'.pluralize # => "octopi"
# 'sheep'.pluralize # => "sheep"
# 'words'.pluralize # => "words"
# 'the blue mailman'.pluralize # => "the blue mailmen"
# 'CamelOctopus'.pluralize # => "CamelOctopi"
# 'apple'.pluralize(1) # => "apple"
# 'apple'.pluralize(2) # => "apples"
# 'ley'.pluralize(:es) # => "leyes"
# 'ley'.pluralize(1, :es) # => "ley"
#
# See ActiveSupport::Inflector.pluralize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#35
def pluralize(count = T.unsafe(nil), locale = T.unsafe(nil)); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#165
def present?; end
# Returns a new string with all occurrences of the patterns removed.
# str = "foo bar test"
# str.remove(" test") # => "foo bar"
# str.remove(" test", /bar/) # => "foo "
# str # => "foo bar test"
#
# source://activesupport//lib/active_support/core_ext/string/filters.rb#32
def remove(*patterns); end
# Alters the string by removing all occurrences of the patterns.
# str = "foo bar test"
# str.remove!(" test", /bar/) # => "foo "
# str # => "foo "
#
# source://activesupport//lib/active_support/core_ext/string/filters.rb#40
def remove!(*patterns); end
# +safe_constantize+ tries to find a declared constant with the name specified
# in the string. It returns +nil+ when the name is not in CamelCase
# or is not initialized.
#
# 'Module'.safe_constantize # => Module
# 'Class'.safe_constantize # => Class
# 'blargle'.safe_constantize # => nil
#
# See ActiveSupport::Inflector.safe_constantize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#86
def safe_constantize; end
# The reverse of +pluralize+, returns the singular form of a word in a string.
#
# If the optional parameter +locale+ is specified,
# the word will be singularized as a word of that language.
# By default, this parameter is set to <tt>:en</tt>.
# You must define your own inflection rules for languages other than English.
#
# 'posts'.singularize # => "post"
# 'octopi'.singularize # => "octopus"
# 'sheep'.singularize # => "sheep"
# 'word'.singularize # => "word"
# 'the blue mailmen'.singularize # => "the blue mailman"
# 'CamelOctopi'.singularize # => "CamelOctopus"
# 'leyes'.singularize(:es) # => "ley"
#
# See ActiveSupport::Inflector.singularize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#60
def singularize(locale = T.unsafe(nil)); end
# Returns the string, first removing all whitespace on both ends of
# the string, and then changing remaining consecutive whitespace
# groups into one space each.
#
# Note that it handles both ASCII and Unicode whitespace.
#
# %{ Multi-line
# string }.squish # => "Multi-line string"
# " foo bar \n \t boo".squish # => "foo bar boo"
#
# source://activesupport//lib/active_support/core_ext/string/filters.rb#13
def squish; end
# Performs a destructive squish. See String#squish.
# str = " foo bar \n \t boo"
# str.squish! # => "foo bar boo"
# str # => "foo bar boo"
#
# source://activesupport//lib/active_support/core_ext/string/filters.rb#21
def squish!; end
# Creates the name of a table like \Rails does for models to table names. This method
# uses the +pluralize+ method on the last word in the string.
#
# 'RawScaledScorer'.tableize # => "raw_scaled_scorers"
# 'ham_and_egg'.tableize # => "ham_and_eggs"
# 'fancyCategory'.tableize # => "fancy_categories"
#
# See ActiveSupport::Inflector.tableize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#227
def tableize; end
# Capitalizes all the words and replaces some characters in the string to create
# a nicer looking title. +titleize+ is meant for creating pretty output. It is not
# used in the \Rails internals.
#
# The trailing '_id','Id'.. can be kept and capitalized by setting the
# optional parameter +keep_id_suffix+ to true.
# By default, this parameter is false.
#
# 'man from the boondocks'.titleize # => "Man From The Boondocks"
# 'x-men: the last stand'.titleize # => "X Men: The Last Stand"
# 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id"
#
# See ActiveSupport::Inflector.titleize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#126
def titlecase(keep_id_suffix: T.unsafe(nil)); end
# Capitalizes all the words and replaces some characters in the string to create
# a nicer looking title. +titleize+ is meant for creating pretty output. It is not
# used in the \Rails internals.
#
# The trailing '_id','Id'.. can be kept and capitalized by setting the
# optional parameter +keep_id_suffix+ to true.
# By default, this parameter is false.
#
# 'man from the boondocks'.titleize # => "Man From The Boondocks"
# 'x-men: the last stand'.titleize # => "X Men: The Last Stand"
# 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id"
#
# See ActiveSupport::Inflector.titleize.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#126
def titleize(keep_id_suffix: T.unsafe(nil)); end
# Returns a substring from the beginning of the string to the given position.
# If the position is negative, it is counted from the end of the string.
#
# str = "hello"
# str.to(0) # => "h"
# str.to(3) # => "hell"
# str.to(-2) # => "hell"
#
# You can mix it with +from+ method and do fun things like:
#
# str = "hello"
# str.from(0).to(-1) # => "hello"
# str.from(1).to(-2) # => "ell"
#
# source://activesupport//lib/active_support/core_ext/string/access.rb#63
def to(position); end
# Converts a string to a Date value.
#
# "1-1-2012".to_date # => Sun, 01 Jan 2012
# "01/01/2012".to_date # => Sun, 01 Jan 2012
# "2012-12-13".to_date # => Thu, 13 Dec 2012
# "12/13/2012".to_date # => ArgumentError: invalid date
#
# source://activesupport//lib/active_support/core_ext/string/conversions.rb#47
def to_date; end
# Converts a string to a DateTime value.
#
# "1-1-2012".to_datetime # => Sun, 01 Jan 2012 00:00:00 +0000
# "01/01/2012 23:59:59".to_datetime # => Sun, 01 Jan 2012 23:59:59 +0000
# "2012-12-13 12:50".to_datetime # => Thu, 13 Dec 2012 12:50:00 +0000
# "12/13/2012".to_datetime # => ArgumentError: invalid date
#
# source://activesupport//lib/active_support/core_ext/string/conversions.rb#57
def to_datetime; end
# Converts a string to a Time value.
# The +form+ can be either +:utc+ or +:local+ (default +:local+).
#
# The time is parsed using Time.parse method.
# If +form+ is +:local+, then the time is in the system timezone.
# If the date part is missing then the current date is used and if
# the time part is missing then it is assumed to be 00:00:00.
#
# "13-12-2012".to_time # => 2012-12-13 00:00:00 +0100
# "06:12".to_time # => 2012-12-13 06:12:00 +0100
# "2012-12-13 06:12".to_time # => 2012-12-13 06:12:00 +0100
# "2012-12-13T06:12".to_time # => 2012-12-13 06:12:00 +0100
# "2012-12-13T06:12".to_time(:utc) # => 2012-12-13 06:12:00 UTC
# "12/13/2012".to_time # => ArgumentError: argument out of range
# "1604326192".to_time # => ArgumentError: argument out of range
#
# source://activesupport//lib/active_support/core_ext/string/conversions.rb#22
def to_time(form = T.unsafe(nil)); end
# Truncates a given +text+ to length <tt>truncate_to</tt> if +text+ is longer than <tt>truncate_to</tt>:
#
# 'Once upon a time in a world far far away'.truncate(27)
# # => "Once upon a time in a wo..."
#
# Pass a string or regexp <tt>:separator</tt> to truncate +text+ at a natural break:
#
# 'Once upon a time in a world far far away'.truncate(27, separator: ' ')
# # => "Once upon a time in a..."
#
# 'Once upon a time in a world far far away'.truncate(27, separator: /\s/)
# # => "Once upon a time in a..."
#
# The last characters will be replaced with the <tt>:omission</tt> string (defaults to "...").
# The total length will not exceed <tt>truncate_to</tt> unless both +text+ and <tt>:omission</tt>
# are longer than <tt>truncate_to</tt>:
#
# 'And they found that many people were sleeping better.'.truncate(25, omission: '... (continued)')
# # => "And they f... (continued)"
#
# 'And they found that many people were sleeping better.'.truncate(4, omission: '... (continued)')
# # => "... (continued)"
#
# source://activesupport//lib/active_support/core_ext/string/filters.rb#70
def truncate(truncate_to, options = T.unsafe(nil)); end
# Truncates +text+ to at most <tt>truncate_to</tt> bytes in length without
# breaking string encoding by splitting multibyte characters or breaking
# grapheme clusters ("perceptual characters") by truncating at combining
# characters.
#
# >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".size
# => 20
# >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".bytesize
# => 80
# >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".truncate_bytes(20)
# => "🔪🔪🔪🔪…"
#
# The truncated text ends with the <tt>:omission</tt> string, defaulting
# to "…", for a total length not exceeding <tt>truncate_to</tt>.
#
# Raises +ArgumentError+ when the bytesize of <tt>:omission</tt> exceeds <tt>truncate_to</tt>.
#
# source://activesupport//lib/active_support/core_ext/string/filters.rb#101
def truncate_bytes(truncate_to, omission: T.unsafe(nil)); end
# Truncates a given +text+ after a given number of words (<tt>words_count</tt>):
#
# 'Once upon a time in a world far far away'.truncate_words(4)
# # => "Once upon a time..."
#
# Pass a string or regexp <tt>:separator</tt> to specify a different separator of words:
#
# 'Once<br>upon<br>a<br>time<br>in<br>a<br>world'.truncate_words(5, separator: '<br>')
# # => "Once<br>upon<br>a<br>time<br>in..."
#
# The last characters will be replaced with the <tt>:omission</tt> string (defaults to "..."):
#
# 'And they found that many people were sleeping better.'.truncate_words(5, omission: '... (continued)')
# # => "And they found that many... (continued)"
#
# source://activesupport//lib/active_support/core_ext/string/filters.rb#142
def truncate_words(words_count, options = T.unsafe(nil)); end
# The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
#
# +underscore+ will also change '::' to '/' to convert namespaces to paths.
#
# 'ActiveModel'.underscore # => "active_model"
# 'ActiveModel::Errors'.underscore # => "active_model/errors"
#
# See ActiveSupport::Inflector.underscore.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#139
def underscore; end
# Converts the first character to uppercase.
#
# 'what a Lovely Day'.upcase_first # => "What a Lovely Day"
# 'w'.upcase_first # => "W"
# ''.upcase_first # => ""
#
# See ActiveSupport::Inflector.upcase_first.
#
# source://activesupport//lib/active_support/core_ext/string/inflections.rb#273
def upcase_first; end
end
# source://activesupport//lib/active_support/core_ext/object/blank.rb#136
String::BLANK_RE = T.let(T.unsafe(nil), Regexp)
# source://activesupport//lib/active_support/core_ext/object/blank.rb#137
String::ENCODED_BLANKS = T.let(T.unsafe(nil), Concurrent::Map)
# source://activesupport//lib/active_support/core_ext/object/json.rb#76
class Struct
include ::Enumerable
# source://activesupport//lib/active_support/core_ext/object/json.rb#77
def as_json(options = T.unsafe(nil)); end
end
# source://activesupport//lib/active_support/core_ext/object/blank.rb#123
class Symbol
include ::Comparable
# source://activesupport//lib/active_support/core_ext/object/json.rb#107
def as_json(options = T.unsafe(nil)); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#130
def present?; end
end
class Thread
# source://activesupport//lib/active_support/isolated_execution_state.rb#9
def active_support_execution_state; end
# source://activesupport//lib/active_support/isolated_execution_state.rb#9
def active_support_execution_state=(_arg0); end
end
# source://activesupport//lib/active_support/core_ext/object/blank.rb#186
class Time
include ::Comparable
include ::DateAndTime::Zones
include ::DateAndTime::Calculations
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#285
def +(other); end
# Time#- can also be used to determine the number of seconds between two Time instances.
# We're layering on additional behavior so that ActiveSupport::TimeWithZone instances
# are coerced into values that Time#- will recognize
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#308
def -(other); end
# Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances
# can be chronologically compared with a Time
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#317
def <=>(other); end
# Duck-types as a Time-like class. See Object#acts_like?.
#
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/time/acts_like.rb#7
def acts_like_time?; end
# Uses Date to provide precise Time calculations for years, months, and days
# according to the proleptic Gregorian calendar. The +options+ parameter
# takes a hash with any of these keys: <tt>:years</tt>, <tt>:months</tt>,
# <tt>:weeks</tt>, <tt>:days</tt>, <tt>:hours</tt>, <tt>:minutes</tt>,
# <tt>:seconds</tt>.
#
# Time.new(2015, 8, 1, 14, 35, 0).advance(seconds: 1) # => 2015-08-01 14:35:01 -0700
# Time.new(2015, 8, 1, 14, 35, 0).advance(minutes: 1) # => 2015-08-01 14:36:00 -0700
# Time.new(2015, 8, 1, 14, 35, 0).advance(hours: 1) # => 2015-08-01 15:35:00 -0700
# Time.new(2015, 8, 1, 14, 35, 0).advance(days: 1) # => 2015-08-02 14:35:00 -0700
# Time.new(2015, 8, 1, 14, 35, 0).advance(weeks: 1) # => 2015-08-08 14:35:00 -0700
#
# Just like Date#advance, increments are applied in order of time units from
# largest to smallest. This order can affect the result around the end of a
# month.
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#187
def advance(options); end
# Returns a new Time representing the time a number of seconds ago, this is basically a wrapper around the Numeric extension
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#213
def ago(seconds); end
# source://activesupport//lib/active_support/core_ext/object/json.rb#195
def as_json(options = T.unsafe(nil)); end
# Returns a new Time representing the start of the day (0:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#226
def at_beginning_of_day; end
# Returns a new Time representing the start of the hour (x:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#255
def at_beginning_of_hour; end
# Returns a new Time representing the start of the minute (x:xx:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#271
def at_beginning_of_minute; end
# Returns a new Time representing the end of the day, 23:59:59.999999
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#244
def at_end_of_day; end
# Returns a new Time representing the end of the hour, x:59:59.999999
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#261
def at_end_of_hour; end
# Returns a new Time representing the end of the minute, x:xx:59.999999
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#277
def at_end_of_minute; end
# Returns a new Time representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#234
def at_midday; end
# Returns a new Time representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#234
def at_middle_of_day; end
# Returns a new Time representing the start of the day (0:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#226
def at_midnight; end
# Returns a new Time representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#234
def at_noon; end
# Returns a new Time representing the start of the day (0:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#226
def beginning_of_day; end
# Returns a new Time representing the start of the hour (x:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#255
def beginning_of_hour; end
# Returns a new Time representing the start of the minute (x:xx:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#271
def beginning_of_minute; end
# No Time is blank:
#
# Time.now.blank? # => false
#
# @return [false]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#192
def blank?; end
# Returns a new Time where one or more of the elements have been changed according
# to the +options+ parameter. The time options (<tt>:hour</tt>, <tt>:min</tt>,
# <tt>:sec</tt>, <tt>:usec</tt>, <tt>:nsec</tt>) reset cascadingly, so if only
# the hour is passed, then minute, sec, usec, and nsec is set to 0. If the hour
# and minute is passed, then sec, usec, and nsec is set to 0. The +options+ parameter
# takes a hash with any of these keys: <tt>:year</tt>, <tt>:month</tt>, <tt>:day</tt>,
# <tt>:hour</tt>, <tt>:min</tt>, <tt>:sec</tt>, <tt>:usec</tt>, <tt>:nsec</tt>,
# <tt>:offset</tt>. Pass either <tt>:usec</tt> or <tt>:nsec</tt>, not both.
#
# Time.new(2012, 8, 29, 22, 35, 0).change(day: 1) # => Time.new(2012, 8, 1, 22, 35, 0)
# Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, day: 1) # => Time.new(1981, 8, 1, 22, 35, 0)
# Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, hour: 0) # => Time.new(1981, 8, 29, 0, 0, 0)
#
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#123
def change(options); end
# Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances
# can be chronologically compared with a Time
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#317
def compare_with_coercion(other); end
# Returns a new Time representing the end of the day, 23:59:59.999999
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#244
def end_of_day; end
# Returns a new Time representing the end of the hour, x:59:59.999999
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#261
def end_of_hour; end
# Returns a new Time representing the end of the minute, x:xx:59.999999
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#277
def end_of_minute; end
# Layers additional behavior on Time#eql? so that ActiveSupport::TimeWithZone instances
# can be eql? to an equivalent Time
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#337
def eql?(other); end
# Layers additional behavior on Time#eql? so that ActiveSupport::TimeWithZone instances
# can be eql? to an equivalent Time
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#337
def eql_with_coercion(other); end
# Returns a formatted string of the offset from UTC, or an alternative
# string if the time zone is already UTC.
#
# Time.local(2000).formatted_offset # => "-06:00"
# Time.local(2000).formatted_offset(false) # => "-0600"
#
# source://activesupport//lib/active_support/core_ext/time/conversions.rb#67
def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end
# Returns a new Time representing the time a number of seconds since the instance time
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#218
def in(seconds); end
# Returns a new Time representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#234
def midday; end
# Returns a new Time representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#234
def middle_of_day; end
# Returns a new Time representing the start of the day (0:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#226
def midnight; end
# Time#- can also be used to determine the number of seconds between two Time instances.
# We're layering on additional behavior so that ActiveSupport::TimeWithZone instances
# are coerced into values that Time#- will recognize
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#308
def minus_with_coercion(other); end
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#295
def minus_with_duration(other); end
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#295
def minus_without_coercion(other); end
# Returns a new time the specified number of days in the future.
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#351
def next_day(days = T.unsafe(nil)); end
# Returns a new time the specified number of months in the future.
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#361
def next_month(months = T.unsafe(nil)); end
# Returns a new time the specified number of years in the future.
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#371
def next_year(years = T.unsafe(nil)); end
# Returns a new Time representing the middle of the day (12:00)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#234
def noon; end
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#285
def plus_with_duration(other); end
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#196
def present?; end
# Returns a new time the specified number of days ago.
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#346
def prev_day(days = T.unsafe(nil)); end
# Returns a new time the specified number of months ago.
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#356
def prev_month(months = T.unsafe(nil)); end
# Returns a new time the specified number of years ago.
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#366
def prev_year(years = T.unsafe(nil)); end
# Returns the fraction of a second as a +Rational+
#
# Time.new(2012, 8, 29, 0, 0, 0.5).sec_fraction # => (1/2)
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#107
def sec_fraction; end
# Returns the number of seconds since 00:00:00.
#
# Time.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0.0
# Time.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296.0
# Time.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399.0
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#91
def seconds_since_midnight; end
# Returns the number of seconds until 23:59:59.
#
# Time.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399
# Time.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103
# Time.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#100
def seconds_until_end_of_day; end
# Returns a new Time representing the time a number of seconds since the instance time
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#218
def since(seconds); end
# Converts to a formatted string. See DATE_FORMATS for built-in formats.
#
# This method is aliased to <tt>to_formatted_s</tt>.
#
# time = Time.now # => 2007-01-18 06:10:17 -06:00
#
# time.to_fs(:time) # => "06:10"
# time.to_formatted_s(:time) # => "06:10"
#
# time.to_fs(:db) # => "2007-01-18 06:10:17"
# time.to_fs(:number) # => "20070118061017"
# time.to_fs(:short) # => "18 Jan 06:10"
# time.to_fs(:long) # => "January 18, 2007 06:10"
# time.to_fs(:long_ordinal) # => "January 18th, 2007 06:10"
# time.to_fs(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
# time.to_fs(:iso8601) # => "2007-01-18T06:10:17-06:00"
#
# == Adding your own time formats to +to_fs+
# You can add your own formats to the Time::DATE_FORMATS hash.
# Use the format name as the hash key and either a strftime string
# or Proc instance that takes a time argument as the value.
#
# # config/initializers/time_formats.rb
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
# Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") }
#
# source://activesupport//lib/active_support/core_ext/time/conversions.rb#53
def to_formatted_s(format = T.unsafe(nil)); end
# Converts to a formatted string. See DATE_FORMATS for built-in formats.
#
# This method is aliased to <tt>to_formatted_s</tt>.
#
# time = Time.now # => 2007-01-18 06:10:17 -06:00
#
# time.to_fs(:time) # => "06:10"
# time.to_formatted_s(:time) # => "06:10"
#
# time.to_fs(:db) # => "2007-01-18 06:10:17"
# time.to_fs(:number) # => "20070118061017"
# time.to_fs(:short) # => "18 Jan 06:10"
# time.to_fs(:long) # => "January 18, 2007 06:10"
# time.to_fs(:long_ordinal) # => "January 18th, 2007 06:10"
# time.to_fs(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
# time.to_fs(:iso8601) # => "2007-01-18T06:10:17-06:00"
#
# == Adding your own time formats to +to_fs+
# You can add your own formats to the Time::DATE_FORMATS hash.
# Use the format name as the hash key and either a strftime string
# or Proc instance that takes a time argument as the value.
#
# # config/initializers/time_formats.rb
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
# Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") }
#
# source://activesupport//lib/active_support/core_ext/time/conversions.rb#53
def to_fs(format = T.unsafe(nil)); end
class << self
# Overriding case equality method so that it returns true for ActiveSupport::TimeWithZone instances
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#18
def ===(other); end
# Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime
# instances can be used when called with a single argument
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#45
def at(time_or_number, *args, **_arg2); end
# Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime
# instances can be used when called with a single argument
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#45
def at_with_coercion(time_or_number, *args, **_arg2); end
# Returns <tt>Time.zone.now</tt> when <tt>Time.zone</tt> or <tt>config.time_zone</tt> are set, otherwise just returns <tt>Time.now</tt>.
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#39
def current; end
# Returns the number of days in the given month.
# If no year is specified, it will use the current year.
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#24
def days_in_month(month, year = T.unsafe(nil)); end
# Returns the number of days in the given year.
# If no year is specified, it will use the current year.
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#34
def days_in_year(year = T.unsafe(nil)); end
# Returns a TimeZone instance matching the time zone provided.
# Accepts the time zone in any format supported by <tt>Time.zone=</tt>.
# Returns +nil+ for invalid time zones.
#
# Time.find_zone "America/New_York" # => #<ActiveSupport::TimeZone @name="America/New_York" ...>
# Time.find_zone "NOT-A-TIMEZONE" # => nil
#
# source://activesupport//lib/active_support/core_ext/time/zones.rb#93
def find_zone(time_zone); end
# Returns a TimeZone instance matching the time zone provided.
# Accepts the time zone in any format supported by <tt>Time.zone=</tt>.
# Raises an +ArgumentError+ for invalid time zones.
#
# Time.find_zone! "America/New_York" # => #<ActiveSupport::TimeZone @name="America/New_York" ...>
# Time.find_zone! "EST" # => #<ActiveSupport::TimeZone @name="EST" ...>
# Time.find_zone! -5.hours # => #<ActiveSupport::TimeZone @name="Bogota" ...>
# Time.find_zone! nil # => nil
# Time.find_zone! false # => false
# Time.find_zone! "NOT-A-TIMEZONE" # => ArgumentError: Invalid Timezone: NOT-A-TIMEZONE
#
# source://activesupport//lib/active_support/core_ext/time/zones.rb#81
def find_zone!(time_zone); end
# Creates a +Time+ instance from an RFC 3339 string.
#
# Time.rfc3339('1999-12-31T14:00:00-10:00') # => 2000-01-01 00:00:00 -1000
#
# If the time or offset components are missing then an +ArgumentError+ will be raised.
#
# Time.rfc3339('1999-12-31') # => ArgumentError: invalid date
#
# @raise [ArgumentError]
#
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#69
def rfc3339(str); end
# Allows override of <tt>Time.zone</tt> locally inside supplied block;
# resets <tt>Time.zone</tt> to existing value when done.
#
# class ApplicationController < ActionController::Base
# around_action :set_time_zone
#
# private
# def set_time_zone
# Time.use_zone(current_user.timezone) { yield }
# end
# end
#
# NOTE: This won't affect any ActiveSupport::TimeWithZone
# objects that have already been created, e.g. any model timestamp
# attributes that have been read before the block will remain in
# the application's default timezone.
#
# source://activesupport//lib/active_support/core_ext/time/zones.rb#61
def use_zone(time_zone); end
# Returns the TimeZone for the current request, if this has been set (via Time.zone=).
# If <tt>Time.zone</tt> has not been set for the current request, returns the TimeZone specified in <tt>config.time_zone</tt>.
#
# source://activesupport//lib/active_support/core_ext/time/zones.rb#14
def zone; end
# Sets <tt>Time.zone</tt> to a TimeZone object for the current request/thread.
#
# This method accepts any of the following:
#
# * A \Rails TimeZone object.
# * An identifier for a \Rails TimeZone object (e.g., "Eastern \Time (US & Canada)", <tt>-5.hours</tt>).
# * A +TZInfo::Timezone+ object.
# * An identifier for a +TZInfo::Timezone+ object (e.g., "America/New_York").
#
# Here's an example of how you might set <tt>Time.zone</tt> on a per request basis and reset it when the request is done.
# <tt>current_user.time_zone</tt> just needs to return a string identifying the user's preferred time zone:
#
# class ApplicationController < ActionController::Base
# around_action :set_time_zone
#
# def set_time_zone
# if logged_in?
# Time.use_zone(current_user.time_zone) { yield }
# else
# yield
# end
# end
# end
#
# source://activesupport//lib/active_support/core_ext/time/zones.rb#41
def zone=(time_zone); end
# Returns the value of attribute zone_default.
#
# source://activesupport//lib/active_support/core_ext/time/zones.rb#10
def zone_default; end
# Sets the attribute zone_default
#
# @param value the value to set the attribute zone_default to.
#
# source://activesupport//lib/active_support/core_ext/time/zones.rb#10
def zone_default=(_arg0); end
end
end
# source://activesupport//lib/active_support/core_ext/time/calculations.rb#14
Time::COMMON_YEAR_DAYS_IN_MONTH = T.let(T.unsafe(nil), Array)
# source://activesupport//lib/active_support/core_ext/time/conversions.rb#8
Time::DATE_FORMATS = T.let(T.unsafe(nil), Hash)
# source://activesupport//lib/active_support/core_ext/object/blank.rb#80
class TrueClass
# source://activesupport//lib/active_support/core_ext/object/json.rb#83
def as_json(options = T.unsafe(nil)); end
# +true+ is not blank:
#
# true.blank? # => false
#
# @return [false]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#86
def blank?; end
# @return [Boolean]
#
# source://activesupport//lib/active_support/core_ext/object/blank.rb#90
def present?; end
# Returns +self+.
#
# source://activesupport//lib/active_support/core_ext/object/to_query.rb#27
def to_param; end
end
# source://activesupport//lib/active_support/core_ext/object/json.rb#224
class URI::Generic
include ::URI::RFC2396_REGEXP
# source://activesupport//lib/active_support/core_ext/object/json.rb#225
def as_json(options = T.unsafe(nil)); end
end