diff --git a/Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.7.6.rbi b/Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.7.6.rbi deleted file mode 100644 index 9de6db6387..0000000000 --- a/Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.7.6.rbi +++ /dev/null @@ -1,18163 +0,0 @@ -# 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`. - -# source://activesupport//lib/active_support/lazy_load_hooks.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#89 - def test_order; end - - # source://activesupport//lib/active_support.rb#89 - def test_order=(val); end - - class << self - # source://activesupport//lib/active_support.rb#83 - def eager_load!; 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 version of the currently loaded 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#89 - def test_order; end - - # source://activesupport//lib/active_support.rb#89 - def test_order=(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#91 - def to_time_preserves_timezone; end - - # source://activesupport//lib/active_support.rb#95 - 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#99 - def utc_to_local_returns_utc_offset_times; end - - # source://activesupport//lib/active_support.rb#103 - def utc_to_local_returns_utc_offset_times=(value); end - - # Returns the version of the currently loaded ActiveSupport as a Gem::Version - # - # source://activesupport//lib/active_support/version.rb#7 - def version; end - end -end - -# Actionable errors let's 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#9 -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#18 - def actions(error); end - - # source://activesupport//lib/active_support/actionable_error.rb#27 - 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#33 -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#43 - def action(name, &block); end -end - -# source://activesupport//lib/active_support/actionable_error.rb#12 -class ActiveSupport::ActionableError::NonActionable < ::StandardError; end - -# 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#26 -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, *args); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/array_inquirer.rb#38 - def respond_to_missing?(name, include_private = T.unsafe(nil)); end -end - -# 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#27 -module ActiveSupport::Autoload - # source://activesupport//lib/active_support/dependencies/autoload.rb#37 - def autoload(const_name, path = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/dependencies/autoload.rb#57 - def autoload_at(path); end - - # source://activesupport//lib/active_support/dependencies/autoload.rb#50 - def autoload_under(path); end - - # source://activesupport//lib/active_support/dependencies/autoload.rb#75 - def autoloads; end - - # source://activesupport//lib/active_support/dependencies/autoload.rb#64 - def eager_autoload; end - - # source://activesupport//lib/active_support/dependencies/autoload.rb#71 - def eager_load!; end - - class << self - # source://activesupport//lib/active_support/dependencies/autoload.rb#28 - def extended(base); end - end -end - -# 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 -# bc.add_filter { |line| line.gsub(Rails.root.to_s, '') } # 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#31 -class ActiveSupport::BacktraceCleaner - # @return [BacktraceCleaner] a new instance of BacktraceCleaner - # - # source://activesupport//lib/active_support/backtrace_cleaner.rb#32 - 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" - # backtrace_cleaner.add_filter { |line| line.gsub(Rails.root, '') } - # - # source://activesupport//lib/active_support/backtrace_cleaner.rb#60 - 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#69 - 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#41 - def clean(backtrace, 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#41 - 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#83 - 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#76 - def remove_silencers!; end - - private - - # source://activesupport//lib/active_support/backtrace_cleaner.rb#90 - def add_gem_filter; end - - # source://activesupport//lib/active_support/backtrace_cleaner.rb#99 - def add_gem_silencer; end - - # source://activesupport//lib/active_support/backtrace_cleaner.rb#103 - def add_stdlib_silencer; end - - # source://activesupport//lib/active_support/backtrace_cleaner.rb#107 - def filter_backtrace(backtrace); end - - # source://activesupport//lib/active_support/backtrace_cleaner.rb#123 - def noise(backtrace); end - - # source://activesupport//lib/active_support/backtrace_cleaner.rb#115 - def silence(backtrace); end -end - -# source://activesupport//lib/active_support/backtrace_cleaner.rb#88 -ActiveSupport::BacktraceCleaner::FORMATTED_GEMS_PATTERN = T.let(T.unsafe(nil), Regexp) - -# source://activesupport//lib/active_support/benchmarkable.rb#7 -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 (:debug, :info, - # :warn, :error) as the :level option. The - # default logger level value is :info. - # - # <% 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#37 - def benchmark(message = T.unsafe(nil), options = T.unsafe(nil)); 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 - -# See ActiveSupport::Cache::Store for documentation. -# -# source://activesupport//lib/active_support/cache.rb#16 -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#89 - def expand_cache_key(key, namespace = T.unsafe(nil)); 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#57 - def lookup_store(store = T.unsafe(nil), *parameters); end - - private - - # source://activesupport//lib/active_support/cache.rb#101 - 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#113 - def retrieve_store_class(store); end - end -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.rb#779 -class ActiveSupport::Cache::Entry - # Creates a new cache entry for the specified value. Options supported are - # +:compress+, +:compress_threshold+, +:version+ and +:expires_in+. - # - # @return [Entry] a new instance of Entry - # - # source://activesupport//lib/active_support/cache.rb#786 - def initialize(value, compress: T.unsafe(nil), compress_threshold: T.unsafe(nil), version: T.unsafe(nil), expires_in: T.unsafe(nil), **_arg5); end - - # Returns the size of the cached value. This could be less than - # value.bytesize if the data is compressed. - # - # source://activesupport//lib/active_support/cache.rb#823 - def bytesize; 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.rb#836 - 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.rb#805 - def expired?; end - - # source://activesupport//lib/active_support/cache.rb#809 - def expires_at; end - - # source://activesupport//lib/active_support/cache.rb#813 - def expires_at=(value); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/cache.rb#799 - def mismatched?(version); end - - # source://activesupport//lib/active_support/cache.rb#795 - def value; end - - # source://activesupport//lib/active_support/cache.rb#780 - def version; end - - private - - # source://activesupport//lib/active_support/cache.rb#847 - def compress!(compress_threshold); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/cache.rb#869 - def compressed?; end - - # source://activesupport//lib/active_support/cache.rb#873 - def uncompress(value); end -end - -# source://activesupport//lib/active_support/cache.rb#782 -ActiveSupport::Cache::Entry::DEFAULT_COMPRESS_LIMIT = T.let(T.unsafe(nil), Integer) - -# A cache store implementation which stores everything on the filesystem. -# -# FileStore implements the Strategy::LocalCache strategy which implements -# an in-memory cache inside of a block. -# -# source://activesupport//lib/active_support/cache/file_store.rb#14 -class ActiveSupport::Cache::FileStore < ::ActiveSupport::Cache::Store - include ::ActiveSupport::Cache::Strategy::LocalCache - - # @return [FileStore] a new instance of FileStore - # - # source://activesupport//lib/active_support/cache/file_store.rb#23 - def initialize(cache_path, **options); end - - # Returns the value of attribute cache_path. - # - # source://activesupport//lib/active_support/cache/file_store.rb#16 - def cache_path; end - - # Preemptively iterates through all stored keys and removes the ones which have expired. - # - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#104 - def cleanup(**options); 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/strategy/local_cache.rb#98 - def clear(**options); end - - # Decrements an already existing integer value that is stored in the cache. - # If the key is not found nothing is done. - # - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#123 - def decrement(name, amount = T.unsafe(nil), **options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#110 - def delete_matched(matcher, options = T.unsafe(nil)); end - - # Increments an already existing integer value that is stored in the cache. - # If the key is not found nothing is done. - # - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#116 - def increment(name, amount = T.unsafe(nil), **options); end - - private - - # Delete empty directories in the cache. - # - # source://activesupport//lib/active_support/cache/file_store.rb#154 - def delete_empty_directories(dir); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#168 - def delete_entry(key, **options); end - - # Make sure a file path's directories exist. - # - # source://activesupport//lib/active_support/cache/file_store.rb#163 - def ensure_cache_path(path); end - - # Translate a file path into a key. - # - # source://activesupport//lib/active_support/cache/file_store.rb#148 - 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#107 - def lock_file(file_name, &block); end - - # Modifies the amount of an already existing integer value that is stored in the cache. - # If the key is not found nothing is done. - # - # source://activesupport//lib/active_support/cache/file_store.rb#181 - def modify_value(name, amount, options); end - - # Translate a key into a file path. - # - # source://activesupport//lib/active_support/cache/file_store.rb#121 - def normalize_key(key, options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#131 - def read_entry(key, **options); end - - # source://activesupport//lib/active_support/cache/file_store.rb#167 - def search_dir(dir, &callback); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#158 - def write_entry(key, entry, **options); end - - class << self - # Advertise cache versioning support. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/cache/file_store.rb#29 - def supports_cache_versioning?; end - end -end - -# source://activesupport//lib/active_support/cache/file_store.rb#18 -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#19 -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#20 -ActiveSupport::Cache::FileStore::FILEPATH_MAX_SIZE = T.let(T.unsafe(nil), Integer) - -# source://activesupport//lib/active_support/cache/file_store.rb#21 -ActiveSupport::Cache::FileStore::GITKEEP_FILES = T.let(T.unsafe(nil), Array) - -# 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#26 -class ActiveSupport::Cache::MemoryStore < ::ActiveSupport::Cache::Store - # @return [MemoryStore] a new instance of MemoryStore - # - # source://activesupport//lib/active_support/cache/memory_store.rb#44 - 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#71 - 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#63 - def clear(options = T.unsafe(nil)); end - - # Decrement an integer value in the cache. - # - # source://activesupport//lib/active_support/cache/memory_store.rb#113 - 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#118 - def delete_matched(matcher, options = T.unsafe(nil)); end - - # Increment an integer value in the cache. - # - # source://activesupport//lib/active_support/cache/memory_store.rb#108 - def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/cache/memory_store.rb#129 - 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#84 - 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#103 - 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#135 - def synchronize(&block); end - - private - - # source://activesupport//lib/active_support/cache/memory_store.rb#142 - def cached_size(key, payload); end - - # source://activesupport//lib/active_support/cache/memory_store.rb#175 - def delete_entry(key, **options); end - - # source://activesupport//lib/active_support/cache/memory_store.rb#183 - def modify_value(name, amount, options); end - - # source://activesupport//lib/active_support/cache/memory_store.rb#146 - def read_entry(key, **options); end - - # source://activesupport//lib/active_support/cache/memory_store.rb#158 - def write_entry(key, entry, **options); end - - class << self - # Advertise cache versioning support. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/cache/memory_store.rb#58 - def supports_cache_versioning?; end - end -end - -# source://activesupport//lib/active_support/cache/memory_store.rb#42 -ActiveSupport::Cache::MemoryStore::DEFAULT_CODER = ActiveSupport::Cache::MemoryStore::DupCoder - -# source://activesupport//lib/active_support/cache/memory_store.rb#27 -module ActiveSupport::Cache::MemoryStore::DupCoder - class << self - # source://activesupport//lib/active_support/cache/memory_store.rb#35 - def dump(entry); end - - # source://activesupport//lib/active_support/cache/memory_store.rb#29 - def load(entry); end - end -end - -# source://activesupport//lib/active_support/cache/memory_store.rb#140 -ActiveSupport::Cache::MemoryStore::PER_ENTRY_OVERHEAD = T.let(T.unsafe(nil), Integer) - -# source://activesupport//lib/active_support/cache.rb#760 -module ActiveSupport::Cache::NullCoder - class << self - # source://activesupport//lib/active_support/cache.rb#766 - def dump(entry); end - - # source://activesupport//lib/active_support/cache.rb#762 - def load(payload); end - end -end - -# 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#12 -class ActiveSupport::Cache::NullStore < ::ActiveSupport::Cache::Store - include ::ActiveSupport::Cache::Strategy::LocalCache - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#104 - def cleanup(**options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#98 - def clear(**options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#123 - def decrement(name, amount = T.unsafe(nil), **options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#110 - def delete_matched(matcher, options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#116 - def increment(name, amount = T.unsafe(nil), **options); end - - private - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#168 - def delete_entry(key, **options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#131 - def read_entry(key, **options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#158 - def write_entry(key, entry, **options); end - - class << self - # Advertise cache versioning support. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/cache/null_store.rb#16 - def supports_cache_versioning?; end - end -end - -# 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 serializable Ruby object. -# -# cache = ActiveSupport::Cache::MemoryStore.new -# -# cache.read('city') # => nil -# cache.write('city', "Duckburgh") -# cache.read('city') # => "Duckburgh" -# -# 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 -# -# Cached data larger than 1kB are compressed by default. To turn off -# compression, pass compress: false to the initializer or to -# individual +fetch+ or +write+ method calls. The 1kB compression -# threshold is configurable with the :compress_threshold option, -# specified in bytes. -# -# source://activesupport//lib/active_support/cache.rb#166 -class ActiveSupport::Cache::Store - # Creates a new cache. The options will be passed to any write method calls - # except for :namespace which can be used to set the global - # namespace for the cache. - # - # @return [Store] a new instance of Store - # - # source://activesupport//lib/active_support/cache.rb#194 - def initialize(options = T.unsafe(nil)); end - - # Cleanups 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#547 - 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#557 - 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#538 - 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. - # - # Options are passed to the underlying cache implementation. - # - # source://activesupport//lib/active_support/cache.rb#483 - 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#520 - def delete_matched(matcher, options = T.unsafe(nil)); end - - # Deletes multiple entries in the cache. - # - # Options are passed to the underlying cache implementation. - # - # source://activesupport//lib/active_support/cache.rb#494 - 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#506 - 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" - # - # You may also specify additional options via the +options+ argument. - # Setting force: true 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 Cache#write. - # - # Setting skip_nil: true will not cache nil result: - # - # cache.fetch('foo') { nil } - # cache.fetch('bar', skip_nil: true) { nil } - # cache.exist?('foo') # => true - # cache.exist?('bar') # => false - # - # - # Setting compress: false disables compression of the cache entry. - # - # Setting :expires_in will set an expiration time on the cache. - # All caches support auto-expiring content after a specified number of - # seconds. This value can be specified as an option to the constructor - # (in which case all entries will be affected), or it can be supplied to - # the +fetch+ or +write+ method to effect just one entry. - # - # cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 5.minutes) - # cache.write(key, value, expires_in: 1.minute) # Set a lower value for one entry - # - # Setting :version verifies the cache stored under name - # is of the same version. nil is returned on mismatches despite contents. - # This feature is used to support recyclable cache keys. - # - # Setting :race_condition_ttl is very useful in situations where - # a cache entry is used very frequently and is under heavy load. If a - # cache expires and due to heavy load several different processes will try - # to read data natively and then they all will try to write to cache. To - # avoid that case the first process to find an expired cache entry will - # bump the cache expiration time by the value set in :race_condition_ttl. - # Yes, this process is extending the time for a stale value by another few - # seconds. Because of extended life of the previous cache, other processes - # will continue to use slightly stale data for a just a bit longer. In the - # meantime that first process will go ahead and will write into cache the - # new value. After that all the processes will start getting the new value. - # The key is to keep :race_condition_ttl small. - # - # If the process regenerating the entry errors out, the entry will be - # regenerated after the specified number of seconds. Also note that the - # life of stale cache is extended only if it expired recently. Otherwise - # a new value is generated and :race_condition_ttl does not play - # any role. - # - # # Set all values to expire after one minute. - # cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 1.minute) - # - # cache.write('foo', 'original value') - # val_1 = nil - # val_2 = nil - # sleep 60 - # - # Thread.new do - # val_1 = cache.fetch('foo', race_condition_ttl: 10.seconds) do - # sleep 1 - # 'new value 1' - # end - # end - # - # Thread.new do - # val_2 = cache.fetch('foo', race_condition_ttl: 10.seconds) do - # 'new value 2' - # end - # end - # - # cache.fetch('foo') # => "original value" - # sleep 10 # First thread extended the life of cache by another 10 seconds - # cache.fetch('foo') # => "new value 1" - # val_1 # => "new value 1" - # val_2 # => "original value" - # - # Other options will be handled by the specific cache store implementation. - # Internally, #fetch calls #read_entry, and calls #write_entry on a cache - # miss. +options+ will be passed to the #read and #write calls. - # - # For example, MemCacheStore's #write method supports the +:raw+ - # option, which tells the memcached server to store all values as strings. - # We can use this option with #fetch too: - # - # cache = ActiveSupport::Cache::MemCacheStore.new - # cache.fetch("foo", force: true, raw: true) do - # :bar - # end - # cache.fetch('foo') # => "bar" - # - # source://activesupport//lib/active_support/cache.rb#326 - 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" } - # - # 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#446 - 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#529 - def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/cache.rb#169 - def logger; end - - # source://activesupport//lib/active_support/cache.rb#169 - def logger=(val); end - - # Silences the logger within a block. - # - # source://activesupport//lib/active_support/cache.rb#206 - def mute; end - - # Returns the value of attribute options. - # - # source://activesupport//lib/active_support/cache.rb#171 - def options; 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 :expires_in or - # :version options, both of these conditions are applied before - # the data is returned. - # - # Options are passed to the underlying cache implementation. - # - # source://activesupport//lib/active_support/cache.rb#361 - 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#394 - def read_multi(*names); end - - # Returns the value of attribute silence. - # - # source://activesupport//lib/active_support/cache.rb#171 - def silence; end - - # Silences the logger. - # - # source://activesupport//lib/active_support/cache.rb#200 - def silence!; end - - # Returns the value of attribute silence. - # - # source://activesupport//lib/active_support/cache.rb#171 - def silence?; end - - # Writes the value to the cache, with the key. - # - # Options are passed to the underlying cache implementation. - # - # source://activesupport//lib/active_support/cache.rb#471 - 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#406 - def write_multi(hash, options = T.unsafe(nil)); end - - private - - # Deletes an entry from the cache implementation. Subclasses must - # implement this method. - # - # @raise [NotImplementedError] - # - # source://activesupport//lib/active_support/cache.rb#630 - 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#636 - def delete_multi_entries(entries, **options); end - - # source://activesupport//lib/active_support/cache.rb#597 - def deserialize_entry(payload); 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#690 - def expanded_key(key); end - - # source://activesupport//lib/active_support/cache.rb#711 - def expanded_version(key); end - - # source://activesupport//lib/active_support/cache.rb#745 - def get_entry_value(entry, name, options); end - - # source://activesupport//lib/active_support/cache.rb#729 - def handle_expired_entry(entry, key, options); end - - # source://activesupport//lib/active_support/cache.rb#719 - def instrument(operation, key, options = T.unsafe(nil)); 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#566 - def key_matcher(pattern, options); end - - # Merges the default options with ones specific to a method call. - # - # source://activesupport//lib/active_support/cache.rb#641 - 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#668 - def namespace_key(key, options = T.unsafe(nil)); end - - # Expands and namespaces the cache key. May be overridden by - # cache stores to do additional normalization. - # - # source://activesupport//lib/active_support/cache.rb#655 - def normalize_key(key, options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/cache.rb#707 - 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#583 - 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#603 - def read_multi_entries(names, **options); end - - # source://activesupport//lib/active_support/cache.rb#750 - def save_block_result_to_cache(name, options); end - - # source://activesupport//lib/active_support/cache.rb#593 - def serialize_entry(entry); end - - # Writes an entry to the cache implementation. Subclasses must implement - # this method. - # - # @raise [NotImplementedError] - # - # source://activesupport//lib/active_support/cache.rb#589 - 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#622 - def write_multi_entries(hash, **options); end - - class << self - # source://activesupport//lib/active_support/cache.rb#169 - def logger; end - - # source://activesupport//lib/active_support/cache.rb#169 - def logger=(val); end - - private - - # source://activesupport//lib/active_support/cache.rb#183 - def ensure_connection_pool_added!; end - - # source://activesupport//lib/active_support/cache.rb#176 - def retrieve_pool_options(options); end - end -end - -# source://activesupport//lib/active_support/cache.rb#167 -ActiveSupport::Cache::Store::DEFAULT_CODER = Marshal - -# source://activesupport//lib/active_support/cache.rb#27 -module ActiveSupport::Cache::Strategy; end - -# 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#12 -module ActiveSupport::Cache::Strategy::LocalCache - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#104 - def cleanup(**options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#98 - def clear(**options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#123 - def decrement(name, amount = T.unsafe(nil), **options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#110 - def delete_matched(matcher, options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#116 - def increment(name, amount = T.unsafe(nil), **options); 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#92 - def middleware; end - - # Use a local cache for the duration of block. - # - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#86 - def with_local_cache; end - - private - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#193 - def bypass_local_cache; end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#168 - def delete_entry(key, **options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#189 - def local_cache; end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#185 - def local_cache_key; end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#131 - def read_entry(key, **options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#145 - def read_multi_entries(keys, **options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#197 - def use_temporary_local_cache(temporary_cache); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#173 - def write_cache_value(name, value, **options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#158 - def write_entry(key, entry, **options); end -end - -# Class for storing and registering the local caches. -# -# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#16 -class ActiveSupport::Cache::Strategy::LocalCache::LocalCacheRegistry - extend ::ActiveSupport::PerThreadRegistry - - # @return [LocalCacheRegistry] a new instance of LocalCacheRegistry - # - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#19 - def initialize; end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#23 - def cache_for(local_cache_key); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#27 - def set_cache_for(local_cache_key, value); end - - class << self - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#32 - def cache_for(l); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#31 - def set_cache_for(l, v); end - end -end - -# 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#37 -class ActiveSupport::Cache::Strategy::LocalCache::LocalStore < ::ActiveSupport::Cache::Store - # @return [LocalStore] a new instance of LocalStore - # - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#38 - def initialize; end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#48 - def clear(options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#73 - def delete_entry(key, **options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#77 - def fetch_entry(key, options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#52 - def read_entry(key, **options); end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#56 - def read_multi_entries(keys, **options); end - - # Don't allow synchronizing since it isn't thread safe. - # - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#44 - def synchronize; end - - # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#67 - def write_entry(key, entry, **options); 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#25 -ActiveSupport::Cache::UNIVERSAL_OPTIONS = T.let(T.unsafe(nil), Array) - -# 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#30 -class ActiveSupport::CachingKeyGenerator - # @return [CachingKeyGenerator] a new instance of CachingKeyGenerator - # - # source://activesupport//lib/active_support/key_generator.rb#31 - def initialize(key_generator); end - - # Returns a derived key suitable for use. - # - # source://activesupport//lib/active_support/key_generator.rb#37 - def generate_key(*args); end -end - -# 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#62 -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#94 - def run_callbacks(kind); 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#146 - 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#70 -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#387 -class ActiveSupport::Callbacks::CallTemplate - # @return [CallTemplate] a new instance of CallTemplate - # - # source://activesupport//lib/active_support/callbacks.rb#388 - def initialize(target, method, arguments, block); 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#408 - def expand(target, value, block); end - - # Return a lambda that will make this call when given the input - # values, but then return the boolean inverse of that result. - # - # source://activesupport//lib/active_support/callbacks.rb#433 - def inverted_lambda; end - - # Return a lambda that will make this call when given the input - # values. - # - # source://activesupport//lib/active_support/callbacks.rb#424 - def make_lambda; end - - class << self - # Filters support: - # - # Symbols:: A method to call. - # Procs:: A proc to call with the object. - # Objects:: An object with a before_foo 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#448 - def build(filter, callback); end - end -end - -# source://activesupport//lib/active_support/callbacks.rb#279 -class ActiveSupport::Callbacks::Callback - # @return [Callback] a new instance of Callback - # - # source://activesupport//lib/active_support/callbacks.rb#294 - def initialize(name, filter, kind, options, chain_config); end - - # Wraps code with filter - # - # source://activesupport//lib/active_support/callbacks.rb#333 - def apply(callback_sequence); end - - # Returns the value of attribute chain_config. - # - # source://activesupport//lib/active_support/callbacks.rb#292 - def chain_config; end - - # source://activesupport//lib/active_support/callbacks.rb#347 - def current_scopes; end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/callbacks.rb#323 - def duplicates?(other); end - - # source://activesupport//lib/active_support/callbacks.rb#304 - def filter; end - - # Returns the value of attribute kind. - # - # source://activesupport//lib/active_support/callbacks.rb#291 - def kind; end - - # Sets the attribute kind - # - # @param value the value to set the attribute kind to. - # - # source://activesupport//lib/active_support/callbacks.rb#291 - def kind=(_arg0); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/callbacks.rb#319 - def matches?(_kind, _filter); end - - # source://activesupport//lib/active_support/callbacks.rb#307 - def merge_conditional_options(chain, if_option:, unless_option:); end - - # Returns the value of attribute name. - # - # source://activesupport//lib/active_support/callbacks.rb#291 - def name; end - - # Sets the attribute name - # - # @param value the value to set the attribute name to. - # - # source://activesupport//lib/active_support/callbacks.rb#291 - def name=(_arg0); end - - # source://activesupport//lib/active_support/callbacks.rb#305 - def raw_filter; end - - private - - # source://activesupport//lib/active_support/callbacks.rb#355 - def check_conditionals(conditionals); end - - # source://activesupport//lib/active_support/callbacks.rb#370 - def compute_identifier(filter); end - - # source://activesupport//lib/active_support/callbacks.rb#379 - def conditions_lambdas; end - - class << self - # source://activesupport//lib/active_support/callbacks.rb#280 - def build(chain, filter, kind, options); end - end -end - -# source://activesupport//lib/active_support/callbacks.rb#352 -ActiveSupport::Callbacks::Callback::EMPTY_ARRAY = T.let(T.unsafe(nil), Array) - -# source://activesupport//lib/active_support/callbacks.rb#520 -class ActiveSupport::Callbacks::CallbackChain - include ::Enumerable - - # @return [CallbackChain] a new instance of CallbackChain - # - # source://activesupport//lib/active_support/callbacks.rb#525 - def initialize(name, config); end - - # source://activesupport//lib/active_support/callbacks.rb#571 - def append(*callbacks); end - - # source://activesupport//lib/active_support/callbacks.rb#550 - def clear; end - - # source://activesupport//lib/active_support/callbacks.rb#562 - def compile; end - - # Returns the value of attribute config. - # - # source://activesupport//lib/active_support/callbacks.rb#523 - def config; end - - # source://activesupport//lib/active_support/callbacks.rb#545 - def delete(o); end - - # source://activesupport//lib/active_support/callbacks.rb#536 - def each(&block); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/callbacks.rb#538 - def empty?; end - - # source://activesupport//lib/active_support/callbacks.rb#537 - def index(o); end - - # source://activesupport//lib/active_support/callbacks.rb#540 - def insert(index, o); end - - # Returns the value of attribute name. - # - # source://activesupport//lib/active_support/callbacks.rb#523 - def name; end - - # source://activesupport//lib/active_support/callbacks.rb#575 - def prepend(*callbacks); end - - protected - - # Returns the value of attribute chain. - # - # source://activesupport//lib/active_support/callbacks.rb#580 - def chain; end - - private - - # source://activesupport//lib/active_support/callbacks.rb#583 - def append_one(callback); end - - # source://activesupport//lib/active_support/callbacks.rb#600 - def default_terminator; end - - # source://activesupport//lib/active_support/callbacks.rb#556 - def initialize_copy(other); end - - # source://activesupport//lib/active_support/callbacks.rb#589 - def prepend_one(callback); end - - # source://activesupport//lib/active_support/callbacks.rb#595 - 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#473 -class ActiveSupport::Callbacks::CallbackSequence - # @return [CallbackSequence] a new instance of CallbackSequence - # - # source://activesupport//lib/active_support/callbacks.rb#474 - def initialize(nested = T.unsafe(nil), call_template = T.unsafe(nil), user_conditions = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/callbacks.rb#488 - def after(&after); end - - # source://activesupport//lib/active_support/callbacks.rb#493 - def around(call_template, user_conditions); end - - # source://activesupport//lib/active_support/callbacks.rb#483 - def before(&before); end - - # source://activesupport//lib/active_support/callbacks.rb#507 - def expand_call_template(arg, block); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/callbacks.rb#503 - def final?; end - - # source://activesupport//lib/active_support/callbacks.rb#515 - def invoke_after(arg); end - - # source://activesupport//lib/active_support/callbacks.rb#511 - def invoke_before(arg); end - - # Returns the value of attribute nested. - # - # source://activesupport//lib/active_support/callbacks.rb#501 - def nested; end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/callbacks.rb#497 - def skip?(arg); end -end - -# source://activesupport//lib/active_support/callbacks.rb#612 -module ActiveSupport::Callbacks::ClassMethods - # This is used internally to append, prepend and skip callbacks to the - # CallbackChain. - # - # source://activesupport//lib/active_support/callbacks.rb#622 - 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 - # - # * :terminator - 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+. - # - # * :skip_after_callbacks_if_terminated - Determines if after - # callbacks should be terminated by the :terminator option. By - # default after callbacks are executed no matter if callback chain was - # terminated or not. This option has no effect if :terminator - # option is set to +nil+. - # - # * :scope - 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 - # Audit#before will be called. On the other hand - # - # define_callbacks :save, scope: [:kind, :name] - # - # would trigger Audit#before_save instead. That's constructed - # by calling #{kind}_#{name} 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 Audit#save. - # - # ===== Notes - # - # +names+ passed to +define_callbacks+ must not end with - # !, ? or =. - # - # Calling +define_callbacks+ multiple times with the same +names+ will - # overwrite previous callbacks registered with +set_callback+. - # - # source://activesupport//lib/active_support/callbacks.rb#812 - def define_callbacks(*names); end - - # source://activesupport//lib/active_support/callbacks.rb#613 - def normalize_callback_params(filters, block); end - - # Remove all set callbacks for the given event. - # - # source://activesupport//lib/active_support/callbacks.rb#722 - 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 :scope 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 - # - # * :if - 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. - # * :unless - 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. - # * :prepend - If +true+, the callback will be prepended to the - # existing chain rather than appended. - # - # source://activesupport//lib/active_support/callbacks.rb#673 - def set_callback(name, *filter_list, &block); end - - # Skip a previously set callback. Like +set_callback+, :if or - # :unless options may be passed in order to control when the - # callback is skipped. - # - # class Writer < Person - # skip_callback :validate, :before, :check_membership, if: -> { age > 18 } - # end - # - # An ArgumentError will be raised if the callback has not - # already been set (unless the :raise option is set to false). - # - # source://activesupport//lib/active_support/callbacks.rb#697 - def skip_callback(name, *filter_list, &block); end - - protected - - # source://activesupport//lib/active_support/callbacks.rb#843 - def get_callbacks(name); end - - # Ruby 2.6 and newer - # - # source://activesupport//lib/active_support/callbacks.rb#852 - def set_callbacks(name, callbacks); end -end - -# source://activesupport//lib/active_support/callbacks.rb#149 -module ActiveSupport::Callbacks::Conditionals; end - -# source://activesupport//lib/active_support/callbacks.rb#150 -class ActiveSupport::Callbacks::Conditionals::Value - # @return [Value] a new instance of Value - # - # source://activesupport//lib/active_support/callbacks.rb#151 - def initialize(&block); end - - # source://activesupport//lib/active_support/callbacks.rb#154 - def call(target, value); end -end - -# source://activesupport//lib/active_support/callbacks.rb#158 -module ActiveSupport::Callbacks::Filters; end - -# source://activesupport//lib/active_support/callbacks.rb#211 -class ActiveSupport::Callbacks::Filters::After - class << self - # source://activesupport//lib/active_support/callbacks.rb#212 - def build(callback_sequence, user_callback, user_conditions, chain_config); end - - private - - # source://activesupport//lib/active_support/callbacks.rb#254 - def conditional(callback_sequence, user_callback, user_conditions); end - - # source://activesupport//lib/active_support/callbacks.rb#243 - def halting(callback_sequence, user_callback); end - - # source://activesupport//lib/active_support/callbacks.rb#228 - def halting_and_conditional(callback_sequence, user_callback, user_conditions); end - - # source://activesupport//lib/active_support/callbacks.rb#268 - def simple(callback_sequence, user_callback); end - end -end - -# source://activesupport//lib/active_support/callbacks.rb#161 -class ActiveSupport::Callbacks::Filters::Before - class << self - # source://activesupport//lib/active_support/callbacks.rb#162 - def build(callback_sequence, user_callback, user_conditions, chain_config, filter, name); end - - private - - # source://activesupport//lib/active_support/callbacks.rb#191 - def halting(callback_sequence, user_callback, halted_lambda, filter, name); end - - # source://activesupport//lib/active_support/callbacks.rb#172 - def halting_and_conditional(callback_sequence, user_callback, user_conditions, halted_lambda, filter, name); end - end -end - -# source://activesupport//lib/active_support/callbacks.rb#159 -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/core_ext/range/compare_range.rb#4 -module ActiveSupport::CompareWithRange - # Extends the default Range#=== to support range comparisons. - # (1..5) === (1..5) # => true - # (1..5) === (2..3) # => true - # (1..5) === (1...6) # => true - # (1..5) === (2..6) # => false - # - # The native Range#=== behavior is untouched. - # ('a'..'f') === ('c') # => true - # (5..9) === (11) # => false - # - # The given range must be fully bounded, with both start and end. - # - # source://activesupport//lib/active_support/core_ext/range/compare_range.rb#16 - def ===(value); end - - # Extends the default Range#cover? to support range comparisons. - # (1..5).cover?(1..5) # => true - # (1..5).cover?(2..3) # => true - # (1..5).cover?(1...6) # => true - # (1..5).cover?(2..6) # => false - # - # The native Range#cover? behavior is untouched. - # ('a'..'f').cover?('c') # => true - # (5..9).cover?(11) # => false - # - # The given range must be fully bounded, with both start and end. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/range/compare_range.rb#66 - def cover?(value); end - - # Extends the default Range#include? to support range comparisons. - # (1..5).include?(1..5) # => true - # (1..5).include?(2..3) # => true - # (1..5).include?(1...6) # => true - # (1..5).include?(2..6) # => false - # - # The native Range#include? behavior is untouched. - # ('a'..'f').include?('c') # => true - # (5..9).include?(11) # => false - # - # The given range must be fully bounded, with both start and end. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/range/compare_range.rb#41 - def include?(value); end -end - -# 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 base -# 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 include, concerns also support prepend with a corresponding -# prepended do callback. module ClassMethods or class_methods do are -# prepended as well. -# -# prepend is also used for any dependencies. -# -# source://activesupport//lib/active_support/concern.rb#110 -module ActiveSupport::Concern - # source://activesupport//lib/active_support/concern.rb#127 - 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#207 - 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#156 - def included(base = T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/concern.rb#140 - 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#173 - def prepended(base = T.unsafe(nil), &block); end - - class << self - # source://activesupport//lib/active_support/concern.rb#123 - def extended(base); end - end -end - -# source://activesupport//lib/active_support/concern.rb#111 -class ActiveSupport::Concern::MultipleIncludedBlocks < ::StandardError - # @return [MultipleIncludedBlocks] a new instance of MultipleIncludedBlocks - # - # source://activesupport//lib/active_support/concern.rb#112 - def initialize; end -end - -# source://activesupport//lib/active_support/concern.rb#117 -class ActiveSupport::Concern::MultiplePrependBlocks < ::StandardError - # @return [MultiplePrependBlocks] a new instance of MultiplePrependBlocks - # - # source://activesupport//lib/active_support/concern.rb#118 - 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); end -end - -# Configurable provides a config method to store and retrieve -# configuration options as an OrderedOptions. -# -# source://activesupport//lib/active_support/configurable.rb#9 -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#142 - def config; end -end - -# source://activesupport//lib/active_support/configurable.rb#27 -module ActiveSupport::Configurable::ClassMethods - # source://activesupport//lib/active_support/configurable.rb#28 - def config; end - - # @yield [config] - # - # source://activesupport//lib/active_support/configurable.rb#37 - 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 instance_writer: false. - # To omit the instance reader method, pass instance_reader: false. - # - # 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 instance_accessor: false, 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 a block to set up the attribute with a default value. - # - # class User - # include ActiveSupport::Configurable - # config_accessor :hair_colors do - # [:brown, :black, :blonde, :red] - # end - # end - # - # User.hair_colors # => [:brown, :black, :blonde, :red] - # - # source://activesupport//lib/active_support/configurable.rb#107 - def config_accessor(*names, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/configurable.rb#12 -class ActiveSupport::Configurable::Configuration < ::ActiveSupport::InheritableOptions - # source://activesupport//lib/active_support/configurable.rb#13 - 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#18 - 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 - -# 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#89 -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#172 - def initialize; end - - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks?; end - - # source://activesupport//lib/active_support/callbacks.rb#835 - def _reset_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#823 - def _run_reset_callbacks(&block); end - - # Returns the value of attribute attributes. - # - # source://activesupport//lib/active_support/current_attributes.rb#170 - 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#170 - def attributes=(_arg0); 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#195 - 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#186 - def set(set_attributes); end - - private - - # source://activesupport//lib/active_support/current_attributes.rb#202 - def assign_attributes(new_attributes); end - - # source://activesupport//lib/active_support/current_attributes.rb#206 - def compute_attributes(keys); end - - class << self - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks=(value); end - - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks?; end - - # source://activesupport//lib/active_support/callbacks.rb#827 - def _reset_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#831 - def _reset_callbacks=(value); end - - # Calls this block after #reset is called on the instance. Used for resetting external collaborators, like Time.zone. - # - # source://activesupport//lib/active_support/current_attributes.rb#130 - def after_reset(&block); end - - # Declares one or more attributes that will be given both class and instance accessor methods. - # - # source://activesupport//lib/active_support/current_attributes.rb#100 - def attribute(*names); end - - # Calls this block 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#125 - def before_reset(&block); end - - # source://activesupport//lib/active_support/current_attributes.rb#141 - def clear_all; end - - # Returns singleton instance for this class in this thread. If none exists, one is created. - # - # source://activesupport//lib/active_support/current_attributes.rb#95 - def instance; end - - # source://activesupport//lib/active_support/current_attributes.rb#135 - def reset(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/current_attributes.rb#137 - def reset_all; end - - # Calls this block after #reset is called on the instance. Used for resetting external collaborators, like Time.zone. - # - # source://activesupport//lib/active_support/current_attributes.rb#130 - def resets(&block); end - - # source://activesupport//lib/active_support/current_attributes.rb#135 - def set(*_arg0, **_arg1, &_arg2); end - - private - - # source://activesupport//lib/active_support/current_attributes.rb#151 - def current_instances; end - - # source://activesupport//lib/active_support/current_attributes.rb#155 - def current_instances_key; end - - # source://activesupport//lib/active_support/current_attributes.rb#147 - def generated_attribute_methods; end - - # source://activesupport//lib/active_support/current_attributes.rb#159 - def method_missing(name, *args, **_arg2, &block); end - end -end - -# source://activesupport//lib/active_support/dependencies/interlock.rb#6 -module ActiveSupport::Dependencies - extend ::ActiveSupport::Dependencies - - # source://activesupport//lib/active_support/dependencies.rb#78 - def _eager_load_paths; end - - # source://activesupport//lib/active_support/dependencies.rb#78 - def _eager_load_paths=(val); end - - # Attempt to autoload the provided module name by searching for a directory - # matching the expected path suffix. If found, the module is created and - # assigned to +into+'s constants with the name +const_name+. Provided that - # the directory was loaded from a reloadable base path, it is added to the - # set of constants that are to be unloaded. - # - # source://activesupport//lib/active_support/dependencies.rb#499 - def autoload_module!(into, const_name, qualified_name, path_suffix); end - - # source://activesupport//lib/active_support/dependencies.rb#73 - def autoload_once_paths; end - - # source://activesupport//lib/active_support/dependencies.rb#73 - def autoload_once_paths=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#69 - def autoload_paths; end - - # source://activesupport//lib/active_support/dependencies.rb#69 - def autoload_paths=(val); end - - # Does the provided path_suffix correspond to an autoloadable module? - # Instead of returning a boolean, the autoload base for this module is - # returned. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/dependencies.rb#481 - def autoloadable_module?(path_suffix); end - - # Determine if the given constant has been automatically loaded. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/dependencies.rb#677 - def autoloaded?(desc); end - - # source://activesupport//lib/active_support/dependencies.rb#83 - def autoloaded_constants; end - - # source://activesupport//lib/active_support/dependencies.rb#83 - def autoloaded_constants=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#389 - def clear; end - - # source://activesupport//lib/active_support/dependencies.rb#185 - def constant_watch_stack; end - - # source://activesupport//lib/active_support/dependencies.rb#185 - def constant_watch_stack=(val); end - - # Get the reference for class named +name+. - # Raises an exception if referenced class does not exist. - # - # source://activesupport//lib/active_support/dependencies.rb#666 - def constantize(name); end - - # source://activesupport//lib/active_support/dependencies.rb#373 - def depend_on(file_name, message = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/dependencies.rb#87 - def explicitly_unloadable_constants; end - - # source://activesupport//lib/active_support/dependencies.rb#87 - def explicitly_unloadable_constants=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#55 - def history; end - - # source://activesupport//lib/active_support/dependencies.rb#55 - def history=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#358 - def hook!; end - - # source://activesupport//lib/active_support/dependencies.rb#25 - def interlock; end - - # source://activesupport//lib/active_support/dependencies.rb#25 - def interlock=(val); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/dependencies.rb#369 - def load?; end - - # Load the file at the provided path. +const_paths+ is a set of qualified - # constant names. When loading the file, Dependencies will watch for the - # addition of these constants. Each that is defined will be marked as - # autoloaded, and will be removed when Dependencies.clear is next called. - # - # If the second parameter is left off, then Dependencies will construct a - # set of names that the file at +path+ may define. See - # +loadable_constants_for_path+ for more details. - # - # source://activesupport//lib/active_support/dependencies.rb#517 - def load_file(path, const_paths = T.unsafe(nil)); end - - # Load the constant named +const_name+ which is missing from +from_mod+. If - # it is not possible to load the constant into from_mod, try its parent - # module using +const_missing+. - # - # source://activesupport//lib/active_support/dependencies.rb#540 - def load_missing_constant(from_mod, const_name); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/dependencies.rb#488 - def load_once_path?(path); end - - # Given +path+, a filesystem path to a ruby file, return an array of - # constant paths which would cause Dependencies to attempt to load this - # file. - # - # source://activesupport//lib/active_support/dependencies.rb#447 - def loadable_constants_for_path(path, bases = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/dependencies.rb#58 - def loaded; end - - # source://activesupport//lib/active_support/dependencies.rb#58 - def loaded=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#61 - def loading; end - - # source://activesupport//lib/active_support/dependencies.rb#61 - def loading=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#805 - def log(message); end - - # source://activesupport//lib/active_support/dependencies.rb#90 - def logger; end - - # source://activesupport//lib/active_support/dependencies.rb#90 - def logger=(val); end - - # Mark the provided constant name for unloading. This constant will be - # unloaded on each request, not just the next one. - # - # source://activesupport//lib/active_support/dependencies.rb#692 - def mark_for_unload(const_desc); end - - # source://activesupport//lib/active_support/dependencies.rb#64 - def mechanism; end - - # source://activesupport//lib/active_support/dependencies.rb#64 - def mechanism=(val); end - - # Run the provided block and detect the new constants that were loaded during - # its execution. Constants may only be regarded as 'new' once -- so if the - # block calls +new_constants_in+ again, then the constants defined within the - # inner call will not be reported in this one. - # - # If the provided block does not run to completion, and instead raises an - # exception, any new constants are regarded as being only partially defined - # and will be removed immediately. - # - # source://activesupport//lib/active_support/dependencies.rb#710 - def new_constants_in(*descs); end - - # Is the provided constant path defined? - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/dependencies.rb#440 - def qualified_const_defined?(path); end - - # Returns the constant path for the provided parent and constant name. - # - # source://activesupport//lib/active_support/dependencies.rb#532 - def qualified_name_for(mod, name); end - - # Store a reference to a class +klass+. - # - # source://activesupport//lib/active_support/dependencies.rb#660 - def reference(klass); end - - # source://activesupport//lib/active_support/dependencies.rb#740 - def remove_constant(const); end - - # Remove the constants that have been autoloaded, and those that have been - # marked for unloading. Before each constant is removed a callback is sent - # to its class/module if it implements +before_remove_const+. - # - # The callback implementation should be restricted to cleaning up caches, etc. - # as the environment will be in an inconsistent state, e.g. other constants - # may have already been unloaded and not accessible. - # - # source://activesupport//lib/active_support/dependencies.rb#613 - def remove_unloadable_constants!; end - - # source://activesupport//lib/active_support/dependencies.rb#397 - def require_or_load(file_name, const_path = T.unsafe(nil)); end - - # Get the reference for class named +name+ if one exists. - # Otherwise returns +nil+. - # - # source://activesupport//lib/active_support/dependencies.rb#672 - def safe_constantize(name); end - - # Search for a file in autoload_paths matching the provided suffix. - # - # source://activesupport//lib/active_support/dependencies.rb#468 - def search_for_file(path_suffix); end - - # Convert the provided const desc to a qualified constant name (as a string). - # A module, class, symbol, or string may be provided. - # - # source://activesupport//lib/active_support/dependencies.rb#729 - def to_constant_name(desc); end - - # source://activesupport//lib/active_support/dependencies.rb#364 - def unhook!; end - - # source://activesupport//lib/active_support/dependencies.rb#93 - def verbose; end - - # source://activesupport//lib/active_support/dependencies.rb#93 - def verbose=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#52 - def warnings_on_first_load; end - - # source://activesupport//lib/active_support/dependencies.rb#52 - def warnings_on_first_load=(val); end - - # Will the provided constant descriptor be unloaded? - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/dependencies.rb#685 - def will_unload?(const_desc); end - - private - - # Returns the original name of a class or module even if `name` has been - # overridden. - # - # source://activesupport//lib/active_support/dependencies.rb#822 - def real_mod_name(mod); end - - # source://activesupport//lib/active_support/dependencies.rb#815 - def uninitialized_constant(qualified_name, const_name, receiver:); end - - class << self - # source://activesupport//lib/active_support/dependencies.rb#78 - def _eager_load_paths; end - - # source://activesupport//lib/active_support/dependencies.rb#78 - def _eager_load_paths=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#73 - def autoload_once_paths; end - - # source://activesupport//lib/active_support/dependencies.rb#73 - def autoload_once_paths=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#69 - def autoload_paths; end - - # source://activesupport//lib/active_support/dependencies.rb#69 - def autoload_paths=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#83 - def autoloaded_constants; end - - # source://activesupport//lib/active_support/dependencies.rb#83 - def autoloaded_constants=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#185 - def constant_watch_stack; end - - # source://activesupport//lib/active_support/dependencies.rb#185 - def constant_watch_stack=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#87 - def explicitly_unloadable_constants; end - - # source://activesupport//lib/active_support/dependencies.rb#87 - def explicitly_unloadable_constants=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#55 - def history; end - - # source://activesupport//lib/active_support/dependencies.rb#55 - def history=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#25 - def interlock; end - - # source://activesupport//lib/active_support/dependencies.rb#25 - def interlock=(val); 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#38 - def load_interlock; end - - # source://activesupport//lib/active_support/dependencies.rb#58 - def loaded; end - - # source://activesupport//lib/active_support/dependencies.rb#58 - def loaded=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#61 - def loading; end - - # source://activesupport//lib/active_support/dependencies.rb#61 - def loading=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#90 - def logger; end - - # source://activesupport//lib/active_support/dependencies.rb#90 - def logger=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#64 - def mechanism; end - - # source://activesupport//lib/active_support/dependencies.rb#64 - def mechanism=(val); end - - # Execute the supplied block without interference from any - # concurrent loads. - # - # source://activesupport//lib/active_support/dependencies.rb#31 - def run_interlock; 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#45 - def unload_interlock; end - - # source://activesupport//lib/active_support/dependencies.rb#93 - def verbose; end - - # source://activesupport//lib/active_support/dependencies.rb#93 - def verbose=(val); end - - # source://activesupport//lib/active_support/dependencies.rb#52 - def warnings_on_first_load; end - - # source://activesupport//lib/active_support/dependencies.rb#52 - def warnings_on_first_load=(val); end - end -end - -# Exception file-blaming. -# -# source://activesupport//lib/active_support/dependencies.rb#338 -module ActiveSupport::Dependencies::Blamable - # source://activesupport//lib/active_support/dependencies.rb#339 - def blame_file!(file); end - - # source://activesupport//lib/active_support/dependencies.rb#343 - def blamed_files; end - - # source://activesupport//lib/active_support/dependencies.rb#352 - def copy_blame!(exc); end - - # source://activesupport//lib/active_support/dependencies.rb#347 - def describe_blame; end -end - -# source://activesupport//lib/active_support/dependencies.rb#621 -class ActiveSupport::Dependencies::ClassCache - # @return [ClassCache] a new instance of ClassCache - # - # source://activesupport//lib/active_support/dependencies.rb#622 - def initialize; end - - # source://activesupport//lib/active_support/dependencies.rb#634 - def [](key); end - - # source://activesupport//lib/active_support/dependencies.rb#652 - def clear!; end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/dependencies.rb#626 - def empty?; end - - # source://activesupport//lib/active_support/dependencies.rb#634 - def get(key); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/dependencies.rb#630 - def key?(key); end - - # source://activesupport//lib/active_support/dependencies.rb#640 - def safe_get(key); end - - # @raise [ArgumentError] - # - # source://activesupport//lib/active_support/dependencies.rb#645 - def store(klass); 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#36 - def done_running; end - - # source://activesupport//lib/active_support/dependencies/interlock.rb#28 - def done_unloading; end - - # source://activesupport//lib/active_support/dependencies/interlock.rb#12 - def loading; end - - # source://activesupport//lib/active_support/dependencies/interlock.rb#46 - def permit_concurrent_loads; end - - # source://activesupport//lib/active_support/dependencies/interlock.rb#52 - def raw_state(&block); end - - # source://activesupport//lib/active_support/dependencies/interlock.rb#40 - def running; end - - # source://activesupport//lib/active_support/dependencies/interlock.rb#32 - def start_running; end - - # source://activesupport//lib/active_support/dependencies/interlock.rb#24 - def start_unloading; end - - # source://activesupport//lib/active_support/dependencies/interlock.rb#18 - def unloading; end -end - -# Object includes this module. -# -# source://activesupport//lib/active_support/dependencies.rb#235 -module ActiveSupport::Dependencies::Loadable - # source://activesupport//lib/active_support/dependencies.rb#293 - def load_dependency(file); end - - # Warning: This method is obsolete in +:zeitwerk+ mode. In - # +:zeitwerk+ mode semantics match Ruby's and you do not need to be - # defensive with load order. Just refer to classes and modules normally. - # If the constant name is dynamic, camelize if needed, and constantize. - # - # In +:classic+ mode, interprets a file using +mechanism+ and marks its - # defined constants as autoloaded. +file_name+ can be either a string or - # respond to to_path. - # - # In +:classic+ mode, use this method in code that absolutely needs a - # certain constant to be defined at that point. A typical use case is to - # make constant name resolution deterministic for constants with the same - # relative name in different namespaces whose evaluation would depend on - # load order otherwise. - # - # 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.rb#282 - def require_dependency(file_name, message = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/dependencies.rb#258 - def require_or_load(file_name); end - - # Mark the given constant as unloadable. Unloadable constants are removed - # each time dependencies are cleared. - # - # Note that marking a constant for unloading need only be done once. Setup - # or init scripts may list each unloadable constant that may need unloading; - # each constant will be removed for every subsequent clear, as opposed to - # for the first clear. - # - # The provided constant descriptor may be a (non-anonymous) module or class, - # or a qualified constant name as a string or symbol. - # - # Returns +true+ if the constant was not previously marked for unloading, - # +false+ otherwise. - # - # source://activesupport//lib/active_support/dependencies.rb#319 - def unloadable(const_desc); end - - private - - # source://activesupport//lib/active_support/dependencies.rb#324 - def load(file, wrap = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/dependencies.rb#330 - def require(file); end - - class << self - # source://activesupport//lib/active_support/dependencies.rb#236 - def exclude_from(base); end - - # source://activesupport//lib/active_support/dependencies.rb#246 - def include_into(base); end - end -end - -# Module includes this module. -# -# source://activesupport//lib/active_support/dependencies.rb#188 -module ActiveSupport::Dependencies::ModuleConstMissing - # source://activesupport//lib/active_support/dependencies.rb#211 - def const_missing(const_name); end - - # We assume that the name of the module reflects the nesting - # (unless it can be proven that is not the case) and the path to the file - # that defines the constant. Anonymous modules cannot follow these - # conventions and therefore we assume that the user wants to refer to a - # top-level constant. - # - # source://activesupport//lib/active_support/dependencies.rb#221 - def guess_for_anonymous(const_name); end - - # source://activesupport//lib/active_support/dependencies.rb#229 - def unloadable(const_desc = T.unsafe(nil)); end - - class << self - # source://activesupport//lib/active_support/dependencies.rb#189 - def append_features(base); end - - # source://activesupport//lib/active_support/dependencies.rb#199 - def exclude_from(base); end - - # source://activesupport//lib/active_support/dependencies.rb#206 - def include_into(base); end - end -end - -# source://activesupport//lib/active_support/dependencies.rb#657 -ActiveSupport::Dependencies::Reference = T.let(T.unsafe(nil), ActiveSupport::Dependencies::ClassCache) - -# source://activesupport//lib/active_support/dependencies.rb#22 -ActiveSupport::Dependencies::UNBOUND_METHOD_MODULE_NAME = T.let(T.unsafe(nil), UnboundMethod) - -# The WatchStack keeps a stack of the modules being watched as files are -# loaded. If a file in the process of being loaded (parent.rb) triggers the -# load of another file (child.rb) the stack will ensure that child.rb -# handles the new constants. -# -# If child.rb is being autoloaded, its constants will be added to -# autoloaded_constants. If it was being required, they will be discarded. -# -# This is handled by walking back up the watch stack and adding the constants -# found by child.rb to the list of original constants in parent.rb. -# -# source://activesupport//lib/active_support/dependencies.rb#105 -class ActiveSupport::Dependencies::WatchStack - include ::Enumerable - - # @return [WatchStack] a new instance of WatchStack - # - # source://activesupport//lib/active_support/dependencies.rb#115 - def initialize; end - - # source://activesupport//lib/active_support/dependencies.rb#120 - def each(&block); end - - # Returns a list of new constants found since the last call to - # watch_namespaces. - # - # source://activesupport//lib/active_support/dependencies.rb#130 - def new_constants; end - - # Add a set of modules to the watch stack, remembering the initial - # constants. - # - # source://activesupport//lib/active_support/dependencies.rb#167 - def watch_namespaces(namespaces); end - - # if parent.rb is autoloaded, the stack will look like [[Object]]. If - # parent.rb then requires namespace/child.rb, the stack will look like - # [[Object], [Namespace]]. - # - # source://activesupport//lib/active_support/dependencies.rb#113 - def watching; end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/dependencies.rb#124 - def watching?; end - - private - - # source://activesupport//lib/active_support/dependencies.rb#179 - def pop_modules(modules); end -end - -# \Deprecation specifies the API used by Rails to deprecate methods, instance -# variables, objects and constants. -# -# source://activesupport//lib/active_support/deprecation.rb#8 -class ActiveSupport::Deprecation - include ::Singleton - include ::ActiveSupport::Deprecation::InstanceDelegator - include ::ActiveSupport::Deprecation::Behavior - include ::ActiveSupport::Deprecation::Reporting - include ::ActiveSupport::Deprecation::Disallowed - include ::ActiveSupport::Deprecation::MethodWrapper - extend ::Singleton::SingletonClassMethods - extend ::ActiveSupport::Deprecation::InstanceDelegator::ClassMethods - extend ::ActiveSupport::Deprecation::InstanceDelegator::OverrideDelegators - - # 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#41 - 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#35 - def deprecation_horizon; end - - # The version number in which the deprecated behavior will be removed, by default. - # - # source://activesupport//lib/active_support/deprecation.rb#35 - def deprecation_horizon=(_arg0); end - - class << self - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def allow(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def behavior(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def behavior=(arg); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def debug(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def debug=(arg); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def deprecate_methods(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def deprecation_horizon(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def deprecation_horizon=(arg); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#31 - def deprecation_warning(deprecated_method_name, message = T.unsafe(nil), caller_backtrace = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def disallowed_behavior(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def disallowed_behavior=(arg); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def disallowed_warnings(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def disallowed_warnings=(arg); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def gem_name(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def gem_name=(arg); end - - def new(*_arg0); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def silence(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def silenced(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21 - def silenced=(arg); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#26 - def warn(message = T.unsafe(nil), callstack = T.unsafe(nil)); end - - private - - def allocate; 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 $stderr. -# [+log+] Log all deprecation warnings to +Rails.logger+. -# [+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+. -# [+silence+] Do nothing. -# -# 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#61 -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#66 - 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 $stderr. - # [+log+] Log all deprecation warnings to +Rails.logger+. - # [+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+. - # [+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. - # - # ActiveSupport::Deprecation.behavior = :stderr - # ActiveSupport::Deprecation.behavior = [:stderr, :log] - # ActiveSupport::Deprecation.behavior = MyCustomHandler - # ActiveSupport::Deprecation.behavior = ->(message, callstack, deprecation_horizon, gem_name) { - # # custom stuff - # } - # - # source://activesupport//lib/active_support/deprecation/behaviors.rb#96 - def behavior=(behavior); end - - # Whether to print a backtrace along with the warning. - # - # source://activesupport//lib/active_support/deprecation/behaviors.rb#63 - def debug; end - - # Whether to print a backtrace along with the warning. - # - # source://activesupport//lib/active_support/deprecation/behaviors.rb#63 - 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#71 - 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#104 - def disallowed_behavior=(behavior); end - - private - - # source://activesupport//lib/active_support/deprecation/behaviors.rb#109 - def arity_coerce(behavior); 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) - -# DeprecatedConstantAccessor transforms a constant into a deprecated one by -# hooking +const_missing+. -# -# It takes the names of an old (deprecated) constant and of a new constant -# (both in string form) and optionally a deprecator. The deprecator defaults -# to +ActiveSupport::Deprecator+ if none is specified. -# -# The deprecated constant now returns the same object as the new one rather -# than a proxy object, so it can be used transparently in +rescue+ blocks -# etc. -# -# 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) -# include ActiveSupport::Deprecation::DeprecatedConstantAccessor -# deprecate_constant 'PLANETS', 'PLANETS_POST_2006' -# -# 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/constant_accessor.rb#28 -module ActiveSupport::Deprecation::DeprecatedConstantAccessor - class << self - # @private - # - # source://activesupport//lib/active_support/deprecation/constant_accessor.rb#29 - def included(base); end - end -end - -# DeprecatedConstantProxy transforms a constant into a deprecated one. It -# takes the names of an old (deprecated) constant and of a new constant -# (both in string form) and optionally a deprecator. The deprecator defaults -# to +ActiveSupport::Deprecator+ if none is specified. 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') -# -# 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#123 -class ActiveSupport::Deprecation::DeprecatedConstantProxy < ::Module - # @return [DeprecatedConstantProxy] a new instance of DeprecatedConstantProxy - # - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#131 - def initialize(old_const, new_const, deprecator = T.unsafe(nil), message: T.unsafe(nil)); 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#157 - def class; end - - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#150 - 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#144 - def inspect; end - - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#150 - def instance_methods(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#150 - def name(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#150 - def respond_to?(*_arg0, **_arg1, &_arg2); end - - private - - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#166 - def const_missing(name); end - - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#171 - def method_missing(called, *args, &block); end - - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#162 - def target; end - - class << self - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#124 - 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 -# and an instance variable. It optionally takes a deprecator as the last -# argument. The deprecator defaults to +ActiveSupport::Deprecator+ if none -# is specified. -# -# class Example -# def initialize -# @request = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(self, :request, :@request) -# @_request = :special_request -# end -# -# def request -# @_request -# end -# -# def old_request -# @request -# end -# end -# -# example = Example.new -# # => # -# -# 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#88 -class ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy < ::ActiveSupport::Deprecation::DeprecationProxy - # @return [DeprecatedInstanceVariableProxy] a new instance of DeprecatedInstanceVariableProxy - # - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#89 - def initialize(instance, method, var = T.unsafe(nil), deprecator = T.unsafe(nil)); end - - private - - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#97 - def target; end - - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#101 - def warn(callstack, called, args); end -end - -# DeprecatedObjectProxy transforms an object into a deprecated one. It -# takes an object, a deprecation message and optionally a deprecator. The -# deprecator defaults to +ActiveSupport::Deprecator+ if none is specified. -# -# deprecated_object = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(Object.new, "This object is now deprecated") -# # => # -# -# deprecated_object.to_s -# DEPRECATION WARNING: This object is now deprecated. -# (Backtrace) -# # => "#" -# -# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#39 -class ActiveSupport::Deprecation::DeprecatedObjectProxy < ::ActiveSupport::Deprecation::DeprecationProxy - # @return [DeprecatedObjectProxy] a new instance of DeprecatedObjectProxy - # - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#40 - def initialize(object, message, deprecator = T.unsafe(nil)); end - - private - - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#47 - def target; end - - # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#51 - 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, &block); end - 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 +ActiveSupport::Deprecation.disallowed_behavior+ - # rather than +ActiveSupport::Deprecation.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#40 - def explicitly_allowed?(message); end -end - -# source://activesupport//lib/active_support/deprecation/instance_delegator.rb#7 -module ActiveSupport::Deprecation::InstanceDelegator - mixes_in_class_methods ::ActiveSupport::Deprecation::InstanceDelegator::ClassMethods - mixes_in_class_methods ::ActiveSupport::Deprecation::InstanceDelegator::OverrideDelegators - - class << self - # @private - # - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#8 - def included(base); end - end -end - -# source://activesupport//lib/active_support/deprecation/instance_delegator.rb#14 -module ActiveSupport::Deprecation::InstanceDelegator::ClassMethods - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#15 - def include(included_module); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#20 - def method_added(method_name); end -end - -# source://activesupport//lib/active_support/deprecation/instance_delegator.rb#25 -module ActiveSupport::Deprecation::InstanceDelegator::OverrideDelegators - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#31 - def deprecation_warning(deprecated_method_name, message = T.unsafe(nil), caller_backtrace = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#26 - def warn(message = T.unsafe(nil), callstack = T.unsafe(nil)); end -end - -# 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 - # - # Using the default deprecator: - # ActiveSupport::Deprecation.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 Rails 5.1. (called from irb_binding at (irb):10) - # # => nil - # - # Fred.new.bbb - # # DEPRECATION WARNING: bbb is deprecated and will be removed from Rails 5.1 (use zzz instead). (called from irb_binding at (irb):11) - # # => nil - # - # Fred.new.ccc - # # DEPRECATION WARNING: ccc is deprecated and will be removed from Rails 5.1 (use Bar#ccc instead). (called from irb_binding at (irb):12) - # # => nil - # - # Passing in a custom deprecator: - # custom_deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem') - # ActiveSupport::Deprecation.deprecate_methods(Fred, ddd: :zzz, deprecator: custom_deprecator) - # # => [:ddd] - # - # Fred.new.ddd - # DEPRECATION WARNING: ddd is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):15) - # # => nil - # - # Using a custom deprecator directly: - # custom_deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem') - # custom_deprecator.deprecate_methods(Fred, eee: :zzz) - # # => [:eee] - # - # Fred.new.eee - # DEPRECATION WARNING: eee is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):18) - # # => nil - # - # source://activesupport//lib/active_support/deprecation/method_wrappers.rb#52 - 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. - # allowed_warnings 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 if: argument accepts a truthy/falsy value or an object that - # responds to .call. If truthy, then matching warnings will be allowed. - # If falsey then the method yields to the block without allowing the warning. - # - # ActiveSupport::Deprecation.disallowed_behavior = :raise - # ActiveSupport::Deprecation.disallowed_warnings = [ - # "something broke" - # ] - # - # ActiveSupport::Deprecation.warn('something broke!') - # # => ActiveSupport::DeprecationException - # - # ActiveSupport::Deprecation.allow ['something broke'] do - # ActiveSupport::Deprecation.warn('something broke!') - # end - # # => nil - # - # ActiveSupport::Deprecation.allow ['something broke'], if: Rails.env.production? do - # ActiveSupport::Deprecation.warn('something broke!') - # end - # # => ActiveSupport::DeprecationException for dev/test, nil for production - # - # source://activesupport//lib/active_support/deprecation/reporting.rb#72 - def allow(allowed_warnings = T.unsafe(nil), if: T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/deprecation/reporting.rb#86 - def deprecation_warning(deprecated_method_name, message = T.unsafe(nil), caller_backtrace = T.unsafe(nil)); 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. - # - # ActiveSupport::Deprecation.warn('something broke!') - # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)" - # - # ActiveSupport::Deprecation.silence do - # ActiveSupport::Deprecation.warn('something broke!') - # end - # # => nil - # - # source://activesupport//lib/active_support/deprecation/reporting.rb#40 - def silence(&block); end - - # source://activesupport//lib/active_support/deprecation/reporting.rb#82 - 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.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#137 - 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#102 - def deprecated_method_warning(method_name, message = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/deprecation/reporting.rb#116 - def deprecation_caller_message(callstack); end - - # source://activesupport//lib/active_support/deprecation/reporting.rb#111 - def deprecation_message(callstack, message = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/deprecation/reporting.rb#127 - def extract_callstack(callstack); end - - # source://activesupport//lib/active_support/deprecation/reporting.rb#152 - def ignored_callstack(path); end -end - -# source://activesupport//lib/active_support/deprecation/reporting.rb#150 -ActiveSupport::Deprecation::Reporting::RAILS_GEM_ROOT = T.let(T.unsafe(nil), String) - -# Raised when ActiveSupport::Deprecation::Behavior#behavior is set with :raise. -# You would set :raise, 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 - -# This module provides an internal implementation to track descendants -# which is faster than iterating through ObjectSpace. -# -# source://activesupport//lib/active_support/descendants_tracker.rb#8 -module ActiveSupport::DescendantsTracker - # source://activesupport//lib/active_support/descendants_tracker.rb#65 - def descendants; end - - # source://activesupport//lib/active_support/descendants_tracker.rb#60 - def direct_descendants; end - - # source://activesupport//lib/active_support/descendants_tracker.rb#55 - def inherited(base); end - - # source://activesupport//lib/active_support/descendants_tracker.rb#60 - def subclasses; end - - class << self - # source://activesupport//lib/active_support/descendants_tracker.rb#24 - def clear; end - - # source://activesupport//lib/active_support/descendants_tracker.rb#18 - def descendants(klass); end - - # source://activesupport//lib/active_support/descendants_tracker.rb#12 - def direct_descendants(klass); end - - # This is the only method that is not thread safe, but is only ever called - # during the eager loading phase. - # - # source://activesupport//lib/active_support/descendants_tracker.rb#40 - def store_inherited(klass, descendant); end - - # source://activesupport//lib/active_support/descendants_tracker.rb#12 - def subclasses(klass); end - - private - - # source://activesupport//lib/active_support/descendants_tracker.rb#45 - def accumulate_descendants(klass, acc); end - end -end - -# DescendantsArray is an array that contains weak references to classes. -# -# source://activesupport//lib/active_support/descendants_tracker.rb#70 -class ActiveSupport::DescendantsTracker::DescendantsArray - include ::Enumerable - - # @return [DescendantsArray] a new instance of DescendantsArray - # - # source://activesupport//lib/active_support/descendants_tracker.rb#73 - def initialize; end - - # source://activesupport//lib/active_support/descendants_tracker.rb#81 - def <<(klass); end - - # source://activesupport//lib/active_support/descendants_tracker.rb#99 - def cleanup!; end - - # source://activesupport//lib/active_support/descendants_tracker.rb#85 - def each; end - - # source://activesupport//lib/active_support/descendants_tracker.rb#95 - def refs_size; end - - # source://activesupport//lib/active_support/descendants_tracker.rb#103 - def reject!; end - - private - - # source://activesupport//lib/active_support/descendants_tracker.rb#77 - def initialize_copy(orig); 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 - -# 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#13 -class ActiveSupport::Duration - # @return [Duration] a new instance of Duration - # - # source://activesupport//lib/active_support/duration.rb#213 - def initialize(value, parts); 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#285 - def %(other); end - - # Multiplies this Duration by a Numeric and returns a new Duration. - # - # source://activesupport//lib/active_support/duration.rb#260 - 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#241 - def +(other); end - - # source://activesupport//lib/active_support/duration.rb#299 - def +@; end - - # Subtracts another Duration or a Numeric from this Duration. Numeric - # values are treated as seconds. - # - # source://activesupport//lib/active_support/duration.rb#255 - def -(other); end - - # source://activesupport//lib/active_support/duration.rb#295 - def -@; end - - # Divides this Duration by a Numeric and returns a new Duration. - # - # source://activesupport//lib/active_support/duration.rb#271 - 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#231 - def <=>(other); end - - # Returns +true+ if +other+ is also a Duration instance with the - # same +value+, or if other == value. - # - # source://activesupport//lib/active_support/duration.rb#314 - def ==(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#409 - 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#417 - def ago(time = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/duration.rb#432 - 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#417 - def before(time = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/duration.rb#218 - def coerce(other); end - - # source://activesupport//lib/active_support/duration.rb#440 - 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#399 - 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#409 - def from_now(time = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/duration.rb#403 - 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#372 - 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#365 - 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#358 - 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#386 - 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://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html] and - # Time[https://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html] should be used for precision - # date and time arithmetic. - # - # source://activesupport//lib/active_support/duration.rb#350 - 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#379 - 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#393 - def in_years; end - - # source://activesupport//lib/active_support/duration.rb#436 - def init_with(coder); end - - # source://activesupport//lib/active_support/duration.rb#423 - def inspect; end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/duration.rb#308 - def instance_of?(klass); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/duration.rb#303 - 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#446 - def iso8601(precision: T.unsafe(nil)); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/duration.rb#303 - def kind_of?(klass); end - - # Returns the value of attribute parts. - # - # source://activesupport//lib/active_support/duration.rb#127 - def parts; end - - # Sets the attribute parts - # - # @param value the value to set the attribute parts to. - # - # source://activesupport//lib/active_support/duration.rb#127 - def parts=(_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#409 - def since(time = T.unsafe(nil)); 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://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html] and - # Time[https://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html] should be used for precision - # date and time arithmetic. - # - # source://activesupport//lib/active_support/duration.rb#350 - 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#326 - 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#417 - def until(time = T.unsafe(nil)); end - - # Returns the value of attribute value. - # - # source://activesupport//lib/active_support/duration.rb#127 - def value; end - - # Sets the attribute value - # - # @param value the value to set the attribute value to. - # - # source://activesupport//lib/active_support/duration.rb#127 - def value=(_arg0); end - - private - - # source://activesupport//lib/active_support/duration.rb#477 - def method_missing(method, *args, &block); end - - # @raise [TypeError] - # - # source://activesupport//lib/active_support/duration.rb#481 - def raise_type_error(other); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/duration.rb#473 - def respond_to_missing?(method, _); end - - # source://activesupport//lib/active_support/duration.rb#451 - def sum(sign, time = T.unsafe(nil)); end - - class << self - # source://activesupport//lib/active_support/duration.rb#143 - 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#183 - def build(value); end - - # source://activesupport//lib/active_support/duration.rb#161 - def days(value); end - - # source://activesupport//lib/active_support/duration.rb#157 - def hours(value); end - - # source://activesupport//lib/active_support/duration.rb#153 - def minutes(value); end - - # source://activesupport//lib/active_support/duration.rb#169 - 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#138 - def parse(iso8601duration); end - - # source://activesupport//lib/active_support/duration.rb#149 - def seconds(value); end - - # source://activesupport//lib/active_support/duration.rb#165 - def weeks(value); end - - # source://activesupport//lib/active_support/duration.rb#173 - def years(value); end - - private - - # source://activesupport//lib/active_support/duration.rb#206 - 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#8 -class ActiveSupport::Duration::ISO8601Serializer - # @return [ISO8601Serializer] a new instance of ISO8601Serializer - # - # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#11 - def initialize(duration, precision: T.unsafe(nil)); end - - # Builds and returns output string. - # - # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#17 - def serialize; end - - private - - # 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. - # If all parts are negative it will negate all of them and return minus as a sign. - # - # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#41 - def normalize; end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#54 - def week_mixed_with_date?(parts); end -end - -# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#9 -ActiveSupport::Duration::ISO8601Serializer::DATE_COMPONENTS = T.let(T.unsafe(nil), Array) - -# source://activesupport//lib/active_support/duration.rb#125 -ActiveSupport::Duration::PARTS = T.let(T.unsafe(nil), Array) - -# source://activesupport//lib/active_support/duration.rb#115 -ActiveSupport::Duration::PARTS_IN_SECONDS = T.let(T.unsafe(nil), Hash) - -# source://activesupport//lib/active_support/duration.rb#110 -ActiveSupport::Duration::SECONDS_PER_DAY = T.let(T.unsafe(nil), Integer) - -# source://activesupport//lib/active_support/duration.rb#109 -ActiveSupport::Duration::SECONDS_PER_HOUR = T.let(T.unsafe(nil), Integer) - -# source://activesupport//lib/active_support/duration.rb#108 -ActiveSupport::Duration::SECONDS_PER_MINUTE = T.let(T.unsafe(nil), Integer) - -# 1/12 of a gregorian year -# -# source://activesupport//lib/active_support/duration.rb#112 -ActiveSupport::Duration::SECONDS_PER_MONTH = T.let(T.unsafe(nil), Integer) - -# source://activesupport//lib/active_support/duration.rb#111 -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#113 -ActiveSupport::Duration::SECONDS_PER_YEAR = T.let(T.unsafe(nil), Integer) - -# source://activesupport//lib/active_support/duration.rb#14 -class ActiveSupport::Duration::Scalar < ::Numeric - # @return [Scalar] a new instance of Scalar - # - # source://activesupport//lib/active_support/duration.rb#18 - def initialize(value); end - - # source://activesupport//lib/active_support/duration.rb#84 - def %(other); end - - # source://activesupport//lib/active_support/duration.rb#65 - def *(other); end - - # source://activesupport//lib/active_support/duration.rb#40 - def +(other); end - - # source://activesupport//lib/active_support/duration.rb#52 - def -(other); end - - # source://activesupport//lib/active_support/duration.rb#26 - def -@; end - - # source://activesupport//lib/active_support/duration.rb#76 - def /(other); end - - # source://activesupport//lib/active_support/duration.rb#30 - def <=>(other); end - - # source://activesupport//lib/active_support/duration.rb#22 - def coerce(other); end - - # source://activesupport//lib/active_support/duration.rb#16 - def to_f(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/duration.rb#16 - def to_i(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/duration.rb#16 - def to_s(*_arg0, **_arg1, &_arg2); end - - # Returns the value of attribute value. - # - # source://activesupport//lib/active_support/duration.rb#15 - def value; end - - private - - # source://activesupport//lib/active_support/duration.rb#93 - def calculate(op, other); end - - # @raise [TypeError] - # - # source://activesupport//lib/active_support/duration.rb#103 - def raise_type_error(other); end -end - -# source://activesupport//lib/active_support/core_ext/range/each.rb#6 -module ActiveSupport::EachTimeWithZone - # source://activesupport//lib/active_support/core_ext/range/each.rb#7 - def each(&block); end - - # source://activesupport//lib/active_support/core_ext/range/each.rb#12 - def step(n = T.unsafe(nil), &block); end - - private - - # @raise [TypeError] - # - # source://activesupport//lib/active_support/core_ext/range/each.rb#18 - def ensure_iteration_allowed; end -end - -# source://activesupport//lib/active_support/environment_inquirer.rb#6 -class ActiveSupport::EnvironmentInquirer < ::ActiveSupport::StringInquirer - # @return [EnvironmentInquirer] a new instance of EnvironmentInquirer - # - # source://activesupport//lib/active_support/environment_inquirer.rb#8 - def initialize(env); end - - def development?; end - def production?; end - def test?; end -end - -# source://activesupport//lib/active_support/environment_inquirer.rb#7 -ActiveSupport::EnvironmentInquirer::DEFAULT_ENVIRONMENTS = T.let(T.unsafe(nil), Array) - -# 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#67 - def __callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks?; end - - # source://activesupport//lib/active_support/callbacks.rb#835 - def _complete_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#835 - def _run_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#823 - def _run_complete_callbacks(&block); end - - # source://activesupport//lib/active_support/callbacks.rb#823 - def _run_run_callbacks(&block); 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#121 - def complete!; end - - # source://activesupport//lib/active_support/execution_wrapper.rb#112 - def run!; end - - private - - # source://activesupport//lib/active_support/execution_wrapper.rb#128 - def hook_state; end - - class << self - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks=(value); end - - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks?; end - - # source://activesupport//lib/active_support/callbacks.rb#827 - def _complete_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#831 - def _complete_callbacks=(value); end - - # source://activesupport//lib/active_support/callbacks.rb#827 - def _run_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#831 - def _run_callbacks=(value); end - - # Returns the value of attribute active. - # - # source://activesupport//lib/active_support/execution_wrapper.rb#98 - def active; end - - # Sets the attribute active - # - # @param value the value to set the attribute active to. - # - # source://activesupport//lib/active_support/execution_wrapper.rb#98 - def active=(_arg0); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/execution_wrapper.rb#108 - def active?; end - - # source://activesupport//lib/active_support/execution_wrapper.rb#101 - def inherited(other); 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; 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 - -# 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#33 -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#42 - 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#80 - def execute; end - - # Execute the block given if updated. - # - # source://activesupport//lib/active_support/file_update_checker.rb#90 - 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#61 - def updated?; end - - private - - # source://activesupport//lib/active_support/file_update_checker.rb#156 - def compile_ext(array); end - - # source://activesupport//lib/active_support/file_update_checker.rb#142 - def compile_glob(hash); end - - # source://activesupport//lib/active_support/file_update_checker.rb#152 - 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#120 - def max_mtime(paths); end - - # source://activesupport//lib/active_support/file_update_checker.rb#109 - def updated_at(paths); end - - # source://activesupport//lib/active_support/file_update_checker.rb#101 - 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#52 - def after_fork(&block); end - - # source://activesupport//lib/active_support/fork_tracker.rb#36 - def check!; end - - # source://activesupport//lib/active_support/fork_tracker.rb#43 - def hook!; end - - # source://activesupport//lib/active_support/fork_tracker.rb#57 - 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(*_arg0, **_arg1); end -end - -# source://activesupport//lib/active_support/fork_tracker.rb#22 -module ActiveSupport::ForkTracker::CoreExtPrivate - include ::ActiveSupport::ForkTracker::CoreExt - - private - - # source://activesupport//lib/active_support/fork_tracker.rb#26 - def fork(*_arg0, **_arg1); end -end - -# 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#15 -module ActiveSupport::Gzip - class << self - # Compresses a string using gzip. - # - # source://activesupport//lib/active_support/gzip.rb#30 - def compress(source, level = T.unsafe(nil), strategy = T.unsafe(nil)); end - - # Decompresses a gzipped string. - # - # source://activesupport//lib/active_support/gzip.rb#25 - def decompress(source); end - end -end - -# source://activesupport//lib/active_support/gzip.rb#16 -class ActiveSupport::Gzip::Stream < ::StringIO - # @return [Stream] a new instance of Stream - # - # source://activesupport//lib/active_support/gzip.rb#17 - def initialize(*_arg0); end - - # source://activesupport//lib/active_support/gzip.rb#21 - def close; end -end - -# Implements a hash where keys :foo and "foo" are considered -# to be the same. -# -# rgb = ActiveSupport::HashWithIndifferentAccess.new -# -# rgb[:black] = '#000000' -# rgb[:black] # => '#000000' -# rgb['black'] # => '#000000' -# -# rgb['white'] = '#FFFFFF' -# rgb[:white] # => '#FFFFFF' -# rgb['white'] # => '#FFFFFF' -# -# Internally symbols are mapped to strings when used as keys in the entire -# writing interface (calling []=, merge, etc). This -# mapping belongs to the public interface. For example, given: -# -# hash = ActiveSupport::HashWithIndifferentAccess.new(a: 1) -# -# You are guaranteed that the key is returned as a string: -# -# hash.keys # => ["a"] -# -# Technically other types of keys are accepted: -# -# hash = ActiveSupport::HashWithIndifferentAccess.new(a: 1) -# hash[0] = 0 -# hash # => {"a"=>1, 0=>0} -# -# but this class is intended for use cases where strings or symbols are the -# expected keys and it is convenient to understand both as the same. For -# example the +params+ hash in Ruby on Rails. -# -# Note that core extensions define Hash#with_indifferent_access: -# -# rgb = { black: '#000000', white: '#FFFFFF' }.with_indifferent_access -# -# which may be handy. -# -# To access this class outside of Rails, require the core extension with: -# -# require "active_support/core_ext/hash/indifferent_access" -# -# which will, in turn, require this file. -# -# source://activesupport//lib/active_support/hash_with_indifferent_access.rb#55 -class ActiveSupport::HashWithIndifferentAccess < ::Hash - # @return [HashWithIndifferentAccess] a new instance of HashWithIndifferentAccess - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#68 - def initialize(constructor = T.unsafe(nil)); end - - # Same as Hash#[] where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = 1 - # - # counters['foo'] # => 1 - # counters[:foo] # => 1 - # counters[:zoo] # => nil - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#164 - def [](key); end - - # Assigns a new value to the hash: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash[:key] = 'value' - # - # This value can be later fetched using either +:key+ or 'key'. - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#94 - def []=(key, value); end - - # Same as Hash#assoc where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = 1 - # - # counters.assoc('foo') # => ["foo", 1] - # counters.assoc(:foo) # => ["foo", 1] - # counters.assoc(:zoo) # => nil - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#177 - def assoc(key); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#355 - def compact; end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#309 - def deep_stringify_keys; end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#307 - def deep_stringify_keys!; end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#314 - def deep_symbolize_keys; end - - # Same as Hash#default where the key passed as argument can be - # either a string or a symbol: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new(1) - # hash.default # => 1 - # - # hash = ActiveSupport::HashWithIndifferentAccess.new { |hash, key| key } - # hash.default # => nil - # hash.default('foo') # => 'foo' - # hash.default(:foo) # => 'foo' - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#219 - def default(*args); end - - # Removes the specified key from the hash. - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#293 - def delete(key); end - - # Same as Hash#dig where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = { bar: 1 } - # - # counters.dig('foo', 'bar') # => 1 - # counters.dig(:foo, :bar) # => 1 - # counters.dig(:zoo) # => nil - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#204 - def dig(*args); end - - # Returns a shallow copy of the hash. - # - # hash = ActiveSupport::HashWithIndifferentAccess.new({ a: { b: 'b' } }) - # dup = hash.dup - # dup[:a][:c] = 'c' - # - # hash[:a][:c] # => "c" - # dup[:a][:c] # => "c" - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#254 - def dup; end - - # Returns a hash with indifferent access that includes everything except given keys. - # hash = { a: "x", b: "y", c: 10 }.with_indifferent_access - # hash.except(:a, "b") # => {c: 10}.with_indifferent_access - # hash # => { a: "x", b: "y", c: 10 }.with_indifferent_access - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#301 - def except(*keys); end - - # Returns +true+ so that Array#extract_options! finds members of - # this class. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#56 - def extractable_options?; end - - # Same as Hash#fetch where the key passed as argument can be - # either a string or a symbol: - # - # counters = ActiveSupport::HashWithIndifferentAccess.new - # counters[:foo] = 1 - # - # counters.fetch('foo') # => 1 - # counters.fetch(:bar, 0) # => 0 - # counters.fetch(:bar) { |key| 0 } # => 0 - # counters.fetch(:zoo) # => KeyError: key not found: "zoo" - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#191 - def fetch(key, *extras); end - - # Returns an array of the values at the specified indices, but also - # raises an exception when one of the keys can't be found. - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash[:a] = 'x' - # hash[:b] = 'y' - # hash.fetch_values('a', 'b') # => ["x", "y"] - # hash.fetch_values('a', 'c') { |key| 'z' } # => ["x", "z"] - # hash.fetch_values('a', 'c') # => KeyError: key not found: "c" - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#242 - def fetch_values(*indices, &block); end - - # Checks the hash for a key matching the argument passed in: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash['key'] = 'value' - # hash.key?(:key) # => true - # hash.key?('key') # => true - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#147 - def has_key?(key); end - - # Checks the hash for a key matching the argument passed in: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash['key'] = 'value' - # hash.key?(:key) # => true - # hash.key?('key') # => true - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#147 - def include?(key); end - - # Checks the hash for a key matching the argument passed in: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash['key'] = 'value' - # hash.key?(:key) # => true - # hash.key?('key') # => true - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#147 - def key?(key); end - - # Checks the hash for a key matching the argument passed in: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash['key'] = 'value' - # hash.key?(:key) # => true - # hash.key?('key') # => true - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#147 - def member?(key); end - - # This method has the same semantics of +update+, except it does not - # modify the receiver but rather returns a new hash with indifferent - # access with the result of the merge. - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#263 - def merge(*hashes, &block); end - - # Updates the receiver in-place, merging in the hashes passed as arguments: - # - # hash_1 = ActiveSupport::HashWithIndifferentAccess.new - # hash_1[:key] = 'value' - # - # hash_2 = ActiveSupport::HashWithIndifferentAccess.new - # hash_2[:key] = 'New Value!' - # - # hash_1.update(hash_2) # => {"key"=>"New Value!"} - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash.update({ "a" => 1 }, { "b" => 2 }) # => { "a" => 1, "b" => 2 } - # - # The arguments can be either an - # ActiveSupport::HashWithIndifferentAccess or a regular +Hash+. - # In either case the merge respects the semantics of indifferent access. - # - # If the argument is a regular hash with keys +:key+ and "key" only one - # of the values end up in the receiver, but which one is unspecified. - # - # When given a block, the value for duplicated keys will be determined - # by the result of invoking the block with the duplicated key, the value - # in the receiver, and the value in +other_hash+. The rules for duplicated - # keys follow the semantics of indifferent access: - # - # hash_1[:key] = 10 - # hash_2['key'] = 12 - # hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22} - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#128 - def merge!(*other_hashes, &block); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#64 - def nested_under_indifferent_access; end - - def regular_update(*_arg0); end - def regular_writer(_arg0, _arg1); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#322 - def reject(*args, &block); end - - # Replaces the contents of this hash with other_hash. - # - # h = { "a" => 100, "b" => 200 } - # h.replace({ "c" => 300, "d" => 400 }) # => {"c"=>300, "d"=>400} - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#288 - def replace(other_hash); end - - # Like +merge+ but the other way around: Merges the receiver into the - # argument and returns a new hash with indifferent access as result: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash['a'] = nil - # hash.reverse_merge(a: 0, b: 1) # => {"a"=>nil, "b"=>1} - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#273 - def reverse_merge(other_hash); end - - # Same semantics as +reverse_merge+ but modifies the receiver in-place. - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#279 - def reverse_merge!(other_hash); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#317 - def select(*args, &block); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#345 - def slice(*keys); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#350 - def slice!(*keys); end - - # Assigns a new value to the hash: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash[:key] = 'value' - # - # This value can be later fetched using either +:key+ or 'key'. - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#94 - def store(key, value); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#308 - def stringify_keys; end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#306 - def stringify_keys!; end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#312 - def symbolize_keys; end - - # Convert to a regular hash with string keys. - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#360 - def to_hash; end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#312 - def to_options; end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#315 - def to_options!; end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#332 - def transform_keys(*args, &block); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#337 - def transform_keys!; end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#327 - def transform_values(*args, &block); end - - # Updates the receiver in-place, merging in the hashes passed as arguments: - # - # hash_1 = ActiveSupport::HashWithIndifferentAccess.new - # hash_1[:key] = 'value' - # - # hash_2 = ActiveSupport::HashWithIndifferentAccess.new - # hash_2[:key] = 'New Value!' - # - # hash_1.update(hash_2) # => {"key"=>"New Value!"} - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash.update({ "a" => 1 }, { "b" => 2 }) # => { "a" => 1, "b" => 2 } - # - # The arguments can be either an - # ActiveSupport::HashWithIndifferentAccess or a regular +Hash+. - # In either case the merge respects the semantics of indifferent access. - # - # If the argument is a regular hash with keys +:key+ and "key" only one - # of the values end up in the receiver, but which one is unspecified. - # - # When given a block, the value for duplicated keys will be determined - # by the result of invoking the block with the duplicated key, the value - # in the receiver, and the value in +other_hash+. The rules for duplicated - # keys follow the semantics of indifferent access: - # - # hash_1[:key] = 10 - # hash_2['key'] = 12 - # hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22} - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#128 - def update(*other_hashes, &block); end - - # Returns an array of the values at the specified indices: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash[:a] = 'x' - # hash[:b] = 'y' - # hash.values_at('a', 'b') # => ["x", "y"] - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#229 - def values_at(*keys); end - - # Like +merge+ but the other way around: Merges the receiver into the - # argument and returns a new hash with indifferent access as result: - # - # hash = ActiveSupport::HashWithIndifferentAccess.new - # hash['a'] = nil - # hash.reverse_merge(a: 0, b: 1) # => {"a"=>nil, "b"=>1} - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#273 - def with_defaults(other_hash); end - - # Same semantics as +reverse_merge+ but modifies the receiver in-place. - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#279 - def with_defaults!(other_hash); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#60 - def with_indifferent_access; end - - # Returns a hash with indifferent access that includes everything except given keys. - # hash = { a: "x", b: "y", c: 10 }.with_indifferent_access - # hash.except(:a, "b") # => {c: 10}.with_indifferent_access - # hash # => { a: "x", b: "y", c: 10 }.with_indifferent_access - # - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#301 - def without(*keys); end - - private - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#372 - def convert_key(key); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#381 - def convert_value(value, conversion: T.unsafe(nil)); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#398 - def set_defaults(target); end - - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#406 - def update_with_single_argument(other_hash, block); end - - class << self - # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#81 - def [](*args); end - end -end - -# source://activesupport//lib/active_support/core_ext/range/include_time_with_zone.rb#7 -module ActiveSupport::IncludeTimeWithZone - # Extends the default Range#include? to support ActiveSupport::TimeWithZone. - # - # (1.hour.ago..1.hour.from_now).include?(Time.current) # => true - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/range/include_time_with_zone.rb#12 - def include?(value); end -end - -# 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#69 - 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#200 - 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#271 - 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#208 - 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#238 - 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#220 - def demodulize(path); 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#249 - 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 a "_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#128 - 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 :en. - # Only rules for English are provided. - # - # ActiveSupport::Inflector.inflections(:en) do |inflect| - # inflect.uncountable 'rails' - # end - # - # source://activesupport//lib/active_support/inflector/inflections.rb#247 - 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#347 - 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#360 - 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 nil and it will use - # the configured I18n.locale. - # - # source://activesupport//lib/active_support/inflector/transliterate.rb#121 - 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 :en. - # - # 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#32 - 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#328 - 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 :en. - # - # 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#49 - 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#186 - 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+ is also aliased as +titlecase+. - # - # 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#174 - 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 i18n.transliterate.rule 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 i18n.transliterate.rule 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#92 - def underscore(camel_cased_word); end - - # Converts just the first character 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#155 - 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#389 - 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#370 - 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) - -# 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 :en. 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 'octopus', 'octopi' -# -# inflect.uncountable 'equipment' -# end -# -# New rules are added at the top. So in the example above, the irregular -# rule for octopus 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#28 -class ActiveSupport::Inflector::Inflections - # @return [Inflections] a new instance of Inflections - # - # source://activesupport//lib/active_support/inflector/inflections.rb#71 - 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#133 - def acronym(word); end - - # Returns the value of attribute acronyms. - # - # source://activesupport//lib/active_support/inflector/inflections.rb#67 - def acronyms; end - - # source://activesupport//lib/active_support/inflector/inflections.rb#69 - def acronyms_camelize_regex; end - - # source://activesupport//lib/active_support/inflector/inflections.rb#69 - def acronyms_underscore_regex; end - - # Clears the loaded inflections within a given scope (default is - # :all). Give the scope as a symbol of the inflection type, the - # options are: :plurals, :singulars, :uncountables, - # :humans. - # - # clear :all - # clear :plurals - # - # source://activesupport//lib/active_support/inflector/inflections.rb#222 - 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#211 - def human(rule, replacement); end - - # Returns the value of attribute humans. - # - # source://activesupport//lib/active_support/inflector/inflections.rb#67 - 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 'octopus', 'octopi' - # irregular 'person', 'people' - # - # source://activesupport//lib/active_support/inflector/inflections.rb#165 - 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#142 - def plural(rule, replacement); end - - # Returns the value of attribute plurals. - # - # source://activesupport//lib/active_support/inflector/inflections.rb#67 - 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#152 - def singular(rule, replacement); end - - # Returns the value of attribute singulars. - # - # source://activesupport//lib/active_support/inflector/inflections.rb#67 - 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#199 - def uncountable(*words); end - - # Returns the value of attribute uncountables. - # - # source://activesupport//lib/active_support/inflector/inflections.rb#67 - def uncountables; end - - private - - # source://activesupport//lib/active_support/inflector/inflections.rb#232 - def define_acronym_regex_patterns; end - - # Private, for the test suite. - # - # source://activesupport//lib/active_support/inflector/inflections.rb#77 - def initialize_dup(orig); end - - class << self - # source://activesupport//lib/active_support/inflector/inflections.rb#63 - def instance(locale = T.unsafe(nil)); end - end -end - -# source://activesupport//lib/active_support/inflector/inflections.rb#31 -class ActiveSupport::Inflector::Inflections::Uncountables < ::Array - # @return [Uncountables] a new instance of Uncountables - # - # source://activesupport//lib/active_support/inflector/inflections.rb#32 - def initialize; end - - # source://activesupport//lib/active_support/inflector/inflections.rb#42 - def <<(*word); end - - # source://activesupport//lib/active_support/inflector/inflections.rb#46 - def add(words); end - - # source://activesupport//lib/active_support/inflector/inflections.rb#37 - def delete(entry); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/inflector/inflections.rb#53 - def uncountable?(str); end - - private - - # source://activesupport//lib/active_support/inflector/inflections.rb#58 - def to_regex(string); end -end - -# +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' -# -# source://activesupport//lib/active_support/ordered_options.rb#79 -class ActiveSupport::InheritableOptions < ::ActiveSupport::OrderedOptions - # @return [InheritableOptions] a new instance of InheritableOptions - # - # source://activesupport//lib/active_support/ordered_options.rb#80 - def initialize(parent = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/ordered_options.rb#91 - def inheritable_copy; 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 - - # Dumps objects in JSON (JavaScript Object Notation). - # See http://www.json.org for more info. - # - # ActiveSupport::JSON.encode({ team: 'rails', players: '36' }) - # # => "{\"team\":\"rails\",\"players\":\"36\"}" - # - # source://activesupport//lib/active_support/json/encoding.rb#21 - def encode(value, options = T.unsafe(nil)); 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#42 - def parse_error; end - - private - - # source://activesupport//lib/active_support/json/decoding.rb#47 - 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#25 -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#121 - 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#121 - 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#129 - 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#129 - 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#125 - 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#125 - 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#117 - 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#117 - def use_standard_json_time_format=(_arg0); end - end -end - -# source://activesupport//lib/active_support/json/encoding.rb#26 -class ActiveSupport::JSON::Encoding::JSONGemEncoder - # @return [JSONGemEncoder] a new instance of JSONGemEncoder - # - # source://activesupport//lib/active_support/json/encoding.rb#29 - def initialize(options = T.unsafe(nil)); end - - # Encode the given object into a JSON string - # - # source://activesupport//lib/active_support/json/encoding.rb#34 - def encode(value); end - - # Returns the value of attribute options. - # - # source://activesupport//lib/active_support/json/encoding.rb#27 - def options; end - - private - - # Convert an object into a "JSON-ready" representation composed of - # primitives like Hash, Array, String, 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#89 - def jsonify(value); end - - # Encode a "jsonified" Ruby data structure using the JSON gem - # - # source://activesupport//lib/active_support/json/encoding.rb#109 - def stringify(jsonified); end -end - -# Rails does more escaping than the JSON gem natively does (we -# escape \u2028 and \u2029 and optionally >, <, & to work around -# certain browser problems). -# -# source://activesupport//lib/active_support/json/encoding.rb#42 -ActiveSupport::JSON::Encoding::JSONGemEncoder::ESCAPED_CHARS = T.let(T.unsafe(nil), Hash) - -# source://activesupport//lib/active_support/json/encoding.rb#51 -ActiveSupport::JSON::Encoding::JSONGemEncoder::ESCAPE_REGEX_WITHOUT_HTML_ENTITIES = T.let(T.unsafe(nil), Regexp) - -# source://activesupport//lib/active_support/json/encoding.rb#50 -ActiveSupport::JSON::Encoding::JSONGemEncoder::ESCAPE_REGEX_WITH_HTML_ENTITIES = T.let(T.unsafe(nil), Regexp) - -# This class wraps all the strings we see and does the extra escaping -# -# source://activesupport//lib/active_support/json/encoding.rb#54 -class ActiveSupport::JSON::Encoding::JSONGemEncoder::EscapedString < ::String - # source://activesupport//lib/active_support/json/encoding.rb#55 - def to_json(*_arg0); end - - # source://activesupport//lib/active_support/json/encoding.rb#67 - def to_s; end -end - -# 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#11 -class ActiveSupport::KeyGenerator - # @return [KeyGenerator] a new instance of KeyGenerator - # - # source://activesupport//lib/active_support/key_generator.rb#12 - 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. OpenSSL::Digest::SHA1#block_length - # - # source://activesupport//lib/active_support/key_generator.rb#22 - def generate_key(salt, key_size = T.unsafe(nil)); end -end - -# lazy_load_hooks 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) -# -# source://activesupport//lib/active_support/lazy_load_hooks.rb#25 -module ActiveSupport::LazyLoadHooks - # Declares a block that will be executed when a Rails component is fully - # loaded. - # - # Options: - # - # * :yield - Yields the object that run_load_hooks to +block+. - # * :run_once - Given +block+ will run only once. - # - # source://activesupport//lib/active_support/lazy_load_hooks.rb#41 - def on_load(name, options = T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/lazy_load_hooks.rb#49 - def run_load_hooks(name, base = T.unsafe(nil)); end - - private - - # source://activesupport//lib/active_support/lazy_load_hooks.rb#65 - def execute_hook(name, base, options, block); end - - # source://activesupport//lib/active_support/lazy_load_hooks.rb#57 - def with_execution_control(name, block, once); end - - class << self - # source://activesupport//lib/active_support/lazy_load_hooks.rb#26 - def extended(base); end - end -end - -# 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 -# def sql(event) -# info "#{event.payload[:name]} (#{event.duration}) #{event.payload[:sql]}" -# end -# end -# end -# -# And it's finally registered as: -# -# ActiveRecord::LogSubscriber.attach_to :active_record -# -# Since we need to know all instance methods before attaching the log -# subscriber, the line above should be called after your -# ActiveRecord::LogSubscriber definition. -# -# A logger also needs to be set with ActiveRecord::LogSubscriber.logger=. -# This is assigned automatically in a Rails environment. -# -# After configured, whenever a "sql.active_record" 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 -# -# Log subscriber also has some helpers to deal with logging and automatically -# flushes all logs when the request finishes -# (via action_dispatch.callback notification) in a Rails environment. -# -# source://activesupport//lib/active_support/log_subscriber.rb#66 -class ActiveSupport::LogSubscriber < ::ActiveSupport::Subscriber - # source://activesupport//lib/active_support/log_subscriber.rb#80 - def colorize_logging; end - - # source://activesupport//lib/active_support/log_subscriber.rb#80 - def colorize_logging=(val); end - - # source://activesupport//lib/active_support/log_subscriber.rb#125 - def debug(progname = T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/log_subscriber.rb#125 - def error(progname = T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/log_subscriber.rb#125 - def fatal(progname = T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/log_subscriber.rb#114 - def finish(name, id, payload); end - - # source://activesupport//lib/active_support/log_subscriber.rb#125 - def info(progname = T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/log_subscriber.rb#106 - def logger; end - - # source://activesupport//lib/active_support/log_subscriber.rb#110 - def start(name, id, payload); end - - # source://activesupport//lib/active_support/log_subscriber.rb#125 - def unknown(progname = T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/log_subscriber.rb#125 - def warn(progname = T.unsafe(nil), &block); end - - private - - # Set color by using a symbol or one of the defined constants. If a third - # option is set to +true+, it also adds bold to the string. This is based - # on the Highline implementation and will automatically append CLEAR to the - # end of the returned String. - # - # source://activesupport//lib/active_support/log_subscriber.rb#135 - def color(text, color, bold = T.unsafe(nil)); end - - class << self - # source://activesupport//lib/active_support/log_subscriber.rb#80 - def colorize_logging; end - - # source://activesupport//lib/active_support/log_subscriber.rb#80 - def colorize_logging=(val); end - - # Flush all log_subscribers' logger. - # - # source://activesupport//lib/active_support/log_subscriber.rb#96 - def flush_all!; end - - # source://activesupport//lib/active_support/log_subscriber.rb#91 - def log_subscribers; end - - # source://activesupport//lib/active_support/log_subscriber.rb#83 - 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#89 - def logger=(_arg0); end - - private - - # source://activesupport//lib/active_support/log_subscriber.rb#101 - def fetch_public_methods(subscriber, inherit_all); end - end -end - -# Colors -# -# source://activesupport//lib/active_support/log_subscriber.rb#71 -ActiveSupport::LogSubscriber::BLACK = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/log_subscriber.rb#75 -ActiveSupport::LogSubscriber::BLUE = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/log_subscriber.rb#68 -ActiveSupport::LogSubscriber::BOLD = T.let(T.unsafe(nil), String) - -# Embed in a String to clear all previous ANSI sequences. -# -# source://activesupport//lib/active_support/log_subscriber.rb#67 -ActiveSupport::LogSubscriber::CLEAR = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/log_subscriber.rb#77 -ActiveSupport::LogSubscriber::CYAN = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/log_subscriber.rb#73 -ActiveSupport::LogSubscriber::GREEN = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/log_subscriber.rb#76 -ActiveSupport::LogSubscriber::MAGENTA = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/log_subscriber.rb#72 -ActiveSupport::LogSubscriber::RED = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/log_subscriber.rb#78 -ActiveSupport::LogSubscriber::WHITE = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/log_subscriber.rb#74 -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#80 - 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 - # Broadcasts logs to multiple loggers. - # - # source://activesupport//lib/active_support/logger.rb#23 - def broadcast(logger); end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#13 - def local_levels; end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#13 - def local_levels=(val); end - - # Returns true if the logger destination matches one of the sources - # - # logger = Logger.new(STDOUT) - # ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT) - # # => true - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/logger.rb#16 - def logger_outputs_to?(logger, *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#87 -class ActiveSupport::Logger::SimpleFormatter < ::Logger::Formatter - # This method is invoked when a log event occurs - # - # source://activesupport//lib/active_support/logger.rb#88 - 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#9 -module ActiveSupport::LoggerThreadSafeLevel - extend ::ActiveSupport::Concern - - # Redefined to check severity against #level, and thus the thread-local level, rather than +@level+. - # FIXME: Remove when the minimum Ruby version supports overriding Logger#level. - # - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#59 - def add(severity, message = T.unsafe(nil), progname = T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18 - def debug?; end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18 - def error?; end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18 - def fatal?; end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18 - def info?; end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#45 - def level; end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#28 - def local_level; end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#32 - def local_level=(level); end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#24 - def local_log_id; end - - # Change the thread-local level for the duration of the given block. - # - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#50 - def log_at(level); end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18 - def unknown?; end - - # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18 - def warn?; end -end - -# source://activesupport//lib/active_support/core_ext/marshal.rb#6 -module ActiveSupport::MarshalWithAutoloading - # source://activesupport//lib/active_support/core_ext/marshal.rb#7 - def load(source, proc = T.unsafe(nil)); end -end - -# 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) # => # -# encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..." -# crypt.decrypt_and_verify(encrypted_data) # => "my secret data" -# -# === 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#81 -class ActiveSupport::MessageEncryptor - include ::ActiveSupport::Messages::Rotator - include ::ActiveSupport::Messages::Rotator::Encryptor - - # 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. - # - # First additional parameter is used as the signature key for +MessageVerifier+. - # This allows you to specify keys to encrypt and sign data. - # - # 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 - String of digest to use for signing. Default is - # +SHA1+. Ignored when using an AEAD cipher like 'aes-256-gcm'. - # * :serializer - Object serializer to use. Default is +Marshal+. - # - # @return [MessageEncryptor] a new instance of MessageEncryptor - # - # source://activesupport//lib/active_support/messages/rotator.rb#6 - def initialize(*secrets, on_rotation: T.unsafe(nil), **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/. - # - # source://activesupport//lib/active_support/messages/rotator.rb#21 - def decrypt_and_verify(*args, on_rotation: T.unsafe(nil), **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/. - # - # source://activesupport//lib/active_support/message_encryptor.rb#147 - def encrypt_and_sign(value, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end - - private - - # source://activesupport//lib/active_support/message_encryptor.rb#180 - def _decrypt(encrypted_message, purpose); end - - # source://activesupport//lib/active_support/message_encryptor.rb#163 - def _encrypt(value, **metadata_options); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/message_encryptor.rb#212 - def aead_mode?; end - - # source://activesupport//lib/active_support/message_encryptor.rb#206 - def new_cipher; end - - # source://activesupport//lib/active_support/message_encryptor.rb#216 - def resolve_verifier; end - - # Returns the value of attribute verifier. - # - # source://activesupport//lib/active_support/message_encryptor.rb#210 - def verifier; end - - class << self - # source://activesupport//lib/active_support/message_encryptor.rb#87 - 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#158 - def key_len(cipher = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/message_encryptor.rb#84 - def use_authenticated_message_encryption; end - - # source://activesupport//lib/active_support/message_encryptor.rb#84 - def use_authenticated_message_encryption=(val); end - end -end - -# source://activesupport//lib/active_support/message_encryptor.rb#116 -class ActiveSupport::MessageEncryptor::InvalidMessage < ::StandardError; end - -# source://activesupport//lib/active_support/message_encryptor.rb#96 -module ActiveSupport::MessageEncryptor::NullSerializer - class << self - # source://activesupport//lib/active_support/message_encryptor.rb#101 - def dump(value); end - - # source://activesupport//lib/active_support/message_encryptor.rb#97 - def load(value); end - end -end - -# source://activesupport//lib/active_support/message_encryptor.rb#106 -module ActiveSupport::MessageEncryptor::NullVerifier - class << self - # source://activesupport//lib/active_support/message_encryptor.rb#111 - def generate(value); end - - # source://activesupport//lib/active_support/message_encryptor.rb#107 - def verify(value); end - end -end - -# source://activesupport//lib/active_support/message_encryptor.rb#117 -ActiveSupport::MessageEncryptor::OpenSSLCipherError = OpenSSL::Cipher::CipherError - -# +MessageVerifier+ makes it easy to generate and verify messages which are -# signed to prevent tampering. -# -# This is useful for cases like remember-me tokens and auto-unsubscribe links -# where the session store isn't suitable or available. -# -# Remember Me: -# cookies[:remember_me] = @verifier.generate([@user.id, 2.weeks.from_now]) -# -# In the authentication filter: -# -# id, time = @verifier.verify(cookies[:remember_me]) -# if Time.now < time -# self.current_user = User.find(id) -# end -# -# By default it uses Marshal to serialize the message. If you want to use -# another serialization method, you can set the serializer in the options -# hash upon initialization: -# -# @verifier = ActiveSupport::MessageVerifier.new('s3Krit', serializer: YAML) -# -# +MessageVerifier+ creates HMAC signatures using SHA1 hash algorithm by default. -# If you want to use a different hash algorithm, you can change it by providing -# +:digest+ key as an option while initializing the verifier: -# -# @verifier = ActiveSupport::MessageVerifier.new('s3Krit', digest: 'SHA256') -# -# === 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 = @verifier.generate("this is the chair", purpose: :login) -# -# Then that same purpose must be passed when verifying to get the data back out: -# -# @verifier.verified(token, purpose: :login) # => "this is the chair" -# @verifier.verified(token, purpose: :shipping) # => nil -# @verifier.verified(token) # => nil -# -# @verifier.verify(token, purpose: :login) # => "this is the chair" -# @verifier.verify(token, purpose: :shipping) # => ActiveSupport::MessageVerifier::InvalidSignature -# @verifier.verify(token) # => ActiveSupport::MessageVerifier::InvalidSignature -# -# Likewise, if a message has no purpose it won't be returned when verifying with -# a specific purpose. -# -# token = @verifier.generate("the conversation is lively") -# @verifier.verified(token, purpose: :scare_tactics) # => nil -# @verifier.verified(token) # => "the conversation is lively" -# -# @verifier.verify(token, purpose: :scare_tactics) # => ActiveSupport::MessageVerifier::InvalidSignature -# @verifier.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+. -# -# @verifier.generate(parcel, expires_in: 1.month) -# @verifier.generate(doowad, expires_at: Time.now.end_of_year) -# -# Then the messages can be verified and returned up to the expire time. -# 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 to -# 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#101 -class ActiveSupport::MessageVerifier - include ::ActiveSupport::Messages::Rotator - include ::ActiveSupport::Messages::Rotator::Verifier - - # @raise [ArgumentError] - # @return [MessageVerifier] a new instance of MessageVerifier - # - # source://activesupport//lib/active_support/messages/rotator.rb#6 - def initialize(*secrets, on_rotation: T.unsafe(nil), **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 's3Krit' - # verifier.generate 'a private message' # => "BAhJIhRwcml2YXRlLW1lc3NhZ2UGOgZFVA==--e2d724331ebdee96a10fb99b089508d1c72bd772" - # - # source://activesupport//lib/active_support/message_verifier.rb#186 - def generate(value, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end - - # Checks if a signed message could have been generated by signing an object - # with the +MessageVerifier+'s secret. - # - # verifier = ActiveSupport::MessageVerifier.new 's3Krit' - # signed_message = verifier.generate 'a private 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#122 - def valid_message?(signed_message); end - - # Decodes the signed message using the +MessageVerifier+'s secret. - # - # verifier = ActiveSupport::MessageVerifier.new 's3Krit' - # - # signed_message = verifier.generate 'a private message' - # verifier.verified(signed_message) # => 'a private message' - # - # Returns +nil+ if the message was not signed with the same secret. - # - # other_verifier = ActiveSupport::MessageVerifier.new 'd1ff3r3nt-s3Krit' - # 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 - # - # source://activesupport//lib/active_support/messages/rotator.rb#36 - def verified(*args, on_rotation: T.unsafe(nil), **options); end - - # Decodes the signed message using the +MessageVerifier+'s secret. - # - # verifier = ActiveSupport::MessageVerifier.new 's3Krit' - # signed_message = verifier.generate 'a private message' - # - # verifier.verify(signed_message) # => 'a private message' - # - # Raises +InvalidSignature+ if the message was not signed with the same - # secret or was not Base64-encoded. - # - # other_verifier = ActiveSupport::MessageVerifier.new 'd1ff3r3nt-s3Krit' - # other_verifier.verify(signed_message) # => ActiveSupport::MessageVerifier::InvalidSignature - # - # source://activesupport//lib/active_support/message_verifier.rb#175 - def verify(*args, **options); end - - private - - # source://activesupport//lib/active_support/message_verifier.rb#196 - def decode(data); end - - # source://activesupport//lib/active_support/message_verifier.rb#192 - def encode(data); end - - # source://activesupport//lib/active_support/message_verifier.rb#200 - def generate_digest(data); end -end - -# source://activesupport//lib/active_support/message_verifier.rb#104 -class ActiveSupport::MessageVerifier::InvalidSignature < ::StandardError; end - -# source://activesupport//lib/active_support/messages/rotator.rb#4 -module ActiveSupport::Messages; end - -# source://activesupport//lib/active_support/messages/metadata.rb#7 -class ActiveSupport::Messages::Metadata - # @return [Metadata] a new instance of Metadata - # - # source://activesupport//lib/active_support/messages/metadata.rb#8 - def initialize(message, expires_at = T.unsafe(nil), purpose = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/messages/metadata.rb#13 - def as_json(options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/messages/metadata.rb#58 - def verify(purpose); end - - private - - # @return [Boolean] - # - # source://activesupport//lib/active_support/messages/metadata.rb#67 - def fresh?; end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/messages/metadata.rb#63 - def match?(purpose); end - - # source://activesupport//lib/active_support/messages/metadata.rb#71 - def parse_expires_at(expires_at); end - - class << self - # source://activesupport//lib/active_support/messages/metadata.rb#26 - def verify(message, purpose); end - - # source://activesupport//lib/active_support/messages/metadata.rb#18 - def wrap(message, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end - - private - - # source://activesupport//lib/active_support/messages/metadata.rb#53 - def decode(message); end - - # source://activesupport//lib/active_support/messages/metadata.rb#49 - def encode(message); end - - # source://activesupport//lib/active_support/messages/metadata.rb#39 - def extract_metadata(message); end - - # source://activesupport//lib/active_support/messages/metadata.rb#31 - def pick_expiry(expires_at, expires_in); end - 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(*secrets, on_rotation: T.unsafe(nil), **options); end - - # source://activesupport//lib/active_support/messages/rotator.rb#14 - def rotate(*secrets, **options); end - - private - - # source://activesupport//lib/active_support/messages/rotator.rb#47 - def run_rotations(on_rotation); end -end - -# source://activesupport//lib/active_support/messages/rotator.rb#18 -module ActiveSupport::Messages::Rotator::Encryptor - include ::ActiveSupport::Messages::Rotator - - # source://activesupport//lib/active_support/messages/rotator.rb#21 - def decrypt_and_verify(*args, on_rotation: T.unsafe(nil), **options); end - - private - - # source://activesupport//lib/active_support/messages/rotator.rb#28 - def build_rotation(secret = T.unsafe(nil), sign_secret = T.unsafe(nil), options); end -end - -# source://activesupport//lib/active_support/messages/rotator.rb#33 -module ActiveSupport::Messages::Rotator::Verifier - include ::ActiveSupport::Messages::Rotator - - # source://activesupport//lib/active_support/messages/rotator.rb#36 - def verified(*args, on_rotation: T.unsafe(nil), **options); end - - private - - # source://activesupport//lib/active_support/messages/rotator.rb#41 - def build_rotation(secret = T.unsafe(nil), options); end -end - -# 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 - -# 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 -# # => # -# -# 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#46 -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#55 - def initialize(string); end - - # source://activesupport//lib/active_support/multibyte/chars.rb#52 - def <=>(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/multibyte/chars.rb#52 - def =~(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/multibyte/chars.rb#52 - def acts_like_string?(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/multibyte/chars.rb#160 - def as_json(options = T.unsafe(nil)); end - - # Performs composition on all the characters. - # - # 'é'.length # => 3 - # 'é'.mb_chars.compose.to_s.length # => 2 - # - # source://activesupport//lib/active_support/multibyte/chars.rb#139 - def compose; end - - # Performs canonical decomposition on all the characters. - # - # 'é'.length # => 2 - # 'é'.mb_chars.decompose.to_s.length # => 3 - # - # source://activesupport//lib/active_support/multibyte/chars.rb#131 - def decompose; end - - # Returns the number of grapheme clusters in the string. - # - # 'क्षि'.mb_chars.length # => 4 - # 'क्षि'.mb_chars.grapheme_length # => 3 - # - # source://activesupport//lib/active_support/multibyte/chars.rb#147 - 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#114 - def limit(limit); end - - # source://activesupport//lib/active_support/multibyte/chars.rb#52 - def match?(*_arg0, **_arg1, &_arg2); end - - # Forward all undefined methods to the wrapped string. - # - # source://activesupport//lib/active_support/multibyte/chars.rb#61 - def method_missing(method, *args, &block); end - - # Reverses all characters in the string. - # - # 'Café'.mb_chars.reverse.to_s # => 'éfaC' - # - # source://activesupport//lib/active_support/multibyte/chars.rb#105 - def reverse; end - - # source://activesupport//lib/active_support/multibyte/chars.rb#165 - def reverse!(*args); end - - # Works like String#slice!, 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) # => # - # string # => 'Welome' - # string.mb_chars.slice!(0..3) # => # - # string # => 'me' - # - # source://activesupport//lib/active_support/multibyte/chars.rb#95 - def slice!(*args); end - - # Works just like String#split, 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#82 - 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#156 - def tidy_bytes(force = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/multibyte/chars.rb#165 - 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#122 - 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#122 - def titleize; end - - # Returns the value of attribute wrapped_string. - # - # source://activesupport//lib/active_support/multibyte/chars.rb#48 - def to_s; end - - # Returns the value of attribute wrapped_string. - # - # source://activesupport//lib/active_support/multibyte/chars.rb#48 - def to_str; end - - # Returns the value of attribute wrapped_string. - # - # source://activesupport//lib/active_support/multibyte/chars.rb#48 - def wrapped_string; end - - private - - # source://activesupport//lib/active_support/multibyte/chars.rb#172 - 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#73 - 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#33 - def compose(codepoints); end - - # Decompose composed characters to the decomposed form. - # - # source://activesupport//lib/active_support/multibyte/unicode.rb#24 - def decompose(type, codepoints); end - - # source://activesupport//lib/active_support/multibyte/unicode.rb#11 - def default_normalization_form; end - - # source://activesupport//lib/active_support/multibyte/unicode.rb#17 - def default_normalization_form=(_); 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#44 - def tidy_bytes(string, force = T.unsafe(nil)); end - - private - - # source://activesupport//lib/active_support/multibyte/unicode.rb#77 - 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 |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 # => Monotonic time, when the instrumented block started execution -# finish # => Monotonic time, when the instrumented block ended execution -# id # => String, unique ID for the instrumenter that fired the event -# payload # => Hash, the payload -# end -# -# The +start+ and +finish+ values above represent monotonic time. -# -# For instance, let's store all "render" events in an array: -# -# events = [] -# -# ActiveSupport::Notifications.subscribe('render') do |*args| -# events << ActiveSupport::Notifications::Event.new(*args) -# 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 } -# -# The block in the subscribe call gets the name of the event, start -# timestamp, end timestamp, a string with a unique identifier for that event's instrumenter -# (something like "535801666f04d0298cd6"), and a hash with the payload, in -# that order. -# -# If an exception happens during that particular instrumentation the payload will -# have a key :exception with an array of two elements as value: a string with -# the name of the exception class, and the exception message. -# The :exception_object key of the payload will have the exception -# itself as the value: -# -# event.payload[:exception] # => ["ArgumentError", "Invalid value"] -# event.payload[:exception_object] # => # -# -# 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 call method -# as the second parameter to the subscribe 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 subscribe, 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 {|*args| ... } -# 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 :monotonic option to the -# subscribed method. The :monotonic 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 |*args| -# ... -# 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#6 -module ActiveSupport::Notifications - class << self - # source://activesupport//lib/active_support/notifications.rb#201 - def instrument(name, payload = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/notifications.rb#253 - def instrumenter; end - - # source://activesupport//lib/active_support/notifications.rb#238 - 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#195 - def notifier; end - - # Sets the attribute notifier - # - # @param value the value to set the attribute notifier to. - # - # source://activesupport//lib/active_support/notifications.rb#195 - def notifier=(_arg0); end - - # source://activesupport//lib/active_support/notifications.rb#197 - def publish(name, *args); 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. - # - # ActiveSupport::Notifications.subscribe(/render/) do |*args| - # @event = ActiveSupport::Notifications::Event.new(*args) - # end - # - # The +block+ will receive five parameters 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 - # - # If the block passed to the method only takes one parameter, - # it will yield an event object to the block: - # - # ActiveSupport::Notifications.subscribe(/render/) do |event| - # @event = event - # end - # - # source://activesupport//lib/active_support/notifications.rb#234 - def subscribe(pattern = T.unsafe(nil), callback = T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/notifications.rb#242 - def subscribed(callback, pattern = T.unsafe(nil), monotonic: T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/notifications.rb#249 - def unsubscribe(subscriber_or_name); end - end -end - -# source://activesupport//lib/active_support/notifications/instrumenter.rb#54 -class ActiveSupport::Notifications::Event - # @return [Event] a new instance of Event - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#58 - def initialize(name, start, ending, transaction_id, payload); end - - # source://activesupport//lib/active_support/notifications/instrumenter.rb#119 - def <<(event); end - - # Returns the number of allocations made since the call to +start!+ and - # the call to +finish!+ - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#99 - def allocations; end - - # Returns the value of attribute children. - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#55 - def children; end - - # Returns the CPU time (in milliseconds) passed since the call to - # +start!+ and the call to +finish!+ - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#87 - 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 |*args| - # @event = ActiveSupport::Notifications::Event.new(*args) - # end - # - # ActiveSupport::Notifications.instrument('wait') do - # sleep 1 - # end - # - # @event.duration # => 1000.138 - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#115 - def duration; end - - # Returns the value of attribute end. - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#55 - def end; end - - # Record information at the time this event finishes - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#79 - def finish!; end - - # Returns the idle time time (in milliseconds) passed since the call to - # +start!+ and the call to +finish!+ - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#93 - def idle_time; end - - # Returns the value of attribute name. - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#55 - def name; end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#123 - def parent_of?(event); end - - # Returns the value of attribute payload. - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#56 - 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#56 - def payload=(_arg0); end - - # Record information at the time this event starts - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#72 - def start!; end - - # Returns the value of attribute time. - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#55 - def time; end - - # Returns the value of attribute transaction_id. - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#55 - def transaction_id; end - - private - - # source://activesupport//lib/active_support/notifications/instrumenter.rb#128 - def now; end - - # source://activesupport//lib/active_support/notifications/instrumenter.rb#149 - def now_allocations; end - - # source://activesupport//lib/active_support/notifications/instrumenter.rb#139 - def now_cpu; 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#14 -class ActiveSupport::Notifications::Fanout - include ::Mutex_m - - # @return [Fanout] a new instance of Fanout - # - # source://activesupport//lib/active_support/notifications/fanout.rb#17 - def initialize; end - - # source://activesupport//lib/active_support/notifications/fanout.rb#62 - def finish(name, id, payload, listeners = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#70 - def listeners_for(name); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/notifications/fanout.rb#79 - def listening?(name); end - - # source://mutex_m/0.1.1/mutex_m.rb#93 - def lock; end - - # source://mutex_m/0.1.1/mutex_m.rb#83 - def locked?; end - - # source://activesupport//lib/active_support/notifications/fanout.rb#66 - def publish(name, *args); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#58 - def start(name, id, payload); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#24 - def subscribe(pattern = T.unsafe(nil), callable = T.unsafe(nil), monotonic: T.unsafe(nil), &block); end - - # source://mutex_m/0.1.1/mutex_m.rb#78 - def synchronize(&block); end - - # source://mutex_m/0.1.1/mutex_m.rb#88 - def try_lock; end - - # source://mutex_m/0.1.1/mutex_m.rb#98 - def unlock; end - - # source://activesupport//lib/active_support/notifications/fanout.rb#38 - def unsubscribe(subscriber_or_name); end - - # This is a sync queue, so there is no waiting. - # - # source://activesupport//lib/active_support/notifications/fanout.rb#84 - def wait; end -end - -# source://activesupport//lib/active_support/notifications/fanout.rb#87 -module ActiveSupport::Notifications::Fanout::Subscribers - class << self - # source://activesupport//lib/active_support/notifications/fanout.rb#88 - def new(pattern, listener, monotonic); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#107 - def wrap_all(pattern, subscriber); end - end -end - -# source://activesupport//lib/active_support/notifications/fanout.rb#229 -class ActiveSupport::Notifications::Fanout::Subscribers::AllMessages - # @return [AllMessages] a new instance of AllMessages - # - # source://activesupport//lib/active_support/notifications/fanout.rb#230 - def initialize(delegate); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#238 - def finish(name, id, payload); end - - def matches?(_arg0); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#242 - def publish(name, *args); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#234 - def start(name, id, payload); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/notifications/fanout.rb#246 - def subscribed_to?(name); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#250 - def unsubscribe!(*_arg0); end -end - -# source://activesupport//lib/active_support/notifications/fanout.rb#207 -class ActiveSupport::Notifications::Fanout::Subscribers::EventObject < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented - # source://activesupport//lib/active_support/notifications/fanout.rb#215 - def finish(name, id, payload); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#208 - def start(name, id, payload); end - - private - - # source://activesupport//lib/active_support/notifications/fanout.rb#224 - def build_event(name, id, payload); end -end - -# source://activesupport//lib/active_support/notifications/fanout.rb#137 -class ActiveSupport::Notifications::Fanout::Subscribers::Evented - # @return [Evented] a new instance of Evented - # - # source://activesupport//lib/active_support/notifications/fanout.rb#140 - def initialize(pattern, delegate); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#156 - def finish(name, id, payload); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/notifications/fanout.rb#164 - def matches?(name); end - - # Returns the value of attribute pattern. - # - # source://activesupport//lib/active_support/notifications/fanout.rb#138 - def pattern; end - - # source://activesupport//lib/active_support/notifications/fanout.rb#146 - def publish(name, *args); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#152 - def start(name, id, payload); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/notifications/fanout.rb#160 - def subscribed_to?(name); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#168 - def unsubscribe!(name); end -end - -# source://activesupport//lib/active_support/notifications/fanout.rb#115 -class ActiveSupport::Notifications::Fanout::Subscribers::Matcher - # @return [Matcher] a new instance of Matcher - # - # source://activesupport//lib/active_support/notifications/fanout.rb#123 - def initialize(pattern); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#132 - def ===(name); end - - # Returns the value of attribute exclusions. - # - # source://activesupport//lib/active_support/notifications/fanout.rb#116 - def exclusions; end - - # Returns the value of attribute pattern. - # - # source://activesupport//lib/active_support/notifications/fanout.rb#116 - def pattern; end - - # source://activesupport//lib/active_support/notifications/fanout.rb#128 - def unsubscribe!(name); end - - class << self - # source://activesupport//lib/active_support/notifications/fanout.rb#118 - def wrap(pattern); end - end -end - -# source://activesupport//lib/active_support/notifications/fanout.rb#190 -class ActiveSupport::Notifications::Fanout::Subscribers::MonotonicTimed < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented - # source://activesupport//lib/active_support/notifications/fanout.rb#200 - def finish(name, id, payload); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#191 - def publish(name, *args); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#195 - def start(name, id, payload); end -end - -# source://activesupport//lib/active_support/notifications/fanout.rb#173 -class ActiveSupport::Notifications::Fanout::Subscribers::Timed < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented - # source://activesupport//lib/active_support/notifications/fanout.rb#183 - def finish(name, id, payload); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#174 - def publish(name, *args); end - - # source://activesupport//lib/active_support/notifications/fanout.rb#178 - def start(name, id, payload); end -end - -# This class is a registry which holds all of the +Instrumenter+ objects -# in a particular thread local. To access the +Instrumenter+ object for a -# particular +notifier+, you can call the following method: -# -# InstrumentationRegistry.instrumenter_for(notifier) -# -# The instrumenters for multiple notifiers are held in a single instance of -# this class. -# -# source://activesupport//lib/active_support/notifications.rb#266 -class ActiveSupport::Notifications::InstrumentationRegistry - extend ::ActiveSupport::PerThreadRegistry - - # @return [InstrumentationRegistry] a new instance of InstrumentationRegistry - # - # source://activesupport//lib/active_support/notifications.rb#269 - def initialize; end - - # source://activesupport//lib/active_support/notifications.rb#273 - def instrumenter_for(notifier); end -end - -# Instrumenters are stored in a thread local. -# -# source://activesupport//lib/active_support/notifications/instrumenter.rb#8 -class ActiveSupport::Notifications::Instrumenter - # @return [Instrumenter] a new instance of Instrumenter - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#11 - def initialize(notifier); end - - # Send a finish notification with +name+ and +payload+. - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#40 - def finish(name, payload); end - - # source://activesupport//lib/active_support/notifications/instrumenter.rb#44 - def finish_with_state(listeners_state, name, payload); end - - # Returns the value of attribute id. - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#9 - 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#20 - def instrument(name, payload = T.unsafe(nil)); end - - # Send a start notification with +name+ and +payload+. - # - # source://activesupport//lib/active_support/notifications/instrumenter.rb#35 - def start(name, payload); end - - private - - # source://activesupport//lib/active_support/notifications/instrumenter.rb#49 - def unique_id; 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 (e.g., $13.65). You - # can customize the format in the +options+ hash. - # - # The currency unit and number formatting of the current locale will be used - # unless otherwise specified in the provided 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 - Sets the locale to be used for formatting - # (defaults to current locale). - # * :precision - Sets the level of precision (defaults - # to 2). - # * :round_mode - Determine how rounding is performed - # (defaults to :default. See BigDecimal::mode) - # * :unit - Sets the denomination of the currency - # (defaults to "$"). - # * :separator - Sets the separator between the units - # (defaults to "."). - # * :delimiter - Sets the thousands delimiter (defaults - # to ","). - # * :format - Sets the format for non-negative numbers - # (defaults to "%u%n"). Fields are %u for the - # currency, and %n for the number. - # * :negative_format - Sets the format for negative - # numbers (defaults to prepending a hyphen to the formatted - # number given by :format). Accepts the same fields - # than :format, except %n is here the - # absolute value of the number. - # * :strip_insignificant_zeros - If +true+ removes - # insignificant zeros after the decimal separator (defaults to - # +false+). - # - # ==== Examples - # - # number_to_currency(1234567890.50) # => "$1,234,567,890.50" - # number_to_currency(1234567890.506) # => "$1,234,567,890.51" - # number_to_currency(1234567890.506, precision: 3) # => "$1,234,567,890.506" - # number_to_currency(1234567890.506, locale: :fr) # => "1 234 567 890,51 €" - # number_to_currency('123a456') # => "$123a456" - # - # number_to_currency("123a456", raise: true) # => InvalidNumberError - # - # number_to_currency(-0.456789, precision: 0) - # # => "$0" - # number_to_currency(-1234567890.50, negative_format: '(%u%n)') - # # => "($1,234,567,890.50)" - # number_to_currency(1234567890.50, unit: '£', separator: ',', delimiter: '') - # # => "£1234567890,50" - # number_to_currency(1234567890.50, unit: '£', separator: ',', delimiter: '', format: '%n %u') - # # => "1234567890,50 £" - # number_to_currency(1234567890.50, strip_insignificant_zeros: true) - # # => "$1,234,567,890.5" - # number_to_currency(1234567890.50, precision: 0, round_mode: :up) - # # => "$1,234,567,891" - # - # source://activesupport//lib/active_support/number_helper.rb#116 - def number_to_currency(number, options = T.unsafe(nil)); end - - # Formats a +number+ with grouped thousands using +delimiter+ - # (e.g., 12,324). You can customize the format in the +options+ - # hash. - # - # ==== Options - # - # * :locale - Sets the locale to be used for formatting - # (defaults to current locale). - # * :delimiter - Sets the thousands delimiter (defaults - # to ","). - # * :separator - Sets the separator between the - # fractional and integer digits (defaults to "."). - # * :delimiter_pattern - Sets a custom regular expression used for - # deriving the placement of delimiter. Helpful when using currency formats - # like INR. - # - # ==== Examples - # - # number_to_delimited(12345678) # => "12,345,678" - # number_to_delimited('123456') # => "123,456" - # number_to_delimited(12345678.05) # => "12,345,678.05" - # number_to_delimited(12345678, delimiter: '.') # => "12.345.678" - # number_to_delimited(12345678, delimiter: ',') # => "12,345,678" - # number_to_delimited(12345678.05, separator: ' ') # => "12,345,678 05" - # number_to_delimited(12345678.05, locale: :fr) # => "12 345 678,05" - # number_to_delimited('112a') # => "112a" - # number_to_delimited(98765432.98, delimiter: ' ', separator: ',') - # # => "98 765 432,98" - # number_to_delimited("123456.78", - # delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/) - # # => "1,23,456.78" - # - # source://activesupport//lib/active_support/number_helper.rb#191 - def number_to_delimited(number, options = T.unsafe(nil)); end - - # Pretty prints (formats and approximates) a number in a way it - # is more readable by humans (e.g.: 1200000000 becomes "1.2 - # Billion"). This is useful for numbers that can get very large - # (and too hard to read). - # - # See number_to_human_size if you want to print a file - # size. - # - # You can also define your own unit-quantifier names if you want - # to use other decimal units (e.g.: 1500 becomes "1.5 - # kilometers", 0.150 becomes "150 milliliters", etc). You may - # define a wide range of unit quantifiers, even fractional ones - # (centi, deci, mili, etc). - # - # ==== Options - # - # * :locale - Sets the locale to be used for formatting - # (defaults to current locale). - # * :precision - Sets the precision of the number - # (defaults to 3). - # * :round_mode - Determine how rounding is performed - # (defaults to :default. See BigDecimal::mode) - # * :significant - If +true+, precision will be the number - # of significant_digits. If +false+, the number of fractional - # digits (defaults to +true+) - # * :separator - Sets the separator between the - # fractional and integer digits (defaults to "."). - # * :delimiter - Sets the thousands delimiter (defaults - # to ""). - # * :strip_insignificant_zeros - If +true+ removes - # insignificant zeros after the decimal separator (defaults to - # +true+) - # * :units - A Hash of unit quantifier names. Or a - # string containing an i18n scope where to find this hash. It - # might have the following keys: - # * *integers*: :unit, :ten, - # :hundred, :thousand, :million, - # :billion, :trillion, - # :quadrillion - # * *fractionals*: :deci, :centi, - # :mili, :micro, :nano, - # :pico, :femto - # * :format - Sets the format of the output string - # (defaults to "%n %u"). The field types are: - # * %u - The quantifier (ex.: 'thousand') - # * %n - The number - # - # ==== Examples - # - # 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" - # number_to_human(489939, precision: 2) # => "490 Thousand" - # number_to_human(489939, precision: 4) # => "489.9 Thousand" - # number_to_human(489939, precision: 2 - # , round_mode: :down) # => "480 Thousand" - # number_to_human(1234567, precision: 4, - # significant: false) # => "1.2346 Million" - # number_to_human(1234567, precision: 1, - # separator: ',', - # significant: false) # => "1,2 Million" - # - # number_to_human(500000000, precision: 5) # => "500 Million" - # number_to_human(12345012345, significant: false) # => "12.345 Billion" - # - # Non-significant zeros after the decimal separator are stripped - # out by default (set :strip_insignificant_zeros to - # +false+ to change that): - # - # number_to_human(12.00001) # => "12" - # number_to_human(12.00001, strip_insignificant_zeros: false) # => "12.0" - # - # ==== Custom Unit Quantifiers - # - # You can also use your own custom unit quantifiers: - # number_to_human(500000, units: { unit: 'ml', thousand: 'lt' }) # => "500 lt" - # - # If in your I18n locale you have: - # - # distance: - # centi: - # one: "centimeter" - # other: "centimeters" - # unit: - # one: "meter" - # other: "meters" - # thousand: - # one: "kilometer" - # other: "kilometers" - # billion: "gazillion-distance" - # - # Then you could do: - # - # number_to_human(543934, units: :distance) # => "544 kilometers" - # number_to_human(54393498, units: :distance) # => "54400 kilometers" - # number_to_human(54393498000, units: :distance) # => "54.4 gazillion-distance" - # number_to_human(343, units: :distance, precision: 1) # => "300 meters" - # number_to_human(1, units: :distance) # => "1 meter" - # number_to_human(0.34, units: :distance) # => "34 centimeters" - # - # source://activesupport//lib/active_support/number_helper.rb#393 - def number_to_human(number, options = T.unsafe(nil)); end - - # Formats the bytes in +number+ into a more understandable - # representation (e.g., giving it 1500 yields 1.46 KB). This - # method is useful for reporting file sizes to users. You can - # customize the format in the +options+ hash. - # - # See number_to_human if you want to pretty-print a - # generic number. - # - # ==== Options - # - # * :locale - Sets the locale to be used for formatting - # (defaults to current locale). - # * :precision - Sets the precision of the number - # (defaults to 3). - # * :round_mode - Determine how rounding is performed - # (defaults to :default. See BigDecimal::mode) - # * :significant - If +true+, precision will be the number - # of significant_digits. If +false+, the number of fractional - # digits (defaults to +true+) - # * :separator - Sets the separator between the - # fractional and integer digits (defaults to "."). - # * :delimiter - Sets the thousands delimiter (defaults - # to ""). - # * :strip_insignificant_zeros - If +true+ removes - # insignificant zeros after the decimal separator (defaults to - # +true+) - # - # ==== Examples - # - # 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" - # number_to_human_size(1234567, precision: 2) # => "1.2 MB" - # number_to_human_size(483989, precision: 2) # => "470 KB" - # number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB" - # number_to_human_size(1234567, precision: 2, separator: ',') # => "1,2 MB" - # number_to_human_size(1234567890123, precision: 5) # => "1.1228 TB" - # number_to_human_size(524288000, precision: 5) # => "500 MB" - # - # source://activesupport//lib/active_support/number_helper.rb#285 - def number_to_human_size(number, options = T.unsafe(nil)); end - - # Formats a +number+ as a percentage string (e.g., 65%). You can - # customize the format in the +options+ hash. - # - # ==== Options - # - # * :locale - Sets the locale to be used for formatting - # (defaults to current locale). - # * :precision - Sets the precision of the number - # (defaults to 3). Keeps the number's precision if +nil+. - # * :round_mode - Determine how rounding is performed - # (defaults to :default. See BigDecimal::mode) - # * :significant - If +true+, precision will be the number - # of significant_digits. If +false+, the number of fractional - # digits (defaults to +false+). - # * :separator - Sets the separator between the - # fractional and integer digits (defaults to "."). - # * :delimiter - Sets the thousands delimiter (defaults - # to ""). - # * :strip_insignificant_zeros - If +true+ removes - # insignificant zeros after the decimal separator (defaults to - # +false+). - # * :format - Specifies the format of the percentage - # string The number field is %n (defaults to "%n%"). - # - # ==== Examples - # - # number_to_percentage(100) # => "100.000%" - # number_to_percentage('98') # => "98.000%" - # number_to_percentage(100, precision: 0) # => "100%" - # number_to_percentage(1000, delimiter: '.', separator: ',') # => "1.000,000%" - # number_to_percentage(302.24398923423, precision: 5) # => "302.24399%" - # number_to_percentage(1000, locale: :fr) # => "1000,000%" - # number_to_percentage(1000, precision: nil) # => "1000%" - # number_to_percentage('98a') # => "98a%" - # number_to_percentage(100, format: '%n %') # => "100.000 %" - # number_to_percentage(302.24398923423, precision: 5, round_mode: :down) # => "302.24398%" - # - # source://activesupport//lib/active_support/number_helper.rb#156 - def number_to_percentage(number, options = T.unsafe(nil)); end - - # Formats a +number+ into a phone number (US by default e.g., (555) - # 123-9876). You can customize the format in the +options+ hash. - # - # ==== Options - # - # * :area_code - Adds parentheses around the area code. - # * :delimiter - Specifies the delimiter to use - # (defaults to "-"). - # * :extension - Specifies an extension to add to the - # end of the generated number. - # * :country_code - Sets the country code for the phone - # number. - # * :pattern - Specifies how the number is divided into three - # groups with the custom regexp to override the default format. - # ==== Examples - # - # number_to_phone(5551234) # => "555-1234" - # number_to_phone('5551234') # => "555-1234" - # number_to_phone(1235551234) # => "123-555-1234" - # number_to_phone(1235551234, area_code: true) # => "(123) 555-1234" - # number_to_phone(1235551234, delimiter: ' ') # => "123 555 1234" - # number_to_phone(1235551234, area_code: true, extension: 555) # => "(123) 555-1234 x 555" - # number_to_phone(1235551234, country_code: 1) # => "+1-123-555-1234" - # number_to_phone('123a456') # => "123a456" - # - # number_to_phone(1235551234, country_code: 1, extension: 1343, delimiter: '.') - # # => "+1.123.555.1234 x 1343" - # - # number_to_phone(75561234567, pattern: /(\d{1,4})(\d{4})(\d{4})$/, area_code: true) - # # => "(755) 6123-4567" - # number_to_phone(13312345678, pattern: /(\d{3})(\d{4})(\d{4})$/) - # # => "133-1234-5678" - # - # source://activesupport//lib/active_support/number_helper.rb#53 - def number_to_phone(number, options = T.unsafe(nil)); end - - # Formats a +number+ with the specified level of - # :precision (e.g., 112.32 has a precision of 2 if - # +:significant+ is +false+, and 5 if +:significant+ is +true+). - # You can customize the format in the +options+ hash. - # - # ==== Options - # - # * :locale - Sets the locale to be used for formatting - # (defaults to current locale). - # * :precision - Sets the precision of the number - # (defaults to 3). Keeps the number's precision if +nil+. - # * :round_mode - Determine how rounding is performed - # (defaults to :default. See BigDecimal::mode) - # * :significant - If +true+, precision will be the number - # of significant_digits. If +false+, the number of fractional - # digits (defaults to +false+). - # * :separator - Sets the separator between the - # fractional and integer digits (defaults to "."). - # * :delimiter - Sets the thousands delimiter (defaults - # to ""). - # * :strip_insignificant_zeros - If +true+ removes - # insignificant zeros after the decimal separator (defaults to - # +false+). - # - # ==== Examples - # - # number_to_rounded(111.2345) # => "111.235" - # number_to_rounded(111.2345, precision: 2) # => "111.23" - # number_to_rounded(13, precision: 5) # => "13.00000" - # number_to_rounded(389.32314, precision: 0) # => "389" - # number_to_rounded(111.2345, significant: true) # => "111" - # number_to_rounded(111.2345, precision: 1, significant: true) # => "100" - # number_to_rounded(13, precision: 5, significant: true) # => "13.000" - # number_to_rounded(13, precision: nil) # => "13" - # number_to_rounded(389.32314, precision: 0, round_mode: :up) # => "390" - # number_to_rounded(111.234, locale: :fr) # => "111,234" - # - # number_to_rounded(13, precision: 5, significant: true, strip_insignificant_zeros: true) - # # => "13" - # - # number_to_rounded(389.32314, precision: 4, significant: true) # => "389.3" - # number_to_rounded(1111.2345, precision: 2, separator: ',', delimiter: '.') - # # => "1.111,23" - # - # source://activesupport//lib/active_support/number_helper.rb#238 - def number_to_rounded(number, options = T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/number_helper/number_converter.rb#11 -class ActiveSupport::NumberHelper::NumberConverter - # @return [NumberConverter] a new instance of NumberConverter - # - # source://activesupport//lib/active_support/number_helper/number_converter.rb#123 - def initialize(number, options); end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#128 - def execute; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#13 - def namespace; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#13 - def namespace=(_arg0); end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#13 - def namespace?; end - - # Returns the value of attribute number. - # - # source://activesupport//lib/active_support/number_helper/number_converter.rb#18 - def number; end - - # Returns the value of attribute opts. - # - # source://activesupport//lib/active_support/number_helper/number_converter.rb#18 - def opts; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#16 - def validate_float; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#16 - def validate_float=(_arg0); end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#16 - def validate_float?; end - - private - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#147 - def default_format_options; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#172 - def default_value(key); end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#143 - def format_options; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#153 - def i18n_format_options; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#139 - def options; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#168 - def translate_in_locale(key, **i18n_options); end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#164 - def translate_number_value_with_default(key, **i18n_options); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/number_helper/number_converter.rb#176 - def valid_float?; end - - class << self - # source://activesupport//lib/active_support/number_helper/number_converter.rb#119 - def convert(number, options); end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#13 - def namespace; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#13 - def namespace=(value); end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#13 - def namespace?; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#16 - def validate_float; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#16 - def validate_float=(value); end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#16 - def validate_float?; end - end -end - -# source://activesupport//lib/active_support/number_helper/number_converter.rb#20 -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#33 - def i18n_opts; end - - # source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#24 - def options; end - - class << self - # source://activesupport//lib/active_support/number_helper/number_converter.rb#13 - 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#16 - 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#13 - def namespace; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#16 - 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#13 - def namespace; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#16 - 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#13 - def namespace; end - end -end - -# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#7 -class ActiveSupport::NumberHelper::NumberToPhoneConverter < ::ActiveSupport::NumberHelper::NumberConverter - # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#8 - def convert; end - - private - - # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#15 - def convert_to_phone_number(number); end - - # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#23 - def convert_with_area_code(number); end - - # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#30 - def convert_without_area_code(number); end - - # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#46 - def country_code(code); end - - # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#42 - def delimiter; end - - # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#50 - def phone_ext(ext); end - - # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#54 - def regexp_pattern(default_pattern); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#38 - 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#13 - def namespace; end - - # source://activesupport//lib/active_support/number_helper/number_converter.rb#16 - 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 - - # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#45 - def significant; end -end - -# source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#7 -module ActiveSupport::NumericWithFormat - # Provides options for converting numbers into formatted strings. - # Options are provided for phone numbers, currency, percentage, - # precision, positional notation, file size and pretty printing. - # - # ==== Options - # - # For details on which formats use which options, see ActiveSupport::NumberHelper - # - # ==== Examples - # - # Phone Numbers: - # 5551234.to_s(:phone) # => "555-1234" - # 1235551234.to_s(:phone) # => "123-555-1234" - # 1235551234.to_s(:phone, area_code: true) # => "(123) 555-1234" - # 1235551234.to_s(:phone, delimiter: ' ') # => "123 555 1234" - # 1235551234.to_s(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555" - # 1235551234.to_s(:phone, country_code: 1) # => "+1-123-555-1234" - # 1235551234.to_s(:phone, country_code: 1, extension: 1343, delimiter: '.') - # # => "+1.123.555.1234 x 1343" - # - # Currency: - # 1234567890.50.to_s(:currency) # => "$1,234,567,890.50" - # 1234567890.506.to_s(:currency) # => "$1,234,567,890.51" - # 1234567890.506.to_s(:currency, precision: 3) # => "$1,234,567,890.506" - # 1234567890.506.to_s(:currency, round_mode: :down) # => "$1,234,567,890.50" - # 1234567890.506.to_s(:currency, locale: :fr) # => "1 234 567 890,51 €" - # -1234567890.50.to_s(:currency, negative_format: '(%u%n)') - # # => "($1,234,567,890.50)" - # 1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '') - # # => "£1234567890,50" - # 1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '', format: '%n %u') - # # => "1234567890,50 £" - # - # Percentage: - # 100.to_s(:percentage) # => "100.000%" - # 100.to_s(:percentage, precision: 0) # => "100%" - # 1000.to_s(:percentage, delimiter: '.', separator: ',') # => "1.000,000%" - # 302.24398923423.to_s(:percentage, precision: 5) # => "302.24399%" - # 302.24398923423.to_s(:percentage, round_mode: :down) # => "302.243%" - # 1000.to_s(:percentage, locale: :fr) # => "1 000,000%" - # 100.to_s(:percentage, format: '%n %') # => "100.000 %" - # - # Delimited: - # 12345678.to_s(:delimited) # => "12,345,678" - # 12345678.05.to_s(:delimited) # => "12,345,678.05" - # 12345678.to_s(:delimited, delimiter: '.') # => "12.345.678" - # 12345678.to_s(:delimited, delimiter: ',') # => "12,345,678" - # 12345678.05.to_s(:delimited, separator: ' ') # => "12,345,678 05" - # 12345678.05.to_s(:delimited, locale: :fr) # => "12 345 678,05" - # 98765432.98.to_s(:delimited, delimiter: ' ', separator: ',') - # # => "98 765 432,98" - # - # Rounded: - # 111.2345.to_s(:rounded) # => "111.235" - # 111.2345.to_s(:rounded, precision: 2) # => "111.23" - # 111.2345.to_s(:rounded, precision: 2, round_mode: :up) # => "111.24" - # 13.to_s(:rounded, precision: 5) # => "13.00000" - # 389.32314.to_s(:rounded, precision: 0) # => "389" - # 111.2345.to_s(:rounded, significant: true) # => "111" - # 111.2345.to_s(:rounded, precision: 1, significant: true) # => "100" - # 13.to_s(:rounded, precision: 5, significant: true) # => "13.000" - # 111.234.to_s(:rounded, locale: :fr) # => "111,234" - # 13.to_s(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true) - # # => "13" - # 389.32314.to_s(:rounded, precision: 4, significant: true) # => "389.3" - # 1111.2345.to_s(:rounded, precision: 2, separator: ',', delimiter: '.') - # # => "1.111,23" - # - # Human-friendly size in Bytes: - # 123.to_s(:human_size) # => "123 Bytes" - # 1234.to_s(:human_size) # => "1.21 KB" - # 12345.to_s(:human_size) # => "12.1 KB" - # 1234567.to_s(:human_size) # => "1.18 MB" - # 1234567890.to_s(:human_size) # => "1.15 GB" - # 1234567890123.to_s(:human_size) # => "1.12 TB" - # 1234567890123456.to_s(:human_size) # => "1.1 PB" - # 1234567890123456789.to_s(:human_size) # => "1.07 EB" - # 1234567.to_s(:human_size, precision: 2) # => "1.2 MB" - # 1234567.to_s(:human_size, precision: 2, round_mode: :up) # => "1.3 MB" - # 483989.to_s(:human_size, precision: 2) # => "470 KB" - # 1234567.to_s(:human_size, precision: 2, separator: ',') # => "1,2 MB" - # 1234567890123.to_s(:human_size, precision: 5) # => "1.1228 TB" - # 524288000.to_s(:human_size, precision: 5) # => "500 MB" - # - # Human-friendly format: - # 123.to_s(:human) # => "123" - # 1234.to_s(:human) # => "1.23 Thousand" - # 12345.to_s(:human) # => "12.3 Thousand" - # 1234567.to_s(:human) # => "1.23 Million" - # 1234567890.to_s(:human) # => "1.23 Billion" - # 1234567890123.to_s(:human) # => "1.23 Trillion" - # 1234567890123456.to_s(:human) # => "1.23 Quadrillion" - # 1234567890123456789.to_s(:human) # => "1230 Quadrillion" - # 489939.to_s(:human, precision: 2) # => "490 Thousand" - # 489939.to_s(:human, precision: 2, round_mode: :down) # => "480 Thousand" - # 489939.to_s(:human, precision: 4) # => "489.9 Thousand" - # 1234567.to_s(:human, precision: 4, - # significant: false) # => "1.2346 Million" - # 1234567.to_s(:human, precision: 1, - # separator: ',', - # significant: false) # => "1,2 Million" - # - # source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#109 - def to_s(format = T.unsafe(nil), options = T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/option_merger.rb#7 -class ActiveSupport::OptionMerger - # @return [OptionMerger] a new instance of OptionMerger - # - # source://activesupport//lib/active_support/option_merger.rb#12 - def initialize(context, options); end - - private - - # source://activesupport//lib/active_support/option_merger.rb#32 - def invoke_method(method, arguments, options, &block); end - - # source://activesupport//lib/active_support/option_merger.rb#17 - def method_missing(method, *arguments, &block); 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 Array#extract_options! - # - # @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 - -# +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#31 -class ActiveSupport::OrderedOptions < ::Hash - # source://activesupport//lib/active_support/ordered_options.rb#39 - def [](key); end - - # source://activesupport//lib/active_support/ordered_options.rb#35 - def []=(key, value); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/ordered_options.rb#62 - def extractable_options?; end - - # source://activesupport//lib/active_support/ordered_options.rb#66 - def inspect; end - - # source://activesupport//lib/active_support/ordered_options.rb#43 - def method_missing(name, *args); end - - protected - - # preserve the original #[] method - def _get(_arg0); end - - private - - # @return [Boolean] - # - # source://activesupport//lib/active_support/ordered_options.rb#58 - def respond_to_missing?(name, include_private); end -end - -# NOTE: This approach has been deprecated for end-user code in favor of {thread_mattr_accessor}[rdoc-ref:Module#thread_mattr_accessor] and friends. -# Please use that approach instead. -# -# This module is used to encapsulate access to thread local variables. -# -# Instead of polluting the thread locals namespace: -# -# Thread.current[:connection_handler] -# -# you define a class that extends this module: -# -# module ActiveRecord -# class RuntimeRegistry -# extend ActiveSupport::PerThreadRegistry -# -# attr_accessor :connection_handler -# end -# end -# -# and invoke the declared instance accessors as class methods. So -# -# ActiveRecord::RuntimeRegistry.connection_handler = connection_handler -# -# sets a connection handler local to the current thread, and -# -# ActiveRecord::RuntimeRegistry.connection_handler -# -# returns a connection handler local to the current thread. -# -# This feature is accomplished by instantiating the class and storing the -# instance as a thread local keyed by the class name. In the example above -# a key "ActiveRecord::RuntimeRegistry" is stored in Thread.current. -# The class methods proxy to said thread local instance. -# -# If the class has an initializer, it must accept no arguments. -# -# source://activesupport//lib/active_support/per_thread_registry.rb#41 -module ActiveSupport::PerThreadRegistry - # source://activesupport//lib/active_support/per_thread_registry.rb#46 - def instance; end - - private - - # source://activesupport//lib/active_support/per_thread_registry.rb#51 - def method_missing(name, *args, **_arg2, &block); end - - class << self - # @private - # - # source://activesupport//lib/active_support/per_thread_registry.rb#42 - def extended(object); end - end -end - -# A class with no predefined methods that behaves similarly to Builder's -# BlankSlate. Used for proxy classes. -# -# source://activesupport//lib/active_support/proxy_object.rb#6 -class ActiveSupport::ProxyObject < ::BasicObject - # Let ActiveSupport::ProxyObject at least raise exceptions. - # - # source://activesupport//lib/active_support/proxy_object.rb#11 - def raise(*args); end -end - -# source://activesupport//lib/active_support/core_ext/range/conversions.rb#4 -module ActiveSupport::RangeWithFormat - # Convert range to a formatted string. See RANGE_FORMATS for predefined formats. - # - # range = (1..100) # => 1..100 - # - # range.to_s # => "1..100" - # range.to_s(:db) # => "BETWEEN '1' AND '100'" - # - # == Adding your own range formats to to_s - # You can add your own formats to the Range::RANGE_FORMATS hash. - # Use the format name as the hash key and a Proc instance. - # - # # config/initializers/range_formats.rb - # Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_s(:db)} and #{stop.to_s(:db)}" } - # - # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28 - def to_default_s(format = T.unsafe(nil)); end - - # Convert range to a formatted string. See RANGE_FORMATS for predefined formats. - # - # range = (1..100) # => 1..100 - # - # range.to_s # => "1..100" - # range.to_s(:db) # => "BETWEEN '1' AND '100'" - # - # == Adding your own range formats to to_s - # You can add your own formats to the Range::RANGE_FORMATS hash. - # Use the format name as the hash key and a Proc instance. - # - # # config/initializers/range_formats.rb - # Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_s(:db)} and #{stop.to_s(:db)}" } - # - # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28 - def to_formatted_s(format = T.unsafe(nil)); end - - # Convert range to a formatted string. See RANGE_FORMATS for predefined formats. - # - # range = (1..100) # => 1..100 - # - # range.to_s # => "1..100" - # range.to_s(:db) # => "BETWEEN '1' AND '100'" - # - # == Adding your own range formats to to_s - # You can add your own formats to the Range::RANGE_FORMATS hash. - # Use the format name as the hash key and a Proc instance. - # - # # config/initializers/range_formats.rb - # Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_s(:db)} and #{stop.to_s(:db)}" } - # - # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28 - def to_s(format = T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/core_ext/range/conversions.rb#5 -ActiveSupport::RangeWithFormat::RANGE_FORMATS = T.let(T.unsafe(nil), Hash) - -# -- -# 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#27 -class ActiveSupport::Reloader < ::ActiveSupport::ExecutionWrapper - # @return [Reloader] a new instance of Reloader - # - # source://activesupport//lib/active_support/reloader.rb#91 - def initialize; end - - # source://activesupport//lib/active_support/callbacks.rb#835 - def _class_unload_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#835 - def _prepare_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#823 - def _run_class_unload_callbacks(&block); end - - # source://activesupport//lib/active_support/callbacks.rb#823 - def _run_prepare_callbacks(&block); end - - # source://activesupport//lib/active_support/reloader.rb#77 - def check; end - - # source://activesupport//lib/active_support/reloader.rb#77 - def check=(_arg0); end - - # source://activesupport//lib/active_support/reloader.rb#77 - def check?; end - - # source://activesupport//lib/active_support/reloader.rb#118 - def class_unload!(&block); end - - # source://activesupport//lib/active_support/reloader.rb#123 - def complete!; end - - # source://activesupport//lib/active_support/reloader.rb#76 - def executor; end - - # source://activesupport//lib/active_support/reloader.rb#76 - def executor=(_arg0); end - - # source://activesupport//lib/active_support/reloader.rb#76 - def executor?; end - - # Release the unload lock if it has been previously obtained - # - # source://activesupport//lib/active_support/reloader.rb#106 - 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#98 - def require_unload_lock!; end - - # source://activesupport//lib/active_support/reloader.rb#113 - def run!; end - - class << self - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#827 - def _class_unload_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#831 - def _class_unload_callbacks=(value); end - - # source://activesupport//lib/active_support/callbacks.rb#827 - def _prepare_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#831 - def _prepare_callbacks=(value); end - - # Registers a callback that will run immediately after the classes are unloaded. - # - # source://activesupport//lib/active_support/reloader.rb#43 - 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#38 - def before_class_unload(*args, &block); end - - # source://activesupport//lib/active_support/reloader.rb#77 - def check; end - - # source://activesupport//lib/active_support/reloader.rb#79 - def check!; end - - # source://activesupport//lib/active_support/reloader.rb#77 - def check=(value); end - - # source://activesupport//lib/active_support/reloader.rb#77 - def check?; end - - # source://activesupport//lib/active_support/reloader.rb#76 - def executor; end - - # source://activesupport//lib/active_support/reloader.rb#76 - def executor=(value); end - - # source://activesupport//lib/active_support/reloader.rb#76 - def executor?; end - - # source://activesupport//lib/active_support/reloader.rb#87 - def prepare!; end - - # Initiate a manual reload - # - # source://activesupport//lib/active_support/reloader.rb#50 - def reload!; end - - # source://activesupport//lib/active_support/reloader.rb#83 - def reloaded!; end - - # source://activesupport//lib/active_support/reloader.rb#61 - 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#33 - 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#70 - def wrap; end - end -end - -# Rescuable module adds support for easier exception handling. -# -# source://activesupport//lib/active_support/rescuable.rb#9 -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#170 - 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#164 - 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#16 -module ActiveSupport::Rescuable::ClassMethods - # source://activesupport//lib/active_support/rescuable.rb#103 - def handler_for_rescue(exception, object: T.unsafe(nil)); end - - # Registers exception classes with a handler to be called by rescue_with_handler. - # - # rescue_from receives a series of exception classes or class - # names, and an exception handler specified by a trailing :with - # 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 exception.is_a?(klass) holds true is the one invoked, if - # any. - # - # class ApplicationController < ActionController::Base - # rescue_from User::NotAuthorized, with: :deny_access # self defined exception - # rescue_from ActiveRecord::RecordInvalid, with: :show_errors - # - # rescue_from 'MyAppError::Base' do |exception| - # render xml: exception, status: 500 - # end - # - # private - # def deny_access - # ... - # end - # - # def show_errors(exception) - # exception.record.new_record? ? ... - # end - # end - # - # Exceptions raised inside exception handlers are not propagated up. - # - # source://activesupport//lib/active_support/rescuable.rb#51 - 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#88 - def rescue_with_handler(exception, object: T.unsafe(nil), visited_exceptions: T.unsafe(nil)); end - - private - - # source://activesupport//lib/active_support/rescuable.rb#137 - def constantize_rescue_handler_class(class_or_name); end - - # source://activesupport//lib/active_support/rescuable.rb#122 - def find_rescue_handler(exception); end -end - -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#162 -class ActiveSupport::SafeBuffer < ::String - # @return [SafeBuffer] a new instance of SafeBuffer - # - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#200 - def initialize(str = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#254 - def %(args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#247 - def *(*_arg0); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#243 - def +(other); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#214 - def <<(value); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#181 - def [](*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#235 - def []=(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#219 - def bytesplice(*args, value); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def capitalize(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def capitalize!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def chomp(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def chomp!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def chop(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def chop!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#210 - def clone_empty; end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#214 - def concat(value); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def delete(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def delete!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def delete_prefix(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def delete_prefix!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def delete_suffix(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def delete_suffix!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def downcase(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def downcase!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#277 - def encode_with(coder); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#299 - def gsub(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#310 - def gsub!(*args, &block); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#265 - def html_safe?; end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#223 - def insert(index, value); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def lstrip(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def lstrip!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def next(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def next!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#227 - def prepend(value); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#231 - def replace(value); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def reverse(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def reverse!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def rstrip(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def rstrip!(*args); end - - # @raise [SafeConcatError] - # - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#195 - def safe_concat(value); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def scrub(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def scrub!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def slice(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def slice!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def squeeze(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def squeeze!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def strip(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def strip!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#299 - def sub(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#310 - def sub!(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def succ(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def succ!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def swapcase(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def swapcase!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#273 - def to_param; end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#269 - def to_s; end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def tr(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def tr!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def tr_s(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def tr_s!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def unicode_normalize(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def unicode_normalize!(*args); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284 - def upcase(*args, &block); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288 - def upcase!(*args); end - - private - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#326 - def html_escape_interpolated_argument(arg); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#205 - def initialize_copy(other); end - - def original_concat(*_arg0); end - - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#330 - def set_block_back_references(block, match_data); end -end - -# Raised when ActiveSupport::SafeBuffer#safe_concat is called on unsafe buffers. -# -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#175 -class ActiveSupport::SafeBuffer::SafeConcatError < ::StandardError - # @return [SafeConcatError] a new instance of SafeConcatError - # - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#176 - def initialize; end -end - -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#163 -ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS = T.let(T.unsafe(nil), Array) - -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#169 -ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS_WITH_BACKREF = T.let(T.unsafe(nil), Array) - -# 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#30 -class ActiveSupport::SecureCompareRotator - include ::ActiveSupport::Messages::Rotator - include ::ActiveSupport::SecurityUtils - - # @return [SecureCompareRotator] a new instance of SecureCompareRotator - # - # source://activesupport//lib/active_support/messages/rotator.rb#6 - def initialize(*secrets, on_rotation: T.unsafe(nil), **options); end - - # source://activesupport//lib/active_support/secure_compare_rotator.rb#40 - def secure_compare!(other_value, on_rotation: T.unsafe(nil)); end - - private - - # source://activesupport//lib/active_support/secure_compare_rotator.rb#47 - def build_rotation(previous_value, _options); end -end - -# source://activesupport//lib/active_support/secure_compare_rotator.rb#34 -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 - -# Wrapping a string in this class gives you a prettier way to test -# for equality. The value returned by Rails.env 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, *arguments); 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 - -# 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 "sql.active_record" 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#31 -class ActiveSupport::Subscriber - # @return [Subscriber] a new instance of Subscriber - # - # source://activesupport//lib/active_support/subscriber.rb#129 - def initialize; end - - # source://activesupport//lib/active_support/subscriber.rb#144 - def finish(name, id, payload); end - - # source://activesupport//lib/active_support/subscriber.rb#127 - def patterns; end - - # source://activesupport//lib/active_support/subscriber.rb#135 - def start(name, id, payload); end - - private - - # source://activesupport//lib/active_support/subscriber.rb#154 - def event_stack; end - - class << self - # Attach the subscriber to a namespace. - # - # source://activesupport//lib/active_support/subscriber.rb#34 - 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#49 - 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#68 - def method_added(event); end - - # source://activesupport//lib/active_support/subscriber.rb#77 - def subscribers; end - - private - - # source://activesupport//lib/active_support/subscriber.rb#84 - def add_event_subscriber(event); end - - # source://activesupport//lib/active_support/subscriber.rb#122 - def fetch_public_methods(subscriber, inherit_all); end - - # source://activesupport//lib/active_support/subscriber.rb#106 - def find_attached_subscriber; end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/subscriber.rb#110 - def invalid_event?(event); end - - # Returns the value of attribute namespace. - # - # source://activesupport//lib/active_support/subscriber.rb#82 - def namespace; end - - # Returns the value of attribute notifier. - # - # source://activesupport//lib/active_support/subscriber.rb#82 - def notifier; end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/subscriber.rb#118 - def pattern_subscribed?(pattern); end - - # source://activesupport//lib/active_support/subscriber.rb#114 - def prepare_pattern(event); end - - # source://activesupport//lib/active_support/subscriber.rb#95 - def remove_event_subscriber(event); end - - # Returns the value of attribute subscriber. - # - # source://activesupport//lib/active_support/subscriber.rb#82 - def subscriber; end - end -end - -# This is a registry for all the event stacks kept for subscribers. -# -# See the documentation of ActiveSupport::PerThreadRegistry -# for further details. -# -# source://activesupport//lib/active_support/subscriber.rb#163 -class ActiveSupport::SubscriberQueueRegistry - extend ::ActiveSupport::PerThreadRegistry - - # @return [SubscriberQueueRegistry] a new instance of SubscriberQueueRegistry - # - # source://activesupport//lib/active_support/subscriber.rb#166 - def initialize; end - - # source://activesupport//lib/active_support/subscriber.rb#170 - def get_queue(queue_key); end -end - -# 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") { 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#28 -module ActiveSupport::TaggedLogging - # source://activesupport//lib/active_support/tagged_logging.rb#95 - def clear_tags!(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/tagged_logging.rb#108 - def flush; end - - # source://activesupport//lib/active_support/tagged_logging.rb#95 - def pop_tags(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/tagged_logging.rb#95 - def push_tags(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/tagged_logging.rb#97 - def tagged(*tags); end - - class << self - # source://activesupport//lib/active_support/tagged_logging.rb#81 - def new(logger); end - end -end - -# source://activesupport//lib/active_support/tagged_logging.rb#29 -module ActiveSupport::TaggedLogging::Formatter - # This method is invoked when a log event occurs. - # - # source://activesupport//lib/active_support/tagged_logging.rb#31 - def call(severity, timestamp, progname, msg); end - - # source://activesupport//lib/active_support/tagged_logging.rb#53 - def clear_tags!; end - - # source://activesupport//lib/active_support/tagged_logging.rb#57 - def current_tags; end - - # source://activesupport//lib/active_support/tagged_logging.rb#49 - def pop_tags(size = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/tagged_logging.rb#42 - def push_tags(*tags); end - - # source://activesupport//lib/active_support/tagged_logging.rb#35 - def tagged(*tags); end - - # source://activesupport//lib/active_support/tagged_logging.rb#63 - def tags_text; end -end - -# source://activesupport//lib/active_support/tagged_logging.rb#73 -module ActiveSupport::TaggedLogging::LocalTagStorage - # Returns the value of attribute current_tags. - # - # source://activesupport//lib/active_support/tagged_logging.rb#74 - def current_tags; end - - # Sets the attribute current_tags - # - # @param value the value to set the attribute current_tags to. - # - # source://activesupport//lib/active_support/tagged_logging.rb#74 - def current_tags=(_arg0); end - - class << self - # @private - # - # source://activesupport//lib/active_support/tagged_logging.rb#76 - def extended(base); end - end -end - -# source://activesupport//lib/active_support/test_case.rb#18 -class ActiveSupport::TestCase < ::Minitest::Test - include ::ActiveSupport::Testing::SetupAndTeardown - include ::ActiveSupport::Testing::TaggedLogging - include ::ActiveSupport::Callbacks - include ::ActiveSupport::Testing::Assertions - include ::ActiveSupport::Testing::Deprecation - 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#67 - def __callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks?; end - - # source://activesupport//lib/active_support/callbacks.rb#823 - def _run_setup_callbacks(&block); end - - # source://activesupport//lib/active_support/callbacks.rb#823 - def _run_teardown_callbacks(&block); end - - # source://activesupport//lib/active_support/callbacks.rb#835 - def _setup_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#835 - def _teardown_callbacks; end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#735 - def assert_no_match(matcher, obj, msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#664 - def assert_not_empty(obj, msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#675 - def assert_not_equal(exp, act, msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#687 - def assert_not_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#699 - def assert_not_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#706 - def assert_not_includes(collection, obj, msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#717 - def assert_not_instance_of(cls, obj, msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#727 - def assert_not_kind_of(cls, obj, msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#745 - def assert_not_nil(obj, msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#780 - def assert_not_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#803 - def assert_not_predicate(o1, op, msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#811 - def assert_not_respond_to(obj, meth, msg = T.unsafe(nil)); end - - # source://minitest/5.20.0/lib/minitest/assertions.rb#820 - def assert_not_same(exp, act, msg = T.unsafe(nil)); end - - # test/unit backwards compatibility methods - # - # source://minitest/5.20.0/lib/minitest/assertions.rb#422 - def assert_raise(*exp); 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://minitest/5.20.0/lib/minitest.rb#307 - def method_name; end - - class << self - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks=(value); end - - # source://activesupport//lib/active_support/callbacks.rb#67 - def __callbacks?; end - - # source://activesupport//lib/active_support/callbacks.rb#827 - def _setup_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#831 - def _setup_callbacks=(value); end - - # source://activesupport//lib/active_support/callbacks.rb#827 - def _teardown_callbacks; end - - # source://activesupport//lib/active_support/callbacks.rb#831 - 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 ENV["PARALLEL_WORKERS"] 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 with: :threads to the +parallelize+ - # method. Note the threaded parallelization does not create multiple - # database and will not work with system tests at this time. - # - # parallelize(workers: :number_of_processors, with: :threads) - # - # The threaded parallelization uses minitest's parallel executor directly. - # The processes parallelization uses a Ruby DRb server. - # - # source://activesupport//lib/active_support/test_case.rb#74 - def parallelize(workers: T.unsafe(nil), with: 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#109 - 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#128 - 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#41 - 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#31 - def test_order=(new_order); end - end -end - -# source://activesupport//lib/active_support/test_case.rb#19 -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#175 - 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#86 - 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 - # - # 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#215 - def assert_no_changes(expression, message = 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#137 - 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 if foo. - # - # 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#33 - def assert_nothing_raised; 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/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 - # source://activesupport//lib/active_support/testing/deprecation.rb#8 - def assert_deprecated(match = T.unsafe(nil), deprecator = T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/testing/deprecation.rb#18 - def assert_not_deprecated(deprecator = T.unsafe(nil), &block); end - - # source://activesupport//lib/active_support/testing/deprecation.rb#24 - def collect_deprecations(deprecator = T.unsafe(nil)); end -end - -# Adds simple access to sample files called file fixtures. -# File fixtures are normal files stored in -# ActiveSupport::TestCase.file_fixture_path. -# -# 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#5 -module ActiveSupport::Testing::Isolation - include ::ActiveSupport::Testing::Isolation::Forking - - # source://activesupport//lib/active_support/testing/isolation.rb#18 - def run; end - - class << self - # @return [Boolean] - # - # source://activesupport//lib/active_support/testing/isolation.rb#14 - def forking_env?; end - - # source://activesupport//lib/active_support/testing/isolation.rb#8 - def included(klass); end - end -end - -# source://activesupport//lib/active_support/testing/isolation.rb#26 -module ActiveSupport::Testing::Isolation::Forking - # source://activesupport//lib/active_support/testing/isolation.rb#27 - def run_in_isolation(&blk); end -end - -# source://activesupport//lib/active_support/testing/isolation.rb#63 -module ActiveSupport::Testing::Isolation::Subprocess - # Crazy H4X to get this working in windows / jruby with - # no forking. - # - # source://activesupport//lib/active_support/testing/isolation.rb#68 - def run_in_isolation(&blk); end -end - -# source://activesupport//lib/active_support/testing/isolation.rb#64 -ActiveSupport::Testing::Isolation::Subprocess::ORIG_ARGV = T.let(T.unsafe(nil), Array) - -# 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#45 - def shutdown; 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::Server - include ::DRb::DRbUndumped - - # @return [Server] a new instance of Server - # - # source://activesupport//lib/active_support/testing/parallelization/server.rb#12 - def initialize; end - - # source://activesupport//lib/active_support/testing/parallelization/server.rb#28 - def <<(o); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/testing/parallelization/server.rb#48 - def active_workers?; end - - # source://activesupport//lib/active_support/testing/parallelization/server.rb#33 - def pop; end - - # @raise [DRb::DRbConnError] - # - # source://activesupport//lib/active_support/testing/parallelization/server.rb#18 - def record(reporter, result); end - - # source://activesupport//lib/active_support/testing/parallelization/server.rb#52 - def shutdown; end - - # source://activesupport//lib/active_support/testing/parallelization/server.rb#40 - def start_worker(worker_id); end - - # source://activesupport//lib/active_support/testing/parallelization/server.rb#44 - 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#77 - 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#83 - 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#90 - def add_setup_exception(result); end - - # source://activesupport//lib/active_support/testing/parallelization/worker.rb#94 - def set_process_title(status); end -end - -# Adds support for +setup+ and +teardown+ callbacks. -# These callbacks serve as a replacement to overwriting the -# #setup and #teardown 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 TestCase#setup. - # - # source://activesupport//lib/active_support/testing/setup_and_teardown.rb#29 - def setup(*args, &block); end - - # Add a callback, which runs after TestCase#teardown. - # - # 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#10 -class ActiveSupport::Testing::SimpleStubs - # @return [SimpleStubs] a new instance of SimpleStubs - # - # source://activesupport//lib/active_support/testing/time_helpers.rb#13 - 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#24 - 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#54 - 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#49 - def stubbing(object, method_name); end - - # Remove all object-method stubs held by this instance - # - # source://activesupport//lib/active_support/testing/time_helpers.rb#38 - def unstub_all!; end - - private - - # Restores the original object.method described by the Stub - # - # source://activesupport//lib/active_support/testing/time_helpers.rb#60 - def unstub_object(stub); end -end - -# source://activesupport//lib/active_support/testing/time_helpers.rb#11 -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 - -# Contains helpers that help you test passage of time. -# -# source://activesupport//lib/active_support/testing/time_helpers.rb#69 -module ActiveSupport::Testing::TimeHelpers - # source://activesupport//lib/active_support/testing/time_helpers.rb#70 - def after_teardown; end - - # Calls +travel_to+ with +Time.now+. - # - # 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#225 - def freeze_time(&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. - # - # 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#93 - def travel(duration, &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#199 - def travel_back; end - - # Changes current time to the given time by stubbing +Time.now+, - # +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. Time.current returns said timestamp, - # and Time.now its equivalent in the system time zone. Similarly, - # Date.current returns a date equal to the argument, and - # Date.today the date according to Time.now, which may - # be different. (Note that you rarely want to deal with Time.now, - # or Date.today, in order to honor the application time zone - # please always use Time.current and Date.current.) - # - # 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). - # - # 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#128 - def travel_to(date_or_time); 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#199 - def unfreeze_time; end - - private - - # source://activesupport//lib/active_support/testing/time_helpers.rb#230 - def simple_stubs; end -end - -# 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 ENV['TZ'] 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_s(: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#40 -class ActiveSupport::TimeWithZone - include ::DateAndTime::Compatibility - include ::Comparable - - # @return [TimeWithZone] a new instance of TimeWithZone - # - # source://activesupport//lib/active_support/time_with_zone.rb#52 - 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#292 - def +(other); end - - # Subtracts an interval of time and returns a new TimeWithZone object unless - # the other value +acts_like?+ time. Then it will return a Float of the difference - # between the two times that represents the difference between the current - # object's time and the +other+ time. - # - # 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#327 - def -(other); end - - # Use the time in UTC for comparisons. - # - # source://activesupport//lib/active_support/time_with_zone.rb#225 - def <=>(other); end - - # So that +self+ acts_like?(:time). - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/time_with_zone.rb#488 - 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: - # :years, :months, :weeks, :days, - # :hours, :minutes, :seconds. - # - # 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#416 - 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, time.ago(24.hours) will move back exactly 24 hours, - # while time.ago(1.day) 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#355 - 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 - # ActiveSupport::JSON::Encoding.use_standard_json_time_format - # 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#167 - 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#233 - def between?(min, max); end - - # An instance of ActiveSupport::TimeWithZone is never blank - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/time_with_zone.rb#499 - 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 (:hour, - # :min, :sec, :usec, :nsec) 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: :year, :month, - # :day, :hour, :min, :sec, :usec, - # :nsec, :offset, :zone. Pass either :usec - # or :nsec, not both. Similarly, pass either :zone or - # :offset, 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.116992711 EST -05:00 - # t.change(min: 30) # => Fri, 14 Apr 2017 11:30:00.116992711 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#376 - def change(options); end - - # Returns a Time instance of the simultaneous time in the UTC timezone. - # - # source://activesupport//lib/active_support/time_with_zone.rb#64 - def comparable_time; end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - 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#95 - def dst?; end - - # source://activesupport//lib/active_support/time_with_zone.rb#179 - 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#268 - 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#126 - def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/time_with_zone.rb#503 - 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#263 - def future?; end - - # Returns a Time instance of the simultaneous time in the UTC timezone. - # - # source://activesupport//lib/active_support/time_with_zone.rb#64 - def getgm; end - - # Returns a Time instance of the simultaneous time in the system timezone. - # - # source://activesupport//lib/active_support/time_with_zone.rb#84 - def getlocal(utc_offset = T.unsafe(nil)); end - - # Returns a Time instance of the simultaneous time in the UTC timezone. - # - # source://activesupport//lib/active_support/time_with_zone.rb#64 - 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#106 - def gmt?; end - - # Returns the offset from current time to UTC time in seconds. - # - # source://activesupport//lib/active_support/time_with_zone.rb#112 - def gmt_offset; end - - # Returns a Time instance of the simultaneous time in the UTC timezone. - # - # source://activesupport//lib/active_support/time_with_zone.rb#64 - def gmtime; end - - # Returns the offset from current time to UTC time in seconds. - # - # source://activesupport//lib/active_support/time_with_zone.rb#112 - def gmtoff; end - - # source://activesupport//lib/active_support/time_with_zone.rb#272 - def hash; end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - 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#188 - 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#292 - def in(other); end - - # Returns the simultaneous time in Time.zone, or the specified zone. - # - # source://activesupport//lib/active_support/time_with_zone.rb#78 - def in_time_zone(new_zone = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/time_with_zone.rb#175 - 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#141 - def inspect; end - - # Say we're a Time to thwart type checking. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/time_with_zone.rb#493 - 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#95 - 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#149 - 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#493 - def kind_of?(klass); end - - # Returns a Time instance of the simultaneous time in the system timezone. - # - # source://activesupport//lib/active_support/time_with_zone.rb#84 - def localtime(utc_offset = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/time_with_zone.rb#509 - def marshal_dump; end - - # source://activesupport//lib/active_support/time_with_zone.rb#513 - def marshal_load(variables); end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - 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#534 - def method_missing(sym, *args, &block); end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - def min; end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - def mon; end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - 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#250 - def next_day?; end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - 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#238 - def past?; end - - # Returns the underlying TZInfo::TimezonePeriod. - # - # source://activesupport//lib/active_support/time_with_zone.rb#73 - def period; 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#257 - 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#519 - 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#196 - 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#149 - 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#196 - def rfc822; end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - 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#292 - def since(other); end - - # Replaces %Z directive with +zone before passing to Time#strftime, - # so that zone information is correct. - # - # source://activesupport//lib/active_support/time_with_zone.rb#219 - def strftime(format); end - - # Returns a Time instance that represents the time in +time_zone+. - # - # source://activesupport//lib/active_support/time_with_zone.rb#59 - def time; end - - # Returns the value of attribute time_zone. - # - # source://activesupport//lib/active_support/time_with_zone.rb#50 - 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#439 - def to_a; end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - 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#472 - 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#447 - def to_f; end - - # Returns a string of the object's date and time. - # Accepts an optional format: - # * :default - default value, mimics Ruby Time#to_s format. - # * :db - format outputs time in UTC :db time. See Time#to_formatted_s(: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#206 - def to_formatted_s(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#455 - 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#464 - def to_r; end - - # Returns a string of the object's date and time. - # Accepts an optional format: - # * :default - default value, mimics Ruby Time#to_s format. - # * :db - format outputs time in UTC :db time. See Time#to_formatted_s(: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#206 - def to_s(format = T.unsafe(nil)); 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#479 - 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#244 - 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#250 - 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#455 - def tv_sec; end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - def usec; end - - # Returns a Time instance of the simultaneous time in the UTC timezone. - # - # source://activesupport//lib/active_support/time_with_zone.rb#64 - 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#106 - def utc?; end - - # Returns the offset from current time to UTC time in seconds. - # - # source://activesupport//lib/active_support/time_with_zone.rb#112 - def utc_offset; end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - 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#149 - def xmlschema(fraction_digits = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - def yday; end - - # source://activesupport//lib/active_support/time_with_zone.rb#428 - 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#257 - 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#134 - def zone; end - - private - - # @return [Boolean] - # - # source://activesupport//lib/active_support/time_with_zone.rb#570 - def duration_of_variable_length?(obj); end - - # source://activesupport//lib/active_support/time_with_zone.rb#551 - def get_period_and_ensure_valid_local_time(period); end - - # source://activesupport//lib/active_support/time_with_zone.rb#543 - 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#527 - def respond_to_missing?(sym, include_priv); end - - # source://activesupport//lib/active_support/time_with_zone.rb#564 - def transfer_time_values_to_utc_constructor(time); end - - # source://activesupport//lib/active_support/time_with_zone.rb#574 - def wrap_with_time_zone(time); end - - class << self - # Report class name as 'Time' to thwart type checking. - # - # source://activesupport//lib/active_support/time_with_zone.rb#42 - def name; end - end -end - -# source://activesupport//lib/active_support/time_with_zone.rb#46 -ActiveSupport::TimeWithZone::PRECISIONS = T.let(T.unsafe(nil), Hash) - -# source://activesupport//lib/active_support/time_with_zone.rb#541 -ActiveSupport::TimeWithZone::SECONDS_PER_DAY = T.let(T.unsafe(nil), Integer) - -# 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 config.time_zone in the Rails Application, you can -# access this TimeZone object via Time.zone: -# -# # application.rb: -# class Application < Rails::Application -# config.time_zone = 'Eastern Time (US & Canada)' -# end -# -# Time.zone # => # -# 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#29 -class ActiveSupport::TimeZone - include ::Comparable - - # Create a new TimeZone object with the given name and offset. The - # offset is the number of seconds that this time zone is offset from UTC - # (GMT). Seconds were chosen as the offset unit because that is the unit - # that Ruby uses to represent time zone offsets (see Time#utc_offset). - # - # @return [TimeZone] a new instance of TimeZone - # - # source://activesupport//lib/active_support/values/time_zone.rb#297 - 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#320 - 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#329 - 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#366 - def at(*args); end - - # source://activesupport//lib/active_support/values/time_zone.rb#547 - 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#314 - def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/values/time_zone.rb#543 - 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. - # - # @raise [ArgumentError] - # - # source://activesupport//lib/active_support/values/time_zone.rb#383 - 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#350 - 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#523 - 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#335 - def match?(re); end - - # Returns the value of attribute name. - # - # source://activesupport//lib/active_support/values/time_zone.rb#290 - 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#488 - 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#425 - 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#535 - 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#529 - def period_for_utc(time); end - - # source://activesupport//lib/active_support/values/time_zone.rb#539 - 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#441 - 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#479 - 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#341 - def to_s; end - - # Returns the current date in this time zone. - # - # source://activesupport//lib/active_support/values/time_zone.rb#493 - def today; end - - # Returns the next date in this time zone. - # - # source://activesupport//lib/active_support/values/time_zone.rb#498 - def tomorrow; end - - # Returns the value of attribute tzinfo. - # - # source://activesupport//lib/active_support/values/time_zone.rb#291 - def tzinfo; end - - # Returns the offset of this time zone from UTC in seconds. - # - # source://activesupport//lib/active_support/values/time_zone.rb#304 - 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#514 - def utc_to_local(time); end - - # Returns the previous date in this time zone. - # - # source://activesupport//lib/active_support/values/time_zone.rb#503 - def yesterday; end - - private - - # @raise [ArgumentError] - # - # source://activesupport//lib/active_support/values/time_zone.rb#553 - def parts_to_time(parts, now); end - - # source://activesupport//lib/active_support/values/time_zone.rb#578 - 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#230 - 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#221 - def all; end - - # source://activesupport//lib/active_support/values/time_zone.rb#259 - 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#254 - def country_zones(country_code); end - - def create(*_arg0); end - - # source://activesupport//lib/active_support/values/time_zone.rb#205 - 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#214 - 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#197 - 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#248 - def us_zones; end - - private - - # source://activesupport//lib/active_support/values/time_zone.rb#267 - def load_country_zones(code); end - - # source://activesupport//lib/active_support/values/time_zone.rb#281 - def zones_map; end - end -end - -# Keys are Rails TimeZone names, values are TZInfo identifiers. -# -# source://activesupport//lib/active_support/values/time_zone.rb#31 -ActiveSupport::TimeZone::MAPPING = T.let(T.unsafe(nil), Hash) - -# source://activesupport//lib/active_support/values/time_zone.rb#186 -ActiveSupport::TimeZone::UTC_OFFSET_WITHOUT_COLON = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/values/time_zone.rb#185 -ActiveSupport::TimeZone::UTC_OFFSET_WITH_COLON = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/core_ext/object/json.rb#36 -module ActiveSupport::ToJsonWithActiveSupportEncoder - # source://activesupport//lib/active_support/core_ext/object/json.rb#37 - 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(method_name = T.unsafe(nil), *args, **_arg2, &b); end - - # source://activesupport//lib/active_support/core_ext/object/try.rb#20 - def try!(method_name = T.unsafe(nil), *args, **_arg2, &b); 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), String) - -# 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) - -# source://activesupport//lib/active_support/core_ext/hash/conversions.rb#141 -class ActiveSupport::XMLConverter - # @return [XMLConverter] a new instance of XMLConverter - # - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#152 - def initialize(xml, disallowed_types = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#157 - def to_h; end - - private - - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#223 - def become_array?(value); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#219 - def become_content?(value); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#227 - def become_empty_string?(value); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#233 - def become_hash?(value); end - - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#173 - def deep_to_h(value); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#242 - def garbage?(value); end - - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#162 - def normalize_keys(params); end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#237 - def nothing?(value); end - - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#258 - def process_array(value); end - - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#249 - def process_content(value); end - - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#186 - def process_hash(value); end -end - -# source://activesupport//lib/active_support/core_ext/hash/conversions.rb#150 -ActiveSupport::XMLConverter::DISALLOWED_TYPES = T.let(T.unsafe(nil), Array) - -# Raised if the XML contains attributes with type="yaml" or -# type="symbol". Read Hash#from_xml for more details. -# -# source://activesupport//lib/active_support/core_ext/hash/conversions.rb#144 -class ActiveSupport::XMLConverter::DisallowedType < ::StandardError - # @return [DisallowedType] a new instance of DisallowedType - # - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#145 - def initialize(type); end -end - -# = XmlMini -# -# To use the much faster libxml parser: -# gem 'libxml-ruby', '=0.9.7' -# 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#96 - def backend; end - - # source://activesupport//lib/active_support/xml_mini.rb#100 - def backend=(name); end - - # Returns the value of attribute depth. - # - # source://activesupport//lib/active_support/xml_mini.rb#91 - 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#91 - def depth=(_arg0); end - - # source://activesupport//lib/active_support/xml_mini.rb#94 - def parse(*_arg0, **_arg1, &_arg2); end - - # source://activesupport//lib/active_support/xml_mini.rb#147 - def rename_key(key, options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/xml_mini.rb#114 - def to_tag(key, value, options); end - - # source://activesupport//lib/active_support/xml_mini.rb#106 - def with_backend(name); end - - private - - # source://activesupport//lib/active_support/xml_mini.rb#158 - def _dasherize(key); end - - # TODO: Add support for other encodings - # - # source://activesupport//lib/active_support/xml_mini.rb#165 - def _parse_binary(bin, entity); end - - # source://activesupport//lib/active_support/xml_mini.rb#174 - def _parse_file(file, entity); end - - # source://activesupport//lib/active_support/xml_mini.rb#190 - def cast_backend_name_to_module(name); end - - # source://activesupport//lib/active_support/xml_mini.rb#182 - def current_thread_backend; end - - # source://activesupport//lib/active_support/xml_mini.rb#186 - 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#54 -ActiveSupport::XmlMini::FORMATTING = T.let(T.unsafe(nil), Hash) - -# This module decorates files deserialized using Hash.from_xml with -# the original_filename and content_type 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#64 -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#83 -class Array - include ::Enumerable - - # source://activesupport//lib/active_support/core_ext/object/json.rb#153 - 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#256 - def compact_blank!; end - - # Returns a deep copy of array. - # - # array = [1, [2, 3]] - # dup = array.deep_dup - # dup[1][2] = 4 - # - # array[1][2] # => nil - # dup[1][2] # => 4 - # - # source://activesupport//lib/active_support/core_ext/object/deep_dup.rb#29 - def deep_dup; end - - # Returns a copy of the Array excluding the specified elements. - # - # ["David", "Rafael", "Aaron", "Todd"].excluding("Aaron", "Todd") # => ["David", "Rafael"] - # [ [ 0, 1 ], [ 1, 0 ] ].excluding([ [ 1, 0 ] ]) # => [ [ 0, 1 ] ] - # - # Note: This is an optimization of Enumerable#excluding that uses Array#- - # instead of Array#reject for performance reasons. - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#47 - def excluding(*elements); end - - # Removes and returns the elements for which the block returns a true value. - # If no block is given, an Enumerator is returned instead. - # - # numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - # odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9] - # numbers # => [0, 2, 4, 6, 8] - # - # source://activesupport//lib/active_support/core_ext/array/extract.rb#10 - def extract!; 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 - - # Equal to self[4]. - # - # %w( a b c d e ).fifth # => "e" - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#80 - def fifth; end - - # Equal to self[41]. Also known as accessing "the reddit". - # - # (1..42).to_a.forty_two # => 42 - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#87 - def forty_two; end - - # Equal to self[3]. - # - # %w( a b c d e ).fourth # => "d" - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#73 - def fourth; end - - # Returns the tail of the array from +position+. - # - # %w( a b c d ).from(0) # => ["a", "b", "c", "d"] - # %w( a b c d ).from(2) # => ["c", "d"] - # %w( a b c d ).from(10) # => [] - # %w().from(0) # => [] - # %w( a b c d ).from(-2) # => ["c", "d"] - # %w( a b c ).from(-10) # => [] - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#12 - def from(position); end - - # Splits or iterates over the array in +number+ of groups, padding any - # remaining slots with +fill_with+ unless it is +false+. - # - # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3) {|group| p group} - # ["1", "2", "3", "4"] - # ["5", "6", "7", nil] - # ["8", "9", "10", nil] - # - # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3, ' ') {|group| p group} - # ["1", "2", "3", "4"] - # ["5", "6", "7", " "] - # ["8", "9", "10", " "] - # - # %w(1 2 3 4 5 6 7).in_groups(3, false) {|group| p group} - # ["1", "2", "3"] - # ["4", "5"] - # ["6", "7"] - # - # source://activesupport//lib/active_support/core_ext/array/grouping.rb#62 - def in_groups(number, fill_with = T.unsafe(nil)); end - - # Splits or iterates over the array in groups of size +number+, - # padding any remaining slots with +fill_with+ unless it is +false+. - # - # %w(1 2 3 4 5 6 7 8 9 10).in_groups_of(3) {|group| p group} - # ["1", "2", "3"] - # ["4", "5", "6"] - # ["7", "8", "9"] - # ["10", nil, nil] - # - # %w(1 2 3 4 5).in_groups_of(2, ' ') {|group| p group} - # ["1", "2"] - # ["3", "4"] - # ["5", " "] - # - # %w(1 2 3 4 5).in_groups_of(2, false) {|group| p group} - # ["1", "2"] - # ["3", "4"] - # ["5"] - # - # source://activesupport//lib/active_support/core_ext/array/grouping.rb#22 - def in_groups_of(number, fill_with = T.unsafe(nil)); end - - # Returns a new array that includes the passed elements. - # - # [ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ] - # [ [ 0, 1 ] ].including([ [ 1, 0 ] ]) # => [ [ 0, 1 ], [ 1, 0 ] ] - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#36 - def including(*elements); end - - # Wraps the array in an +ArrayInquirer+ object, which gives a friendlier way - # to check its string-like contents. - # - # pets = [:cat, :dog].inquiry - # - # pets.cat? # => true - # pets.ferret? # => false - # - # pets.any?(:cat, :ferret) # => true - # pets.any?(:ferret, :alligator) # => false - # - # source://activesupport//lib/active_support/core_ext/array/inquiry.rb#16 - def inquiry; end - - # Equal to self[1]. - # - # %w( a b c d e ).second # => "b" - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#59 - def second; end - - # Equal to self[-2]. - # - # %w( a b c d e ).second_to_last # => "d" - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#101 - def second_to_last; end - - # Divides the array into one or more subarrays based on a delimiting +value+ - # or the result of an optional block. - # - # [1, 2, 3, 4, 5].split(3) # => [[1, 2], [4, 5]] - # (1..10).to_a.split { |i| i % 3 == 0 } # => [[1, 2], [4, 5], [7, 8], [10]] - # - # source://activesupport//lib/active_support/core_ext/array/grouping.rb#93 - def split(value = T.unsafe(nil)); end - - # Array#sum was added in Ruby 2.4 but it only works with Numeric elements. - # - # source://activesupport//lib/active_support/core_ext/enumerable.rb#241 - def sum(init = T.unsafe(nil), &block); end - - # Equal to self[2]. - # - # %w( a b c d e ).third # => "c" - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#66 - def third; end - - # Equal to self[-3]. - # - # %w( a b c d e ).third_to_last # => "c" - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#94 - def third_to_last; end - - # Returns the beginning of the array up to +position+. - # - # %w( a b c d ).to(0) # => ["a"] - # %w( a b c d ).to(2) # => ["a", "b", "c"] - # %w( a b c d ).to(10) # => ["a", "b", "c", "d"] - # %w().to(0) # => [] - # %w( a b c d ).to(-2) # => ["a", "b", "c"] - # %w( a b c ).to(-10) # => [] - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#24 - def to(position); end - - # Extends Array#to_s to convert a collection of elements into a - # comma separated id list if :db argument is given as the format. - # - # Blog.all.to_formatted_s(:db) # => "1,2,3" - # Blog.none.to_formatted_s(:db) # => "null" - # [1,2].to_formatted_s # => "[1, 2]" - # - # source://activesupport//lib/active_support/core_ext/array/conversions.rb#93 - def to_formatted_s(format = T.unsafe(nil)); end - - # Calls to_param on all its elements and joins the result with - # slashes. This is used by url_for 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 - - # Extends Array#to_s to convert a collection of elements into a - # comma separated id list if :db argument is given as the format. - # - # Blog.all.to_formatted_s(:db) # => "1,2,3" - # Blog.none.to_formatted_s(:db) # => "null" - # [1,2].to_formatted_s # => "[1, 2]" - # - # source://activesupport//lib/active_support/core_ext/array/conversions.rb#93 - def to_s(format = T.unsafe(nil)); 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 - # ArgumentError. - # - # ==== Options - # - # * :words_connector - The sign or word used to join the elements - # in arrays with two or more elements (default: ", "). - # * :two_words_connector - The sign or word used to join the elements - # in arrays with two elements (default: " and "). - # * :last_word_connector - The sign or word used to join the last element - # in arrays with three or more elements (default: ", and "). - # * :locale - 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 :locale 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#61 - 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 - # - # - # - # - # 20000.0 - # 1567 - # 2008-04-09 - # ... - # - # - # 57230.0 - # 1567 - # 2008-04-15 - # ... - # - # - # - # Otherwise the root element is "objects": - # - # [{ foo: 1, bar: 2}, { baz: 3}].to_xml - # - # - # - # - # 2 - # 1 - # - # - # 3 - # - # - # - # If the collection is empty the root element is "nil-classes" by default: - # - # [].to_xml - # - # - # - # - # To ensure a meaningful root element use the :root option: - # - # customer_with_no_projects.projects.to_xml(root: 'projects') - # - # - # - # - # By default name of the node for the children of root is root.singularize. - # You can change it with the :children option. - # - # The +options+ hash is passed downwards: - # - # Message.all.to_xml(skip_types: true) - # - # - # - # - # 2008-03-07T09:58:18+01:00 - # 1 - # 1 - # 2008-03-07T09:58:18+01:00 - # 1 - # - # - # - # source://activesupport//lib/active_support/core_ext/array/conversions.rb#183 - def to_xml(options = T.unsafe(nil)); end - - # Alias for #excluding. - # - # source://activesupport//lib/active_support/core_ext/array/access.rb#52 - def without(*elements); end - - class << self - # Wraps its argument in an array unless it is already an array (or array-like). - # - # Specifically: - # - # * If the argument is +nil+ an empty array is returned. - # * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned. - # * Otherwise, returns an array with the argument as its single element. - # - # Array.wrap(nil) # => [] - # Array.wrap([1, 2, 3]) # => [1, 2, 3] - # Array.wrap(0) # => [0] - # - # This method is similar in purpose to Kernel#Array, but there are some differences: - # - # * If the argument responds to +to_ary+ the method is invoked. Kernel#Array - # moves on to try +to_a+ if the returned value is +nil+, but Array.wrap returns - # an array with the argument as its single element right away. - # * If the returned value from +to_ary+ is neither +nil+ nor an +Array+ object, Kernel#Array - # raises an exception, while Array.wrap does not, it just returns the value. - # * It does not call +to_a+ on the argument, if the argument does not respond to +to_ary+ - # it returns an array with the argument as its single element. - # - # The last point is easily explained with some enumerables: - # - # Array(foo: :bar) # => [[:foo, :bar]] - # Array.wrap(foo: :bar) # => [{:foo=>:bar}] - # - # There's also a related idiom that uses the splat operator: - # - # [*object] - # - # which returns [] for +nil+, but calls to Array(object) otherwise. - # - # The differences with Kernel#Array explained above - # apply to the rest of objects. - # - # source://activesupport//lib/active_support/core_ext/array/wrap.rb#39 - def wrap(object); end - end -end - -# source://activesupport//lib/active_support/core_ext/object/json.rb#113 -class BigDecimal < ::Numeric - include ::ActiveSupport::BigDecimalWithDefaultFormat - include ::ActiveSupport::NumericWithFormat - - # 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#123 - def as_json(options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#109 - def to_s(format = T.unsafe(nil), options = 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 - # - # * :instance_reader - Sets the instance reader method (defaults to true). - # * :instance_writer - Sets the instance writer method (defaults to true). - # * :instance_accessor - Sets both instance methods (defaults to true). - # * :instance_predicate - Sets a predicate method (defaults to true). - # * :default - 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 Subclass.setting = _something_, Subclass.setting - # 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 instance_predicate: false. - # - # 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 instance_reader: false. - # - # object.setting # => NoMethodError - # object.setting? # => NoMethodError - # - # To opt out of the instance writer method, pass instance_writer: false. - # - # object.setting = false # => NoMethodError - # - # To opt out of both instance methods, pass instance_accessor: false. - # - # To set a default value for the attribute, pass default:, 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 - - # Returns an array with all classes that are < than its receiver. - # - # class C; end - # C.descendants # => [] - # - # class B < C; end - # C.descendants # => [B] - # - # class A < B; end - # C.descendants # => [B, A] - # - # class D < C; end - # C.descendants # => [B, A, D] - # - # source://activesupport//lib/active_support/core_ext/class/subclasses.rb#17 - def descendants; end - - # Returns an array with the direct children of +self+. - # - # class Foo; end - # class Bar < Foo; end - # class Baz < Bar; end - # - # Foo.subclasses # => [Bar] - # - # source://activesupport//lib/active_support/core_ext/class/subclasses.rb#30 - def subclasses; 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#137 - 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: :years, :months, :weeks, :days. - # - # source://activesupport//lib/active_support/core_ext/date/calculations.rb#112 - 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#192 - 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 - - # No Date is blank: - # - # Date.today.blank? # => false - # - # @return [false] - # - # source://activesupport//lib/active_support/core_ext/date/blank.rb#11 - def blank?; 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: :year, :month, :day. - # - # 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#128 - 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#137 - 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#62 - 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#62 - 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 to_s. - # - # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 - # - # date.to_formatted_s(:db) # => "2007-11-10" - # date.to_s(:db) # => "2007-11-10" - # - # date.to_formatted_s(:short) # => "10 Nov" - # date.to_formatted_s(:number) # => "20071110" - # date.to_formatted_s(:long) # => "November 10, 2007" - # date.to_formatted_s(:long_ordinal) # => "November 10th, 2007" - # date.to_formatted_s(:rfc822) # => "10 Nov 2007" - # date.to_formatted_s(:iso8601) # => "2007-11-10" - # - # == Adding your own date formats to to_formatted_s - # 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 to_s. - # - # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 - # - # date.to_formatted_s(:db) # => "2007-11-10" - # date.to_s(:db) # => "2007-11-10" - # - # date.to_formatted_s(:short) # => "10 Nov" - # date.to_formatted_s(:number) # => "20071110" - # date.to_formatted_s(:long) # => "November 10, 2007" - # date.to_formatted_s(:long_ordinal) # => "November 10th, 2007" - # date.to_formatted_s(:rfc822) # => "10 Nov 2007" - # date.to_formatted_s(:iso8601) # => "2007-11-10" - # - # == Adding your own date formats to to_formatted_s - # 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_s(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. ENV['TZ']. - # If the *application's* timezone is needed, then use +in_time_zone+ instead. - # - # @raise [ArgumentError] - # - # source://activesupport//lib/active_support/core_ext/date/conversions.rb#82 - 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#94 - 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 Date.beginning_of_week has not been set for the current request, returns the week start specified in config.beginning_of_week. - # 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 Date.beginning_of_week 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 Time.zone or config.time_zone 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#5 -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 date_or_time. - # - # @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#300 - 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#311 - 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#316 - def all_quarter; end - - # Returns a Range representing the whole week of the current date/time. - # Week starts 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#306 - 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#321 - 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#257 - 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#169 - 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#286 - 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#273 - 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#294 - def at_end_of_year; end - - # Returns true if the date/time falls before date_or_time. - # - # @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#257 - 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#169 - 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#248 - 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#286 - 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#273 - 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#294 - 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 months_ago(1). - # - # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#230 - def last_month; end - - # Short-hand for months_ago(3). - # - # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#235 - 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#213 - 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#220 - def last_weekday; end - - # Short-hand for years_ago(1). - # - # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#241 - 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#265 - 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#330 - def next_occurring(day_of_week); end - - # Short-hand for months_since(3) - # - # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#205 - 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#190 - 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#196 - 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#341 - def prev_occurring(day_of_week); end - - # Short-hand for months_ago(3). - # - # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#235 - 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#213 - 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#220 - def prev_weekday; 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#280 - 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#360 - def copy_time_to(other); end - - # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#356 - def days_span(day); end - - # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#348 - def first_hour(date_or_time); end - - # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#352 - 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#6 -module DateAndTime::Compatibility - # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#14 - def preserve_timezone; end - - # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#29 - def utc_to_local_returns_utc_offset_times; end - - class << self - # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#14 - def preserve_timezone; end - - # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#14 - def preserve_timezone=(val); end - - # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#29 - def utc_to_local_returns_utc_offset_times; end - - # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#29 - 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 Time.zone 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 Time.zone 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 Time.zone. - # - # 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 - include ::DateAndTime::Compatibility - - # 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#204 - def <=>(other); end - - # Duck-types as a Date-like class. See Object#acts_like?. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/date_time/acts_like.rb#8 - def acts_like_date?; end - - # Duck-types as a Time-like class. See Object#acts_like?. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/date_time/acts_like.rb#13 - def acts_like_time?; end - - # Uses Date to provide precise Time calculations for years, months, and days. - # The +options+ parameter takes a hash with any of these keys: :years, - # :months, :weeks, :days, :hours, - # :minutes, :seconds. - # - # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#78 - 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#105 - def ago(seconds); end - - # source://activesupport//lib/active_support/core_ext/object/json.rb#202 - 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#118 - 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#142 - 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#154 - 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#136 - 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#148 - 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#160 - 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#126 - 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#126 - 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#118 - 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#126 - 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#118 - 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#142 - 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#154 - def beginning_of_minute; end - - # No DateTime is ever blank: - # - # DateTime.now.blank? # => false - # - # @return [false] - # - # source://activesupport//lib/active_support/core_ext/date_time/blank.rb#11 - def blank?; end - - # Returns a new DateTime where one or more of the elements have been changed - # according to the +options+ parameter. The time options (:hour, - # :min, :sec) 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: :year, :month, :day, :hour, - # :min, :sec, :offset, :start. - # - # 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#136 - 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#148 - 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#160 - 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 Time 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#180 - def getgm; end - - # Returns a Time instance of the simultaneous time in the system timezone. - # - # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#166 - def getlocal(utc_offset = T.unsafe(nil)); end - - # Returns a Time 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#180 - def getutc; end - - # Returns a Time 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#180 - 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#112 - 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 Time instance of the simultaneous time in the system timezone. - # - # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#166 - 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#126 - 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#126 - 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#118 - 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#126 - 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#112 - 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 to_s. - # - # === Examples - # datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000 - # - # datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00" - # datetime.to_s(:db) # => "2007-12-04 00:00:00" - # datetime.to_s(:number) # => "20071204000000" - # datetime.to_formatted_s(:short) # => "04 Dec 00:00" - # datetime.to_formatted_s(:long) # => "December 04, 2007 00:00" - # datetime.to_formatted_s(:long_ordinal) # => "December 4th, 2007 00:00" - # datetime.to_formatted_s(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000" - # datetime.to_formatted_s(:iso8601) # => "2007-12-04T00:00:00+00:00" - # - # == Adding your own datetime formats to to_formatted_s - # 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 - - # 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 - - # Convert to a formatted string. See Time::DATE_FORMATS for predefined formats. - # - # This method is aliased to to_s. - # - # === Examples - # datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000 - # - # datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00" - # datetime.to_s(:db) # => "2007-12-04 00:00:00" - # datetime.to_s(:number) # => "20071204000000" - # datetime.to_formatted_s(:short) # => "04 Dec 00:00" - # datetime.to_formatted_s(:long) # => "December 04, 2007 00:00" - # datetime.to_formatted_s(:long_ordinal) # => "December 4th, 2007 00:00" - # datetime.to_formatted_s(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000" - # datetime.to_formatted_s(:iso8601) # => "2007-12-04T00:00:00+00:00" - # - # == Adding your own datetime formats to to_formatted_s - # 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_s(format = T.unsafe(nil)); end - - # Either return an instance of +Time+ with the same UTC offset - # as +self+ or an instance of +Time+ representing the same time - # in the local system timezone depending on the setting of - # on the setting of +ActiveSupport.to_time_preserves_timezone+. - # - # source://activesupport//lib/active_support/core_ext/date_time/compatibility.rb#15 - def to_time; 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 Time 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#180 - def utc; end - - # Returns +true+ if offset == 0. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#193 - def utc?; end - - # Returns the offset value in seconds. - # - # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#198 - 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 Time.zone.now.to_datetime when Time.zone or - # config.time_zone are set, otherwise returns - # Time.now.to_datetime. - # - # 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/digest/uuid.rb#7 -module Digest::UUID - class << self - # Generates a v5 non-random UUID (Universally Unique IDentifier). - # - # Using Digest::MD5 generates version 3 UUIDs; Digest::SHA1 generates version 5 UUIDs. - # uuid_from_hash always generates the same UUID for a given name and namespace combination. - # - # See RFC 4122 for details of UUID at: https://www.ietf.org/rfc/rfc4122.txt - # - # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#19 - def uuid_from_hash(hash_class, uuid_namespace, name); end - - # Convenience method for uuid_from_hash using Digest::MD5. - # - # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#40 - def uuid_v3(uuid_namespace, name); end - - # Convenience method for SecureRandom.uuid. - # - # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#50 - def uuid_v4; end - - # Convenience method for uuid_from_hash using Digest::SHA1. - # - # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#45 - def uuid_v5(uuid_namespace, name); end - end -end - -# source://activesupport//lib/active_support/core_ext/digest/uuid.rb#8 -Digest::UUID::DNS_NAMESPACE = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/core_ext/digest/uuid.rb#10 -Digest::UUID::OID_NAMESPACE = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/core_ext/digest/uuid.rb#9 -Digest::UUID::URL_NAMESPACE = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/core_ext/digest/uuid.rb#11 -Digest::UUID::X500_NAMESPACE = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#8 -module ERB::Util - private - - # A utility method for escaping HTML tag characters. - # This method is also aliased as h. - # - # puts html_escape('is a > 0 & a < 10?') - # # => is a > 0 & a < 10? - # - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#27 - def h(s); end - - # A utility method for escaping HTML tag characters. - # This method is also aliased as h. - # - # puts html_escape('is a > 0 & a < 10?') - # # => is a > 0 & a < 10? - # - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#27 - 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/string/output_safety.rb#58 - 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: ""}) - # # => "{\"name\":\"\"}" - # - # 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: - # - # - # - # It is necessary to +raw+ the result of +json_escape+, so that quotation marks - # don't get converted to " 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 html(). 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: - # - #
...
- # - # 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 eval() 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/string/output_safety.rb#120 - def json_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/string/output_safety.rb#41 - 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/string/output_safety.rb#133 - def xml_name_escape(name); end - - class << self - # A utility method for escaping HTML tag characters. - # This method is also aliased as h. - # - # puts html_escape('is a > 0 & a < 10?') - # # => is a > 0 & a < 10? - # - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#27 - def h(s); end - - # A utility method for escaping HTML tag characters. - # This method is also aliased as h. - # - # puts html_escape('is a > 0 & a < 10?') - # # => is a > 0 & a < 10? - # - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#27 - 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/string/output_safety.rb#58 - 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: ""}) - # # => "{\"name\":\"\"}" - # - # 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: - # - # - # - # It is necessary to +raw+ the result of +json_escape+, so that quotation marks - # don't get converted to " 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 html(). 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: - # - #
...
- # - # 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 eval() 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/string/output_safety.rb#120 - def json_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/string/output_safety.rb#41 - 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/string/output_safety.rb#133 - def xml_name_escape(name); end - end -end - -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#9 -ERB::Util::HTML_ESCAPE = T.let(T.unsafe(nil), Hash) - -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#11 -ERB::Util::HTML_ESCAPE_ONCE_REGEXP = T.let(T.unsafe(nil), Regexp) - -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#10 -ERB::Util::JSON_ESCAPE = T.let(T.unsafe(nil), Hash) - -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#12 -ERB::Util::JSON_ESCAPE_REGEXP = T.let(T.unsafe(nil), Regexp) - -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#19 -ERB::Util::TAG_NAME_FOLLOWING_REGEXP = T.let(T.unsafe(nil), Regexp) - -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#20 -ERB::Util::TAG_NAME_REPLACEMENT_CHAR = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#18 -ERB::Util::TAG_NAME_START_REGEXP = T.let(T.unsafe(nil), Regexp) - -# Following XML requirements: https://www.w3.org/TR/REC-xml/#NT-Name -# -# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#15 -ERB::Util::TAG_NAME_START_REGEXP_SET = T.let(T.unsafe(nil), String) - -# source://activesupport//lib/active_support/core_ext/enumerable.rb#3 -module Enumerable - include ::ActiveSupport::ToJsonWithActiveSupportEncoder - - # source://activesupport//lib/active_support/core_ext/object/json.rb#135 - 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, 2]) - # # => [2, 1] (or [1, 2]) - # - # 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#191 - def compact_blank; end - - # The negative of the Enumerable#include?. Returns +true+ if the - # collection does not include the object. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/enumerable.rb#121 - 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#135 - def excluding(*elements); 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#115 - 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" => , "chade-" => , ...} - # - # people.index_by { |person| "#{person.first_name} #{person.last_name}" } - # # => { "Chade- Fowlersburg-e" => , "David Heinemeier Hansson" => , ...} - # - # source://activesupport//lib/active_support/core_ext/enumerable.rb#55 - 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#78 - def index_with(default = T.unsafe(nil)); end - - # Returns +true+ if the enumerable has more than 1 element. Functionally - # equivalent to enum.to_a.size > 1. Can be called with a block too, - # much like any?, so people.many? { |p| p.age > 26 } returns +true+ - # if more than one person is over 26. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/enumerable.rb#96 - def many?; 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#168 - 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#152 - def pluck(*keys); end - - # Calculates a sum from the elements. - # - # payments.sum { |p| p.price * p.tax_rate } - # payments.sum(&:price) - # - # The latter is a shortcut for: - # - # payments.inject(0) { |sum, p| sum + p.price } - # - # It can also calculate the sum without the use of a block. - # - # [5, 15, 10].sum # => 30 - # ['foo', 'bar'].sum # => "foobar" - # [[1, 2], [3, 1, 5]].sum # => [1, 2, 3, 1, 5] - # - # The default sum of an empty list is zero. You can override this default: - # - # [].sum(Payment.new(0)) { |i| i.amount } # => Payment.new(0) - # - # source://activesupport//lib/active_support/core_ext/enumerable.rb#37 - def sum(identity = T.unsafe(nil), &block); end - - # Alias for #excluding. - # - # source://activesupport//lib/active_support/core_ext/enumerable.rb#141 - def without(*elements); end -end - -# source://activesupport//lib/active_support/core_ext/enumerable.rb#4 -Enumerable::INDEX_WITH_DEFAULT = T.let(T.unsafe(nil), Object) - -# source://activesupport//lib/active_support/core_ext/object/json.rb#235 -class Exception - include ::ActiveSupport::Dependencies::Blamable - - # source://activesupport//lib/active_support/core_ext/object/json.rb#236 - def as_json(options = T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/core_ext/object/blank.rb#61 -class FalseClass - # source://activesupport//lib/active_support/core_ext/object/json.rb#76 - 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#67 - def blank?; 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#105 -class Float < ::Numeric - include ::ActiveSupport::NumericWithFormat - - # 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#108 - def as_json(options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#109 - def to_s(format = T.unsafe(nil), options = T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/core_ext/hash/deep_merge.rb#3 -class Hash - include ::Enumerable - - # source://activesupport//lib/active_support/core_ext/object/json.rb#159 - def as_json(options = T.unsafe(nil)); end - - # Validates all keys in a hash match *valid_keys, 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#198 - 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#208 - def compact_blank!; end - - # Returns a deep copy of hash. - # - # hash = { a: { b: 'b' } } - # dup = hash.deep_dup - # dup[:a][:c] = 'c' - # - # hash[:a][:c] # => nil - # dup[:a][:c] # => "c" - # - # source://activesupport//lib/active_support/core_ext/object/deep_dup.rb#43 - def deep_dup; end - - # Returns a new hash with +self+ and +other_hash+ merged recursively. - # - # h1 = { a: true, b: { c: [1, 2, 3] } } - # h2 = { a: false, b: { x: [3, 4, 5] } } - # - # h1.deep_merge(h2) # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } } - # - # Like with Hash#merge in the standard library, a block can be provided - # to merge values: - # - # h1 = { a: 100, b: 200, c: { c1: 100 } } - # h2 = { b: 250, c: { c1: 200 } } - # h1.deep_merge(h2) { |key, this_val, other_val| this_val + other_val } - # # => { a: 100, b: 450, c: { c1: 300 } } - # - # source://activesupport//lib/active_support/core_ext/hash/deep_merge.rb#18 - def deep_merge(other_hash, &block); end - - # Same as +deep_merge+, but modifies +self+. - # - # source://activesupport//lib/active_support/core_ext/hash/deep_merge.rb#23 - def deep_merge!(other_hash, &block); 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 - - # Returns a new hash with all values converted by the block operation. - # This includes the values from the root hash and from all - # nested hashes and arrays. - # - # hash = { person: { name: 'Rob', age: '28' } } - # - # hash.deep_transform_values{ |value| value.to_s.upcase } - # # => {person: {name: "ROB", age: "28"}} - # - # source://activesupport//lib/active_support/core_ext/hash/deep_transform_values.rb#12 - def deep_transform_values(&block); end - - # Destructively converts all values by using the block operation. - # This includes the values from the root hash and from all - # nested hashes and arrays. - # - # source://activesupport//lib/active_support/core_ext/hash/deep_transform_values.rb#19 - def deep_transform_values!(&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 - - # Returns an ActiveSupport::HashWithIndifferentAccess out of its receiver: - # - # { a: 1 }.with_indifferent_access['a'] # => 1 - # Called when object is nested under an object that receives - # #with_indifferent_access. This method will be called on the current object - # by the enclosing object and is aliased to #with_indifferent_access by - # default. Subclasses of Hash may overwrite this method to return +self+ if - # converting to an ActiveSupport::HashWithIndifferentAccess would not be - # desirable. - # - # b = { b: 1 } - # { a: b }.with_indifferent_access['a'] # calls b.nested_under_indifferent_access - # # => {"b"=>1} - # - # source://activesupport//lib/active_support/core_ext/hash/indifferent_access.rb#9 - def nested_under_indifferent_access; end - - # Merges the caller into +other_hash+. For example, - # - # options = options.reverse_merge(size: 25, velocity: 10) - # - # is equivalent to - # - # options = { size: 25, velocity: 10 }.merge(options) - # - # This is particularly useful for initializing an options hash - # with default values. - # - # source://activesupport//lib/active_support/core_ext/hash/reverse_merge.rb#14 - def reverse_merge(other_hash); end - - # Destructive +reverse_merge+. - # - # source://activesupport//lib/active_support/core_ext/hash/reverse_merge.rb#20 - def reverse_merge!(other_hash); end - - # Destructive +reverse_merge+. - # - # source://activesupport//lib/active_support/core_ext/hash/reverse_merge.rb#20 - def reverse_update(other_hash); 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. - # - # This method is also aliased as +to_param+. - # - # source://activesupport//lib/active_support/core_ext/object/to_query.rb#77 - 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. - # - # This method is also aliased as +to_param+. - # - # source://activesupport//lib/active_support/core_ext/object/to_query.rb#77 - def to_query(namespace = T.unsafe(nil)); end - - # Returns a string containing an XML representation of its receiver: - # - # { foo: 1, bar: 2 }.to_xml - # # => - # # - # # - # # 1 - # # 2 - # # - # - # To do so, the method loops over the pairs and builds nodes that depend on - # the _values_. Given a pair +key+, +value+: - # - # * If +value+ is a hash there's a recursive call with +key+ as :root. - # - # * If +value+ is an array there's a recursive call with +key+ as :root, - # and +key+ singularized as :children. - # - # * If +value+ is a callable object it must expect one or two arguments. Depending - # on the arity, the callable is invoked with the +options+ hash as first argument - # with +key+ as :root, and +key+ singularized as second argument. The - # callable can add nodes by using options[:builder]. - # - # {foo: lambda { |options, key| options[:builder].b(key) }}.to_xml - # # => "foo" - # - # * If +value+ responds to +to_xml+ the method is invoked with +key+ as :root. - # - # class Foo - # def to_xml(options) - # options[:builder].bar 'fooing!' - # end - # end - # - # { foo: Foo.new }.to_xml(skip_instruct: true) - # # => - # # - # # fooing! - # # - # - # * Otherwise, a node with +key+ as tag is created with a string representation of - # +value+ as text node. If +value+ is +nil+ an attribute "nil" set to "true" is added. - # Unless the option :skip_types exists and is true, an attribute "type" is - # added as well according to the following mapping: - # - # XML_TYPE_NAMES = { - # "Symbol" => "symbol", - # "Integer" => "integer", - # "BigDecimal" => "decimal", - # "Float" => "float", - # "TrueClass" => "boolean", - # "FalseClass" => "boolean", - # "Date" => "date", - # "DateTime" => "dateTime", - # "Time" => "dateTime" - # } - # - # By default the root node is "hash", but that's configurable via the :root option. - # - # The default XML builder is a fresh instance of Builder::XmlMarkup. You can - # configure your own builder with the :builder option. The method also accepts - # options like :dasherize and friends, they are forwarded to the builder. - # - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#75 - def to_xml(options = T.unsafe(nil)); end - - # Merges the caller into +other_hash+. For example, - # - # options = options.reverse_merge(size: 25, velocity: 10) - # - # is equivalent to - # - # options = { size: 25, velocity: 10 }.merge(options) - # - # This is particularly useful for initializing an options hash - # with default values. - # - # source://activesupport//lib/active_support/core_ext/hash/reverse_merge.rb#14 - def with_defaults(other_hash); end - - # Destructive +reverse_merge+. - # - # source://activesupport//lib/active_support/core_ext/hash/reverse_merge.rb#20 - def with_defaults!(other_hash); end - - # Returns an ActiveSupport::HashWithIndifferentAccess out of its receiver: - # - # { a: 1 }.with_indifferent_access['a'] # => 1 - # - # source://activesupport//lib/active_support/core_ext/hash/indifferent_access.rb#9 - def with_indifferent_access; 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 - - # Support methods for deep transforming nested hashes and arrays. - # - # source://activesupport//lib/active_support/core_ext/hash/deep_transform_values.rb#25 - def _deep_transform_values_in_object(object, &block); end - - # source://activesupport//lib/active_support/core_ext/hash/deep_transform_values.rb#36 - def _deep_transform_values_in_object!(object, &block); end - - class << self - # Builds a Hash from XML just like Hash.from_xml, but also allows Symbol and YAML. - # - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#134 - def from_trusted_xml(xml); end - - # Returns a Hash containing a collection of pairs when the key is the node name and the value is - # its content - # - # xml = <<-XML - # - # - # 1 - # 2 - # - # XML - # - # hash = Hash.from_xml(xml) - # # => {"hash"=>{"foo"=>1, "bar"=>2}} - # - # +DisallowedType+ is raised if the XML contains attributes with type="yaml" or - # type="symbol". Use Hash.from_trusted_xml to - # parse this XML. - # - # Custom +disallowed_types+ can also be passed in the form of an - # array. - # - # xml = <<-XML - # - # - # 1 - # "David" - # - # XML - # - # hash = Hash.from_xml(xml, ['integer']) - # # => ActiveSupport::XMLConverter::DisallowedType: Disallowed type attribute: "integer" - # - # Note that passing custom disallowed types will override the default types, - # which are Symbol and YAML. - # - # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#129 - def from_xml(xml, disallowed_types = T.unsafe(nil)); end - end -end - -# :stopdoc: -# -# source://activesupport//lib/active_support/hash_with_indifferent_access.rb#423 -HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess - -# source://activesupport//lib/active_support/core_ext/object/json.rb#140 -class IO - include ::Enumerable - include ::File::Constants - - # source://activesupport//lib/active_support/core_ext/object/json.rb#141 - def as_json(options = T.unsafe(nil)); end -end - -class IO::Buffer - include ::Comparable - - def initialize(*_arg0); end - - def <=>(_arg0); end - def clear(*_arg0); end - def copy(*_arg0); end - def empty?; end - def external?; end - def free; end - def get_string(*_arg0); end - def get_value(_arg0, _arg1); end - def hexdump; end - def inspect; end - def internal?; end - def locked; end - def locked?; end - def mapped?; end - def null?; end - def pread(_arg0, _arg1, _arg2); end - def pwrite(_arg0, _arg1, _arg2); end - def read(_arg0, _arg1); end - def readonly?; end - def resize(_arg0); end - def set_string(*_arg0); end - def set_value(_arg0, _arg1, _arg2); end - def size; end - def slice(_arg0, _arg1); end - def to_s; end - def transfer; end - def valid?; end - def write(_arg0, _arg1); end - - class << self - def for(_arg0); end - def map(*_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) -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) - -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) -IO::WRITABLE = T.let(T.unsafe(nil), Integer) - -# source://activesupport//lib/active_support/core_ext/object/json.rb#223 -class IPAddr - # source://activesupport//lib/active_support/core_ext/object/json.rb#224 - def as_json(options = T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/core_ext/integer/time.rb#6 -class Integer < ::Numeric - include ::ActiveSupport::NumericWithFormat - - # Returns a Duration instance matching the number of months provided. - # - # 2.months # => 2 months - # - # source://activesupport//lib/active_support/core_ext/integer/time.rb#10 - def month; end - - # Returns a Duration instance matching the number of months provided. - # - # 2.months # => 2 months - # - # source://activesupport//lib/active_support/core_ext/integer/time.rb#10 - def months; end - - # Check whether the integer is evenly divisible by the argument. - # - # 0.multiple_of?(0) # => true - # 6.multiple_of?(5) # => false - # 10.multiple_of?(2) # => true - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/integer/multiple.rb#9 - def multiple_of?(number); end - - # Ordinal returns the suffix used to denote the position - # in an ordered sequence such as 1st, 2nd, 3rd, 4th. - # - # 1.ordinal # => "st" - # 2.ordinal # => "nd" - # 1002.ordinal # => "nd" - # 1003.ordinal # => "rd" - # -11.ordinal # => "th" - # -1001.ordinal # => "st" - # - # source://activesupport//lib/active_support/core_ext/integer/inflections.rb#28 - def ordinal; end - - # Ordinalize turns a number into an ordinal string used to denote the - # position in an ordered sequence such as 1st, 2nd, 3rd, 4th. - # - # 1.ordinalize # => "1st" - # 2.ordinalize # => "2nd" - # 1002.ordinalize # => "1002nd" - # 1003.ordinalize # => "1003rd" - # -11.ordinalize # => "-11th" - # -1001.ordinalize # => "-1001st" - # - # source://activesupport//lib/active_support/core_ext/integer/inflections.rb#15 - def ordinalize; end - - # source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#109 - def to_s(format = T.unsafe(nil), options = T.unsafe(nil)); end - - # Returns a Duration instance matching the number of years provided. - # - # 2.years # => 2 years - # - # source://activesupport//lib/active_support/core_ext/integer/time.rb#18 - def year; end - - # Returns a Duration instance matching the number of years provided. - # - # 2.years # => 2 years - # - # source://activesupport//lib/active_support/core_ext/integer/time.rb#18 - def years; end -end - -# source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#3 -module Kernel - include ::ActiveSupport::ForkTracker::CoreExt - include ::ActiveSupport::ForkTracker::CoreExtPrivate - - # class_eval on an object acts like singleton_class.class_eval. - # - # source://activesupport//lib/active_support/core_ext/kernel/singleton_class.rb#5 - def class_eval(*args, &block); end - - private - - # A shortcut to define a toplevel concern, not within a module. - # - # See Module::Concerning for more. - # - # source://activesupport//lib/active_support/core_ext/kernel/concern.rb#11 - def concern(topic, &module_definition); end - - # 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; end - - # source://activesupport//lib/active_support/fork_tracker.rb#26 - def fork(*_arg0, **_arg1); 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; 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 - # A shortcut to define a toplevel concern, not within a module. - # - # See Module::Concerning for more. - # - # source://activesupport//lib/active_support/core_ext/kernel/concern.rb#11 - def concern(topic, &module_definition); end - - # 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; end - - # source://activesupport//lib/active_support/fork_tracker.rb#6 - def fork(*_arg0, **_arg1); 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; 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 - -# source://activesupport//lib/active_support/core_ext/load_error.rb#3 -class LoadError < ::ScriptError - include ::DidYouMean::Correctable - - # Returns true if the given path name (except perhaps for the ".rb" - # extension) is the missing file which caused the exception to be raised. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/load_error.rb#6 - def is_missing?(location); end -end - -module Marshal - extend ::ActiveSupport::MarshalWithAutoloading -end - -# source://activesupport//lib/active_support/core_ext/object/duplicable.rb#31 -class Method - # Methods are not duplicable: - # - # method(:puts).duplicable? # => false - # method(:puts).dup # => TypeError: allocator undefined for Method - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/object/duplicable.rb#36 - def duplicable?; end -end - -# 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. -# -# source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#6 -class Module - include ::Module::Concerning - include ::ActiveSupport::Dependencies::ModuleConstMissing - - # Allows you to make aliases for attributes, which includes - # getter, setter, and a predicate. - # - # class Content < ActiveRecord::Base - # # has a title attribute - # end - # - # class Email < Content - # alias_attribute :subject, :title - # end - # - # e = Email.find(1) - # e.title # => "Superstars" - # e.subject # => "Superstars" - # e.subject? # => true - # e.subject = "Megastars" - # e.title # => "Megastars" - # - # source://activesupport//lib/active_support/core_ext/module/aliasing.rb#21 - def alias_attribute(new_name, old_name); end - - # A module may or may not have a name. - # - # module M; end - # M.name # => "M" - # - # m = Module.new - # m.name # => nil - # - # +anonymous?+ method returns true if module does not have a name, false otherwise: - # - # Module.new.anonymous? # => true - # - # module M; end - # M.anonymous? # => false - # - # A module gets a name when it is first assigned to a constant. Either - # via the +module+ or +class+ keyword or by an explicit assignment: - # - # m = Module.new # creates an anonymous module - # m.anonymous? # => true - # M = m # m gets a name here as a side-effect - # m.name # => "M" - # m.anonymous? # => false - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/module/anonymous.rb#27 - def anonymous?; end - - # Declares an attribute reader and writer backed by an internally-named instance - # variable. - # - # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#16 - def attr_internal(*attrs); end - - # Declares an attribute reader and writer backed by an internally-named instance - # variable. - # - # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#16 - def attr_internal_accessor(*attrs); end - - # Declares an attribute reader backed by an internally-named instance variable. - # - # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#5 - def attr_internal_reader(*attrs); end - - # Declares an attribute writer backed by an internally-named instance variable. - # - # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#10 - def attr_internal_writer(*attrs); 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 instance_writer: false. - # To omit the instance reader method, pass instance_reader: false. - # - # 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 instance_accessor: false, 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] - # end - # - # class Person - # include HairColors - # end - # - # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#200 - 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 - # instance_reader: false or instance_accessor: false. - # - # 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] - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors # => [:brown, :black, :blonde, :red] - # - # @raise [TypeError] - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#51 - 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 - # instance_writer: false or instance_accessor: false. - # - # 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] - # end - # - # class Person - # include HairColors - # end - # - # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] - # - # @raise [TypeError] - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#115 - 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 - # * :to - Specifies the target object name as a symbol or string - # * :prefix - Prefixes the new method with the target name or a custom prefix - # * :allow_nil - If set to true, prevents a +Module::DelegationError+ - # from being raised - # * :private - 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 :to 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 # - # - # 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 :prefix option. If the value - # is true, 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 private: true 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.new.age # => 2 - # - # If the target is +nil+ and does not respond to the delegated method a - # +Module::DelegationError+ is raised. If you wish to instead return +nil+, - # use the :allow_nil option. - # - # class User < ActiveRecord::Base - # has_one :profile - # delegate :age, to: :profile - # end - # - # User.new.age - # # => Module::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 - # :allow_nil 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#171 - 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 Module#delegate_missing_to, 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 +DelegationError+. If you wish to instead return +nil+, - # use the :allow_nil option. - # - # The marshal_dump and _dump methods are exempt from - # delegation due to possible interference when calling - # Marshal.dump(object), should the delegation target method - # of object add or remove instance variables. - # - # source://activesupport//lib/active_support/core_ext/module/delegation.rb#295 - def delegate_missing_to(target, allow_nil: T.unsafe(nil)); end - - # deprecate :foo - # deprecate bar: 'message' - # deprecate :foo, :bar, baz: 'warning!', qux: 'gone!' - # - # You can also use custom deprecator instance: - # - # deprecate :foo, deprecator: MyLib::Deprecator.new - # deprecate :foo, bar: "warning!", deprecator: MyLib::Deprecator.new - # - # \Custom deprecators must respond to deprecation_warning(deprecated_method_name, message, caller_backtrace) - # method 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#22 - def deprecate(*method_names); 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 instance_writer: false. - # To omit the instance reader method, pass instance_reader: false. - # - # 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 instance_accessor: false, 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] - # end - # - # class Person - # include HairColors - # end - # - # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#200 - 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 - # instance_reader: false or instance_accessor: false. - # - # 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] - # end - # - # class Person - # include HairColors - # end - # - # Person.new.hair_colors # => [:brown, :black, :blonde, :red] - # - # @raise [TypeError] - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#51 - 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 - # instance_writer: false or instance_accessor: false. - # - # 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] - # end - # - # class Person - # include HairColors - # end - # - # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] - # - # @raise [TypeError] - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#115 - 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 - - # Returns the module which contains this one according to its name. - # - # module M - # module N - # end - # end - # X = M::N - # - # M::N.module_parent # => M - # X.module_parent # => M - # - # The parent of top-level and anonymous modules is Object. - # - # M.module_parent # => Object - # Module.new.module_parent # => Object - # - # source://activesupport//lib/active_support/core_ext/module/introspection.rb#35 - def module_parent; end - - # Returns the name of the module containing this one. - # - # M::N.module_parent_name # => "M" - # - # source://activesupport//lib/active_support/core_ext/module/introspection.rb#10 - def module_parent_name; end - - # Returns all the parents of this module according to its name, ordered from - # nested outwards. The receiver is not contained within the result. - # - # module M - # module N - # end - # end - # X = M::N - # - # M.module_parents # => [Object] - # M::N.module_parents # => [M, Object] - # X.module_parents # => [M, Object] - # - # source://activesupport//lib/active_support/core_ext/module/introspection.rb#51 - def module_parents; 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 - - # Defines both class and instance accessors for class attributes. - # - # class Account - # thread_mattr_accessor :user - # end - # - # Account.user = "DHH" - # Account.user # => "DHH" - # Account.new.user # => "DHH" - # - # If a subclass changes the value, the parent class' value is not changed. - # Similarly, if the parent class changes the value, the value of subclasses - # is not changed. - # - # class Customer < Account - # end - # - # Customer.user = "Rafael" - # Customer.user # => "Rafael" - # Account.user # => "DHH" - # - # To omit the instance writer method, pass instance_writer: false. - # To omit the instance reader method, pass instance_reader: false. - # - # class Current - # thread_mattr_accessor :user, instance_writer: false, instance_reader: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - # Current.new.user # => NoMethodError - # - # Or pass instance_accessor: false, to omit both instance methods. - # - # class Current - # thread_mattr_accessor :user, instance_accessor: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - # Current.new.user # => NoMethodError - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#143 - def thread_cattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end - - # Defines a per-thread class attribute and creates class and instance reader methods. - # The underlying per-thread class variable is set to +nil+, if it is not previously defined. - # - # module Current - # thread_mattr_reader :user - # end - # - # Current.user # => nil - # Thread.current[:attr_Current_user] = "DHH" - # Current.user # => "DHH" - # - # The attribute name must be a valid method name in Ruby. - # - # module Foo - # thread_mattr_reader :"1_Badname" - # end - # # => NameError: invalid attribute name: 1_Badname - # - # To omit the instance reader method, pass - # instance_reader: false or instance_accessor: false. - # - # class Current - # thread_mattr_reader :user, instance_reader: false - # end - # - # Current.new.user # => NoMethodError - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#36 - def thread_cattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end - - # Defines a per-thread class attribute and creates a class and instance writer methods to - # allow assignment to the attribute. - # - # module Current - # thread_mattr_writer :user - # end - # - # Current.user = "DHH" - # Thread.current[:attr_Current_user] # => "DHH" - # - # To omit the instance writer method, pass - # instance_writer: false or instance_accessor: false. - # - # class Current - # thread_mattr_writer :user, instance_writer: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#79 - def thread_cattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end - - # Defines both class and instance accessors for class attributes. - # - # class Account - # thread_mattr_accessor :user - # end - # - # Account.user = "DHH" - # Account.user # => "DHH" - # Account.new.user # => "DHH" - # - # If a subclass changes the value, the parent class' value is not changed. - # Similarly, if the parent class changes the value, the value of subclasses - # is not changed. - # - # class Customer < Account - # end - # - # Customer.user = "Rafael" - # Customer.user # => "Rafael" - # Account.user # => "DHH" - # - # To omit the instance writer method, pass instance_writer: false. - # To omit the instance reader method, pass instance_reader: false. - # - # class Current - # thread_mattr_accessor :user, instance_writer: false, instance_reader: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - # Current.new.user # => NoMethodError - # - # Or pass instance_accessor: false, to omit both instance methods. - # - # class Current - # thread_mattr_accessor :user, instance_accessor: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - # Current.new.user # => NoMethodError - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#143 - def thread_mattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end - - # Defines a per-thread class attribute and creates class and instance reader methods. - # The underlying per-thread class variable is set to +nil+, if it is not previously defined. - # - # module Current - # thread_mattr_reader :user - # end - # - # Current.user # => nil - # Thread.current[:attr_Current_user] = "DHH" - # Current.user # => "DHH" - # - # The attribute name must be a valid method name in Ruby. - # - # module Foo - # thread_mattr_reader :"1_Badname" - # end - # # => NameError: invalid attribute name: 1_Badname - # - # To omit the instance reader method, pass - # instance_reader: false or instance_accessor: false. - # - # class Current - # thread_mattr_reader :user, instance_reader: false - # end - # - # Current.new.user # => NoMethodError - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#36 - def thread_mattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end - - # Defines a per-thread class attribute and creates a class and instance writer methods to - # allow assignment to the attribute. - # - # module Current - # thread_mattr_writer :user - # end - # - # Current.user = "DHH" - # Thread.current[:attr_Current_user] # => "DHH" - # - # To omit the instance writer method, pass - # instance_writer: false or instance_accessor: false. - # - # class Current - # thread_mattr_writer :user, instance_writer: false - # end - # - # Current.new.user = "DHH" # => NoMethodError - # - # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#79 - def thread_mattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end - - private - - # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#30 - def attr_internal_define(attr_name, type); end - - # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#26 - def attr_internal_ivar_name(attr); end - - class << self - # Returns the value of attribute attr_internal_naming_format. - # - # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#22 - def attr_internal_naming_format; end - - # Sets the attribute attr_internal_naming_format - # - # @param value the value to set the attribute attr_internal_naming_format to. - # - # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#22 - def attr_internal_naming_format=(_arg0); end - end -end - -# = Bite-sized separation of concerns -# -# We often find ourselves with a medium-sized chunk of behavior that we'd -# like to extract, but only mix in to a single class. -# -# Extracting a plain old Ruby object to encapsulate it and collaborate or -# delegate to the original object is often a good choice, but when there's -# no additional state to encapsulate or we're making DSL-style declarations -# about the parent class, introducing new collaborators can obfuscate rather -# than simplify. -# -# The typical route is to just dump everything in a monolithic class, perhaps -# with a comment, as a least-bad alternative. Using modules in separate files -# means tedious sifting to get a big-picture view. -# -# = Dissatisfying ways to separate small concerns -# -# == Using comments: -# -# class Todo < ApplicationRecord -# # Other todo implementation -# # ... -# -# ## Event tracking -# has_many :events -# -# before_create :track_creation -# -# private -# def track_creation -# # ... -# end -# end -# -# == With an inline module: -# -# Noisy syntax. -# -# class Todo < ApplicationRecord -# # Other todo implementation -# # ... -# -# module EventTracking -# extend ActiveSupport::Concern -# -# included do -# has_many :events -# before_create :track_creation -# end -# -# private -# def track_creation -# # ... -# end -# end -# include EventTracking -# end -# -# == Mix-in noise exiled to its own file: -# -# Once our chunk of behavior starts pushing the scroll-to-understand-it -# boundary, we give in and move it to a separate file. At this size, the -# increased overhead can be a reasonable tradeoff even if it reduces our -# at-a-glance perception of how things work. -# -# class Todo < ApplicationRecord -# # Other todo implementation -# # ... -# -# include TodoEventTracking -# end -# -# = Introducing Module#concerning -# -# By quieting the mix-in noise, we arrive at a natural, low-ceremony way to -# separate bite-sized concerns. -# -# class Todo < ApplicationRecord -# # Other todo implementation -# # ... -# -# concerning :EventTracking do -# included do -# has_many :events -# before_create :track_creation -# end -# -# private -# def track_creation -# # ... -# end -# end -# end -# -# Todo.ancestors -# # => [Todo, Todo::EventTracking, ApplicationRecord, Object] -# -# This small step has some wonderful ripple effects. We can -# * grok the behavior of our class in one glance, -# * clean up monolithic junk-drawer classes by separating their concerns, and -# * stop leaning on protected/private for crude "this is internal stuff" modularity. -# -# === Prepending concerning -# -# concerning supports a prepend: true argument which will prepend the -# concern instead of using include for it. -# -# source://activesupport//lib/active_support/core_ext/module/concerning.rb#112 -module Module::Concerning - # A low-cruft shortcut to define a concern. - # - # concern :EventTracking do - # ... - # end - # - # is equivalent to - # - # module EventTracking - # extend ActiveSupport::Concern - # - # ... - # end - # - # source://activesupport//lib/active_support/core_ext/module/concerning.rb#132 - def concern(topic, &module_definition); end - - # Define a new concern and mix it in. - # - # source://activesupport//lib/active_support/core_ext/module/concerning.rb#114 - def concerning(topic, prepend: T.unsafe(nil), &block); end -end - -# source://activesupport//lib/active_support/core_ext/module/delegation.rb#13 -Module::DELEGATION_RESERVED_KEYWORDS = T.let(T.unsafe(nil), Array) - -# source://activesupport//lib/active_support/core_ext/module/delegation.rb#14 -Module::DELEGATION_RESERVED_METHOD_NAMES = T.let(T.unsafe(nil), Set) - -# Error generated by +delegate+ when a method is called on +nil+ and +allow_nil+ -# option is not used. -# -# source://activesupport//lib/active_support/core_ext/module/delegation.rb#8 -class Module::DelegationError < ::NoMethodError; end - -# source://activesupport//lib/active_support/core_ext/module/delegation.rb#10 -Module::RUBY_RESERVED_KEYWORDS = T.let(T.unsafe(nil), Array) - -# source://activesupport//lib/active_support/core_ext/name_error.rb#3 -class NameError < ::StandardError - include ::ErrorHighlight::CoreExt - include ::DidYouMean::Correctable - - # Extract the name of the missing constant from the exception message. - # - # begin - # HelloWorld - # rescue NameError => e - # e.missing_name - # end - # # => "HelloWorld" - # - # source://activesupport//lib/active_support/core_ext/name_error.rb#12 - def missing_name; end - - # Was this exception raised because the given name was missing? - # - # begin - # HelloWorld - # rescue NameError => e - # e.missing_name?("HelloWorld") - # end - # # => true - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/name_error.rb#44 - def missing_name?(name); end - - private - - # source://activesupport//lib/active_support/core_ext/name_error.rb#57 - def real_mod_name(mod); end -end - -# source://activesupport//lib/active_support/core_ext/name_error.rb#53 -NameError::UNBOUND_METHOD_MODULE_NAME = T.let(T.unsafe(nil), UnboundMethod) - -# source://activesupport//lib/active_support/core_ext/object/blank.rb#50 -class NilClass - # source://activesupport//lib/active_support/core_ext/object/json.rb#82 - 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 - - # 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(_method_name = T.unsafe(nil), *_arg1); 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!(_method_name = T.unsafe(nil), *_arg1); end -end - -# source://activesupport//lib/active_support/core_ext/object/blank.rb#134 -class Numeric - include ::Comparable - - # source://activesupport//lib/active_support/core_ext/object/json.rb#100 - 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#141 - 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#14 - 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#14 - 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#62 - 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#62 - 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#38 - 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#38 - 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#156 - 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#22 - 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#22 - 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#30 - 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#30 - 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#54 - 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#54 - def petabytes; 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#46 - 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#46 - 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 -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) - -# -- -# 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::ToJsonWithActiveSupportEncoder - include ::ActiveSupport::ForkTracker::CoreExt - include ::ActiveSupport::ForkTracker::CoreExtPrivate - include ::Kernel - include ::PP::ObjectMixin - include ::ActiveSupport::Tryable - include ::ActiveSupport::Dependencies::Loadable - - # A duck-type assistant method. For example, Active Support extends Date - # to define an acts_like_date? method, and extends Time to define - # acts_like_time?. As a result, we can do x.acts_like?(:time) and - # x.acts_like?(:date) to do duck-type-safe comparisons, since classes that - # we want to act like Time simply need to define an acts_like_time? method. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/object/acts_like.rb#9 - def acts_like?(duck); end - - # source://activesupport//lib/active_support/core_ext/object/json.rb#54 - 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 - - # Returns a deep copy of object if it's duplicable. If it's - # not duplicable, returns +self+. - # - # object = Object.new - # dup = object.deep_dup - # dup.instance_variable_set(:@a, 1) - # - # object.instance_variable_defined?(:@a) # => false - # dup.instance_variable_defined?(:@a) # => true - # - # source://activesupport//lib/active_support/core_ext/object/deep_dup.rb#15 - def deep_dup; end - - # Can you safely dup this object? - # - # False for method objects; - # true otherwise. - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/object/duplicable.rb#26 - def duplicable?; end - - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#150 - def html_safe?; end - - # Returns true if this object is included in the argument. Argument must be - # any object which responds to +#include?+. Usage: - # - # characters = ["Konata", "Kagami", "Tsukasa"] - # "Konata".in?(characters) # => true - # - # 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#12 - 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#27 - def instance_variable_names; end - - # Returns the receiver if it's present otherwise returns +nil+. - # object.presence 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#26 - 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 to_s. - # - # 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 key as the param name. - # - # source://activesupport//lib/active_support/core_ext/object/to_query.rb#13 - def to_query(key); end - - # An elegant way to factor duplication out of options passed to a series of - # method calls. Each method called in the block, with the block variable as - # the receiver, will have its options merged with the default +options+ hash - # provided. Each method called on the block variable must take an options - # hash as its final argument. - # - # Without with_options, this code contains duplication: - # - # class Account < ActiveRecord::Base - # has_many :customers, dependent: :destroy - # has_many :products, dependent: :destroy - # has_many :invoices, dependent: :destroy - # has_many :expenses, dependent: :destroy - # end - # - # Using with_options, we can remove the duplication: - # - # class Account < ActiveRecord::Base - # with_options dependent: :destroy do |assoc| - # assoc.has_many :customers - # assoc.has_many :products - # assoc.has_many :invoices - # assoc.has_many :expenses - # end - # end - # - # It can also be used with an explicit receiver: - # - # I18n.with_options locale: user.locale, scope: 'newsletter' do |i18n| - # subject i18n.t :subject - # body i18n.t :body, user_name: user.name - # end - # - # When you don't pass an explicit receiver, it executes the whole block - # in merging options context: - # - # class Account < ActiveRecord::Base - # with_options dependent: :destroy do - # has_many :customers - # has_many :products - # has_many :invoices - # has_many :expenses - # end - # end - # - # with_options can also be nested since the call is forwarded to its receiver. - # - # NOTE: Each nesting level will merge inherited defaults in addition to their own. - # - # class Post < ActiveRecord::Base - # with_options if: :persisted?, length: { minimum: 50 } do - # validates :content, if: -> { content.present? } - # end - # end - # - # The code is equivalent to: - # - # validates :content, length: { minimum: 50 }, if: -> { content.present? } - # - # Hence the inherited default for +if+ key is ignored. - # - # NOTE: You cannot call class methods implicitly inside of with_options. - # You can access these methods using the class name instead: - # - # class Phone < ActiveRecord::Base - # enum phone_number_type: { home: 0, office: 1, mobile: 2 } - # - # with_options presence: true do - # validates :phone_number_type, inclusion: { in: Phone.phone_number_types.keys } - # end - # end - # - # source://activesupport//lib/active_support/core_ext/object/with_options.rb#78 - def with_options(options, &block); end -end - -# source://activesupport//lib/active_support/core_ext/object/json.rb#217 -class Pathname - # source://activesupport//lib/active_support/core_ext/object/json.rb#218 - def as_json(options = T.unsafe(nil)); end -end - -module Process - class << self - # source://activesupport//lib/active_support/fork_tracker.rb#6 - def fork(*_arg0, **_arg1); end - end -end - -# source://activesupport//lib/active_support/core_ext/object/json.rb#229 -class Process::Status - # source://activesupport//lib/active_support/core_ext/object/json.rb#230 - def as_json(options = T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/core_ext/enumerable.rb#214 -class Range - include ::ActiveSupport::RangeWithFormat - include ::ActiveSupport::CompareWithRange - include ::ActiveSupport::IncludeTimeWithZone - include ::ActiveSupport::EachTimeWithZone - include ::Enumerable - - # source://activesupport//lib/active_support/core_ext/range/compare_range.rb#16 - def ===(value); end - - # source://activesupport//lib/active_support/core_ext/object/json.rb#147 - def as_json(options = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/core_ext/range/compare_range.rb#66 - def cover?(value); end - - # source://activesupport//lib/active_support/core_ext/range/each.rb#7 - def each(&block); end - - # source://activesupport//lib/active_support/core_ext/range/include_time_with_zone.rb#12 - def include?(value); end - - # Compare two ranges and see if they overlap each other - # (1..5).overlaps?(4..6) # => true - # (1..5).overlaps?(7..9) # => false - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/range/overlaps.rb#7 - def overlaps?(other); end - - # source://activesupport//lib/active_support/core_ext/range/each.rb#12 - def step(n = T.unsafe(nil), &block); 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#217 - def sum(identity = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28 - def to_default_s(format = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28 - def to_formatted_s(format = T.unsafe(nil)); end - - # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28 - def to_s(format = T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/core_ext/object/json.rb#128 -class Regexp - # source://activesupport//lib/active_support/core_ext/object/json.rb#129 - def as_json(options = T.unsafe(nil)); end - - # Returns +true+ if the regexp has the multiline flag set. - # - # (/./).multiline? # => false - # (/./m).multiline? # => true - # - # Regexp.new(".").multiline? # => false - # Regexp.new(".", Regexp::MULTILINE).multiline? # => true - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/regexp.rb#11 - def multiline?; end -end - -# source://activesupport//lib/active_support/core_ext/securerandom.rb#5 -module SecureRandom - class << self - # SecureRandom.base36 generates a random base36 string in lowercase. - # - # The argument _n_ specifies the length of the random string to be generated. - # - # If _n_ is not specified or is +nil+, 16 is assumed. It may be larger in the future. - # This method can be used over +base58+ if a deterministic case key is necessary. - # - # The result will contain alphanumeric characters in lowercase. - # - # p SecureRandom.base36 # => "4kugl2pdqmscqtje" - # p SecureRandom.base36(24) # => "77tmhrhjfvfdwodq8w7ev2m7" - # - # source://activesupport//lib/active_support/core_ext/securerandom.rb#38 - def base36(n = T.unsafe(nil)); end - - # SecureRandom.base58 generates a random base58 string. - # - # The argument _n_ specifies the length of the random string to be generated. - # - # If _n_ is not specified or is +nil+, 16 is assumed. It may be larger in the future. - # - # The result may contain alphanumeric characters except 0, O, I and l. - # - # p SecureRandom.base58 # => "4kUgL2pdQMSCQtjE" - # p SecureRandom.base58(24) # => "77TMHrHJFvFDwodq8w7Ev2m7" - # - # source://activesupport//lib/active_support/core_ext/securerandom.rb#19 - def base58(n = T.unsafe(nil)); end - end -end - -# source://activesupport//lib/active_support/core_ext/securerandom.rb#7 -SecureRandom::BASE36_ALPHABET = T.let(T.unsafe(nil), Array) - -# source://activesupport//lib/active_support/core_ext/securerandom.rb#6 -SecureRandom::BASE58_ALPHABET = T.let(T.unsafe(nil), Array) - -# 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/string/multibyte.rb#5 -class String - include ::Comparable - - # Enables more predictable duck-typing on String-like classes. See Object#acts_like?. - # - # @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#88 - 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#121 - def blank?; end - - # By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize - # is set to :lower 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" - # - # +camelize+ is also aliased as +camelcase+. - # - # See ActiveSupport::Inflector.camelize. - # - # source://activesupport//lib/active_support/core_ext/string/inflections.rb#103 - def camelcase(first_letter = T.unsafe(nil)); end - - # By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize - # is set to :lower 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" - # - # +camelize+ is also aliased as +camelcase+. - # - # See ActiveSupport::Inflector.camelize. - # - # source://activesupport//lib/active_support/core_ext/string/inflections.rb#103 - 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#243 - 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#152 - 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#181 - 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#166 - def demodulize; end - - # The inverse of String#include?. Returns true if the string - # does not include the other string. - # - # "hello".exclude? "lo" # => false - # "hello".exclude? "ol" # => true - # "hello".exclude? ?h # => false - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/string/exclude.rb#10 - def exclude?(string); 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#290 - 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#344 - 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#266 - def humanize(capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end - - # Converts String to a TimeWithZone in the current zone if Time.zone or Time.zone_default - # is set, otherwise converts String to a Time via String#to_time - # - # source://activesupport//lib/active_support/core_ext/string/zones.rb#9 - def in_time_zone(zone = T.unsafe(nil)); end - - # Indents the lines in the receiver: - # - # < - # def some_method - # some_code - # end - # - # The second argument, +indent_string+, specifies which indent string to - # use. The default is +nil+, which tells the method to make a guess by - # peeking at the first indented line, and fallback to a space if there is - # none. - # - # " foo".indent(2) # => " foo" - # "foo\n\t\tbar".indent(2) # => "\t\tfoo\n\t\t\t\tbar" - # "foo".indent(2, "\t") # => "\t\tfoo" - # - # While +indent_string+ is typically one space or tab, it may be any string. - # - # The third argument, +indent_empty_lines+, is a flag that says whether - # empty lines should be indented. Default is false. - # - # "foo\n\nbar".indent(2) # => " foo\n\n bar" - # "foo\n\nbar".indent(2, nil, true) # => " foo\n \n bar" - # - # source://activesupport//lib/active_support/core_ext/string/indent.rb#42 - def indent(amount, indent_string = T.unsafe(nil), indent_empty_lines = T.unsafe(nil)); end - - # Same as +indent+, except it indents the receiver in-place. - # - # Returns the indented string, or +nil+ if there was nothing to indent. - # - # source://activesupport//lib/active_support/core_ext/string/indent.rb#7 - def indent!(amount, indent_string = T.unsafe(nil), indent_empty_lines = T.unsafe(nil)); end - - # Wraps the current string in the ActiveSupport::StringInquirer class, - # which gives you a prettier way to test for equality. - # - # env = 'production'.inquiry - # env.production? # => true - # env.development? # => false - # - # source://activesupport//lib/active_support/core_ext/string/inquiry.rb#13 - def inquiry; 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 nil and it will use - # the configured I18n.locale. - # - # class Person - # def to_param - # "#{id}-#{name.parameterize}" - # end - # end - # - # @person = Person.find(1) - # # => # - # - # <%= link_to(@person.name, person_path) %> - # # => Donald E. Knuth - # - # 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) - # # => # - # - # <%= link_to(@person.name, person_path) %> - # # => Donald E. Knuth - # - # See ActiveSupport::Inflector.parameterize. - # - # source://activesupport//lib/active_support/core_ext/string/inflections.rb#219 - 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 count == 1. - # 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 :en. - # 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 - - # 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 :en. - # 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 - - # Strips indentation in heredocs. - # - # For example in - # - # if options[:usage] - # puts <<-USAGE.strip_heredoc - # This command does such and such. - # - # Supported options are: - # -h This message - # ... - # USAGE - # end - # - # the user would see the usage message aligned against the left margin. - # - # Technically, it looks for the least indented non-empty line - # in the whole string, and removes that amount of leading whitespace. - # - # source://activesupport//lib/active_support/core_ext/string/strip.rb#22 - def strip_heredoc; 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#231 - 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" - # - # +titleize+ is also aliased as +titlecase+. - # - # See ActiveSupport::Inflector.titleize. - # - # source://activesupport//lib/active_support/core_ext/string/inflections.rb#130 - 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" - # - # +titleize+ is also aliased as +titlecase+. - # - # See ActiveSupport::Inflector.titleize. - # - # source://activesupport//lib/active_support/core_ext/string/inflections.rb#130 - 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+ after a given length if +text+ is longer than length: - # - # 'Once upon a time in a world far far away'.truncate(27) - # # => "Once upon a time in a wo..." - # - # Pass a string or regexp :separator 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 :omission string (defaults to "...") - # for a total length not exceeding length: - # - # 'And they found that many people were sleeping better.'.truncate(25, omission: '... (continued)') - # # => "And they f... (continued)" - # - # source://activesupport//lib/active_support/core_ext/string/filters.rb#66 - def truncate(truncate_at, options = T.unsafe(nil)); end - - # Truncates +text+ to at most bytesize 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 :omission string, defaulting - # to "…", for a total length not exceeding bytesize. - # - # source://activesupport//lib/active_support/core_ext/string/filters.rb#95 - def truncate_bytes(truncate_at, omission: T.unsafe(nil)); end - - # Truncates a given +text+ after a given number of words (words_count): - # - # 'Once upon a time in a world far far away'.truncate_words(4) - # # => "Once upon a time..." - # - # Pass a string or regexp :separator to specify a different separator of words: - # - # 'Once
upon
a
time
in
a
world'.truncate_words(5, separator: '
') - # # => "Once
upon
a
time
in..." - # - # The last characters will be replaced with the :omission 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#136 - 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#143 - def underscore; end - - # Converts just 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#277 - def upcase_first; end -end - -# source://activesupport//lib/active_support/core_ext/object/blank.rb#104 -String::BLANK_RE = T.let(T.unsafe(nil), Regexp) - -# source://activesupport//lib/active_support/core_ext/object/blank.rb#105 -String::ENCODED_BLANKS = T.let(T.unsafe(nil), Concurrent::Map) - -# source://activesupport//lib/active_support/core_ext/object/json.rb#63 -class Struct - include ::Enumerable - - # source://activesupport//lib/active_support/core_ext/object/json.rb#64 - def as_json(options = T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/core_ext/symbol/starts_ends_with.rb#3 -class Symbol - include ::Comparable - - # source://activesupport//lib/active_support/core_ext/object/json.rb#94 - def as_json(options = T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/core_ext/object/blank.rb#146 -class Time - include ::Comparable - include ::DateAndTime::Zones - include ::DateAndTime::Calculations - include ::DateAndTime::Compatibility - - # source://activesupport//lib/active_support/core_ext/time/calculations.rb#281 - 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#304 - 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#313 - 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: :years, :months, - # :weeks, :days, :hours, :minutes, - # :seconds. - # - # 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 - # - # source://activesupport//lib/active_support/core_ext/time/calculations.rb#183 - 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#209 - def ago(seconds); end - - # source://activesupport//lib/active_support/core_ext/object/json.rb#182 - 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#222 - 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#251 - 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#267 - 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#240 - 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#257 - 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#273 - 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#230 - 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#230 - 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#222 - 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#230 - 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#222 - 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#251 - 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#267 - 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#152 - 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 (:hour, :min, - # :sec, :usec, :nsec) 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: :year, :month, :day, - # :hour, :min, :sec, :usec, :nsec, - # :offset. Pass either :usec or :nsec, 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#139 - 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#313 - 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#240 - 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#257 - 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#273 - 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#328 - 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#328 - 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#68 - 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#214 - 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#230 - 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#230 - 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#222 - 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#304 - def minus_with_coercion(other); end - - # source://activesupport//lib/active_support/core_ext/time/calculations.rb#291 - def minus_with_duration(other); end - - # source://activesupport//lib/active_support/core_ext/time/calculations.rb#291 - 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#342 - 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#352 - 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#362 - 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#230 - def noon; end - - # source://activesupport//lib/active_support/core_ext/time/calculations.rb#281 - def plus_with_duration(other); end - - # Returns a new time the specified number of days ago. - # - # source://activesupport//lib/active_support/core_ext/time/calculations.rb#337 - 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#347 - 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#357 - 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#108 - 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#92 - 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#101 - 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#214 - def since(seconds); end - - # Converts to a formatted string. See DATE_FORMATS for built-in formats. - # - # This method is aliased to to_s. - # - # time = Time.now # => 2007-01-18 06:10:17 -06:00 - # - # time.to_formatted_s(:time) # => "06:10" - # time.to_s(:time) # => "06:10" - # - # time.to_formatted_s(:db) # => "2007-01-18 06:10:17" - # time.to_formatted_s(:number) # => "20070118061017" - # time.to_formatted_s(:short) # => "18 Jan 06:10" - # time.to_formatted_s(:long) # => "January 18, 2007 06:10" - # time.to_formatted_s(:long_ordinal) # => "January 18th, 2007 06:10" - # time.to_formatted_s(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600" - # time.to_formatted_s(:iso8601) # => "2007-01-18T06:10:17-06:00" - # - # == Adding your own time formats to +to_formatted_s+ - # 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 to_s. - # - # time = Time.now # => 2007-01-18 06:10:17 -06:00 - # - # time.to_formatted_s(:time) # => "06:10" - # time.to_s(:time) # => "06:10" - # - # time.to_formatted_s(:db) # => "2007-01-18 06:10:17" - # time.to_formatted_s(:number) # => "20070118061017" - # time.to_formatted_s(:short) # => "18 Jan 06:10" - # time.to_formatted_s(:long) # => "January 18, 2007 06:10" - # time.to_formatted_s(:long_ordinal) # => "January 18th, 2007 06:10" - # time.to_formatted_s(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600" - # time.to_formatted_s(:iso8601) # => "2007-01-18T06:10:17-06:00" - # - # == Adding your own time formats to +to_formatted_s+ - # 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_s(format = T.unsafe(nil)); end - - # Either return +self+ or the time in the local system timezone depending - # on the setting of +ActiveSupport.to_time_preserves_timezone+. - # - # source://activesupport//lib/active_support/core_ext/time/compatibility.rb#13 - def to_time; 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(*args, **_arg1); 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(*args, **_arg1); end - - # Returns Time.zone.now when Time.zone or config.time_zone are set, otherwise just returns Time.now. - # - # 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 Time.zone=. - # Returns +nil+ for invalid time zones. - # - # Time.find_zone "America/New_York" # => # - # Time.find_zone "NOT-A-TIMEZONE" # => nil - # - # source://activesupport//lib/active_support/core_ext/time/zones.rb#109 - def find_zone(time_zone); end - - # Returns a TimeZone instance matching the time zone provided. - # Accepts the time zone in any format supported by Time.zone=. - # Raises an +ArgumentError+ for invalid time zones. - # - # Time.find_zone! "America/New_York" # => # - # Time.find_zone! "EST" # => # - # Time.find_zone! -5.hours # => # - # 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#82 - 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#70 - def rfc3339(str); end - - # Allows override of Time.zone locally inside supplied block; - # resets Time.zone 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#62 - def use_zone(time_zone); end - - # Returns the TimeZone for the current request, if this has been set (via Time.zone=). - # If Time.zone has not been set for the current request, returns the TimeZone specified in config.time_zone. - # - # source://activesupport//lib/active_support/core_ext/time/zones.rb#14 - def zone; end - - # Sets Time.zone 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)", -5.hours). - # * 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 Time.zone on a per request basis and reset it when the request is done. - # current_user.time_zone 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#72 -class TrueClass - # source://activesupport//lib/active_support/core_ext/object/json.rb#70 - 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#78 - def blank?; 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/uri.rb#19 -module URI - class << self - # source://activesupport//lib/active_support/core_ext/uri.rb#21 - def parser; end - end -end - -# source://activesupport//lib/active_support/core_ext/object/json.rb#211 -class URI::Generic - include ::URI::RFC2396_REGEXP - - # source://activesupport//lib/active_support/core_ext/object/json.rb#212 - def as_json(options = T.unsafe(nil)); end -end - -# source://activesupport//lib/active_support/core_ext/object/duplicable.rb#41 -class UnboundMethod - # Unbound methods are not duplicable: - # - # method(:puts).unbind.duplicable? # => false - # method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod - # - # @return [Boolean] - # - # source://activesupport//lib/active_support/core_ext/object/duplicable.rb#46 - def duplicable?; end -end diff --git a/Library/Homebrew/sorbet/rbi/gems/concurrent-ruby@1.2.3.rbi b/Library/Homebrew/sorbet/rbi/gems/concurrent-ruby@1.2.3.rbi deleted file mode 100644 index 21edf8bff1..0000000000 --- a/Library/Homebrew/sorbet/rbi/gems/concurrent-ruby@1.2.3.rbi +++ /dev/null @@ -1,11590 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `concurrent-ruby` gem. -# Please instead update this file by running `bin/tapioca gem concurrent-ruby`. - -# {include:file:README.md} -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/constants.rb#1 -module Concurrent - extend ::Concurrent::Utility::EngineDetector - extend ::Concurrent::Utility::NativeExtensionLoader - extend ::Logger::Severity - extend ::Concurrent::Concern::Logging - extend ::Concurrent::Concern::Deprecation - - private - - # Abort a currently running transaction - see `Concurrent::atomically`. - # - # @raise [Transaction::AbortError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#139 - def abort_transaction; end - - # Run a block that reads and writes `TVar`s as a single atomic transaction. - # With respect to the value of `TVar` objects, the transaction is atomic, in - # that it either happens or it does not, consistent, in that the `TVar` - # objects involved will never enter an illegal state, and isolated, in that - # transactions never interfere with each other. You may recognise these - # properties from database transactions. - # - # There are some very important and unusual semantics that you must be aware of: - # - # * Most importantly, the block that you pass to atomically may be executed - # more than once. In most cases your code should be free of - # side-effects, except for via TVar. - # - # * If an exception escapes an atomically block it will abort the transaction. - # - # * It is undefined behaviour to use callcc or Fiber with atomically. - # - # * If you create a new thread within an atomically, it will not be part of - # the transaction. Creating a thread counts as a side-effect. - # - # Transactions within transactions are flattened to a single transaction. - # - # @example - # a = new TVar(100_000) - # b = new TVar(100) - # - # Concurrent::atomically do - # a.value -= 10 - # b.value += 10 - # end - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#82 - def atomically; end - - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#56 - def call_dataflow(method, executor, *inputs, &block); end - - # Dataflow allows you to create a task that will be scheduled when all of its data dependencies are available. - # {include:file:docs-source/dataflow.md} - # - # @param inputs [Future] zero or more `Future` operations that this dataflow depends upon - # @raise [ArgumentError] if no block is given - # @raise [ArgumentError] if any of the inputs are not `IVar`s - # @return [Object] the result of all the operations - # @yield The operation to perform once all the dependencies are met - # @yieldparam inputs [Future] each of the `Future` inputs to the dataflow - # @yieldreturn [Object] the result of the block operation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#34 - def dataflow(*inputs, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#44 - def dataflow!(*inputs, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#39 - def dataflow_with(executor, *inputs, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#49 - def dataflow_with!(executor, *inputs, &block); end - - # Leave a transaction without committing or aborting - see `Concurrent::atomically`. - # - # @raise [Transaction::LeaveError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#144 - def leave_transaction; end - - # Returns the current time as tracked by the application monotonic clock. - # - # @param unit [Symbol] the time unit to be returned, can be either - # :float_second, :float_millisecond, :float_microsecond, :second, - # :millisecond, :microsecond, or :nanosecond default to :float_second. - # @return [Float] The current monotonic time since some unspecified - # starting point - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/monotonic_time.rb#15 - def monotonic_time(unit = T.unsafe(nil)); end - - class << self - # Abort a currently running transaction - see `Concurrent::atomically`. - # - # @raise [Transaction::AbortError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#139 - def abort_transaction; end - - # Run a block that reads and writes `TVar`s as a single atomic transaction. - # With respect to the value of `TVar` objects, the transaction is atomic, in - # that it either happens or it does not, consistent, in that the `TVar` - # objects involved will never enter an illegal state, and isolated, in that - # transactions never interfere with each other. You may recognise these - # properties from database transactions. - # - # There are some very important and unusual semantics that you must be aware of: - # - # * Most importantly, the block that you pass to atomically may be executed - # more than once. In most cases your code should be free of - # side-effects, except for via TVar. - # - # * If an exception escapes an atomically block it will abort the transaction. - # - # * It is undefined behaviour to use callcc or Fiber with atomically. - # - # * If you create a new thread within an atomically, it will not be part of - # the transaction. Creating a thread counts as a side-effect. - # - # Transactions within transactions are flattened to a single transaction. - # - # @example - # a = new TVar(100_000) - # b = new TVar(100) - # - # Concurrent::atomically do - # a.value -= 10 - # b.value += 10 - # end - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#82 - def atomically; end - - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#56 - def call_dataflow(method, executor, *inputs, &block); end - - # @return [Logger] Logger with provided level and output. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#37 - def create_simple_logger(level = T.unsafe(nil), output = T.unsafe(nil)); end - - # @deprecated - # @return [Logger] Logger with provided level and output. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#69 - def create_stdlib_logger(level = T.unsafe(nil), output = T.unsafe(nil)); end - - # Dataflow allows you to create a task that will be scheduled when all of its data dependencies are available. - # {include:file:docs-source/dataflow.md} - # - # @param inputs [Future] zero or more `Future` operations that this dataflow depends upon - # @raise [ArgumentError] if no block is given - # @raise [ArgumentError] if any of the inputs are not `IVar`s - # @return [Object] the result of all the operations - # @yield The operation to perform once all the dependencies are met - # @yieldparam inputs [Future] each of the `Future` inputs to the dataflow - # @yieldreturn [Object] the result of the block operation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#34 - def dataflow(*inputs, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#44 - def dataflow!(*inputs, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#39 - def dataflow_with(executor, *inputs, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#49 - def dataflow_with!(executor, *inputs, &block); end - - # Disables AtExit handlers including pool auto-termination handlers. - # When disabled it will be the application programmer's responsibility - # to ensure that the handlers are shutdown properly prior to application - # exit by calling `AtExit.run` method. - # - # @deprecated Has no effect since it is no longer needed, see https://github.com/ruby-concurrency/concurrent-ruby/pull/841. - # @note this option should be needed only because of `at_exit` ordering - # issues which may arise when running some of the testing frameworks. - # E.g. Minitest's test-suite runs itself in `at_exit` callback which - # executes after the pools are already terminated. Then auto termination - # needs to be disabled and called manually after test-suite ends. - # @note This method should *never* be called - # from within a gem. It should *only* be used from within the main - # application and even then it should be used only when necessary. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#48 - def disable_at_exit_handlers!; end - - # General access point to global executors. - # - # @param executor_identifier [Symbol, Executor] symbols: - # - :fast - {Concurrent.global_fast_executor} - # - :io - {Concurrent.global_io_executor} - # - :immediate - {Concurrent.global_immediate_executor} - # @return [Executor] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#83 - def executor(executor_identifier); end - - # Global thread pool optimized for short, fast *operations*. - # - # @return [ThreadPoolExecutor] the thread pool - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#55 - def global_fast_executor; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#66 - def global_immediate_executor; end - - # Global thread pool optimized for long, blocking (IO) *tasks*. - # - # @return [ThreadPoolExecutor] the thread pool - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#62 - def global_io_executor; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#109 - def global_logger; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#113 - def global_logger=(value); end - - # Global thread pool user for global *timers*. - # - # @return [Concurrent::TimerSet] the thread pool - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#73 - def global_timer_set; end - - # Leave a transaction without committing or aborting - see `Concurrent::atomically`. - # - # @raise [Transaction::LeaveError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#144 - def leave_transaction; end - - # Returns the current time as tracked by the application monotonic clock. - # - # @param unit [Symbol] the time unit to be returned, can be either - # :float_second, :float_millisecond, :float_microsecond, :second, - # :millisecond, :microsecond, or :nanosecond default to :float_second. - # @return [Float] The current monotonic time since some unspecified - # starting point - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/monotonic_time.rb#15 - def monotonic_time(unit = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb#7 - def mutex_owned_per_thread?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#87 - def new_fast_executor(opts = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#98 - def new_io_executor(opts = T.unsafe(nil)); end - - # Number of physical processor cores on the current system. For performance - # reasons the calculated value will be memoized on the first call. - # - # On Windows the Win32 API will be queried for the `NumberOfCores from - # Win32_Processor`. This will return the total number "of cores for the - # current instance of the processor." On Unix-like operating systems either - # the `hwprefs` or `sysctl` utility will be called in a subshell and the - # returned value will be used. In the rare case where none of these methods - # work or an exception is raised the function will simply return 1. - # - # @return [Integer] number physical processor cores on the current system - # @see https://github.com/grosser/parallel/blob/4fc8b89d08c7091fe0419ca8fba1ec3ce5a8d185/lib/parallel.rb - # @see http://msdn.microsoft.com/en-us/library/aa394373(v=vs.85).aspx - # @see http://www.unix.com/man-page/osx/1/HWPREFS/ - # @see http://linux.die.net/man/8/sysctl - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#107 - def physical_processor_count; end - - # Number of processors seen by the OS and used for process scheduling. For - # performance reasons the calculated value will be memoized on the first - # call. - # - # When running under JRuby the Java runtime call - # `java.lang.Runtime.getRuntime.availableProcessors` will be used. According - # to the Java documentation this "value may change during a particular - # invocation of the virtual machine... [applications] should therefore - # occasionally poll this property." Subsequently the result will NOT be - # memoized under JRuby. - # - # Otherwise Ruby's Etc.nprocessors will be used. - # - # @return [Integer] number of processors seen by the OS or Java runtime - # @see http://docs.oracle.com/javase/6/docs/api/java/lang/Runtime.html#availableProcessors() - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#86 - def processor_count; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#68 - def processor_counter; end - - # Use logger created by #create_simple_logger to log concurrent-ruby messages. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#63 - def use_simple_logger(level = T.unsafe(nil), output = T.unsafe(nil)); end - - # Use logger created by #create_stdlib_logger to log concurrent-ruby messages. - # - # @deprecated - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#96 - def use_stdlib_logger(level = T.unsafe(nil), output = T.unsafe(nil)); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#38 -class Concurrent::AbstractExchanger < ::Concurrent::Synchronization::Object - # @return [AbstractExchanger] a new instance of AbstractExchanger - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#44 - def initialize; end - - # Waits for another thread to arrive at this exchange point (unless the - # current thread is interrupted), and then transfers the given object to - # it, receiving its object in return. The timeout value indicates the - # approximate number of seconds the method should block while waiting - # for the exchange. When the timeout value is `nil` the method will - # block indefinitely. - # - # - # In some edge cases when a `timeout` is given a return value of `nil` may be - # ambiguous. Specifically, if `nil` is a valid value in the exchange it will - # be impossible to tell whether `nil` is the actual return value or if it - # signifies timeout. When `nil` is a valid value in the exchange consider - # using {#exchange!} or {#try_exchange} instead. - # - # @param value [Object] the value to exchange with another thread - # @param timeout [Numeric, nil] in seconds, `nil` blocks indefinitely - # @return [Object] the value exchanged by the other thread or `nil` on timeout - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#69 - def exchange(value, timeout = T.unsafe(nil)); end - - # Waits for another thread to arrive at this exchange point (unless the - # current thread is interrupted), and then transfers the given object to - # it, receiving its object in return. The timeout value indicates the - # approximate number of seconds the method should block while waiting - # for the exchange. When the timeout value is `nil` the method will - # block indefinitely. - # - # - # On timeout a {Concurrent::TimeoutError} exception will be raised. - # - # @param value [Object] the value to exchange with another thread - # @param timeout [Numeric, nil] in seconds, `nil` blocks indefinitely - # @raise [Concurrent::TimeoutError] on timeout - # @return [Object] the value exchanged by the other thread - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#80 - def exchange!(value, timeout = T.unsafe(nil)); end - - # Waits for another thread to arrive at this exchange point (unless the - # current thread is interrupted), and then transfers the given object to - # it, receiving its object in return. The timeout value indicates the - # approximate number of seconds the method should block while waiting - # for the exchange. When the timeout value is `nil` the method will - # block indefinitely. - # - # - # The return value will be a {Concurrent::Maybe} set to `Just` on success or - # `Nothing` on timeout. - # - # @example - # - # exchanger = Concurrent::Exchanger.new - # - # result = exchanger.exchange(:foo, 0.5) - # - # if result.just? - # puts result.value #=> :bar - # else - # puts 'timeout' - # end - # @param value [Object] the value to exchange with another thread - # @param timeout [Numeric, nil] in seconds, `nil` blocks indefinitely - # @return [Concurrent::Maybe] on success a `Just` maybe will be returned with - # the item exchanged by the other thread as `#value`; on timeout a - # `Nothing` maybe will be returned with {Concurrent::TimeoutError} as `#reason` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#109 - def try_exchange(value, timeout = T.unsafe(nil)); end - - private - - # Waits for another thread to arrive at this exchange point (unless the - # current thread is interrupted), and then transfers the given object to - # it, receiving its object in return. The timeout value indicates the - # approximate number of seconds the method should block while waiting - # for the exchange. When the timeout value is `nil` the method will - # block indefinitely. - # - # @param value [Object] the value to exchange with another thread - # @param timeout [Numeric, nil] in seconds, `nil` blocks indefinitely - # @raise [NotImplementedError] - # @return [Object, CANCEL] the value exchanged by the other thread; {CANCEL} on timeout - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#122 - def do_exchange(value, timeout); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#41 -Concurrent::AbstractExchanger::CANCEL = T.let(T.unsafe(nil), Object) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#10 -class Concurrent::AbstractExecutorService < ::Concurrent::Synchronization::LockableObject - include ::Logger::Severity - include ::Concurrent::Concern::Logging - include ::Concurrent::ExecutorService - include ::Concurrent::Concern::Deprecation - - # Create a new thread pool. - # - # @return [AbstractExecutorService] a new instance of AbstractExecutorService - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#23 - def initialize(opts = T.unsafe(nil), &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#72 - def auto_terminate=(value); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#67 - def auto_terminate?; end - - # Returns the value of attribute fallback_policy. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#18 - def fallback_policy; end - - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#42 - def kill; end - - # Returns the value of attribute name. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#20 - def name; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#52 - def running?; end - - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#37 - def shutdown; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#62 - def shutdown?; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#57 - def shuttingdown?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#32 - def to_s; end - - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#47 - def wait_for_termination(timeout = T.unsafe(nil)); end - - private - - # Returns an action which executes the `fallback_policy` once the queue - # size reaches `max_queue`. The reason for the indirection of an action - # is so that the work can be deferred outside of synchronization. - # - # @param args [Array] the arguments to the task which is being handled. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#85 - def fallback_action(*args); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#126 - def ns_auto_terminate?; end - - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#106 - def ns_execute(*args, &task); end - - # Callback method called when the executor has been killed. - # The default behavior is to do nothing. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#122 - def ns_kill_execution; end - - # Callback method called when an orderly shutdown has completed. - # The default behavior is to signal all waiting threads. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#114 - def ns_shutdown_execution; end -end - -# The set of possible fallback policies that may be set at thread pool creation. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#15 -Concurrent::AbstractExecutorService::FALLBACK_POLICIES = T.let(T.unsafe(nil), Array) - -# An abstract implementation of local storage, with sub-classes for -# per-thread and per-fiber locals. -# -# Each execution context (EC, thread or fiber) has a lazily initialized array -# of local variable values. Each time a new local variable is created, we -# allocate an "index" for it. -# -# For example, if the allocated index is 1, that means slot #1 in EVERY EC's -# locals array will be used for the value of that variable. -# -# The good thing about using a per-EC structure to hold values, rather than -# a global, is that no synchronization is needed when reading and writing -# those values (since the structure is only ever accessed by a single -# thread). -# -# Of course, when a local variable is GC'd, 1) we need to recover its index -# for use by other new local variables (otherwise the locals arrays could -# get bigger and bigger with time), and 2) we need to null out all the -# references held in the now-unused slots (both to avoid blocking GC of those -# objects, and also to prevent "stale" values from being passed on to a new -# local when the index is reused). -# -# Because we need to null out freed slots, we need to keep references to -# ALL the locals arrays, so we can null out the appropriate slots in all of -# them. This is why we need to use a finalizer to clean up the locals array -# when the EC goes out of scope. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#35 -class Concurrent::AbstractLocals - # @return [AbstractLocals] a new instance of AbstractLocals - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#36 - def initialize; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#89 - def fetch(index); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#71 - def free_index(index); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#55 - def next_index(local); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#102 - def set(index, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#43 - def synchronize; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#48 - def weak_synchronize; end - - private - - # When the local goes out of scope, clean up that slot across all locals currently assigned. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#112 - def local_finalizer(index); end - - # Returns the locals for the current scope, or nil if none exist. - # - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#128 - def locals; end - - # Returns the locals for the current scope, creating them if necessary. - # - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#133 - def locals!; end - - # When a thread/fiber goes out of scope, remove the array from @all_arrays. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#119 - def thread_fiber_finalizer(array_object_id); end -end - -# `Agent` is inspired by Clojure's [agent](http://clojure.org/agents) -# function. An agent is a shared, mutable variable providing independent, -# uncoordinated, *asynchronous* change of individual values. Best used when -# the value will undergo frequent, complex updates. Suitable when the result -# of an update does not need to be known immediately. `Agent` is (mostly) -# functionally equivalent to Clojure's agent, except where the runtime -# prevents parity. -# -# Agents are reactive, not autonomous - there is no imperative message loop -# and no blocking receive. The state of an Agent should be itself immutable -# and the `#value` of an Agent is always immediately available for reading by -# any thread without any messages, i.e. observation does not require -# cooperation or coordination. -# -# Agent action dispatches are made using the various `#send` methods. These -# methods always return immediately. At some point later, in another thread, -# the following will happen: -# -# 1. The given `action` will be applied to the state of the Agent and the -# `args`, if any were supplied. -# 2. The return value of `action` will be passed to the validator lambda, -# if one has been set on the Agent. -# 3. If the validator succeeds or if no validator was given, the return value -# of the given `action` will become the new `#value` of the Agent. See -# `#initialize` for details. -# 4. If any observers were added to the Agent, they will be notified. See -# `#add_observer` for details. -# 5. If during the `action` execution any other dispatches are made (directly -# or indirectly), they will be held until after the `#value` of the Agent -# has been changed. -# -# If any exceptions are thrown by an action function, no nested dispatches -# will occur, and the exception will be cached in the Agent itself. When an -# Agent has errors cached, any subsequent interactions will immediately throw -# an exception, until the agent's errors are cleared. Agent errors can be -# examined with `#error` and the agent restarted with `#restart`. -# -# The actions of all Agents get interleaved amongst threads in a thread pool. -# At any point in time, at most one action for each Agent is being executed. -# Actions dispatched to an agent from another single agent or thread will -# occur in the order they were sent, potentially interleaved with actions -# dispatched to the same agent from other sources. The `#send` method should -# be used for actions that are CPU limited, while the `#send_off` method is -# appropriate for actions that may block on IO. -# -# Unlike in Clojure, `Agent` cannot participate in `Concurrent::TVar` transactions. -# -# ## Example -# -# ``` -# def next_fibonacci(set = nil) -# return [0, 1] if set.nil? -# set + [set[-2..-1].reduce{|sum,x| sum + x }] -# end -# -# # create an agent with an initial value -# agent = Concurrent::Agent.new(next_fibonacci) -# -# # send a few update requests -# 5.times do -# agent.send{|set| next_fibonacci(set) } -# end -# -# # wait for them to complete -# agent.await -# -# # get the current value -# agent.value #=> [0, 1, 1, 2, 3, 5, 8] -# ``` -# -# ## Observation -# -# Agents support observers through the {Concurrent::Observable} mixin module. -# Notification of observers occurs every time an action dispatch returns and -# the new value is successfully validated. Observation will *not* occur if the -# action raises an exception, if validation fails, or when a {#restart} occurs. -# -# When notified the observer will receive three arguments: `time`, `old_value`, -# and `new_value`. The `time` argument is the time at which the value change -# occurred. The `old_value` is the value of the Agent when the action began -# processing. The `new_value` is the value to which the Agent was set when the -# action completed. Note that `old_value` and `new_value` may be the same. -# This is not an error. It simply means that the action returned the same -# value. -# -# ## Nested Actions -# -# It is possible for an Agent action to post further actions back to itself. -# The nested actions will be enqueued normally then processed *after* the -# outer action completes, in the order they were sent, possibly interleaved -# with action dispatches from other threads. Nested actions never deadlock -# with one another and a failure in a nested action will never affect the -# outer action. -# -# Nested actions can be called using the Agent reference from the enclosing -# scope or by passing the reference in as a "send" argument. Nested actions -# cannot be post using `self` from within the action block/proc/lambda; `self` -# in this context will not reference the Agent. The preferred method for -# dispatching nested actions is to pass the Agent as an argument. This allows -# Ruby to more effectively manage the closing scope. -# -# Prefer this: -# -# ``` -# agent = Concurrent::Agent.new(0) -# agent.send(agent) do |value, this| -# this.send {|v| v + 42 } -# 3.14 -# end -# agent.value #=> 45.14 -# ``` -# -# Over this: -# -# ``` -# agent = Concurrent::Agent.new(0) -# agent.send do |value| -# agent.send {|v| v + 42 } -# 3.14 -# end -# ``` -# -# -# **NOTE** Never, *under any circumstances*, call any of the "await" methods -# ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action -# block/proc/lambda. The call will block the Agent and will always fail. -# Calling either {#await} or {#wait} (with a timeout of `nil`) will -# hopelessly deadlock the Agent with no possibility of recovery. -# -# @see http://clojure.org/Agents Clojure Agents -# @see http://clojure.org/state Values and Change - Clojure's approach to Identity and State -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#145 -class Concurrent::Agent < ::Concurrent::Synchronization::LockableObject - include ::Concurrent::Concern::Observable - - # Create a new `Agent` with the given initial value and options. - # - # The `:validator` option must be `nil` or a side-effect free proc/lambda - # which takes one argument. On any intended value change the validator, if - # provided, will be called. If the new value is invalid the validator should - # return `false` or raise an error. - # - # The `:error_handler` option must be `nil` or a proc/lambda which takes two - # arguments. When an action raises an error or validation fails, either by - # returning false or raising an error, the error handler will be called. The - # arguments to the error handler will be a reference to the agent itself and - # the error object which was raised. - # - # The `:error_mode` may be either `:continue` (the default if an error - # handler is given) or `:fail` (the default if error handler nil or not - # given). - # - # If an action being run by the agent throws an error or doesn't pass - # validation the error handler, if present, will be called. After the - # handler executes if the error mode is `:continue` the Agent will continue - # as if neither the action that caused the error nor the error itself ever - # happened. - # - # If the mode is `:fail` the Agent will become {#failed?} and will stop - # accepting new action dispatches. Any previously queued actions will be - # held until {#restart} is called. The {#value} method will still work, - # returning the value of the Agent before the error. - # - # @option opts - # @option opts - # @option opts - # @param initial [Object] the initial value - # @param opts [Hash] the configuration options - # @return [Agent] a new instance of Agent - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#220 - def initialize(initial, opts = T.unsafe(nil)); end - - # Dispatches an action to the Agent and returns immediately. Subsequently, - # in a thread from a thread pool, the {#value} will be set to the return - # value of the action. Appropriate for actions that may block on IO. - # - # @param action [Proc] the action dispatch to be enqueued - # @return [Concurrent::Agent] self - # @see #send_off - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#331 - def <<(action); end - - # Blocks the current thread (indefinitely!) until all actions dispatched - # thus far, from this thread or nested by the Agent, have occurred. Will - # block when {#failed?}. Will never return if a failed Agent is {#restart} - # with `:clear_actions` true. - # - # Returns a reference to `self` to support method chaining: - # - # ``` - # current_value = agent.await.value - # ``` - # - # - # **NOTE** Never, *under any circumstances*, call any of the "await" methods - # ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action - # block/proc/lambda. The call will block the Agent and will always fail. - # Calling either {#await} or {#wait} (with a timeout of `nil`) will - # hopelessly deadlock the Agent with no possibility of recovery. - # - # @return [Boolean] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#350 - def await; end - - # Blocks the current thread until all actions dispatched thus far, from this - # thread or nested by the Agent, have occurred, or the timeout (in seconds) - # has elapsed. - # - # - # **NOTE** Never, *under any circumstances*, call any of the "await" methods - # ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action - # block/proc/lambda. The call will block the Agent and will always fail. - # Calling either {#await} or {#wait} (with a timeout of `nil`) will - # hopelessly deadlock the Agent with no possibility of recovery. - # - # @param timeout [Float] the maximum number of seconds to wait - # @return [Boolean] true if all actions complete before timeout else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#363 - def await_for(timeout); end - - # Blocks the current thread until all actions dispatched thus far, from this - # thread or nested by the Agent, have occurred, or the timeout (in seconds) - # has elapsed. - # - # - # **NOTE** Never, *under any circumstances*, call any of the "await" methods - # ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action - # block/proc/lambda. The call will block the Agent and will always fail. - # Calling either {#await} or {#wait} (with a timeout of `nil`) will - # hopelessly deadlock the Agent with no possibility of recovery. - # - # @param timeout [Float] the maximum number of seconds to wait - # @raise [Concurrent::TimeoutError] when timout is reached - # @return [Boolean] true if all actions complete before timeout - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#377 - def await_for!(timeout); end - - # The current value (state) of the Agent, irrespective of any pending or - # in-progress actions. The value is always available and is non-blocking. - # - # @return [Object] the current value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#229 - def deref; end - - # When {#failed?} and {#error_mode} is `:fail`, returns the error object - # which caused the failure, else `nil`. When {#error_mode} is `:continue` - # will *always* return `nil`. - # - # @return [nil, Error] the error which caused the failure when {#failed?} - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#240 - def error; end - - # The error mode this Agent is operating in. See {#initialize} for details. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#184 - def error_mode; end - - # Is the Agent in a failed state? - # - # @return [Boolean] - # @see #restart - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#402 - def failed?; end - - # Dispatches an action to the Agent and returns immediately. Subsequently, - # in a thread from a thread pool, the {#value} will be set to the return - # value of the action. Action dispatches are only allowed when the Agent - # is not {#failed?}. - # - # The action must be a block/proc/lambda which takes 1 or more arguments. - # The first argument is the current {#value} of the Agent. Any arguments - # passed to the send method via the `args` parameter will be passed to the - # action as the remaining arguments. The action must return the new value - # of the Agent. - # - # * {#send} and {#send!} should be used for actions that are CPU limited - # * {#send_off}, {#send_off!}, and {#<<} are appropriate for actions that - # may block on IO - # * {#send_via} and {#send_via!} are used when a specific executor is to - # be used for the action - # - # @param args [Array] zero or more arguments to be passed to - # the action - # @param action [Proc] the action dispatch to be enqueued - # @return [Boolean] true if the action is successfully enqueued, false if - # the Agent is {#failed?} - # @yield [agent, value, *args] process the old value and return the new - # @yieldparam value [Object] the current {#value} of the Agent - # @yieldparam args [Array] zero or more arguments to pass to the - # action - # @yieldreturn [Object] the new value of the Agent - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#294 - def post(*args, &action); end - - # When {#failed?} and {#error_mode} is `:fail`, returns the error object - # which caused the failure, else `nil`. When {#error_mode} is `:continue` - # will *always* return `nil`. - # - # @return [nil, Error] the error which caused the failure when {#failed?} - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#240 - def reason; end - - # When an Agent is {#failed?}, changes the Agent {#value} to `new_value` - # then un-fails the Agent so that action dispatches are allowed again. If - # the `:clear_actions` option is give and true, any actions queued on the - # Agent that were being held while it was failed will be discarded, - # otherwise those held actions will proceed. The `new_value` must pass the - # validator if any, or `restart` will raise an exception and the Agent will - # remain failed with its old {#value} and {#error}. Observers, if any, will - # not be notified of the new state. - # - # @option opts - # @param new_value [Object] the new value for the Agent once restarted - # @param opts [Hash] the configuration options - # @raise [Concurrent:AgentError] when not failed - # @return [Boolean] true - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#424 - def restart(new_value, opts = T.unsafe(nil)); end - - # Dispatches an action to the Agent and returns immediately. Subsequently, - # in a thread from a thread pool, the {#value} will be set to the return - # value of the action. Action dispatches are only allowed when the Agent - # is not {#failed?}. - # - # The action must be a block/proc/lambda which takes 1 or more arguments. - # The first argument is the current {#value} of the Agent. Any arguments - # passed to the send method via the `args` parameter will be passed to the - # action as the remaining arguments. The action must return the new value - # of the Agent. - # - # * {#send} and {#send!} should be used for actions that are CPU limited - # * {#send_off}, {#send_off!}, and {#<<} are appropriate for actions that - # may block on IO - # * {#send_via} and {#send_via!} are used when a specific executor is to - # be used for the action - # - # @param args [Array] zero or more arguments to be passed to - # the action - # @param action [Proc] the action dispatch to be enqueued - # @return [Boolean] true if the action is successfully enqueued, false if - # the Agent is {#failed?} - # @yield [agent, value, *args] process the old value and return the new - # @yieldparam value [Object] the current {#value} of the Agent - # @yieldparam args [Array] zero or more arguments to pass to the - # action - # @yieldreturn [Object] the new value of the Agent - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#278 - def send(*args, &action); end - - # Dispatches an action to the Agent and returns immediately. Subsequently, - # in a thread from a thread pool, the {#value} will be set to the return - # value of the action. Action dispatches are only allowed when the Agent - # is not {#failed?}. - # - # The action must be a block/proc/lambda which takes 1 or more arguments. - # The first argument is the current {#value} of the Agent. Any arguments - # passed to the send method via the `args` parameter will be passed to the - # action as the remaining arguments. The action must return the new value - # of the Agent. - # - # * {#send} and {#send!} should be used for actions that are CPU limited - # * {#send_off}, {#send_off!}, and {#<<} are appropriate for actions that - # may block on IO - # * {#send_via} and {#send_via!} are used when a specific executor is to - # be used for the action - # - # @param args [Array] zero or more arguments to be passed to - # the action - # @param action [Proc] the action dispatch to be enqueued - # @raise [Concurrent::Agent::Error] if the Agent is {#failed?} - # @return [Boolean] true if the action is successfully enqueued - # @yield [agent, value, *args] process the old value and return the new - # @yieldparam value [Object] the current {#value} of the Agent - # @yieldparam args [Array] zero or more arguments to pass to the - # action - # @yieldreturn [Object] the new value of the Agent - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#287 - def send!(*args, &action); end - - # Dispatches an action to the Agent and returns immediately. Subsequently, - # in a thread from a thread pool, the {#value} will be set to the return - # value of the action. Action dispatches are only allowed when the Agent - # is not {#failed?}. - # - # The action must be a block/proc/lambda which takes 1 or more arguments. - # The first argument is the current {#value} of the Agent. Any arguments - # passed to the send method via the `args` parameter will be passed to the - # action as the remaining arguments. The action must return the new value - # of the Agent. - # - # * {#send} and {#send!} should be used for actions that are CPU limited - # * {#send_off}, {#send_off!}, and {#<<} are appropriate for actions that - # may block on IO - # * {#send_via} and {#send_via!} are used when a specific executor is to - # be used for the action - # - # @param args [Array] zero or more arguments to be passed to - # the action - # @param action [Proc] the action dispatch to be enqueued - # @return [Boolean] true if the action is successfully enqueued, false if - # the Agent is {#failed?} - # @yield [agent, value, *args] process the old value and return the new - # @yieldparam value [Object] the current {#value} of the Agent - # @yieldparam args [Array] zero or more arguments to pass to the - # action - # @yieldreturn [Object] the new value of the Agent - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#294 - def send_off(*args, &action); end - - # Dispatches an action to the Agent and returns immediately. Subsequently, - # in a thread from a thread pool, the {#value} will be set to the return - # value of the action. Action dispatches are only allowed when the Agent - # is not {#failed?}. - # - # The action must be a block/proc/lambda which takes 1 or more arguments. - # The first argument is the current {#value} of the Agent. Any arguments - # passed to the send method via the `args` parameter will be passed to the - # action as the remaining arguments. The action must return the new value - # of the Agent. - # - # * {#send} and {#send!} should be used for actions that are CPU limited - # * {#send_off}, {#send_off!}, and {#<<} are appropriate for actions that - # may block on IO - # * {#send_via} and {#send_via!} are used when a specific executor is to - # be used for the action - # - # @param args [Array] zero or more arguments to be passed to - # the action - # @param action [Proc] the action dispatch to be enqueued - # @raise [Concurrent::Agent::Error] if the Agent is {#failed?} - # @return [Boolean] true if the action is successfully enqueued - # @yield [agent, value, *args] process the old value and return the new - # @yieldparam value [Object] the current {#value} of the Agent - # @yieldparam args [Array] zero or more arguments to pass to the - # action - # @yieldreturn [Object] the new value of the Agent - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#302 - def send_off!(*args, &action); end - - # Dispatches an action to the Agent and returns immediately. Subsequently, - # in a thread from a thread pool, the {#value} will be set to the return - # value of the action. Action dispatches are only allowed when the Agent - # is not {#failed?}. - # - # The action must be a block/proc/lambda which takes 1 or more arguments. - # The first argument is the current {#value} of the Agent. Any arguments - # passed to the send method via the `args` parameter will be passed to the - # action as the remaining arguments. The action must return the new value - # of the Agent. - # - # * {#send} and {#send!} should be used for actions that are CPU limited - # * {#send_off}, {#send_off!}, and {#<<} are appropriate for actions that - # may block on IO - # * {#send_via} and {#send_via!} are used when a specific executor is to - # be used for the action - # - # @param args [Array] zero or more arguments to be passed to - # the action - # @param action [Proc] the action dispatch to be enqueued - # @param executor [Concurrent::ExecutorService] the executor on which the - # action is to be dispatched - # @return [Boolean] true if the action is successfully enqueued, false if - # the Agent is {#failed?} - # @yield [agent, value, *args] process the old value and return the new - # @yieldparam value [Object] the current {#value} of the Agent - # @yieldparam args [Array] zero or more arguments to pass to the - # action - # @yieldreturn [Object] the new value of the Agent - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#311 - def send_via(executor, *args, &action); end - - # Dispatches an action to the Agent and returns immediately. Subsequently, - # in a thread from a thread pool, the {#value} will be set to the return - # value of the action. Action dispatches are only allowed when the Agent - # is not {#failed?}. - # - # The action must be a block/proc/lambda which takes 1 or more arguments. - # The first argument is the current {#value} of the Agent. Any arguments - # passed to the send method via the `args` parameter will be passed to the - # action as the remaining arguments. The action must return the new value - # of the Agent. - # - # * {#send} and {#send!} should be used for actions that are CPU limited - # * {#send_off}, {#send_off!}, and {#<<} are appropriate for actions that - # may block on IO - # * {#send_via} and {#send_via!} are used when a specific executor is to - # be used for the action - # - # @param args [Array] zero or more arguments to be passed to - # the action - # @param action [Proc] the action dispatch to be enqueued - # @param executor [Concurrent::ExecutorService] the executor on which the - # action is to be dispatched - # @raise [Concurrent::Agent::Error] if the Agent is {#failed?} - # @return [Boolean] true if the action is successfully enqueued - # @yield [agent, value, *args] process the old value and return the new - # @yieldparam value [Object] the current {#value} of the Agent - # @yieldparam args [Array] zero or more arguments to pass to the - # action - # @yieldreturn [Object] the new value of the Agent - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#319 - def send_via!(executor, *args, &action); end - - # Is the Agent in a failed state? - # - # @return [Boolean] - # @see #restart - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#402 - def stopped?; end - - # The current value (state) of the Agent, irrespective of any pending or - # in-progress actions. The value is always available and is non-blocking. - # - # @return [Object] the current value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#229 - def value; end - - # Blocks the current thread until all actions dispatched thus far, from this - # thread or nested by the Agent, have occurred, or the timeout (in seconds) - # has elapsed. Will block indefinitely when timeout is nil or not given. - # - # Provided mainly for consistency with other classes in this library. Prefer - # the various `await` methods instead. - # - # - # **NOTE** Never, *under any circumstances*, call any of the "await" methods - # ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action - # block/proc/lambda. The call will block the Agent and will always fail. - # Calling either {#await} or {#wait} (with a timeout of `nil`) will - # hopelessly deadlock the Agent with no possibility of recovery. - # - # @param timeout [Float] the maximum number of seconds to wait - # @return [Boolean] true if all actions complete before timeout else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#393 - def wait(timeout = T.unsafe(nil)); end - - private - - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#510 - def enqueue_action_job(action, args, executor); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#516 - def enqueue_await_job(latch); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#543 - def execute_next_job; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#576 - def handle_error(error); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#529 - def ns_enqueue_job(job, index = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#584 - def ns_find_last_job_for_thread; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#490 - def ns_initialize(initial, opts); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#539 - def ns_post_next_job; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#570 - def ns_validate(value); end - - class << self - # Blocks the current thread (indefinitely!) until all actions dispatched - # thus far to all the given Agents, from this thread or nested by the - # given Agents, have occurred. Will block when any of the agents are - # failed. Will never return if a failed Agent is restart with - # `:clear_actions` true. - # - # - # **NOTE** Never, *under any circumstances*, call any of the "await" methods - # ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action - # block/proc/lambda. The call will block the Agent and will always fail. - # Calling either {#await} or {#wait} (with a timeout of `nil`) will - # hopelessly deadlock the Agent with no possibility of recovery. - # - # @param agents [Array] the Agents on which to wait - # @return [Boolean] true - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#449 - def await(*agents); end - - # Blocks the current thread until all actions dispatched thus far to all - # the given Agents, from this thread or nested by the given Agents, have - # occurred, or the timeout (in seconds) has elapsed. - # - # - # **NOTE** Never, *under any circumstances*, call any of the "await" methods - # ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action - # block/proc/lambda. The call will block the Agent and will always fail. - # Calling either {#await} or {#wait} (with a timeout of `nil`) will - # hopelessly deadlock the Agent with no possibility of recovery. - # - # @param timeout [Float] the maximum number of seconds to wait - # @param agents [Array] the Agents on which to wait - # @return [Boolean] true if all actions complete before timeout else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#463 - def await_for(timeout, *agents); end - - # Blocks the current thread until all actions dispatched thus far to all - # the given Agents, from this thread or nested by the given Agents, have - # occurred, or the timeout (in seconds) has elapsed. - # - # - # **NOTE** Never, *under any circumstances*, call any of the "await" methods - # ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action - # block/proc/lambda. The call will block the Agent and will always fail. - # Calling either {#await} or {#wait} (with a timeout of `nil`) will - # hopelessly deadlock the Agent with no possibility of recovery. - # - # @param timeout [Float] the maximum number of seconds to wait - # @param agents [Array] the Agents on which to wait - # @raise [Concurrent::TimeoutError] when timout is reached - # @return [Boolean] true if all actions complete before timeout - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#482 - def await_for!(timeout, *agents); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#154 -Concurrent::Agent::AWAIT_ACTION = T.let(T.unsafe(nil), Proc) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#151 -Concurrent::Agent::AWAIT_FLAG = T.let(T.unsafe(nil), Object) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#157 -Concurrent::Agent::DEFAULT_ERROR_HANDLER = T.let(T.unsafe(nil), Proc) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#160 -Concurrent::Agent::DEFAULT_VALIDATOR = T.let(T.unsafe(nil), Proc) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#148 -Concurrent::Agent::ERROR_MODES = T.let(T.unsafe(nil), Array) - -# Raised during action processing or any other time in an Agent's lifecycle. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#167 -class Concurrent::Agent::Error < ::StandardError - # @return [Error] a new instance of Error - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#168 - def initialize(message = T.unsafe(nil)); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#163 -class Concurrent::Agent::Job < ::Struct - # Returns the value of attribute action - # - # @return [Object] the current value of action - def action; end - - # Sets the attribute action - # - # @param value [Object] the value to set the attribute action to. - # @return [Object] the newly set value - def action=(_); end - - # Returns the value of attribute args - # - # @return [Object] the current value of args - def args; end - - # Sets the attribute args - # - # @param value [Object] the value to set the attribute args to. - # @return [Object] the newly set value - def args=(_); end - - # Returns the value of attribute caller - # - # @return [Object] the current value of caller - def caller; end - - # Sets the attribute caller - # - # @param value [Object] the value to set the attribute caller to. - # @return [Object] the newly set value - def caller=(_); end - - # Returns the value of attribute executor - # - # @return [Object] the current value of executor - def executor; end - - # Sets the attribute executor - # - # @param value [Object] the value to set the attribute executor to. - # @return [Object] the newly set value - def executor=(_); end - - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# Raised when a new value obtained during action processing or at `#restart` -# fails validation. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#176 -class Concurrent::Agent::ValidationError < ::Concurrent::Agent::Error - # @return [ValidationError] a new instance of ValidationError - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#177 - def initialize(message = T.unsafe(nil)); end -end - -# A thread-safe subclass of Array. This version locks against the object -# itself for every method call, ensuring only one thread can be reading -# or writing at a time. This includes iteration methods like `#each`. -# -# @note `a += b` is **not** a **thread-safe** operation on -# `Concurrent::Array`. It reads array `a`, then it creates new `Concurrent::Array` -# which is concatenation of `a` and `b`, then it writes the concatenation to `a`. -# The read and write are independent operations they do not form a single atomic -# operation therefore when two `+=` operations are executed concurrently updates -# may be lost. Use `#concat` instead. -# @see http://ruby-doc.org/core/Array.html Ruby standard library `Array` -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/array.rb#53 -class Concurrent::Array < ::Array; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/array.rb#22 -Concurrent::ArrayImplementation = Array - -# A mixin module that provides simple asynchronous behavior to a class, -# turning it into a simple actor. Loosely based on Erlang's -# [gen_server](http://www.erlang.org/doc/man/gen_server.html), but without -# supervision or linking. -# -# A more feature-rich {Concurrent::Actor} is also available when the -# capabilities of `Async` are too limited. -# -# ```cucumber -# Feature: -# As a stateful, plain old Ruby class -# I want safe, asynchronous behavior -# So my long-running methods don't block the main thread -# ``` -# -# The `Async` module is a way to mix simple yet powerful asynchronous -# capabilities into any plain old Ruby object or class, turning each object -# into a simple Actor. Method calls are processed on a background thread. The -# caller is free to perform other actions while processing occurs in the -# background. -# -# Method calls to the asynchronous object are made via two proxy methods: -# `async` (alias `cast`) and `await` (alias `call`). These proxy methods post -# the method call to the object's background thread and return a "future" -# which will eventually contain the result of the method call. -# -# This behavior is loosely patterned after Erlang's `gen_server` behavior. -# When an Erlang module implements the `gen_server` behavior it becomes -# inherently asynchronous. The `start` or `start_link` function spawns a -# process (similar to a thread but much more lightweight and efficient) and -# returns the ID of the process. Using the process ID, other processes can -# send messages to the `gen_server` via the `cast` and `call` methods. Unlike -# Erlang's `gen_server`, however, `Async` classes do not support linking or -# supervision trees. -# -# ## Basic Usage -# -# When this module is mixed into a class, objects of the class become inherently -# asynchronous. Each object gets its own background thread on which to post -# asynchronous method calls. Asynchronous method calls are executed in the -# background one at a time in the order they are received. -# -# To create an asynchronous class, simply mix in the `Concurrent::Async` module: -# -# ``` -# class Hello -# include Concurrent::Async -# -# def hello(name) -# "Hello, #{name}!" -# end -# end -# ``` -# -# Mixing this module into a class provides each object two proxy methods: -# `async` and `await`. These methods are thread safe with respect to the -# enclosing object. The former proxy allows methods to be called -# asynchronously by posting to the object's internal thread. The latter proxy -# allows a method to be called synchronously but does so safely with respect -# to any pending asynchronous method calls and ensures proper ordering. Both -# methods return a {Concurrent::IVar} which can be inspected for the result -# of the proxied method call. Calling a method with `async` will return a -# `:pending` `IVar` whereas `await` will return a `:complete` `IVar`. -# -# ``` -# class Echo -# include Concurrent::Async -# -# def echo(msg) -# print "#{msg}\n" -# end -# end -# -# horn = Echo.new -# horn.echo('zero') # synchronous, not thread-safe -# # returns the actual return value of the method -# -# horn.async.echo('one') # asynchronous, non-blocking, thread-safe -# # returns an IVar in the :pending state -# -# horn.await.echo('two') # synchronous, blocking, thread-safe -# # returns an IVar in the :complete state -# ``` -# -# ## Let It Fail -# -# The `async` and `await` proxy methods have built-in error protection based -# on Erlang's famous "let it fail" philosophy. Instance methods should not be -# programmed defensively. When an exception is raised by a delegated method -# the proxy will rescue the exception, expose it to the caller as the `reason` -# attribute of the returned future, then process the next method call. -# -# ## Calling Methods Internally -# -# External method calls should *always* use the `async` and `await` proxy -# methods. When one method calls another method, the `async` proxy should -# rarely be used and the `await` proxy should *never* be used. -# -# When an object calls one of its own methods using the `await` proxy the -# second call will be enqueued *behind* the currently running method call. -# Any attempt to wait on the result will fail as the second call will never -# run until after the current call completes. -# -# Calling a method using the `await` proxy from within a method that was -# itself called using `async` or `await` will irreversibly deadlock the -# object. Do *not* do this, ever. -# -# ## Instance Variables and Attribute Accessors -# -# Instance variables do not need to be thread-safe so long as they are private. -# Asynchronous method calls are processed in the order they are received and -# are processed one at a time. Therefore private instance variables can only -# be accessed by one thread at a time. This is inherently thread-safe. -# -# When using private instance variables within asynchronous methods, the best -# practice is to read the instance variable into a local variable at the start -# of the method then update the instance variable at the *end* of the method. -# This way, should an exception be raised during method execution the internal -# state of the object will not have been changed. -# -# ### Reader Attributes -# -# The use of `attr_reader` is discouraged. Internal state exposed externally, -# when necessary, should be done through accessor methods. The instance -# variables exposed by these methods *must* be thread-safe, or they must be -# called using the `async` and `await` proxy methods. These two approaches are -# subtly different. -# -# When internal state is accessed via the `async` and `await` proxy methods, -# the returned value represents the object's state *at the time the call is -# processed*, which may *not* be the state of the object at the time the call -# is made. -# -# To get the state *at the current* time, irrespective of an enqueued method -# calls, a reader method must be called directly. This is inherently unsafe -# unless the instance variable is itself thread-safe, preferably using one -# of the thread-safe classes within this library. Because the thread-safe -# classes within this library are internally-locking or non-locking, they can -# be safely used from within asynchronous methods without causing deadlocks. -# -# Generally speaking, the best practice is to *not* expose internal state via -# reader methods. The best practice is to simply use the method's return value. -# -# ### Writer Attributes -# -# Writer attributes should never be used with asynchronous classes. Changing -# the state externally, even when done in the thread-safe way, is not logically -# consistent. Changes to state need to be timed with respect to all asynchronous -# method calls which my be in-process or enqueued. The only safe practice is to -# pass all necessary data to each method as arguments and let the method update -# the internal state as necessary. -# -# ## Class Constants, Variables, and Methods -# -# ### Class Constants -# -# Class constants do not need to be thread-safe. Since they are read-only and -# immutable they may be safely read both externally and from within -# asynchronous methods. -# -# ### Class Variables -# -# Class variables should be avoided. Class variables represent shared state. -# Shared state is anathema to concurrency. Should there be a need to share -# state using class variables they *must* be thread-safe, preferably -# using the thread-safe classes within this library. When updating class -# variables, never assign a new value/object to the variable itself. Assignment -# is not thread-safe in Ruby. Instead, use the thread-safe update functions -# of the variable itself to change the value. -# -# The best practice is to *never* use class variables with `Async` classes. -# -# ### Class Methods -# -# Class methods which are pure functions are safe. Class methods which modify -# class variables should be avoided, for all the reasons listed above. -# -# ## An Important Note About Thread Safe Guarantees -# -# > Thread safe guarantees can only be made when asynchronous method calls -# > are not mixed with direct method calls. Use only direct method calls -# > when the object is used exclusively on a single thread. Use only -# > `async` and `await` when the object is shared between threads. Once you -# > call a method using `async` or `await`, you should no longer call methods -# > directly on the object. Use `async` and `await` exclusively from then on. -# -# @example -# -# class Echo -# include Concurrent::Async -# -# def echo(msg) -# print "#{msg}\n" -# end -# end -# -# horn = Echo.new -# horn.echo('zero') # synchronous, not thread-safe -# # returns the actual return value of the method -# -# horn.async.echo('one') # asynchronous, non-blocking, thread-safe -# # returns an IVar in the :pending state -# -# horn.await.echo('two') # synchronous, blocking, thread-safe -# # returns an IVar in the :complete state -# @see Concurrent::Actor -# @see https://en.wikipedia.org/wiki/Actor_model "Actor Model" at Wikipedia -# @see http://www.erlang.org/doc/man/gen_server.html Erlang gen_server -# @see http://c2.com/cgi/wiki?LetItCrash "Let It Crash" at http://c2.com/ -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#217 -module Concurrent::Async - mixes_in_class_methods ::Concurrent::Async::ClassMethods - - # Causes the chained method call to be performed asynchronously on the - # object's thread. The delegated method will return a future in the - # `:pending` state and the method call will have been scheduled on the - # object's thread. The final disposition of the method call can be obtained - # by inspecting the returned future. - # - # @note The method call is guaranteed to be thread safe with respect to - # all other method calls against the same object that are called with - # either `async` or `await`. The mutable nature of Ruby references - # (and object orientation in general) prevent any other thread safety - # guarantees. Do NOT mix direct method calls with delegated method calls. - # Use *only* delegated method calls when sharing the object between threads. - # @raise [NameError] the object does not respond to the requested method - # @raise [ArgumentError] the given `args` do not match the arity of - # the requested method - # @return [Concurrent::IVar] the pending result of the asynchronous operation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#412 - def async; end - - # Causes the chained method call to be performed synchronously on the - # current thread. The delegated will return a future in either the - # `:fulfilled` or `:rejected` state and the delegated method will have - # completed. The final disposition of the delegated method can be obtained - # by inspecting the returned future. - # - # @note The method call is guaranteed to be thread safe with respect to - # all other method calls against the same object that are called with - # either `async` or `await`. The mutable nature of Ruby references - # (and object orientation in general) prevent any other thread safety - # guarantees. Do NOT mix direct method calls with delegated method calls. - # Use *only* delegated method calls when sharing the object between threads. - # @raise [NameError] the object does not respond to the requested method - # @raise [ArgumentError] the given `args` do not match the arity of the - # requested method - # @return [Concurrent::IVar] the completed result of the synchronous operation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#430 - def await; end - - # Causes the chained method call to be performed synchronously on the - # current thread. The delegated will return a future in either the - # `:fulfilled` or `:rejected` state and the delegated method will have - # completed. The final disposition of the delegated method can be obtained - # by inspecting the returned future. - # - # @note The method call is guaranteed to be thread safe with respect to - # all other method calls against the same object that are called with - # either `async` or `await`. The mutable nature of Ruby references - # (and object orientation in general) prevent any other thread safety - # guarantees. Do NOT mix direct method calls with delegated method calls. - # Use *only* delegated method calls when sharing the object between threads. - # @raise [NameError] the object does not respond to the requested method - # @raise [ArgumentError] the given `args` do not match the arity of the - # requested method - # @return [Concurrent::IVar] the completed result of the synchronous operation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#430 - def call; end - - # Causes the chained method call to be performed asynchronously on the - # object's thread. The delegated method will return a future in the - # `:pending` state and the method call will have been scheduled on the - # object's thread. The final disposition of the method call can be obtained - # by inspecting the returned future. - # - # @note The method call is guaranteed to be thread safe with respect to - # all other method calls against the same object that are called with - # either `async` or `await`. The mutable nature of Ruby references - # (and object orientation in general) prevent any other thread safety - # guarantees. Do NOT mix direct method calls with delegated method calls. - # Use *only* delegated method calls when sharing the object between threads. - # @raise [NameError] the object does not respond to the requested method - # @raise [ArgumentError] the given `args` do not match the arity of - # the requested method - # @return [Concurrent::IVar] the pending result of the asynchronous operation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#412 - def cast; end - - # Initialize the internal serializer and other stnchronization mechanisms. - # - # @note This method *must* be called immediately upon object construction. - # This is the only way thread-safe initialization can be guaranteed. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#441 - def init_synchronization; end - - class << self - # @private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#262 - def included(base); end - - # Check for the presence of a method on an object and determine if a given - # set of arguments matches the required arity. - # - # @note This check is imperfect because of the way Ruby reports the arity of - # methods with a variable number of arguments. It is possible to determine - # if too few arguments are given but impossible to determine if too many - # arguments are given. This check may also fail to recognize dynamic behavior - # of the object, such as methods simulated with `method_missing`. - # @param obj [Object] the object to check against - # @param method [Symbol] the method to check the object for - # @param args [Array] zero or more arguments for the arity check - # @raise [NameError] the object does not respond to `method` method - # @raise [ArgumentError] the given `args` do not match the arity of `method` - # @see http://www.ruby-doc.org/core-2.1.1/Method.html#method-i-arity Method#arity - # @see http://ruby-doc.org/core-2.1.0/Object.html#method-i-respond_to-3F Object#respond_to? - # @see http://www.ruby-doc.org/core-2.1.0/BasicObject.html#method-i-method_missing BasicObject#method_missing - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#250 - def validate_argc(obj, method, *args); end - end -end - -# Delegates asynchronous, thread-safe method calls to the wrapped object. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#282 -class Concurrent::Async::AsyncDelegator < ::Concurrent::Synchronization::LockableObject - # Create a new delegator object wrapping the given delegate. - # - # @param delegate [Object] the object to wrap and delegate method calls to - # @return [AsyncDelegator] a new instance of AsyncDelegator - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#288 - def initialize(delegate); end - - # Delegates method calls to the wrapped object. - # - # @param method [Symbol] the method being called - # @param args [Array] zero or more arguments to the method - # @raise [NameError] the object does not respond to `method` method - # @raise [ArgumentError] the given `args` do not match the arity of `method` - # @return [IVar] the result of the method call - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#305 - def method_missing(method, *args, &block); end - - # Perform all enqueued tasks. - # - # This method must be called from within the executor. It must not be - # called while already running. It will loop until the queue is empty. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#330 - def perform; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#348 - def reset_if_forked; end - - private - - # Check whether the method is responsive - # - # @param method [Symbol] the method being called - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#322 - def respond_to_missing?(method, include_private = T.unsafe(nil)); end -end - -# Delegates synchronous, thread-safe method calls to the wrapped object. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#360 -class Concurrent::Async::AwaitDelegator - # Create a new delegator object wrapping the given delegate. - # - # @param delegate [AsyncDelegator] the object to wrap and delegate method calls to - # @return [AwaitDelegator] a new instance of AwaitDelegator - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#365 - def initialize(delegate); end - - # Delegates method calls to the wrapped object. - # - # @param method [Symbol] the method being called - # @param args [Array] zero or more arguments to the method - # @raise [NameError] the object does not respond to `method` method - # @raise [ArgumentError] the given `args` do not match the arity of `method` - # @return [IVar] the result of the method call - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#378 - def method_missing(method, *args, &block); end - - private - - # Check whether the method is responsive - # - # @param method [Symbol] the method being called - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#387 - def respond_to_missing?(method, include_private = T.unsafe(nil)); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#269 -module Concurrent::Async::ClassMethods - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/async.rb#270 - def new(*args, **_arg1, &block); end -end - -# Atoms provide a way to manage shared, synchronous, independent state. -# -# An atom is initialized with an initial value and an optional validation -# proc. At any time the value of the atom can be synchronously and safely -# changed. If a validator is given at construction then any new value -# will be checked against the validator and will be rejected if the -# validator returns false or raises an exception. -# -# There are two ways to change the value of an atom: {#compare_and_set} and -# {#swap}. The former will set the new value if and only if it validates and -# the current value matches the new value. The latter will atomically set the -# new value to the result of running the given block if and only if that -# value validates. -# -# ## Example -# -# ``` -# def next_fibonacci(set = nil) -# return [0, 1] if set.nil? -# set + [set[-2..-1].reduce{|sum,x| sum + x }] -# end -# -# # create an atom with an initial value -# atom = Concurrent::Atom.new(next_fibonacci) -# -# # send a few update requests -# 5.times do -# atom.swap{|set| next_fibonacci(set) } -# end -# -# # get the current value -# atom.value #=> [0, 1, 1, 2, 3, 5, 8] -# ``` -# -# ## Observation -# -# Atoms support observers through the {Concurrent::Observable} mixin module. -# Notification of observers occurs every time the value of the Atom changes. -# When notified the observer will receive three arguments: `time`, `old_value`, -# and `new_value`. The `time` argument is the time at which the value change -# occurred. The `old_value` is the value of the Atom when the change began -# The `new_value` is the value to which the Atom was set when the change -# completed. Note that `old_value` and `new_value` may be the same. This is -# not an error. It simply means that the change operation returned the same -# value. -# -# Unlike in Clojure, `Atom` cannot participate in {Concurrent::TVar} transactions. -# -# -# ## Thread-safe Variable Classes -# -# Each of the thread-safe variable classes is designed to solve a different -# problem. In general: -# -# * *{Concurrent::Agent}:* Shared, mutable variable providing independent, -# uncoordinated, *asynchronous* change of individual values. Best used when -# the value will undergo frequent, complex updates. Suitable when the result -# of an update does not need to be known immediately. -# * *{Concurrent::Atom}:* Shared, mutable variable providing independent, -# uncoordinated, *synchronous* change of individual values. Best used when -# the value will undergo frequent reads but only occasional, though complex, -# updates. Suitable when the result of an update must be known immediately. -# * *{Concurrent::AtomicReference}:* A simple object reference that can be updated -# atomically. Updates are synchronous but fast. Best used when updates a -# simple set operations. Not suitable when updates are complex. -# {Concurrent::AtomicBoolean} and {Concurrent::AtomicFixnum} are similar -# but optimized for the given data type. -# * *{Concurrent::Exchanger}:* Shared, stateless synchronization point. Used -# when two or more threads need to exchange data. The threads will pair then -# block on each other until the exchange is complete. -# * *{Concurrent::MVar}:* Shared synchronization point. Used when one thread -# must give a value to another, which must take the value. The threads will -# block on each other until the exchange is complete. -# * *{Concurrent::ThreadLocalVar}:* Shared, mutable, isolated variable which -# holds a different value for each thread which has access. Often used as -# an instance variable in objects which must maintain different state -# for different threads. -# * *{Concurrent::TVar}:* Shared, mutable variables which provide -# *coordinated*, *synchronous*, change of *many* stated. Used when multiple -# value must change together, in an all-or-nothing transaction. -# -# @see http://clojure.org/atoms Clojure Atoms -# @see http://clojure.org/state Values and Change - Clojure's approach to Identity and State -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atom.rb#95 -class Concurrent::Atom < ::Concurrent::Synchronization::Object - include ::Concurrent::Concern::Observable - extend ::Concurrent::Synchronization::SafeInitialization - - # Create a new atom with the given initial value. - # - # @option opts - # @param value [Object] The initial value - # @param opts [Hash] The options used to configure the atom - # @raise [ArgumentError] if the validator is not a `Proc` (when given) - # @return [Atom] a new instance of Atom - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atom.rb#121 - def initialize(value, opts = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#137 - def __initialize_atomic_fields__; end - - # Atomically sets the value of atom to the new value if and only if the - # current value of the atom is identical to the old value and the new - # value successfully validates against the (optional) validator given - # at construction. - # - # @param old_value [Object] The expected current value. - # @param new_value [Object] The intended new value. - # @return [Boolean] True if the value is changed else false. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atom.rb#181 - def compare_and_set(old_value, new_value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#93 - def deref; end - - # Atomically sets the value of atom to the new value without regard for the - # current value so long as the new value successfully validates against the - # (optional) validator given at construction. - # - # @param new_value [Object] The intended new value. - # @return [Object] The final value of the atom after all operations and - # validations are complete. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atom.rb#198 - def reset(new_value); end - - # Atomically swaps the value of atom using the given block. The current - # value will be passed to the block, as will any arguments passed as - # arguments to the function. The new value will be validated against the - # (optional) validator proc given at construction. If validation fails the - # value will not be changed. - # - # Internally, {#swap} reads the current value, applies the block to it, and - # attempts to compare-and-set it in. Since another thread may have changed - # the value in the intervening time, it may have to retry, and does so in a - # spin loop. The net effect is that the value will always be the result of - # the application of the supplied block to a current value, atomically. - # However, because the block might be called multiple times, it must be free - # of side effects. - # - # @note The given block may be called multiple times, and thus should be free - # of side effects. - # @param args [Object] Zero or more arguments passed to the block. - # @raise [ArgumentError] When no block is given. - # @return [Object] The final value of the atom after all operations and - # validations are complete. - # @yield [value, args] Calculates a new value for the atom based on the - # current value and any supplied arguments. - # @yieldparam value [Object] The current value of the atom. - # @yieldparam args [Object] All arguments passed to the function, in order. - # @yieldreturn [Object] The intended new value of the atom. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atom.rb#157 - def swap(*args); end - - # The current value of the atom. - # - # @return [Object] The current value. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#93 - def value; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#105 - def compare_and_set_value(expected, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#101 - def swap_value(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#109 - def update_value(&block); end - - # Is the new value valid? - # - # @param new_value [Object] The intended new value. - # @return [Boolean] false if the validator function returns false or raises - # an exception else true - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atom.rb#216 - def valid?(new_value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#97 - def value=(value); end -end - -# A boolean value that can be updated atomically. Reads and writes to an atomic -# boolean and thread-safe and guaranteed to succeed. Reads and writes may block -# briefly but no explicit locking is required. -# -# -# ## Thread-safe Variable Classes -# -# Each of the thread-safe variable classes is designed to solve a different -# problem. In general: -# -# * *{Concurrent::Agent}:* Shared, mutable variable providing independent, -# uncoordinated, *asynchronous* change of individual values. Best used when -# the value will undergo frequent, complex updates. Suitable when the result -# of an update does not need to be known immediately. -# * *{Concurrent::Atom}:* Shared, mutable variable providing independent, -# uncoordinated, *synchronous* change of individual values. Best used when -# the value will undergo frequent reads but only occasional, though complex, -# updates. Suitable when the result of an update must be known immediately. -# * *{Concurrent::AtomicReference}:* A simple object reference that can be updated -# atomically. Updates are synchronous but fast. Best used when updates a -# simple set operations. Not suitable when updates are complex. -# {Concurrent::AtomicBoolean} and {Concurrent::AtomicFixnum} are similar -# but optimized for the given data type. -# * *{Concurrent::Exchanger}:* Shared, stateless synchronization point. Used -# when two or more threads need to exchange data. The threads will pair then -# block on each other until the exchange is complete. -# * *{Concurrent::MVar}:* Shared synchronization point. Used when one thread -# must give a value to another, which must take the value. The threads will -# block on each other until the exchange is complete. -# * *{Concurrent::ThreadLocalVar}:* Shared, mutable, isolated variable which -# holds a different value for each thread which has access. Often used as -# an instance variable in objects which must maintain different state -# for different threads. -# * *{Concurrent::TVar}:* Shared, mutable variables which provide -# *coordinated*, *synchronous*, change of *many* stated. Used when multiple -# value must change together, in an all-or-nothing transaction. -# Performance: -# -# ``` -# Testing with ruby 2.1.2 -# Testing with Concurrent::MutexAtomicBoolean... -# 2.790000 0.000000 2.790000 ( 2.791454) -# Testing with Concurrent::CAtomicBoolean... -# 0.740000 0.000000 0.740000 ( 0.740206) -# -# Testing with jruby 1.9.3 -# Testing with Concurrent::MutexAtomicBoolean... -# 5.240000 2.520000 7.760000 ( 3.683000) -# Testing with Concurrent::JavaAtomicBoolean... -# 3.340000 0.010000 3.350000 ( 0.855000) -# ``` -# -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicBoolean.html java.util.concurrent.atomic.AtomicBoolean -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_boolean.rb#120 -class Concurrent::AtomicBoolean < ::Concurrent::MutexAtomicBoolean - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_boolean.rb#121 - def inspect; end - - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_boolean.rb#121 - def to_s; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_boolean.rb#82 -Concurrent::AtomicBooleanImplementation = Concurrent::MutexAtomicBoolean - -# Define update methods that use direct paths -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/atomic_direct_update.rb#9 -module Concurrent::AtomicDirectUpdate - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/atomic_direct_update.rb#15 - def try_update; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/atomic_direct_update.rb#24 - def try_update!; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/atomic_direct_update.rb#10 - def update; end -end - -# A numeric value that can be updated atomically. Reads and writes to an atomic -# fixnum and thread-safe and guaranteed to succeed. Reads and writes may block -# briefly but no explicit locking is required. -# -# -# ## Thread-safe Variable Classes -# -# Each of the thread-safe variable classes is designed to solve a different -# problem. In general: -# -# * *{Concurrent::Agent}:* Shared, mutable variable providing independent, -# uncoordinated, *asynchronous* change of individual values. Best used when -# the value will undergo frequent, complex updates. Suitable when the result -# of an update does not need to be known immediately. -# * *{Concurrent::Atom}:* Shared, mutable variable providing independent, -# uncoordinated, *synchronous* change of individual values. Best used when -# the value will undergo frequent reads but only occasional, though complex, -# updates. Suitable when the result of an update must be known immediately. -# * *{Concurrent::AtomicReference}:* A simple object reference that can be updated -# atomically. Updates are synchronous but fast. Best used when updates a -# simple set operations. Not suitable when updates are complex. -# {Concurrent::AtomicBoolean} and {Concurrent::AtomicFixnum} are similar -# but optimized for the given data type. -# * *{Concurrent::Exchanger}:* Shared, stateless synchronization point. Used -# when two or more threads need to exchange data. The threads will pair then -# block on each other until the exchange is complete. -# * *{Concurrent::MVar}:* Shared synchronization point. Used when one thread -# must give a value to another, which must take the value. The threads will -# block on each other until the exchange is complete. -# * *{Concurrent::ThreadLocalVar}:* Shared, mutable, isolated variable which -# holds a different value for each thread which has access. Often used as -# an instance variable in objects which must maintain different state -# for different threads. -# * *{Concurrent::TVar}:* Shared, mutable variables which provide -# *coordinated*, *synchronous*, change of *many* stated. Used when multiple -# value must change together, in an all-or-nothing transaction. -# Performance: -# -# ``` -# Testing with ruby 2.1.2 -# Testing with Concurrent::MutexAtomicFixnum... -# 3.130000 0.000000 3.130000 ( 3.136505) -# Testing with Concurrent::CAtomicFixnum... -# 0.790000 0.000000 0.790000 ( 0.785550) -# -# Testing with jruby 1.9.3 -# Testing with Concurrent::MutexAtomicFixnum... -# 5.460000 2.460000 7.920000 ( 3.715000) -# Testing with Concurrent::JavaAtomicFixnum... -# 4.520000 0.030000 4.550000 ( 1.187000) -# ``` -# -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicLong.html java.util.concurrent.atomic.AtomicLong -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb#137 -class Concurrent::AtomicFixnum < ::Concurrent::MutexAtomicFixnum - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb#138 - def inspect; end - - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb#138 - def to_s; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_fixnum.rb#99 -Concurrent::AtomicFixnumImplementation = Concurrent::MutexAtomicFixnum - -# An atomic reference which maintains an object reference along with a mark bit -# that can be updated atomically. -# -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicMarkableReference.html java.util.concurrent.atomic.AtomicMarkableReference -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#10 -class Concurrent::AtomicMarkableReference < ::Concurrent::Synchronization::Object - extend ::Concurrent::Synchronization::SafeInitialization - - # @return [AtomicMarkableReference] a new instance of AtomicMarkableReference - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#15 - def initialize(value = T.unsafe(nil), mark = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#137 - def __initialize_atomic_fields__; end - - # Atomically sets the value and mark to the given updated value and - # mark given both: - # - the current value == the expected value && - # - the current mark == the expected mark - # - # that the actual value was not equal to the expected value or the - # actual mark was not equal to the expected mark - # - # @param expected_val [Object] the expected value - # @param new_val [Object] the new value - # @param expected_mark [Boolean] the expected mark - # @param new_mark [Boolean] the new mark - # @return [Boolean] `true` if successful. A `false` return indicates - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#33 - def compare_and_set(expected_val, new_val, expected_mark, new_mark); end - - # Atomically sets the value and mark to the given updated value and - # mark given both: - # - the current value == the expected value && - # - the current mark == the expected mark - # - # that the actual value was not equal to the expected value or the - # actual mark was not equal to the expected mark - # - # @param expected_val [Object] the expected value - # @param new_val [Object] the new value - # @param expected_mark [Boolean] the expected mark - # @param new_mark [Boolean] the new mark - # @return [Boolean] `true` if successful. A `false` return indicates - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#33 - def compare_and_swap(expected_val, new_val, expected_mark, new_mark); end - - # Gets the current reference and marked values. - # - # @return [Array] the current reference and marked values - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#64 - def get; end - - # Gets the current marked value - # - # @return [Boolean] the current marked value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#78 - def mark; end - - # Gets the current marked value - # - # @return [Boolean] the current marked value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#78 - def marked?; end - - # _Unconditionally_ sets to the given value of both the reference and - # the mark. - # - # @param new_val [Object] the new value - # @param new_mark [Boolean] the new mark - # @return [Array] both the new value and the new mark - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#91 - def set(new_val, new_mark); end - - # Pass the current value to the given block, replacing it with the - # block's result. Simply return nil if update fails. - # - # the update failed - # - # @return [Array] the new value and marked state, or nil if - # @yield [Object] Calculate a new value and marked state for the atomic - # reference using given (old) value and (old) marked - # @yieldparam old_val [Object] the starting value of the atomic reference - # @yieldparam old_mark [Boolean] the starting state of marked - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#152 - def try_update; end - - # Pass the current value to the given block, replacing it - # with the block's result. Raise an exception if the update - # fails. - # - # @raise [Concurrent::ConcurrentUpdateError] if the update fails - # @return [Array] the new value and marked state - # @yield [Object] Calculate a new value and marked state for the atomic - # reference using given (old) value and (old) marked - # @yieldparam old_val [Object] the starting value of the atomic reference - # @yieldparam old_mark [Boolean] the starting state of marked - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#128 - def try_update!; end - - # Pass the current value and marked state to the given block, replacing it - # with the block's results. May retry if the value changes during the - # block's execution. - # - # @return [Array] the new value and new mark - # @yield [Object] Calculate a new value and marked state for the atomic - # reference using given (old) value and (old) marked - # @yieldparam old_val [Object] the starting value of the atomic reference - # @yieldparam old_mark [Boolean] the starting state of marked - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#105 - def update; end - - # Gets the current value of the reference - # - # @return [Object] the current value of the reference - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#71 - def value; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#105 - def compare_and_set_reference(expected, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_markable_reference.rb#163 - def immutable_array(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#93 - def reference; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#97 - def reference=(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#101 - def swap_reference(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#109 - def update_reference(&block); end -end - -# Special "compare and set" handling of numeric values. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/numeric_cas_wrapper.rb#7 -module Concurrent::AtomicNumericCompareAndSetWrapper - # Atomically sets the value to the given updated value if - # the current value == the expected value. - # - # that the actual value was not equal to the expected value. - # - # @param old_value [Object] the expected value - # @param new_value [Object] the new value - # @return [Boolean] `true` if successful. A `false` return indicates - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/numeric_cas_wrapper.rb#10 - def compare_and_set(old_value, new_value); end -end - -# An object reference that may be updated atomically. All read and write -# operations have java volatile semantic. -# -# -# ## Thread-safe Variable Classes -# -# Each of the thread-safe variable classes is designed to solve a different -# problem. In general: -# -# * *{Concurrent::Agent}:* Shared, mutable variable providing independent, -# uncoordinated, *asynchronous* change of individual values. Best used when -# the value will undergo frequent, complex updates. Suitable when the result -# of an update does not need to be known immediately. -# * *{Concurrent::Atom}:* Shared, mutable variable providing independent, -# uncoordinated, *synchronous* change of individual values. Best used when -# the value will undergo frequent reads but only occasional, though complex, -# updates. Suitable when the result of an update must be known immediately. -# * *{Concurrent::AtomicReference}:* A simple object reference that can be updated -# atomically. Updates are synchronous but fast. Best used when updates a -# simple set operations. Not suitable when updates are complex. -# {Concurrent::AtomicBoolean} and {Concurrent::AtomicFixnum} are similar -# but optimized for the given data type. -# * *{Concurrent::Exchanger}:* Shared, stateless synchronization point. Used -# when two or more threads need to exchange data. The threads will pair then -# block on each other until the exchange is complete. -# * *{Concurrent::MVar}:* Shared synchronization point. Used when one thread -# must give a value to another, which must take the value. The threads will -# block on each other until the exchange is complete. -# * *{Concurrent::ThreadLocalVar}:* Shared, mutable, isolated variable which -# holds a different value for each thread which has access. Often used as -# an instance variable in objects which must maintain different state -# for different threads. -# * *{Concurrent::TVar}:* Shared, mutable variables which provide -# *coordinated*, *synchronous*, change of *many* stated. Used when multiple -# value must change together, in an all-or-nothing transaction. -# -# @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicReference.html -# @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/package-summary.html -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb#126 -class Concurrent::AtomicReference < ::Concurrent::MutexAtomicReference - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb#129 - def inspect; end - - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb#129 - def to_s; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/atomic_reference.rb#18 -Concurrent::AtomicReferenceImplementation = Concurrent::MutexAtomicReference - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/set.rb#30 -class Concurrent::CRubySet < ::Set - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#18 - def initialize(*args, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def &(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def +(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def -(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def <(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def <<(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def <=(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def <=>(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def ==(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def ===(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def >(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def >=(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def ^(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def add(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def add?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def classify(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def clear(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def collect!(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def compare_by_identity(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def compare_by_identity?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def delete(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def delete?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def delete_if(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def difference(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def disjoint?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def divide(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def each(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def empty?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def eql?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def filter!(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def flatten(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def flatten!(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def flatten_merge(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def freeze(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def hash(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def include?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def inspect(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def intersect?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def intersection(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def join(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def keep_if(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def length(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def map!(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def member?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def merge(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def pretty_print(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def pretty_print_cycle(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def proper_subset?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def proper_superset?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def reject!(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def replace(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def reset(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def select!(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def size(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def subset?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def subtract(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def superset?(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def to_a(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def to_s(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def to_set(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def union(*args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#32 - def |(*args); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#23 - def initialize_copy(other); end -end - -# A thread pool that dynamically grows and shrinks to fit the current workload. -# New threads are created as needed, existing threads are reused, and threads -# that remain idle for too long are killed and removed from the pool. These -# pools are particularly suited to applications that perform a high volume of -# short-lived tasks. -# -# On creation a `CachedThreadPool` has zero running threads. New threads are -# created on the pool as new operations are `#post`. The size of the pool -# will grow until `#max_length` threads are in the pool or until the number -# of threads exceeds the number of running and pending operations. When a new -# operation is post to the pool the first available idle thread will be tasked -# with the new operation. -# -# Should a thread crash for any reason the thread will immediately be removed -# from the pool. Similarly, threads which remain idle for an extended period -# of time will be killed and reclaimed. Thus these thread pools are very -# efficient at reclaiming unused resources. -# -# The API and behavior of this class are based on Java's `CachedThreadPool` -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/cached_thread_pool.rb#27 -class Concurrent::CachedThreadPool < ::Concurrent::ThreadPoolExecutor - # Create a new thread pool. - # - # @option opts - # @param opts [Hash] the options defining pool behavior. - # @raise [ArgumentError] if `fallback_policy` is not a known policy - # @return [CachedThreadPool] a new instance of CachedThreadPool - # @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html#newCachedThreadPool-- - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/cached_thread_pool.rb#39 - def initialize(opts = T.unsafe(nil)); end - - private - - # Create a new thread pool. - # - # @option opts - # @param opts [Hash] the options defining pool behavior. - # @raise [ArgumentError] if `fallback_policy` is not a known policy - # @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html#newCachedThreadPool-- - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/cached_thread_pool.rb#51 - def ns_initialize(opts); end -end - -# Raised when an asynchronous operation is cancelled before execution. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#9 -class Concurrent::CancelledOperationError < ::Concurrent::Error; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#7 -module Concurrent::Collection; end - -# A thread safe observer set implemented using copy-on-read approach: -# observers are added and removed from a thread safe collection; every time -# a notification is required the internal data structure is copied to -# prevent concurrency issues -# -# @api private -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#12 -class Concurrent::Collection::CopyOnNotifyObserverSet < ::Concurrent::Synchronization::LockableObject - # @api private - # @return [CopyOnNotifyObserverSet] a new instance of CopyOnNotifyObserverSet - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#14 - def initialize; end - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#20 - def add_observer(observer = T.unsafe(nil), func = T.unsafe(nil), &block); end - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#55 - def count_observers; end - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#39 - def delete_observer(observer); end - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#47 - def delete_observers; end - - # Notifies all registered observers with optional args and deletes them. - # - # @api private - # @param args [Object] arguments to be passed to each observer - # @return [CopyOnWriteObserverSet] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#72 - def notify_and_delete_observers(*args, &block); end - - # Notifies all registered observers with optional args - # - # @api private - # @param args [Object] arguments to be passed to each observer - # @return [CopyOnWriteObserverSet] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#62 - def notify_observers(*args, &block); end - - protected - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#80 - def ns_initialize; end - - private - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#86 - def duplicate_and_clear_observers; end - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#94 - def duplicate_observers; end - - # @api private - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_notify_observer_set.rb#98 - def notify_to(observers, *args); end -end - -# A thread safe observer set implemented using copy-on-write approach: -# every time an observer is added or removed the whole internal data structure is -# duplicated and replaced with a new one. -# -# @api private -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#11 -class Concurrent::Collection::CopyOnWriteObserverSet < ::Concurrent::Synchronization::LockableObject - # @api private - # @return [CopyOnWriteObserverSet] a new instance of CopyOnWriteObserverSet - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#13 - def initialize; end - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#19 - def add_observer(observer = T.unsafe(nil), func = T.unsafe(nil), &block); end - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#56 - def count_observers; end - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#40 - def delete_observer(observer); end - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#50 - def delete_observers; end - - # Notifies all registered observers with optional args and deletes them. - # - # @api private - # @param args [Object] arguments to be passed to each observer - # @return [CopyOnWriteObserverSet] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#72 - def notify_and_delete_observers(*args, &block); end - - # Notifies all registered observers with optional args - # - # @api private - # @param args [Object] arguments to be passed to each observer - # @return [CopyOnWriteObserverSet] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#63 - def notify_observers(*args, &block); end - - protected - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#80 - def ns_initialize; end - - private - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#102 - def clear_observers_and_return_old; end - - # @api private - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#86 - def notify_to(observers, *args); end - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#94 - def observers; end - - # @api private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/copy_on_write_observer_set.rb#98 - def observers=(new_set); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#10 -Concurrent::Collection::MapImplementation = Concurrent::Collection::MriMapBackend - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#10 -class Concurrent::Collection::MriMapBackend < ::Concurrent::Collection::NonConcurrentMapBackend - # @return [MriMapBackend] a new instance of MriMapBackend - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#12 - def initialize(options = T.unsafe(nil), &default_proc); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#17 - def []=(key, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#61 - def clear; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#33 - def compute(key); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#21 - def compute_if_absent(key); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#29 - def compute_if_present(key); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#53 - def delete(key); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#57 - def delete_pair(key, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#49 - def get_and_set(key, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#37 - def merge_pair(key, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#45 - def replace_if_exists(key, new_value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#41 - def replace_pair(key, old_value, new_value); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#9 -class Concurrent::Collection::NonConcurrentMapBackend - # WARNING: all public methods of the class must operate on the @backend - # directly without calling each other. This is important because of the - # SynchronizedMapBackend which uses a non-reentrant mutex for performance - # reasons. - # - # @return [NonConcurrentMapBackend] a new instance of NonConcurrentMapBackend - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#15 - def initialize(options = T.unsafe(nil), &default_proc); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#21 - def [](key); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#25 - def []=(key, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#94 - def clear; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#59 - def compute(key); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#29 - def compute_if_absent(key); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#53 - def compute_if_present(key); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#81 - def delete(key); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#85 - def delete_pair(key, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#99 - def each_pair; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#71 - def get_and_set(key, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#110 - def get_or_default(key, default_value); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#77 - def key?(key); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#63 - def merge_pair(key, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#46 - def replace_if_exists(key, new_value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#37 - def replace_pair(key, old_value, new_value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#106 - def size; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#130 - def dupped_backend; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#124 - def initialize_copy(other); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#134 - def pair?(key, expected_value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#116 - def set_backend(default_proc); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#138 - def store_computed_value(key, new_value); end -end - -# A queue collection in which the elements are sorted based on their -# comparison (spaceship) operator `<=>`. Items are added to the queue -# at a position relative to their priority. On removal the element -# with the "highest" priority is removed. By default the sort order is -# from highest to lowest, but a lowest-to-highest sort order can be -# set on construction. -# -# The API is based on the `Queue` class from the Ruby standard library. -# -# The pure Ruby implementation, `RubyNonConcurrentPriorityQueue` uses a heap algorithm -# stored in an array. The algorithm is based on the work of Robert Sedgewick -# and Kevin Wayne. -# -# The JRuby native implementation is a thin wrapper around the standard -# library `java.util.NonConcurrentPriorityQueue`. -# -# When running under JRuby the class `NonConcurrentPriorityQueue` extends `JavaNonConcurrentPriorityQueue`. -# When running under all other interpreters it extends `RubyNonConcurrentPriorityQueue`. -# -# @note This implementation is *not* thread safe. -# @see http://en.wikipedia.org/wiki/Priority_queue -# @see http://ruby-doc.org/stdlib-2.0.0/libdoc/thread/rdoc/Queue.html -# @see http://algs4.cs.princeton.edu/24pq/index.php#2.6 -# @see http://algs4.cs.princeton.edu/24pq/MaxPQ.java.html -# @see http://docs.oracle.com/javase/7/docs/api/java/util/PriorityQueue.html -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/non_concurrent_priority_queue.rb#50 -class Concurrent::Collection::NonConcurrentPriorityQueue < ::Concurrent::Collection::RubyNonConcurrentPriorityQueue - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#78 - def <<(item); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#65 - def deq; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#78 - def enq(item); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#48 - def has_priority?(item); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#65 - def shift; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#54 - def size; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/non_concurrent_priority_queue.rb#10 -Concurrent::Collection::NonConcurrentPriorityQueueImplementation = Concurrent::Collection::RubyNonConcurrentPriorityQueue - -# A queue collection in which the elements are sorted based on their -# comparison (spaceship) operator `<=>`. Items are added to the queue -# at a position relative to their priority. On removal the element -# with the "highest" priority is removed. By default the sort order is -# from highest to lowest, but a lowest-to-highest sort order can be -# set on construction. -# -# The API is based on the `Queue` class from the Ruby standard library. -# -# The pure Ruby implementation, `RubyNonConcurrentPriorityQueue` uses a heap algorithm -# stored in an array. The algorithm is based on the work of Robert Sedgewick -# and Kevin Wayne. -# -# The JRuby native implementation is a thin wrapper around the standard -# library `java.util.NonConcurrentPriorityQueue`. -# -# When running under JRuby the class `NonConcurrentPriorityQueue` extends `JavaNonConcurrentPriorityQueue`. -# When running under all other interpreters it extends `RubyNonConcurrentPriorityQueue`. -# -# @note This implementation is *not* thread safe. -# @see http://en.wikipedia.org/wiki/Priority_queue -# @see http://ruby-doc.org/stdlib-2.0.0/libdoc/thread/rdoc/Queue.html -# @see http://algs4.cs.princeton.edu/24pq/index.php#2.6 -# @see http://algs4.cs.princeton.edu/24pq/MaxPQ.java.html -# @see http://docs.oracle.com/javase/7/docs/api/java/util/PriorityQueue.html -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#8 -class Concurrent::Collection::RubyNonConcurrentPriorityQueue - # Create a new priority queue with no items. - # - # @option opts - # @param opts [Hash] the options for creating the queue - # @return [RubyNonConcurrentPriorityQueue] a new instance of RubyNonConcurrentPriorityQueue - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#11 - def initialize(opts = T.unsafe(nil)); end - - # Inserts the specified element into this priority queue. - # - # @param item [Object] the item to insert onto the queue - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#78 - def <<(item); end - - # Removes all of the elements from this priority queue. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#18 - def clear; end - - # Deletes all items from `self` that are equal to `item`. - # - # @param item [Object] the item to be removed from the queue - # @return [Object] true if the item is found else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#25 - def delete(item); end - - # Retrieves and removes the head of this queue, or returns `nil` if this - # queue is empty. - # - # @return [Object] the head of the queue or `nil` when empty - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#65 - def deq; end - - # Returns `true` if `self` contains no elements. - # - # @return [Boolean] true if there are no items in the queue else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#43 - def empty?; end - - # Inserts the specified element into this priority queue. - # - # @param item [Object] the item to insert onto the queue - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#78 - def enq(item); end - - # Returns `true` if the given item is present in `self` (that is, if any - # element == `item`), otherwise returns false. - # - # @param item [Object] the item to search for - # @return [Boolean] true if the item is found else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#48 - def has_priority?(item); end - - # Returns `true` if the given item is present in `self` (that is, if any - # element == `item`), otherwise returns false. - # - # @param item [Object] the item to search for - # @return [Boolean] true if the item is found else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#48 - def include?(item); end - - # The current length of the queue. - # - # @return [Fixnum] the number of items in the queue - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#54 - def length; end - - # Retrieves, but does not remove, the head of this queue, or returns `nil` - # if this queue is empty. - # - # @return [Object] the head of the queue or `nil` when empty - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#60 - def peek; end - - # Retrieves and removes the head of this queue, or returns `nil` if this - # queue is empty. - # - # @return [Object] the head of the queue or `nil` when empty - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#65 - def pop; end - - # Inserts the specified element into this priority queue. - # - # @param item [Object] the item to insert onto the queue - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#78 - def push(item); end - - # Retrieves and removes the head of this queue, or returns `nil` if this - # queue is empty. - # - # @return [Object] the head of the queue or `nil` when empty - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#65 - def shift; end - - # The current length of the queue. - # - # @return [Fixnum] the number of items in the queue - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#54 - def size; end - - private - - # Are the items at the given indexes ordered based on the priority - # order specified at construction? - # - # @param x [Integer] the first index from which to retrieve a comparable value - # @param y [Integer] the second index from which to retrieve a comparable value - # @return [Boolean] true if the two elements are in the correct priority order - # else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#119 - def ordered?(x, y); end - - # Percolate down to maintain heap invariant. - # - # @param k [Integer] the index at which to start the percolation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#128 - def sink(k); end - - # Exchange the values at the given indexes within the internal array. - # - # @param x [Integer] the first index to swap - # @param y [Integer] the second index to swap - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#103 - def swap(x, y); end - - # Percolate up to maintain heap invariant. - # - # @param k [Integer] the index at which to start the percolation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#147 - def swim(k); end - - class << self - # @!macro priority_queue_method_from_list - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/ruby_non_concurrent_priority_queue.rb#89 - def from_list(list, opts = T.unsafe(nil)); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/dereferenceable.rb#2 -module Concurrent::Concern; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/deprecation.rb#8 -module Concurrent::Concern::Deprecation - include ::Logger::Severity - include ::Concurrent::Concern::Logging - extend ::Logger::Severity - extend ::Concurrent::Concern::Logging - extend ::Concurrent::Concern::Deprecation - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/deprecation.rb#12 - def deprecated(message, strip = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/deprecation.rb#27 - def deprecated_method(old_name, new_name); end -end - -# Object references in Ruby are mutable. This can lead to serious problems when -# the `#value` of a concurrent object is a mutable reference. Which is always the -# case unless the value is a `Fixnum`, `Symbol`, or similar "primitive" data type. -# Most classes in this library that expose a `#value` getter method do so using the -# `Dereferenceable` mixin module. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/dereferenceable.rb#11 -module Concurrent::Concern::Dereferenceable - # Return the value this object represents after applying the options specified - # by the `#set_deref_options` method. - # - # @return [Object] the current value of the object - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/dereferenceable.rb#21 - def deref; end - - # Return the value this object represents after applying the options specified - # by the `#set_deref_options` method. - # - # @return [Object] the current value of the object - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/dereferenceable.rb#21 - def value; end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/dereferenceable.rb#63 - def apply_deref_options(value); end - - # Set the options which define the operations #value performs before - # returning data to the caller (dereferencing). - # - # @note Most classes that include this module will call `#set_deref_options` - # from within the constructor, thus allowing these options to be set at - # object creation. - # @option opts - # @option opts - # @option opts - # @param opts [Hash] the options defining dereference behavior. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/dereferenceable.rb#54 - def ns_set_deref_options(opts); end - - # Set the options which define the operations #value performs before - # returning data to the caller (dereferencing). - # - # @note Most classes that include this module will call `#set_deref_options` - # from within the constructor, thus allowing these options to be set at - # object creation. - # @option opts - # @option opts - # @option opts - # @param opts [Hash] the options defining dereference behavior. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/dereferenceable.rb#48 - def set_deref_options(opts = T.unsafe(nil)); end - - # Set the internal value of this object - # - # @param value [Object] the new value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/dereferenceable.rb#31 - def value=(value); end -end - -# Include where logging is needed -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#10 -module Concurrent::Concern::Logging - include ::Logger::Severity - - # Logs through {Concurrent.global_logger}, it can be overridden by setting @logger - # - # @param level [Integer] one of Logger::Severity constants - # @param progname [String] e.g. a path of an Actor - # @param message [String, nil] when nil block is used to generate the message - # @yieldreturn [String] a message - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#18 - def log(level, progname, message = T.unsafe(nil), &block); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#10 -module Concurrent::Concern::Obligation - include ::Concurrent::Concern::Dereferenceable - - # Has the obligation completed processing? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#49 - def complete?; end - - # @example allows Obligation to be risen - # rejected_ivar = Ivar.new.fail - # raise rejected_ivar - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#126 - def exception(*args); end - - # Has the obligation been fulfilled? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#20 - def fulfilled?; end - - # Is the obligation still awaiting completion of processing? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#56 - def incomplete?; end - - # Wait until obligation is complete or the timeout is reached. Will re-raise - # any exceptions raised during processing (but will not raise an exception - # on timeout). - # - # @param timeout [Numeric] the maximum time in seconds to wait. - # @raise [Exception] raises the reason when rejected - # @return [Obligation] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#86 - def no_error!(timeout = T.unsafe(nil)); end - - # Is obligation completion still pending? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#35 - def pending?; end - - # Has the obligation been fulfilled? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#20 - def realized?; end - - # If an exception was raised during processing this will return the - # exception object. Will return `nil` when the state is pending or if - # the obligation has been successfully fulfilled. - # - # @return [Exception] the exception raised during processing or `nil` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#119 - def reason; end - - # Has the obligation been rejected? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#28 - def rejected?; end - - # The current state of the obligation. - # - # @return [Symbol] the current state - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#110 - def state; end - - # Is the obligation still unscheduled? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#42 - def unscheduled?; end - - # The current value of the obligation. Will be `nil` while the state is - # pending or the operation has been rejected. - # - # @param timeout [Numeric] the maximum time in seconds to wait. - # @return [Object] see Dereferenceable#deref - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#65 - def value(timeout = T.unsafe(nil)); end - - # The current value of the obligation. Will be `nil` while the state is - # pending or the operation has been rejected. Will re-raise any exceptions - # raised during processing (but will not raise an exception on timeout). - # - # @param timeout [Numeric] the maximum time in seconds to wait. - # @raise [Exception] raises the reason when rejected - # @return [Object] see Dereferenceable#deref - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#98 - def value!(timeout = T.unsafe(nil)); end - - # Wait until obligation is complete or the timeout has been reached. - # - # @param timeout [Numeric] the maximum time in seconds to wait. - # @return [Obligation] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#74 - def wait(timeout = T.unsafe(nil)); end - - # Wait until obligation is complete or the timeout is reached. Will re-raise - # any exceptions raised during processing (but will not raise an exception - # on timeout). - # - # @param timeout [Numeric] the maximum time in seconds to wait. - # @raise [Exception] raises the reason when rejected - # @return [Obligation] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#86 - def wait!(timeout = T.unsafe(nil)); end - - protected - - # Atomic compare and set operation - # State is set to `next_state` only if `current state == expected_current`. - # - # @param next_state [Symbol] - # @param expected_current [Symbol] - # @return [Boolean] true is state is changed, false otherwise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#174 - def compare_and_set_state(next_state, *expected_current); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#145 - def event; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#134 - def get_arguments_from(opts = T.unsafe(nil)); end - - # Executes the block within mutex if current state is included in expected_states - # - # @return block value if executed, false otherwise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#190 - def if_state(*expected_states); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#139 - def init_obligation; end - - # Am I in the current state? - # - # @param expected [Symbol] The state to check against - # @return [Boolean] true if in the expected state else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#210 - def ns_check_state?(expected); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#215 - def ns_set_state(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#150 - def set_state(success, value, reason); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/obligation.rb#161 - def state=(value); end -end - -# The [observer pattern](http://en.wikipedia.org/wiki/Observer_pattern) is one -# of the most useful design patterns. -# -# The workflow is very simple: -# - an `observer` can register itself to a `subject` via a callback -# - many `observers` can be registered to the same `subject` -# - the `subject` notifies all registered observers when its status changes -# - an `observer` can deregister itself when is no more interested to receive -# event notifications -# -# In a single threaded environment the whole pattern is very easy: the -# `subject` can use a simple data structure to manage all its subscribed -# `observer`s and every `observer` can react directly to every event without -# caring about synchronization. -# -# In a multi threaded environment things are more complex. The `subject` must -# synchronize the access to its data structure and to do so currently we're -# using two specialized ObserverSet: {Concurrent::Concern::CopyOnWriteObserverSet} -# and {Concurrent::Concern::CopyOnNotifyObserverSet}. -# -# When implementing and `observer` there's a very important rule to remember: -# **there are no guarantees about the thread that will execute the callback** -# -# Let's take this example -# ``` -# class Observer -# def initialize -# @count = 0 -# end -# -# def update -# @count += 1 -# end -# end -# -# obs = Observer.new -# [obj1, obj2, obj3, obj4].each { |o| o.add_observer(obs) } -# # execute [obj1, obj2, obj3, obj4] -# ``` -# -# `obs` is wrong because the variable `@count` can be accessed by different -# threads at the same time, so it should be synchronized (using either a Mutex -# or an AtomicFixum) -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/observable.rb#50 -module Concurrent::Concern::Observable - # Adds an observer to this set. If a block is passed, the observer will be - # created by this method and no other params should be passed. - # - # @param observer [Object] the observer to add - # @param func [Symbol] the function to call on the observer during notification. - # Default is :update - # @return [Object] the added observer - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/observable.rb#61 - def add_observer(observer = T.unsafe(nil), func = T.unsafe(nil), &block); end - - # Return the number of observers associated with this object. - # - # @return [Integer] the observers count - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/observable.rb#101 - def count_observers; end - - # Remove `observer` as an observer on this object so that it will no - # longer receive notifications. - # - # @param observer [Object] the observer to remove - # @return [Object] the deleted observer - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/observable.rb#82 - def delete_observer(observer); end - - # Remove all observers associated with this object. - # - # @return [Observable] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/observable.rb#91 - def delete_observers; end - - # As `#add_observer` but can be used for chaining. - # - # @param observer [Object] the observer to add - # @param func [Symbol] the function to call on the observer during notification. - # @return [Observable] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/observable.rb#70 - def with_observer(observer = T.unsafe(nil), func = T.unsafe(nil), &block); end - - protected - - # Returns the value of attribute observers. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/observable.rb#107 - def observers; end - - # Sets the attribute observers - # - # @param value the value to set the attribute observers to. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/observable.rb#107 - def observers=(_arg0); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#71 -class Concurrent::ConcurrentUpdateError < ::ThreadError; end - -# frozen pre-allocated backtrace to speed ConcurrentUpdateError -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#72 -Concurrent::ConcurrentUpdateError::CONC_UP_ERR_BACKTRACE = T.let(T.unsafe(nil), Array) - -# Raised when errors occur during configuration. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#6 -class Concurrent::ConfigurationError < ::Concurrent::Error; end - -# A synchronization object that allows one thread to wait on multiple other threads. -# The thread that will wait creates a `CountDownLatch` and sets the initial value -# (normally equal to the number of other threads). The initiating thread passes the -# latch to the other threads then waits for the other threads by calling the `#wait` -# method. Each of the other threads calls `#count_down` when done with its work. -# When the latch counter reaches zero the waiting thread is unblocked and continues -# with its work. A `CountDownLatch` can be used only once. Its value cannot be reset. -# -# @example Waiter and Decrementer -# latch = Concurrent::CountDownLatch.new(3) -# -# waiter = Thread.new do -# latch.wait() -# puts ("Waiter released") -# end -# -# decrementer = Thread.new do -# sleep(1) -# latch.count_down -# puts latch.count -# -# sleep(1) -# latch.count_down -# puts latch.count -# -# sleep(1) -# latch.count_down -# puts latch.count -# end -# -# [waiter, decrementer].each(&:join) -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/count_down_latch.rb#98 -class Concurrent::CountDownLatch < ::Concurrent::MutexCountDownLatch; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/count_down_latch.rb#56 -Concurrent::CountDownLatchImplementation = Concurrent::MutexCountDownLatch - -# A synchronization aid that allows a set of threads to all wait for each -# other to reach a common barrier point. -# -# @example -# barrier = Concurrent::CyclicBarrier.new(3) -# jobs = Array.new(3) { |i| -> { sleep i; p done: i } } -# process = -> (i) do -# # waiting to start at the same time -# barrier.wait -# # execute job -# jobs[i].call -# # wait for others to finish -# barrier.wait -# end -# threads = 2.times.map do |i| -# Thread.new(i, &process) -# end -# -# # use main as well -# process.call 2 -# -# # here we can be sure that all jobs are processed -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb#27 -class Concurrent::CyclicBarrier < ::Concurrent::Synchronization::LockableObject - # Create a new `CyclicBarrier` that waits for `parties` threads - # - # @param parties [Fixnum] the number of parties - # @raise [ArgumentError] if `parties` is not an integer or is less than zero - # @return [CyclicBarrier] a new instance of CyclicBarrier - # @yield an optional block that will be executed that will be executed after - # the last thread arrives and before the others are released - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb#40 - def initialize(parties, &block); end - - # A barrier can be broken when: - # - a thread called the `reset` method while at least one other thread was waiting - # - at least one thread timed out on `wait` method - # - # A broken barrier can be restored using `reset` it's safer to create a new one - # - # @return [Boolean] true if the barrier is broken otherwise false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb#105 - def broken?; end - - # @return [Fixnum] the number of threads currently waiting on the barrier - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb#54 - def number_waiting; end - - # @return [Fixnum] the number of threads needed to pass the barrier - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb#49 - def parties; end - - # resets the barrier to its initial state - # If there is at least one waiting thread, it will be woken up, the `wait` - # method will return false and the barrier will be broken - # If the barrier is broken, this method restores it to the original state - # - # @return [nil] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb#95 - def reset; end - - # Blocks on the barrier until the number of waiting threads is equal to - # `parties` or until `timeout` is reached or `reset` is called - # If a block has been passed to the constructor, it will be executed once by - # the last arrived thread before releasing the others - # - # @param timeout [Fixnum] the number of seconds to wait for the counter or - # `nil` to block indefinitely - # @return [Boolean] `true` if the `count` reaches zero else false on - # `timeout` or on `reset` or if the barrier is broken - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb#66 - def wait(timeout = T.unsafe(nil)); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb#111 - def ns_generation_done(generation, status, continue = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb#122 - def ns_initialize(parties, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb#117 - def ns_next_generation; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/cyclic_barrier.rb#30 -class Concurrent::CyclicBarrier::Generation < ::Struct - # Returns the value of attribute status - # - # @return [Object] the current value of status - def status; end - - # Sets the attribute status - # - # @param value [Object] the value to set the attribute status to. - # @return [Object] the newly set value - def status=(_); end - - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# Lazy evaluation of a block yielding an immutable result. Useful for -# expensive operations that may never be needed. It may be non-blocking, -# supports the `Concern::Obligation` interface, and accepts the injection of -# custom executor upon which to execute the block. Processing of -# block will be deferred until the first time `#value` is called. -# At that time the caller can choose to return immediately and let -# the block execute asynchronously, block indefinitely, or block -# with a timeout. -# -# When a `Delay` is created its state is set to `pending`. The value and -# reason are both `nil`. The first time the `#value` method is called the -# enclosed opration will be run and the calling thread will block. Other -# threads attempting to call `#value` will block as well. Once the operation -# is complete the *value* will be set to the result of the operation or the -# *reason* will be set to the raised exception, as appropriate. All threads -# blocked on `#value` will return. Subsequent calls to `#value` will immediately -# return the cached value. The operation will only be run once. This means that -# any side effects created by the operation will only happen once as well. -# -# `Delay` includes the `Concurrent::Concern::Dereferenceable` mixin to support thread -# safety of the reference returned by `#value`. -# -# @note The default behavior of `Delay` is to block indefinitely when -# calling either `value` or `wait`, executing the delayed operation on -# the current thread. This makes the `timeout` value completely -# irrelevant. To enable non-blocking behavior, use the `executor` -# constructor option. This will cause the delayed operation to be -# execute on the given executor, allowing the call to timeout. -# @see Concurrent::Concern::Dereferenceable -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/delay.rb#44 -class Concurrent::Delay < ::Concurrent::Synchronization::LockableObject - include ::Concurrent::Concern::Dereferenceable - include ::Concurrent::Concern::Obligation - - # Create a new `Delay` in the `:pending` state. - # - # @raise [ArgumentError] if no block is given - # @return [Delay] a new instance of Delay - # @yield the delayed operation to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/delay.rb#62 - def initialize(opts = T.unsafe(nil), &block); end - - # Reconfigures the block returning the value if still `#incomplete?` - # - # @return [true, false] if success - # @yield the delayed operation to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/delay.rb#146 - def reconfigure(&block); end - - # Return the value this object represents after applying the options - # specified by the `#set_deref_options` method. If the delayed operation - # raised an exception this method will return nil. The exception object - # can be accessed via the `#reason` method. - # - # @note The default behavior of `Delay` is to block indefinitely when - # calling either `value` or `wait`, executing the delayed operation on - # the current thread. This makes the `timeout` value completely - # irrelevant. To enable non-blocking behavior, use the `executor` - # constructor option. This will cause the delayed operation to be - # execute on the given executor, allowing the call to timeout. - # @param timeout [Numeric] the maximum number of seconds to wait - # @return [Object] the current value of the object - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/delay.rb#77 - def value(timeout = T.unsafe(nil)); end - - # Return the value this object represents after applying the options - # specified by the `#set_deref_options` method. If the delayed operation - # raised an exception, this method will raise that exception (even when) - # the operation has already been executed). - # - # @note The default behavior of `Delay` is to block indefinitely when - # calling either `value` or `wait`, executing the delayed operation on - # the current thread. This makes the `timeout` value completely - # irrelevant. To enable non-blocking behavior, use the `executor` - # constructor option. This will cause the delayed operation to be - # execute on the given executor, allowing the call to timeout. - # @param timeout [Numeric] the maximum number of seconds to wait - # @raise [Exception] when `#rejected?` raises `#reason` - # @return [Object] the current value of the object - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/delay.rb#113 - def value!(timeout = T.unsafe(nil)); end - - # Return the value this object represents after applying the options - # specified by the `#set_deref_options` method. - # - # @note The default behavior of `Delay` is to block indefinitely when - # calling either `value` or `wait`, executing the delayed operation on - # the current thread. This makes the `timeout` value completely - # irrelevant. To enable non-blocking behavior, use the `executor` - # constructor option. This will cause the delayed operation to be - # execute on the given executor, allowing the call to timeout. - # @param timeout [Integer] (nil) the maximum number of seconds to wait for - # the value to be computed. When `nil` the caller will block indefinitely. - # @return [Object] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/delay.rb#132 - def wait(timeout = T.unsafe(nil)); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/delay.rb#160 - def ns_initialize(opts, &block); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/delay.rb#173 - def execute_task_once; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#7 -class Concurrent::DependencyCounter - # @return [DependencyCounter] a new instance of DependencyCounter - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#9 - def initialize(count, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#14 - def update(time, value, reason); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#3 -class Concurrent::Error < ::StandardError; end - -# Old school kernel-style event reminiscent of Win32 programming in C++. -# -# When an `Event` is created it is in the `unset` state. Threads can choose to -# `#wait` on the event, blocking until released by another thread. When one -# thread wants to alert all blocking threads it calls the `#set` method which -# will then wake up all listeners. Once an `Event` has been set it remains set. -# New threads calling `#wait` will return immediately. An `Event` may be -# `#reset` at any time once it has been set. -# -# @example -# event = Concurrent::Event.new -# -# t1 = Thread.new do -# puts "t1 is waiting" -# event.wait(1) -# puts "event occurred" -# end -# -# t2 = Thread.new do -# puts "t2 calling set" -# event.set -# end -# -# [t1, t2].each(&:join) -# -# # prints: -# # t1 is waiting -# # t2 calling set -# # event occurred -# @see http://msdn.microsoft.com/en-us/library/windows/desktop/ms682655.aspx -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/event.rb#36 -class Concurrent::Event < ::Concurrent::Synchronization::LockableObject - # Creates a new `Event` in the unset state. Threads calling `#wait` on the - # `Event` will block. - # - # @return [Event] a new instance of Event - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/event.rb#40 - def initialize; end - - # Reset a previously set event back to the `unset` state. - # Has no effect if the `Event` has not yet been set. - # - # @return [Boolean] should always return `true` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/event.rb#68 - def reset; end - - # Trigger the event, setting the state to `set` and releasing all threads - # waiting on the event. Has no effect if the `Event` has already been set. - # - # @return [Boolean] should always return `true` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/event.rb#56 - def set; end - - # Is the object in the set state? - # - # @return [Boolean] indicating whether or not the `Event` has been set - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/event.rb#48 - def set?; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/event.rb#60 - def try?; end - - # Wait a given number of seconds for the `Event` to be set by another - # thread. Will wait forever when no `timeout` value is given. Returns - # immediately if the `Event` has already been set. - # - # @return [Boolean] true if the `Event` was set before timeout else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/event.rb#83 - def wait(timeout = T.unsafe(nil)); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/event.rb#104 - def ns_initialize; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/event.rb#96 - def ns_set; end -end - -# A synchronization point at which threads can pair and swap elements within -# pairs. Each thread presents some object on entry to the exchange method, -# matches with a partner thread, and receives its partner's object on return. -# -# -# ## Thread-safe Variable Classes -# -# Each of the thread-safe variable classes is designed to solve a different -# problem. In general: -# -# * *{Concurrent::Agent}:* Shared, mutable variable providing independent, -# uncoordinated, *asynchronous* change of individual values. Best used when -# the value will undergo frequent, complex updates. Suitable when the result -# of an update does not need to be known immediately. -# * *{Concurrent::Atom}:* Shared, mutable variable providing independent, -# uncoordinated, *synchronous* change of individual values. Best used when -# the value will undergo frequent reads but only occasional, though complex, -# updates. Suitable when the result of an update must be known immediately. -# * *{Concurrent::AtomicReference}:* A simple object reference that can be updated -# atomically. Updates are synchronous but fast. Best used when updates a -# simple set operations. Not suitable when updates are complex. -# {Concurrent::AtomicBoolean} and {Concurrent::AtomicFixnum} are similar -# but optimized for the given data type. -# * *{Concurrent::Exchanger}:* Shared, stateless synchronization point. Used -# when two or more threads need to exchange data. The threads will pair then -# block on each other until the exchange is complete. -# * *{Concurrent::MVar}:* Shared synchronization point. Used when one thread -# must give a value to another, which must take the value. The threads will -# block on each other until the exchange is complete. -# * *{Concurrent::ThreadLocalVar}:* Shared, mutable, isolated variable which -# holds a different value for each thread which has access. Often used as -# an instance variable in objects which must maintain different state -# for different threads. -# * *{Concurrent::TVar}:* Shared, mutable variables which provide -# *coordinated*, *synchronous*, change of *many* stated. Used when multiple -# value must change together, in an all-or-nothing transaction. -# This implementation is very simple, using only a single slot for each -# exchanger (unlike more advanced implementations which use an "arena"). -# This approach will work perfectly fine when there are only a few threads -# accessing a single `Exchanger`. Beyond a handful of threads the performance -# will degrade rapidly due to contention on the single slot, but the algorithm -# will remain correct. -# -# @example -# -# exchanger = Concurrent::Exchanger.new -# -# threads = [ -# Thread.new { puts "first: " << exchanger.exchange('foo', 1) }, #=> "first: bar" -# Thread.new { puts "second: " << exchanger.exchange('bar', 1) } #=> "second: foo" -# ] -# threads.each {|t| t.join(2) } -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Exchanger.html java.util.concurrent.Exchanger -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#336 -class Concurrent::Exchanger < ::Concurrent::RubyExchanger; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#327 -Concurrent::ExchangerImplementation = Concurrent::RubyExchanger - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/executor_service.rb#157 -module Concurrent::ExecutorService - include ::Logger::Severity - include ::Concurrent::Concern::Logging - - # Submit a task to the executor for asynchronous processing. - # - # @param task [Proc] the asynchronous task to perform - # @return [self] returns itself - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/executor_service.rb#166 - def <<(task); end - - # Does the task queue have a maximum size? - # - # @note Always returns `false` - # @return [Boolean] True if the task queue has a maximum size else false. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/executor_service.rb#174 - def can_overflow?; end - - # Submit a task to the executor for asynchronous processing. - # - # @param args [Array] zero or more arguments to be passed to the task - # @raise [ArgumentError] if no task is given - # @return [Boolean] `true` if the task is queued, `false` if the executor - # is not running - # @yield the asynchronous task to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/executor_service.rb#161 - def post(*args, &task); end - - # Does this executor guarantee serialization of its operations? - # - # @note Always returns `false` - # @return [Boolean] True if the executor guarantees that all operations - # will be post in the order they are received and no two operations may - # occur simultaneously. Else false. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/executor_service.rb#181 - def serialized?; end -end - -# A `FiberLocalVar` is a variable where the value is different for each fiber. -# Each variable may have a default value, but when you modify the variable only -# the current fiber will ever see that change. -# -# This is similar to Ruby's built-in fiber-local variables (`Thread.current[:name]`), -# but with these major advantages: -# * `FiberLocalVar` has its own identity, it doesn't need a Symbol. -# * Each Ruby's built-in fiber-local variable leaks some memory forever (it's a Symbol held forever on the fiber), -# so it's only OK to create a small amount of them. -# `FiberLocalVar` has no such issue and it is fine to create many of them. -# * Ruby's built-in fiber-local variables leak forever the value set on each fiber (unless set to nil explicitly). -# `FiberLocalVar` automatically removes the mapping for each fiber once the `FiberLocalVar` instance is GC'd. -# -# @example -# v = FiberLocalVar.new(14) -# v.value #=> 14 -# v.value = 2 -# v.value #=> 2 -# @example -# v = FiberLocalVar.new(14) -# -# Fiber.new do -# v.value #=> 14 -# v.value = 1 -# v.value #=> 1 -# end.resume -# -# Fiber.new do -# v.value #=> 14 -# v.value = 2 -# v.value #=> 2 -# end.resume -# -# v.value #=> 14 -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/fiber_local_var.rb#41 -class Concurrent::FiberLocalVar - # Creates a fiber local variable. - # - # @param default [Object] the default value when otherwise unset - # @param default_block [Proc] Optional block that gets called to obtain the - # default value for each fiber - # @return [FiberLocalVar] a new instance of FiberLocalVar - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/fiber_local_var.rb#49 - def initialize(default = T.unsafe(nil), &default_block); end - - # Bind the given value to fiber local storage during - # execution of the given block. - # - # @param value [Object] the value to bind - # @return [Object] the value - # @yield the operation to be performed with the bound variable - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/fiber_local_var.rb#86 - def bind(value); end - - # Returns the value in the current fiber's copy of this fiber-local variable. - # - # @return [Object] the current value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/fiber_local_var.rb#68 - def value; end - - # Sets the current fiber's copy of this fiber-local variable to the specified value. - # - # @param value [Object] the value to set - # @return [Object] the new value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/fiber_local_var.rb#76 - def value=(value); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/fiber_local_var.rb#101 - def default; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/fiber_local_var.rb#42 -Concurrent::FiberLocalVar::LOCALS = T.let(T.unsafe(nil), Concurrent::FiberLocals) - -# An array-backed storage of indexed variables per fiber. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#166 -class Concurrent::FiberLocals < ::Concurrent::AbstractLocals - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#167 - def locals; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#171 - def locals!; end -end - -# A thread pool that reuses a fixed number of threads operating off an unbounded queue. -# At any point, at most `num_threads` will be active processing tasks. When all threads are busy new -# tasks `#post` to the thread pool are enqueued until a thread becomes available. -# Should a thread crash for any reason the thread will immediately be removed -# from the pool and replaced. -# -# The API and behavior of this class are based on Java's `FixedThreadPool` -# -# **Thread Pool Options** -# -# Thread pools support several configuration options: -# -# * `idletime`: The number of seconds that a thread may be idle before being reclaimed. -# * `name`: The name of the executor (optional). Printed in the executor's `#to_s` output and -# a `-worker-` name is given to its threads if supported by used Ruby -# implementation. `` is uniq for each thread. -# * `max_queue`: The maximum number of tasks that may be waiting in the work queue at -# any one time. When the queue size reaches `max_queue` and no new threads can be created, -# subsequent tasks will be rejected in accordance with the configured `fallback_policy`. -# * `auto_terminate`: When true (default), the threads started will be marked as daemon. -# * `fallback_policy`: The policy defining how rejected tasks are handled. -# -# Three fallback policies are supported: -# -# * `:abort`: Raise a `RejectedExecutionError` exception and discard the task. -# * `:discard`: Discard the task and return false. -# * `:caller_runs`: Execute the task on the calling thread. -# -# **Shutting Down Thread Pools** -# -# Killing a thread pool while tasks are still being processed, either by calling -# the `#kill` method or at application exit, will have unpredictable results. There -# is no way for the thread pool to know what resources are being used by the -# in-progress tasks. When those tasks are killed the impact on those resources -# cannot be predicted. The *best* practice is to explicitly shutdown all thread -# pools using the provided methods: -# -# * Call `#shutdown` to initiate an orderly termination of all in-progress tasks -# * Call `#wait_for_termination` with an appropriate timeout interval an allow -# the orderly shutdown to complete -# * Call `#kill` *only when* the thread pool fails to shutdown in the allotted time -# -# On some runtime platforms (most notably the JVM) the application will not -# exit until all thread pools have been shutdown. To prevent applications from -# "hanging" on exit, all threads can be marked as daemon according to the -# `:auto_terminate` option. -# -# ```ruby -# pool1 = Concurrent::FixedThreadPool.new(5) # threads will be marked as daemon -# pool2 = Concurrent::FixedThreadPool.new(5, auto_terminate: false) # mark threads as non-daemon -# ``` -# -# @note Failure to properly shutdown a thread pool can lead to unpredictable results. -# Please read *Shutting Down Thread Pools* for more information. -# @see http://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html Java Tutorials: Thread Pools -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html Java Executors class -# @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html Java ExecutorService interface -# @see https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#setDaemon-boolean- -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/fixed_thread_pool.rb#201 -class Concurrent::FixedThreadPool < ::Concurrent::ThreadPoolExecutor - # Create a new thread pool. - # - # @option opts - # @param num_threads [Integer] the number of threads to allocate - # @param opts [Hash] the options defining pool behavior. - # @raise [ArgumentError] if `num_threads` is less than or equal to zero - # @raise [ArgumentError] if `fallback_policy` is not a known policy - # @return [FixedThreadPool] a new instance of FixedThreadPool - # @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool-int- - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/fixed_thread_pool.rb#215 - def initialize(num_threads, opts = T.unsafe(nil)); end -end - -# {include:file:docs-source/future.md} -# -# @see http://ruby-doc.org/stdlib-2.1.1/libdoc/observer/rdoc/Observable.html Ruby Observable module -# @see http://clojuredocs.org/clojure_core/clojure.core/future Clojure's future function -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html java.util.concurrent.Future -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/future.rb#21 -class Concurrent::Future < ::Concurrent::IVar - # Create a new `Future` in the `:unscheduled` state. - # - # @option opts - # @param opts [Hash] a customizable set of options - # @raise [ArgumentError] if no block is given - # @return [Future] a new instance of Future - # @yield the asynchronous operation to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/future.rb#33 - def initialize(opts = T.unsafe(nil), &block); end - - # Attempt to cancel the operation if it has not already processed. - # The operation can only be cancelled while still `pending`. It cannot - # be cancelled once it has begun processing or has completed. - # - # @return [Boolean] was the operation successfully cancelled. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/future.rb#99 - def cancel; end - - # Has the operation been successfully cancelled? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/future.rb#111 - def cancelled?; end - - # Execute an `:unscheduled` `Future`. Immediately sets the state to `:pending` and - # passes the block to a new thread/thread pool for eventual execution. - # Does nothing if the `Future` is in any state other than `:unscheduled`. - # - # @example Instance and execute in separate steps - # future = Concurrent::Future.new{ sleep(1); 42 } - # future.state #=> :unscheduled - # future.execute - # future.state #=> :pending - # @example Instance and execute in one line - # future = Concurrent::Future.new{ sleep(1); 42 }.execute - # future.state #=> :pending - # @return [Future] a reference to `self` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/future.rb#53 - def execute; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/future.rb#82 - def set(value = T.unsafe(nil), &block); end - - # Wait the given number of seconds for the operation to complete. - # On timeout attempt to cancel the operation. - # - # @param timeout [Numeric] the maximum time in seconds to wait. - # @return [Boolean] true if the operation completed before the timeout - # else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/future.rb#121 - def wait_or_cancel(timeout); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/future.rb#133 - def ns_initialize(value, opts); end - - class << self - # Create a new `Future` object with the given block, execute it, and return the - # `:pending` object. - # - # @example - # future = Concurrent::Future.execute{ sleep(1); 42 } - # future.state #=> :pending - # @option opts - # @param opts [Hash] a customizable set of options - # @raise [ArgumentError] if no block is given - # @return [Future] the newly created `Future` in the `:pending` state - # @yield the asynchronous operation to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/future.rb#77 - def execute(opts = T.unsafe(nil), &block); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#18 -Concurrent::GLOBAL_FAST_EXECUTOR = T.let(T.unsafe(nil), Concurrent::Delay) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#30 -Concurrent::GLOBAL_IMMEDIATE_EXECUTOR = T.let(T.unsafe(nil), Concurrent::ImmediateExecutor) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#22 -Concurrent::GLOBAL_IO_EXECUTOR = T.let(T.unsafe(nil), Concurrent::Delay) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#106 -Concurrent::GLOBAL_LOGGER = T.let(T.unsafe(nil), Concurrent::AtomicReference) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#26 -Concurrent::GLOBAL_TIMER_SET = T.let(T.unsafe(nil), Concurrent::Delay) - -# A thread-safe subclass of Hash. This version locks against the object -# itself for every method call, ensuring only one thread can be reading -# or writing at a time. This includes iteration methods like `#each`, -# which takes the lock repeatedly when reading an item. -# -# @see http://ruby-doc.org/core/Hash.html Ruby standard library `Hash` -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/hash.rb#49 -class Concurrent::Hash < ::Hash; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/hash.rb#16 -Concurrent::HashImplementation = Hash - -# An `IVar` is like a future that you can assign. As a future is a value that -# is being computed that you can wait on, an `IVar` is a value that is waiting -# to be assigned, that you can wait on. `IVars` are single assignment and -# deterministic. -# -# Then, express futures as an asynchronous computation that assigns an `IVar`. -# The `IVar` becomes the primitive on which [futures](Future) and -# [dataflow](Dataflow) are built. -# -# An `IVar` is a single-element container that is normally created empty, and -# can only be set once. The I in `IVar` stands for immutable. Reading an -# `IVar` normally blocks until it is set. It is safe to set and read an `IVar` -# from different threads. -# -# If you want to have some parallel task set the value in an `IVar`, you want -# a `Future`. If you want to create a graph of parallel tasks all executed -# when the values they depend on are ready you want `dataflow`. `IVar` is -# generally a low-level primitive. -# -# ## Examples -# -# Create, set and get an `IVar` -# -# ```ruby -# ivar = Concurrent::IVar.new -# ivar.set 14 -# ivar.value #=> 14 -# ivar.set 2 # would now be an error -# ``` -# -# ## See Also -# -# 1. For the theory: Arvind, R. Nikhil, and K. Pingali. -# [I-Structures: Data structures for parallel computing](http://dl.acm.org/citation.cfm?id=69562). -# In Proceedings of Workshop on Graph Reduction, 1986. -# 2. For recent application: -# [DataDrivenFuture in Habanero Java from Rice](http://www.cs.rice.edu/~vs3/hjlib/doc/edu/rice/hj/api/HjDataDrivenFuture.html). -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#48 -class Concurrent::IVar < ::Concurrent::Synchronization::LockableObject - include ::Concurrent::Concern::Dereferenceable - include ::Concurrent::Concern::Obligation - include ::Concurrent::Concern::Observable - - # Create a new `IVar` in the `:pending` state with the (optional) initial value. - # - # @option opts - # @option opts - # @option opts - # @param value [Object] the initial value - # @param opts [Hash] the options to create a message with - # @return [IVar] a new instance of IVar - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#62 - def initialize(value = T.unsafe(nil), opts = T.unsafe(nil), &block); end - - # Add an observer on this object that will receive notification on update. - # - # Upon completion the `IVar` will notify all observers in a thread-safe way. - # The `func` method of the observer will be called with three arguments: the - # `Time` at which the `Future` completed the asynchronous operation, the - # final `value` (or `nil` on rejection), and the final `reason` (or `nil` on - # fulfillment). - # - # @param observer [Object] the object that will be notified of changes - # @param func [Symbol] symbol naming the method to call when this - # `Observable` has changes` - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#81 - def add_observer(observer = T.unsafe(nil), func = T.unsafe(nil), &block); end - - # Set the `IVar` to failed due to some error and wake or notify all threads waiting on it. - # - # @param reason [Object] for the failure - # @raise [Concurrent::MultipleAssignmentError] if the `IVar` has already - # been set or otherwise completed - # @return [IVar] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#135 - def fail(reason = T.unsafe(nil)); end - - # Set the `IVar` to a value and wake or notify all threads waiting on it. - # - # @param value [Object] the value to store in the `IVar` - # @raise [ArgumentError] if both a value and a block are given - # @raise [Concurrent::MultipleAssignmentError] if the `IVar` has already - # been set or otherwise completed - # @return [IVar] self - # @yield A block operation to use for setting the value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#113 - def set(value = T.unsafe(nil)); end - - # Attempt to set the `IVar` with the given value or block. Return a - # boolean indicating the success or failure of the set operation. - # - # @param value [Object] the value to store in the `IVar` - # @raise [ArgumentError] if both a value and a block are given - # @raise [Concurrent::MultipleAssignmentError] if the `IVar` has already - # been set or otherwise completed - # @return [Boolean] true if the value was set else false - # @yield A block operation to use for setting the value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#145 - def try_set(value = T.unsafe(nil), &block); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#202 - def check_for_block_or_value!(block_given, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#177 - def complete(success, value, reason); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#184 - def complete_without_notification(success, value, reason); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#190 - def notify_observers(value, reason); end - - # @raise [MultipleAssignmentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#195 - def ns_complete_without_notification(success, value, reason); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#155 - def ns_initialize(value, opts); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#168 - def safe_execute(task, args = T.unsafe(nil)); end -end - -# Raised when an operation is attempted which is not legal given the -# receiver's current state -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#20 -class Concurrent::IllegalOperationError < ::Concurrent::Error; end - -# An executor service which runs all operations on the current thread, -# blocking as necessary. Operations are performed in the order they are -# received and no two operations can be performed simultaneously. -# -# This executor service exists mainly for testing an debugging. When used -# it immediately runs every `#post` operation on the current thread, blocking -# that thread until the operation is complete. This can be very beneficial -# during testing because it makes all operations deterministic. -# -# @note Intended for use primarily in testing and debugging. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/immediate_executor.rb#17 -class Concurrent::ImmediateExecutor < ::Concurrent::AbstractExecutorService - include ::Concurrent::SerialExecutorService - - # Creates a new executor - # - # @return [ImmediateExecutor] a new instance of ImmediateExecutor - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/immediate_executor.rb#21 - def initialize; end - - # Submit a task to the executor for asynchronous processing. - # - # @param task [Proc] the asynchronous task to perform - # @return [self] returns itself - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/immediate_executor.rb#34 - def <<(task); end - - # Begin an orderly shutdown. Tasks already in the queue will be executed, - # but no new tasks will be accepted. Has no additional effect if the - # thread pool is not running. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/immediate_executor.rb#55 - def kill; end - - # Submit a task to the executor for asynchronous processing. - # - # @param args [Array] zero or more arguments to be passed to the task - # @raise [ArgumentError] if no task is given - # @return [Boolean] `true` if the task is queued, `false` if the executor - # is not running - # @yield the asynchronous task to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/immediate_executor.rb#26 - def post(*args, &task); end - - # Is the executor running? - # - # @return [Boolean] `true` when running, `false` when shutting down or shutdown - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/immediate_executor.rb#40 - def running?; end - - # Begin an orderly shutdown. Tasks already in the queue will be executed, - # but no new tasks will be accepted. Has no additional effect if the - # thread pool is not running. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/immediate_executor.rb#55 - def shutdown; end - - # Is the executor shutdown? - # - # @return [Boolean] `true` when shutdown, `false` when shutting down or running - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/immediate_executor.rb#50 - def shutdown?; end - - # Is the executor shuttingdown? - # - # @return [Boolean] `true` when not running and not shutdown, else `false` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/immediate_executor.rb#45 - def shuttingdown?; end - - # Block until executor shutdown is complete or until `timeout` seconds have - # passed. - # - # @note Does not initiate shutdown or termination. Either `shutdown` or `kill` - # must be called before this method (or on another thread). - # @param timeout [Integer] the maximum number of seconds to wait for shutdown to complete - # @return [Boolean] `true` if shutdown complete or false on `timeout` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/immediate_executor.rb#62 - def wait_for_termination(timeout = T.unsafe(nil)); end -end - -# Raised when an attempt is made to violate an immutability guarantee. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#16 -class Concurrent::ImmutabilityError < ::Concurrent::Error; end - -# A thread-safe, immutable variation of Ruby's standard `Struct`. -# -# @see http://ruby-doc.org/core/Struct.html Ruby standard library `Struct` -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#9 -module Concurrent::ImmutableStruct - include ::Concurrent::Synchronization::AbstractStruct - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#51 - def ==(other); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#46 - def [](member); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#56 - def each(&block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#62 - def each_pair(&block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#29 - def inspect; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#36 - def merge(other, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#68 - def select(&block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#17 - def to_a; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#41 - def to_h; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#29 - def to_s; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#17 - def values; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#24 - def values_at(*indexes); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#76 - def initialize_copy(original); end - - class << self - # @private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#12 - def included(base); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#82 - def new(*args, &block); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/immutable_struct.rb#92 -Concurrent::ImmutableStruct::FACTORY = T.let(T.unsafe(nil), T.untyped) - -# An executor service which runs all operations on a new thread, blocking -# until it completes. Operations are performed in the order they are received -# and no two operations can be performed simultaneously. -# -# This executor service exists mainly for testing an debugging. When used it -# immediately runs every `#post` operation on a new thread, blocking the -# current thread until the operation is complete. This is similar to how the -# ImmediateExecutor works, but the operation has the full stack of the new -# thread at its disposal. This can be helpful when the operations will spawn -# more operations on the same executor and so on - such a situation might -# overflow the single stack in case of an ImmediateExecutor, which is -# inconsistent with how it would behave for a threaded executor. -# -# @note Intended for use primarily in testing and debugging. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/indirect_immediate_executor.rb#20 -class Concurrent::IndirectImmediateExecutor < ::Concurrent::ImmediateExecutor - # Creates a new executor - # - # @return [IndirectImmediateExecutor] a new instance of IndirectImmediateExecutor - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/indirect_immediate_executor.rb#21 - def initialize; end - - # Submit a task to the executor for asynchronous processing. - # - # @param args [Array] zero or more arguments to be passed to the task - # @raise [ArgumentError] if no task is given - # @return [Boolean] `true` if the task is queued, `false` if the executor - # is not running - # @yield the asynchronous task to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/indirect_immediate_executor.rb#27 - def post(*args, &task); end -end - -# Raised when an object's methods are called when it has not been -# properly initialized. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#24 -class Concurrent::InitializationError < ::Concurrent::Error; end - -# Raised when a lifecycle method (such as `stop`) is called in an improper -# sequence or when the object is in an inappropriate state. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#13 -class Concurrent::LifecycleError < ::Concurrent::Error; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#6 -class Concurrent::LockFreeStack < ::Concurrent::Synchronization::Object - include ::Enumerable - extend ::Concurrent::Synchronization::SafeInitialization - - # @param head [Node] - # @return [LockFreeStack] a new instance of LockFreeStack - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#51 - def initialize(head = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#137 - def __initialize_atomic_fields__; end - - # @return [true, false] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#118 - def clear; end - - # @return [self] - # @yield over the cleared stack - # @yieldparam value [Object] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#142 - def clear_each(&block); end - - # @param head [Node] - # @return [true, false] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#128 - def clear_if(head); end - - # @param head [Node] - # @return [true, false] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#99 - def compare_and_clear(head); end - - # @param head [Node] - # @return [true, false] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#85 - def compare_and_pop(head); end - - # @param head [Node] - # @param value [Object] - # @return [true, false] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#65 - def compare_and_push(head, value); end - - # @param head [Node] - # @return [self] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#107 - def each(head = T.unsafe(nil)); end - - # @param head [Node] - # @return [true, false] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#58 - def empty?(head = T.unsafe(nil)); end - - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#154 - def inspect; end - - # @return [Node] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#79 - def peek; end - - # @return [Object] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#90 - def pop; end - - # @param value [Object] - # @return [self] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#71 - def push(value); end - - # @param head [Node] - # @param new_head [Node] - # @return [true, false] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#135 - def replace_if(head, new_head); end - - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#154 - def to_s; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#105 - def compare_and_set_head(expected, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#93 - def head; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#97 - def head=(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#101 - def swap_head(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#109 - def update_head(&block); end - - class << self - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#41 - def of1(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#46 - def of2(value1, value2); end - end -end - -# The singleton for empty node -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#32 -Concurrent::LockFreeStack::EMPTY = T.let(T.unsafe(nil), Concurrent::LockFreeStack::Node) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#10 -class Concurrent::LockFreeStack::Node - # @return [Node] a new instance of Node - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#23 - def initialize(value, next_node); end - - # @return [Node] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#14 - def next_node; end - - # @return [Object] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#17 - def value; end - - # allow to nil-ify to free GC when the entry is no longer relevant, not synchronised - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/lock_free_stack.rb#21 - def value=(_arg0); end - - class << self - def [](*_arg0); end - end -end - -# Either {FiberLocalVar} or {ThreadLocalVar} depending on whether Mutex (and Monitor) -# are held, respectively, per Fiber or per Thread. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb#21 -Concurrent::LockLocalVar = Concurrent::FiberLocalVar - -# An `MVar` is a synchronized single element container. They are empty or -# contain one item. Taking a value from an empty `MVar` blocks, as does -# putting a value into a full one. You can either think of them as blocking -# queue of length one, or a special kind of mutable variable. -# -# On top of the fundamental `#put` and `#take` operations, we also provide a -# `#mutate` that is atomic with respect to operations on the same instance. -# These operations all support timeouts. -# -# We also support non-blocking operations `#try_put!` and `#try_take!`, a -# `#set!` that ignores existing values, a `#value` that returns the value -# without removing it or returns `MVar::EMPTY`, and a `#modify!` that yields -# `MVar::EMPTY` if the `MVar` is empty and can be used to set `MVar::EMPTY`. -# You shouldn't use these operations in the first instance. -# -# `MVar` is a [Dereferenceable](Dereferenceable). -# -# `MVar` is related to M-structures in Id, `MVar` in Haskell and `SyncVar` in Scala. -# -# Note that unlike the original Haskell paper, our `#take` is blocking. This is how -# Haskell and Scala do it today. -# -# ## See Also -# -# 1. P. Barth, R. Nikhil, and Arvind. [M-Structures: Extending a parallel, non- strict, functional language with state](http://dl.acm.org/citation.cfm?id=652538). In Proceedings of the 5th -# ACM Conference on Functional Programming Languages and Computer Architecture (FPCA), 1991. -# -# 2. S. Peyton Jones, A. Gordon, and S. Finne. [Concurrent Haskell](http://dl.acm.org/citation.cfm?id=237794). -# In Proceedings of the 23rd Symposium on Principles of Programming Languages -# (PoPL), 1996. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#38 -class Concurrent::MVar < ::Concurrent::Synchronization::Object - include ::Concurrent::Concern::Dereferenceable - extend ::Concurrent::Synchronization::SafeInitialization - - # Create a new `MVar`, either empty or with an initial value. - # - # @param opts [Hash] the options controlling how the future will be processed - # @return [MVar] a new instance of MVar - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#54 - def initialize(value = T.unsafe(nil), opts = T.unsafe(nil)); end - - # acquires lock on the from an `MVAR`, yields the value to provided block, - # and release lock. A timeout can be set to limit the time spent blocked, - # in which case it returns `TIMEOUT` if the time is exceeded. - # - # @return [Object] the value returned by the block, or `TIMEOUT` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#86 - def borrow(timeout = T.unsafe(nil)); end - - # Returns if the `MVar` is currently empty. - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#195 - def empty?; end - - # Returns if the `MVar` currently contains a value. - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#200 - def full?; end - - # Atomically `take`, yield the value to a block for transformation, and then - # `put` the transformed value. Returns the transformed value. A timeout can - # be set to limit the time spent blocked, in which case it returns `TIMEOUT` - # if the time is exceeded. - # - # @raise [ArgumentError] - # @return [Object] the transformed value, or `TIMEOUT` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#123 - def modify(timeout = T.unsafe(nil)); end - - # Non-blocking version of `modify` that will yield with `EMPTY` if there is no value yet. - # - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#179 - def modify!; end - - # Put a value into an `MVar`, blocking if there is already a value until - # it is empty. A timeout can be set to limit the time spent blocked, in - # which case it returns `TIMEOUT` if the time is exceeded. - # - # @return [Object] the value that was put, or `TIMEOUT` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#103 - def put(value, timeout = T.unsafe(nil)); end - - # Non-blocking version of `put` that will overwrite an existing value. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#169 - def set!(value); end - - # Remove the value from an `MVar`, leaving it empty, and blocking if there - # isn't a value. A timeout can be set to limit the time spent blocked, in - # which case it returns `TIMEOUT` if the time is exceeded. - # - # @return [Object] the value that was taken, or `TIMEOUT` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#66 - def take(timeout = T.unsafe(nil)); end - - # Non-blocking version of `put`, that returns whether or not it was successful. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#156 - def try_put!(value); end - - # Non-blocking version of `take`, that returns `EMPTY` instead of blocking. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#142 - def try_take!; end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#206 - def synchronize(&block); end - - private - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#212 - def unlocked_empty?; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#216 - def unlocked_full?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#224 - def wait_for_empty(timeout); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#220 - def wait_for_full(timeout); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#228 - def wait_while(condition, timeout); end -end - -# Unique value that represents that an `MVar` was empty -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#43 -Concurrent::MVar::EMPTY = T.let(T.unsafe(nil), Object) - -# Unique value that represents that an `MVar` timed out before it was able -# to produce a value. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/mvar.rb#47 -Concurrent::MVar::TIMEOUT = T.let(T.unsafe(nil), Object) - -# `Concurrent::Map` is a hash-like object and should have much better performance -# characteristics, especially under high concurrency, than `Concurrent::Hash`. -# However, `Concurrent::Map `is not strictly semantically equivalent to a ruby `Hash` -# -- for instance, it does not necessarily retain ordering by insertion time as `Hash` -# does. For most uses it should do fine though, and we recommend you consider -# `Concurrent::Map` instead of `Concurrent::Hash` for your concurrency-safe hash needs. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#39 -class Concurrent::Map < ::Concurrent::Collection::MriMapBackend - # Iterates over each key value pair. - # This method is atomic. - # - # @note Atomic methods taking a block do not allow the `self` instance - # to be used within the block. Doing so will cause a deadlock. - # @return [self] - # @yield for each key value pair in the map - # @yieldparam key [Object] - # @yieldparam value [Object] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#274 - def each; end - - # Iterates over each key. - # This method is atomic. - # - # @note Atomic methods taking a block do not allow the `self` instance - # to be used within the block. Doing so will cause a deadlock. - # @return [self] - # @yield for each key in the map - # @yieldparam key [Object] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#255 - def each_key; end - - # Iterates over each key value pair. - # This method is atomic. - # - # @note Atomic methods taking a block do not allow the `self` instance - # to be used within the block. Doing so will cause a deadlock. - # @return [self] - # @yield for each key value pair in the map - # @yieldparam key [Object] - # @yieldparam value [Object] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#274 - def each_pair; end - - # Iterates over each value. - # This method is atomic. - # - # @note Atomic methods taking a block do not allow the `self` instance - # to be used within the block. Doing so will cause a deadlock. - # @return [self] - # @yield for each value in the map - # @yieldparam value [Object] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#264 - def each_value; end - - # Is map empty? - # - # @return [true, false] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#291 - def empty?; end - - # Get a value with key, or default_value when key is absent, - # or fail when no default_value is given. - # - # @note The "fetch-then-act" methods of `Map` are not atomic. `Map` is intended - # to be use as a concurrency primitive with strong happens-before - # guarantees. It is not intended to be used as a high-level abstraction - # supporting complex operations. All read and write operations are - # thread safe, but no guarantees are made regarding race conditions - # between the fetch operation and yielding to the block. Additionally, - # this method does not support recursion. This is due to internal - # constraints that are very unlikely to change in the near future. - # @param key [Object] - # @param default_value [Object] - # @raise [KeyError] when key is missing and no default_value is provided - # @return [Object] the value or default value - # @yield default value for a key - # @yieldparam key [Object] - # @yieldreturn [Object] default value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#183 - def fetch(key, default_value = T.unsafe(nil)); end - - # Fetch value with key, or store default value when key is absent, - # or fail when no default_value is given. This is a two step operation, - # therefore not atomic. The store can overwrite other concurrently - # stored value. - # - # @param key [Object] - # @param default_value [Object] - # @return [Object] the value or default value - # @yield default value for a key - # @yieldparam key [Object] - # @yieldreturn [Object] default value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#205 - def fetch_or_store(key, default_value = T.unsafe(nil)); end - - # Get a value with key - # - # @param key [Object] - # @return [Object] the value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb#21 - def get(key); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#321 - def inspect; end - - # Find key of a value. - # - # @param value [Object] - # @return [Object, nil] key or nil when not found - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#284 - def key(value); end - - # All keys - # - # @return [::Array] keys - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#236 - def keys; end - - # @raise [TypeError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#305 - def marshal_dump; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#313 - def marshal_load(hash); end - - # Set a value with key - # - # @param key [Object] - # @param value [Object] - # @return [Object] the new value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/collection/map/mri_map_backend.rb#17 - def put(key, value); end - - # Insert value into map with key if key is absent in one atomic step. - # - # @param key [Object] - # @param value [Object] - # @return [Object, nil] the previous value when key was present or nil when there was no key - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#215 - def put_if_absent(key, value); end - - # Is the value stored in the map. Iterates over all values. - # - # @param value [Object] - # @return [true, false] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#227 - def value?(value); end - - # All values - # - # @return [::Array] values - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#244 - def values; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#331 - def initialize_copy(other); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#336 - def populate_from(hash); end - - # @raise [KeyError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#327 - def raise_fetch_no_key; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/map.rb#341 - def validate_options_hash!(options); end -end - -# Raised when an object with a start/stop lifecycle has been started an -# excessive number of times. Often used in conjunction with a restart -# policy or strategy. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#29 -class Concurrent::MaxRestartFrequencyError < ::Concurrent::Error; end - -# A `Maybe` encapsulates an optional value. A `Maybe` either contains a value -# of (represented as `Just`), or it is empty (represented as `Nothing`). Using -# `Maybe` is a good way to deal with errors or exceptional cases without -# resorting to drastic measures such as exceptions. -# -# `Maybe` is a replacement for the use of `nil` with better type checking. -# -# For compatibility with {Concurrent::Concern::Obligation} the predicate and -# accessor methods are aliased as `fulfilled?`, `rejected?`, `value`, and -# `reason`. -# -# ## Motivation -# -# A common pattern in languages with pattern matching, such as Erlang and -# Haskell, is to return *either* a value *or* an error from a function -# Consider this Erlang code: -# -# ```erlang -# case file:consult("data.dat") of -# {ok, Terms} -> do_something_useful(Terms); -# {error, Reason} -> lager:error(Reason) -# end. -# ``` -# -# In this example the standard library function `file:consult` returns a -# [tuple](http://erlang.org/doc/reference_manual/data_types.html#id69044) -# with two elements: an [atom](http://erlang.org/doc/reference_manual/data_types.html#id64134) -# (similar to a ruby symbol) and a variable containing ancillary data. On -# success it returns the atom `ok` and the data from the file. On failure it -# returns `error` and a string with an explanation of the problem. With this -# pattern there is no ambiguity regarding success or failure. If the file is -# empty the return value cannot be misinterpreted as an error. And when an -# error occurs the return value provides useful information. -# -# In Ruby we tend to return `nil` when an error occurs or else we raise an -# exception. Both of these idioms are problematic. Returning `nil` is -# ambiguous because `nil` may also be a valid value. It also lacks -# information pertaining to the nature of the error. Raising an exception -# is both expensive and usurps the normal flow of control. All of these -# problems can be solved with the use of a `Maybe`. -# -# A `Maybe` is unambiguous with regard to whether or not it contains a value. -# When `Just` it contains a value, when `Nothing` it does not. When `Just` -# the value it contains may be `nil`, which is perfectly valid. When -# `Nothing` the reason for the lack of a value is contained as well. The -# previous Erlang example can be duplicated in Ruby in a principled way by -# having functions return `Maybe` objects: -# -# ```ruby -# result = MyFileUtils.consult("data.dat") # returns a Maybe -# if result.just? -# do_something_useful(result.value) # or result.just -# else -# logger.error(result.reason) # or result.nothing -# end -# ``` -# -# @example Returning a Maybe from a Function -# module MyFileUtils -# def self.consult(path) -# file = File.open(path, 'r') -# Concurrent::Maybe.just(file.read) -# rescue => ex -# return Concurrent::Maybe.nothing(ex) -# ensure -# file.close if file -# end -# end -# -# maybe = MyFileUtils.consult('bogus.file') -# maybe.just? #=> false -# maybe.nothing? #=> true -# maybe.reason #=> # -# -# maybe = MyFileUtils.consult('README.md') -# maybe.just? #=> true -# maybe.nothing? #=> false -# maybe.value #=> "# Concurrent Ruby\n[![Gem Version..." -# @example Using Maybe with a Block -# result = Concurrent::Maybe.from do -# Client.find(10) # Client is an ActiveRecord model -# end -# -# # -- if the record was found -# result.just? #=> true -# result.value #=> # -# -# # -- if the record was not found -# result.just? #=> false -# result.reason #=> ActiveRecord::RecordNotFound -# @example Using Maybe with the Null Object Pattern -# # In a Rails controller... -# result = ClientService.new(10).find # returns a Maybe -# render json: result.or(NullClient.new) -# @see https://hackage.haskell.org/package/base-4.2.0.1/docs/Data-Maybe.html Haskell Data.Maybe -# @see https://github.com/purescript/purescript-maybe/blob/master/docs/Data.Maybe.md PureScript Data.Maybe -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#104 -class Concurrent::Maybe < ::Concurrent::Synchronization::Object - include ::Comparable - extend ::Concurrent::Synchronization::SafeInitialization - - # Create a new `Maybe` with the given attributes. - # - # @param just [Object] The value when `Just` else `NONE`. - # @param nothing [Exception, Object] The exception when `Nothing` else `NONE`. - # @return [Maybe] The new `Maybe`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#224 - def initialize(just, nothing); end - - # Comparison operator. - # - # @return [Integer] 0 if self and other are both `Nothing`; - # -1 if self is `Nothing` and other is `Just`; - # 1 if self is `Just` and other is nothing; - # `self.just <=> other.just` if both self and other are `Just`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#199 - def <=>(other); end - - # Is this `Maybe` a `Just` (successfully fulfilled with a value)? - # - # @return [Boolean] True if `Just` or false if `Nothing`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#176 - def fulfilled?; end - - # The value of a `Maybe` when `Just`. Will be `NONE` when `Nothing`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#114 - def just; end - - # Is this `Maybe` a `Just` (successfully fulfilled with a value)? - # - # @return [Boolean] True if `Just` or false if `Nothing`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#176 - def just?; end - - # The reason for the `Maybe` when `Nothing`. Will be `NONE` when `Just`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#117 - def nothing; end - - # Is this `Maybe` a `nothing` (rejected with an exception upon fulfillment)? - # - # @return [Boolean] True if `Nothing` or false if `Just`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#184 - def nothing?; end - - # Return either the value of self or the given default value. - # - # @return [Object] The value of self when `Just`; else the given default. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#210 - def or(other); end - - # The reason for the `Maybe` when `Nothing`. Will be `NONE` when `Just`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#117 - def reason; end - - # Is this `Maybe` a `nothing` (rejected with an exception upon fulfillment)? - # - # @return [Boolean] True if `Nothing` or false if `Just`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#184 - def rejected?; end - - # The value of a `Maybe` when `Just`. Will be `NONE` when `Nothing`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#114 - def value; end - - class << self - # Create a new `Maybe` using the given block. - # - # Runs the given block passing all function arguments to the block as block - # arguments. If the block runs to completion without raising an exception - # a new `Just` is created with the value set to the return value of the - # block. If the block raises an exception a new `Nothing` is created with - # the reason being set to the raised exception. - # - # @param args [Array] Zero or more arguments to pass to the block. - # @raise [ArgumentError] when no block given. - # @return [Maybe] The newly created object. - # @yield The block from which to create a new `Maybe`. - # @yieldparam args [Array] Zero or more block arguments passed as - # arguments to the function. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#137 - def from(*args); end - - # Create a new `Just` with the given value. - # - # @param value [Object] The value to set for the new `Maybe` object. - # @return [Maybe] The newly created object. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#152 - def just(value); end - - # Create a new `Nothing` with the given (optional) reason. - # - # @param error [Exception] The reason to set for the new `Maybe` object. - # When given a string a new `StandardError` will be created with the - # argument as the message. When no argument is given a new - # `StandardError` with an empty message will be created. - # @return [Maybe] The newly created object. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#164 - def nothing(error = T.unsafe(nil)); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/safe_initialization.rb#29 - def new(*args, &block); end - end -end - -# Indicates that the given attribute has not been set. -# When `Just` the {#nothing} getter will return `NONE`. -# When `Nothing` the {#just} getter will return `NONE`. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/maybe.rb#111 -Concurrent::Maybe::NONE = T.let(T.unsafe(nil), Object) - -# Raised when an attempt is made to modify an immutable object -# (such as an `IVar`) after its final state has been set. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#33 -class Concurrent::MultipleAssignmentError < ::Concurrent::Error - # @return [MultipleAssignmentError] a new instance of MultipleAssignmentError - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#36 - def initialize(message = T.unsafe(nil), inspection_data = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#41 - def inspect; end - - # Returns the value of attribute inspection_data. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#34 - def inspection_data; end -end - -# Aggregates multiple exceptions. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#58 -class Concurrent::MultipleErrors < ::Concurrent::Error - # @return [MultipleErrors] a new instance of MultipleErrors - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#61 - def initialize(errors, message = T.unsafe(nil)); end - - # Returns the value of attribute errors. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#59 - def errors; end -end - -# An thread-safe variation of Ruby's standard `Struct`. Values can be set at -# construction or safely changed at any time during the object's lifecycle. -# -# @see http://ruby-doc.org/core/Struct.html Ruby standard library `Struct` -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#10 -module Concurrent::MutableStruct - include ::Concurrent::Synchronization::AbstractStruct - - # Equality - # - # @return [Boolean] true if other has the same struct subclass and has - # equal member values (according to `Object#==`) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#128 - def ==(other); end - - # Attribute Reference - # - # @param member [Symbol, String, Integer] the string or symbol name of the member - # for which to obtain the value or the member's index - # @raise [NameError] if the member does not exist - # @raise [IndexError] if the index is out of range. - # @return [Object] the value of the given struct member or the member at the given index. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#118 - def [](member); end - - # Attribute Assignment - # - # Sets the value of the given struct member or the member at the given index. - # - # @param member [Symbol, String, Integer] the string or symbol name of the member - # for which to obtain the value or the member's index - # @raise [NameError] if the name does not exist - # @raise [IndexError] if the index is out of range. - # @return [Object] the value of the given struct member or the member at the given index. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#185 - def []=(member, value); end - - # Yields the value of each struct member in order. If no block is given - # an enumerator is returned. - # - # @yield the operation to be performed on each struct member - # @yieldparam value [Object] each struct value (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#139 - def each(&block); end - - # Yields the name and value of each struct member in order. If no block is - # given an enumerator is returned. - # - # @yield the operation to be performed on each struct member/value pair - # @yieldparam member [Object] each struct member (in order) - # @yieldparam value [Object] each struct value (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#152 - def each_pair(&block); end - - # Describe the contents of this struct in a string. - # - # @return [String] the contents of this struct in a string - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#72 - def inspect; end - - # Returns a new struct containing the contents of `other` and the contents - # of `self`. If no block is specified, the value for entries with duplicate - # keys will be that of `other`. Otherwise the value for each duplicate key - # is determined by calling the block with the key, its value in `self` and - # its value in `other`. - # - # @param other [Hash] the hash from which to set the new values - # @raise [ArgumentError] of given a member that is not defined in the struct - # @return [Synchronization::AbstractStruct] a new struct with the new values - # @yield an options block for resolving duplicate keys - # @yieldparam member [String, Symbol] the name of the member which is duplicated - # @yieldparam selfvalue [Object] the value of the member in `self` - # @yieldparam othervalue [Object] the value of the member in `other` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#94 - def merge(other, &block); end - - # Yields each member value from the struct to the block and returns an Array - # containing the member values from the struct for which the given block - # returns a true value (equivalent to `Enumerable#select`). - # - # @return [Array] an array containing each value for which the block returns true - # @yield the operation to be performed on each struct member - # @yieldparam value [Object] each struct value (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#167 - def select(&block); end - - # Returns the values for this struct as an Array. - # - # @return [Array] the values for this struct - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#51 - def to_a; end - - # Returns a hash containing the names and values for the struct’s members. - # - # @return [Hash] the names and values for the struct’s members - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#103 - def to_h; end - - # Describe the contents of this struct in a string. - # - # @return [String] the contents of this struct in a string - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#72 - def to_s; end - - # Returns the values for this struct as an Array. - # - # @return [Array] the values for this struct - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#51 - def values; end - - # Returns the struct member values for each selector as an Array. - # - # A selector may be either an Integer offset or a Range of offsets (as in `Array#values_at`). - # - # @param indexes [Fixnum, Range] the index(es) from which to obatin the values (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#63 - def values_at(*indexes); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#202 - def initialize_copy(original); end - - class << self - # Factory for creating new struct classes. - # - # ``` - # new([class_name] [, member_name]+>) -> StructClass click to toggle source - # new([class_name] [, member_name]+>) {|StructClass| block } -> StructClass - # new(value, ...) -> obj - # StructClass[value, ...] -> obj - # ``` - # - # The first two forms are used to create a new struct subclass `class_name` - # that can contain a value for each member_name . This subclass can be - # used to create instances of the structure like any other Class . - # - # If the `class_name` is omitted an anonymous struct class will be created. - # Otherwise, the name of this struct will appear as a constant in the struct class, - # so it must be unique for all structs under this base class and must start with a - # capital letter. Assigning a struct class to a constant also gives the class - # the name of the constant. - # - # If a block is given it will be evaluated in the context of `StructClass`, passing - # the created class as a parameter. This is the recommended way to customize a struct. - # Subclassing an anonymous struct creates an extra anonymous class that will never be used. - # - # The last two forms create a new instance of a struct subclass. The number of value - # parameters must be less than or equal to the number of attributes defined for the - # struct. Unset parameters default to nil. Passing more parameters than number of attributes - # will raise an `ArgumentError`. - # - # @see http://ruby-doc.org/core/Struct.html#method-c-new Ruby standard library `Struct#new` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#210 - def new(*args, &block); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/mutable_struct.rb#220 -Concurrent::MutableStruct::FACTORY = T.let(T.unsafe(nil), T.untyped) - -# A boolean value that can be updated atomically. Reads and writes to an atomic -# boolean and thread-safe and guaranteed to succeed. Reads and writes may block -# briefly but no explicit locking is required. -# -# -# ## Thread-safe Variable Classes -# -# Each of the thread-safe variable classes is designed to solve a different -# problem. In general: -# -# * *{Concurrent::Agent}:* Shared, mutable variable providing independent, -# uncoordinated, *asynchronous* change of individual values. Best used when -# the value will undergo frequent, complex updates. Suitable when the result -# of an update does not need to be known immediately. -# * *{Concurrent::Atom}:* Shared, mutable variable providing independent, -# uncoordinated, *synchronous* change of individual values. Best used when -# the value will undergo frequent reads but only occasional, though complex, -# updates. Suitable when the result of an update must be known immediately. -# * *{Concurrent::AtomicReference}:* A simple object reference that can be updated -# atomically. Updates are synchronous but fast. Best used when updates a -# simple set operations. Not suitable when updates are complex. -# {Concurrent::AtomicBoolean} and {Concurrent::AtomicFixnum} are similar -# but optimized for the given data type. -# * *{Concurrent::Exchanger}:* Shared, stateless synchronization point. Used -# when two or more threads need to exchange data. The threads will pair then -# block on each other until the exchange is complete. -# * *{Concurrent::MVar}:* Shared synchronization point. Used when one thread -# must give a value to another, which must take the value. The threads will -# block on each other until the exchange is complete. -# * *{Concurrent::ThreadLocalVar}:* Shared, mutable, isolated variable which -# holds a different value for each thread which has access. Often used as -# an instance variable in objects which must maintain different state -# for different threads. -# * *{Concurrent::TVar}:* Shared, mutable variables which provide -# *coordinated*, *synchronous*, change of *many* stated. Used when multiple -# value must change together, in an all-or-nothing transaction. -# Performance: -# -# ``` -# Testing with ruby 2.1.2 -# Testing with Concurrent::MutexAtomicBoolean... -# 2.790000 0.000000 2.790000 ( 2.791454) -# Testing with Concurrent::CAtomicBoolean... -# 0.740000 0.000000 0.740000 ( 0.740206) -# -# Testing with jruby 1.9.3 -# Testing with Concurrent::MutexAtomicBoolean... -# 5.240000 2.520000 7.760000 ( 3.683000) -# Testing with Concurrent::JavaAtomicBoolean... -# 3.340000 0.010000 3.350000 ( 0.855000) -# ``` -# -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicBoolean.html java.util.concurrent.atomic.AtomicBoolean -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb#8 -class Concurrent::MutexAtomicBoolean - extend ::Concurrent::Synchronization::SafeInitialization - - # Creates a new `AtomicBoolean` with the given initial value. - # - # @param initial [Boolean] the initial value - # @return [MutexAtomicBoolean] a new instance of MutexAtomicBoolean - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb#12 - def initialize(initial = T.unsafe(nil)); end - - # Is the current value `false` - # - # @return [Boolean] true if the current value is `false`, else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb#34 - def false?; end - - # Explicitly sets the value to false. - # - # @return [Boolean] true if value has changed, otherwise false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb#44 - def make_false; end - - # Explicitly sets the value to true. - # - # @return [Boolean] true if value has changed, otherwise false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb#39 - def make_true; end - - # Is the current value `true` - # - # @return [Boolean] true if the current value is `true`, else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb#29 - def true?; end - - # Retrieves the current `Boolean` value. - # - # @return [Boolean] the current value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb#19 - def value; end - - # Explicitly sets the value. - # - # @param value [Boolean] the new value to be set - # @return [Boolean] the current value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb#24 - def value=(value); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb#51 - def synchronize; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_boolean.rb#62 - def ns_make_value(value); end -end - -# A numeric value that can be updated atomically. Reads and writes to an atomic -# fixnum and thread-safe and guaranteed to succeed. Reads and writes may block -# briefly but no explicit locking is required. -# -# -# ## Thread-safe Variable Classes -# -# Each of the thread-safe variable classes is designed to solve a different -# problem. In general: -# -# * *{Concurrent::Agent}:* Shared, mutable variable providing independent, -# uncoordinated, *asynchronous* change of individual values. Best used when -# the value will undergo frequent, complex updates. Suitable when the result -# of an update does not need to be known immediately. -# * *{Concurrent::Atom}:* Shared, mutable variable providing independent, -# uncoordinated, *synchronous* change of individual values. Best used when -# the value will undergo frequent reads but only occasional, though complex, -# updates. Suitable when the result of an update must be known immediately. -# * *{Concurrent::AtomicReference}:* A simple object reference that can be updated -# atomically. Updates are synchronous but fast. Best used when updates a -# simple set operations. Not suitable when updates are complex. -# {Concurrent::AtomicBoolean} and {Concurrent::AtomicFixnum} are similar -# but optimized for the given data type. -# * *{Concurrent::Exchanger}:* Shared, stateless synchronization point. Used -# when two or more threads need to exchange data. The threads will pair then -# block on each other until the exchange is complete. -# * *{Concurrent::MVar}:* Shared synchronization point. Used when one thread -# must give a value to another, which must take the value. The threads will -# block on each other until the exchange is complete. -# * *{Concurrent::ThreadLocalVar}:* Shared, mutable, isolated variable which -# holds a different value for each thread which has access. Often used as -# an instance variable in objects which must maintain different state -# for different threads. -# * *{Concurrent::TVar}:* Shared, mutable variables which provide -# *coordinated*, *synchronous*, change of *many* stated. Used when multiple -# value must change together, in an all-or-nothing transaction. -# Performance: -# -# ``` -# Testing with ruby 2.1.2 -# Testing with Concurrent::MutexAtomicFixnum... -# 3.130000 0.000000 3.130000 ( 3.136505) -# Testing with Concurrent::CAtomicFixnum... -# 0.790000 0.000000 0.790000 ( 0.785550) -# -# Testing with jruby 1.9.3 -# Testing with Concurrent::MutexAtomicFixnum... -# 5.460000 2.460000 7.920000 ( 3.715000) -# Testing with Concurrent::JavaAtomicFixnum... -# 4.520000 0.030000 4.550000 ( 1.187000) -# ``` -# -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/atomic/AtomicLong.html java.util.concurrent.atomic.AtomicLong -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#9 -class Concurrent::MutexAtomicFixnum - extend ::Concurrent::Synchronization::SafeInitialization - - # Creates a new `AtomicFixnum` with the given initial value. - # - # @param initial [Fixnum] the initial value - # @raise [ArgumentError] if the initial value is not a `Fixnum` - # @return [MutexAtomicFixnum] a new instance of MutexAtomicFixnum - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#13 - def initialize(initial = T.unsafe(nil)); end - - # Atomically sets the value to the given updated value if the current - # value == the expected value. - # - # @param expect [Fixnum] the expected value - # @param update [Fixnum] the new value - # @return [Boolean] true if the value was updated else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#44 - def compare_and_set(expect, update); end - - # Decreases the current value by the given amount (defaults to 1). - # - # @param delta [Fixnum] the amount by which to decrease the current value - # @return [Fixnum] the current value after decrementation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#37 - def decrement(delta = T.unsafe(nil)); end - - # Decreases the current value by the given amount (defaults to 1). - # - # @param delta [Fixnum] the amount by which to decrease the current value - # @return [Fixnum] the current value after decrementation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#37 - def down(delta = T.unsafe(nil)); end - - # Increases the current value by the given amount (defaults to 1). - # - # @param delta [Fixnum] the amount by which to increase the current value - # @return [Fixnum] the current value after incrementation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#30 - def increment(delta = T.unsafe(nil)); end - - # Increases the current value by the given amount (defaults to 1). - # - # @param delta [Fixnum] the amount by which to increase the current value - # @return [Fixnum] the current value after incrementation - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#30 - def up(delta = T.unsafe(nil)); end - - # Pass the current value to the given block, replacing it - # with the block's result. May retry if the value changes - # during the block's execution. - # - # @return [Object] the new value - # @yield [Object] Calculate a new value for the atomic reference using - # given (old) value - # @yieldparam old_value [Object] the starting value of the atomic reference - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#56 - def update; end - - # Retrieves the current `Fixnum` value. - # - # @return [Fixnum] the current value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#20 - def value; end - - # Explicitly sets the value. - # - # @param value [Fixnum] the new value to be set - # @raise [ArgumentError] if the new value is not a `Fixnum` - # @return [Fixnum] the current value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#25 - def value=(value); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#65 - def synchronize; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_atomic_fixnum.rb#76 - def ns_set(value); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb#9 -class Concurrent::MutexAtomicReference - include ::Concurrent::AtomicDirectUpdate - include ::Concurrent::AtomicNumericCompareAndSetWrapper - extend ::Concurrent::Synchronization::SafeInitialization - - # @param value [Object] The initial value. - # @return [MutexAtomicReference] a new instance of MutexAtomicReference - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb#16 - def initialize(value = T.unsafe(nil)); end - - # Atomically sets the value to the given updated value if - # the current value == the expected value. - # - # that the actual value was not equal to the expected value. - # - # @param old_value [Object] the expected value - # @param new_value [Object] the new value - # @return [Boolean] `true` if successful. A `false` return indicates - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb#45 - def _compare_and_set(old_value, new_value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/numeric_cas_wrapper.rb#10 - def compare_and_swap(old_value, new_value); end - - # Gets the current value. - # - # @return [Object] the current value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb#23 - def get; end - - # Atomically sets to the given value and returns the old value. - # - # @param new_value [Object] the new value - # @return [Object] the old value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb#35 - def get_and_set(new_value); end - - # Sets to the given value. - # - # @param new_value [Object] the new value - # @return [Object] the new value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb#29 - def set(new_value); end - - # Atomically sets to the given value and returns the old value. - # - # @param new_value [Object] the new value - # @return [Object] the old value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb#35 - def swap(new_value); end - - # Gets the current value. - # - # @return [Object] the current value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb#23 - def value; end - - # Sets to the given value. - # - # @param new_value [Object] the new value - # @return [Object] the new value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb#29 - def value=(new_value); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic_reference/mutex_atomic.rb#59 - def synchronize; end -end - -# A synchronization object that allows one thread to wait on multiple other threads. -# The thread that will wait creates a `CountDownLatch` and sets the initial value -# (normally equal to the number of other threads). The initiating thread passes the -# latch to the other threads then waits for the other threads by calling the `#wait` -# method. Each of the other threads calls `#count_down` when done with its work. -# When the latch counter reaches zero the waiting thread is unblocked and continues -# with its work. A `CountDownLatch` can be used only once. Its value cannot be reset. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb#9 -class Concurrent::MutexCountDownLatch < ::Concurrent::Synchronization::LockableObject - # Create a new `CountDownLatch` with the initial `count`. - # - # @param count [new] the initial count - # @raise [ArgumentError] if `count` is not an integer or is less than zero - # @return [MutexCountDownLatch] a new instance of MutexCountDownLatch - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb#12 - def initialize(count = T.unsafe(nil)); end - - # The current value of the counter. - # - # @return [Fixnum] the current value of the counter - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb#34 - def count; end - - # Signal the latch to decrement the counter. Will signal all blocked threads when - # the `count` reaches zero. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb#26 - def count_down; end - - # Block on the latch until the counter reaches zero or until `timeout` is reached. - # - # @param timeout [Fixnum] the number of seconds to wait for the counter or `nil` - # to block indefinitely - # @return [Boolean] `true` if the `count` reaches zero else false on `timeout` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb#21 - def wait(timeout = T.unsafe(nil)); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_count_down_latch.rb#40 - def ns_initialize(count); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb#9 -class Concurrent::MutexSemaphore < ::Concurrent::Synchronization::LockableObject - # @return [MutexSemaphore] a new instance of MutexSemaphore - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb#12 - def initialize(count); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb#20 - def acquire(permits = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb#38 - def available_permits; end - - # Acquires and returns all permits that are immediately available. - # - # @return [Integer] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb#47 - def drain_permits; end - - # Shrinks the number of available permits by the indicated reduction. - # - # @param reduction [Fixnum] Number of permits to remove. - # @raise [ArgumentError] if `reduction` is not an integer or is negative - # @raise [ArgumentError] if `@free` - `@reduction` is less than zero - # @return [nil] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb#99 - def reduce_permits(reduction); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb#77 - def release(permits = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb#54 - def try_acquire(permits = T.unsafe(nil), timeout = T.unsafe(nil)); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb#110 - def ns_initialize(count); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb#117 - def try_acquire_now(permits); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/mutex_semaphore.rb#127 - def try_acquire_timed(permits, timeout); end -end - -# Various classes within allows for +nil+ values to be stored, -# so a special +NULL+ token is required to indicate the "nil-ness". -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/constants.rb#6 -Concurrent::NULL = T.let(T.unsafe(nil), Object) - -# Suppresses all output when used for logging. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#103 -Concurrent::NULL_LOGGER = T.let(T.unsafe(nil), Proc) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/options.rb#6 -module Concurrent::Options - class << self - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/options.rb#27 - def executor(executor_identifier); end - - # Get the requested `Executor` based on the values set in the options hash. - # - # @option opts - # @param opts [Hash] the options defining the requested executor - # @return [Executor, nil] the requested thread pool, or nil when no option specified - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/options.rb#19 - def executor_from_options(opts = T.unsafe(nil)); end - end -end - -# Promises are inspired by the JavaScript [Promises/A](http://wiki.commonjs.org/wiki/Promises/A) -# and [Promises/A+](http://promises-aplus.github.io/promises-spec/) specifications. -# -# > A promise represents the eventual value returned from the single -# > completion of an operation. -# -# Promises are similar to futures and share many of the same behaviours. -# Promises are far more robust, however. Promises can be chained in a tree -# structure where each promise may have zero or more children. Promises are -# chained using the `then` method. The result of a call to `then` is always -# another promise. Promises are resolved asynchronously (with respect to the -# main thread) but in a strict order: parents are guaranteed to be resolved -# before their children, children before their younger siblings. The `then` -# method takes two parameters: an optional block to be executed upon parent -# resolution and an optional callable to be executed upon parent failure. The -# result of each promise is passed to each of its children upon resolution. -# When a promise is rejected all its children will be summarily rejected and -# will receive the reason. -# -# Promises have several possible states: *:unscheduled*, *:pending*, -# *:processing*, *:rejected*, or *:fulfilled*. These are also aggregated as -# `#incomplete?` and `#complete?`. When a Promise is created it is set to -# *:unscheduled*. Once the `#execute` method is called the state becomes -# *:pending*. Once a job is pulled from the thread pool's queue and is given -# to a thread for processing (often immediately upon `#post`) the state -# becomes *:processing*. The future will remain in this state until processing -# is complete. A future that is in the *:unscheduled*, *:pending*, or -# *:processing* is considered `#incomplete?`. A `#complete?` Promise is either -# *:rejected*, indicating that an exception was thrown during processing, or -# *:fulfilled*, indicating success. If a Promise is *:fulfilled* its `#value` -# will be updated to reflect the result of the operation. If *:rejected* the -# `reason` will be updated with a reference to the thrown exception. The -# predicate methods `#unscheduled?`, `#pending?`, `#rejected?`, and -# `#fulfilled?` can be called at any time to obtain the state of the Promise, -# as can the `#state` method, which returns a symbol. -# -# Retrieving the value of a promise is done through the `value` (alias: -# `deref`) method. Obtaining the value of a promise is a potentially blocking -# operation. When a promise is *rejected* a call to `value` will return `nil` -# immediately. When a promise is *fulfilled* a call to `value` will -# immediately return the current value. When a promise is *pending* a call to -# `value` will block until the promise is either *rejected* or *fulfilled*. A -# *timeout* value can be passed to `value` to limit how long the call will -# block. If `nil` the call will block indefinitely. If `0` the call will not -# block. Any other integer or float value will indicate the maximum number of -# seconds to block. -# -# Promises run on the global thread pool. -# -# ### Examples -# -# Start by requiring promises -# -# ```ruby -# require 'concurrent/promise' -# ``` -# -# Then create one -# -# ```ruby -# p = Concurrent::Promise.execute do -# # do something -# 42 -# end -# ``` -# -# Promises can be chained using the `then` method. The `then` method accepts a -# block and an executor, to be executed on fulfillment, and a callable argument to be executed -# on rejection. The result of the each promise is passed as the block argument -# to chained promises. -# -# ```ruby -# p = Concurrent::Promise.new{10}.then{|x| x * 2}.then{|result| result - 10 }.execute -# ``` -# -# And so on, and so on, and so on... -# -# ```ruby -# p = Concurrent::Promise.fulfill(20). -# then{|result| result - 10 }. -# then{|result| result * 3 }. -# then(executor: different_executor){|result| result % 5 }.execute -# ``` -# -# The initial state of a newly created Promise depends on the state of its parent: -# - if parent is *unscheduled* the child will be *unscheduled* -# - if parent is *pending* the child will be *pending* -# - if parent is *fulfilled* the child will be *pending* -# - if parent is *rejected* the child will be *pending* (but will ultimately be *rejected*) -# -# Promises are executed asynchronously from the main thread. By the time a -# child Promise finishes intialization it may be in a different state than its -# parent (by the time a child is created its parent may have completed -# execution and changed state). Despite being asynchronous, however, the order -# of execution of Promise objects in a chain (or tree) is strictly defined. -# -# There are multiple ways to create and execute a new `Promise`. Both ways -# provide identical behavior: -# -# ```ruby -# # create, operate, then execute -# p1 = Concurrent::Promise.new{ "Hello World!" } -# p1.state #=> :unscheduled -# p1.execute -# -# # create and immediately execute -# p2 = Concurrent::Promise.new{ "Hello World!" }.execute -# -# # execute during creation -# p3 = Concurrent::Promise.execute{ "Hello World!" } -# ``` -# -# Once the `execute` method is called a `Promise` becomes `pending`: -# -# ```ruby -# p = Concurrent::Promise.execute{ "Hello, world!" } -# p.state #=> :pending -# p.pending? #=> true -# ``` -# -# Wait a little bit, and the promise will resolve and provide a value: -# -# ```ruby -# p = Concurrent::Promise.execute{ "Hello, world!" } -# sleep(0.1) -# -# p.state #=> :fulfilled -# p.fulfilled? #=> true -# p.value #=> "Hello, world!" -# ``` -# -# If an exception occurs, the promise will be rejected and will provide -# a reason for the rejection: -# -# ```ruby -# p = Concurrent::Promise.execute{ raise StandardError.new("Here comes the Boom!") } -# sleep(0.1) -# -# p.state #=> :rejected -# p.rejected? #=> true -# p.reason #=> "#" -# ``` -# -# #### Rejection -# -# When a promise is rejected all its children will be rejected and will -# receive the rejection `reason` as the rejection callable parameter: -# -# ```ruby -# p = Concurrent::Promise.execute { Thread.pass; raise StandardError } -# -# c1 = p.then(-> reason { 42 }) -# c2 = p.then(-> reason { raise 'Boom!' }) -# -# c1.wait.state #=> :fulfilled -# c1.value #=> 45 -# c2.wait.state #=> :rejected -# c2.reason #=> # -# ``` -# -# Once a promise is rejected it will continue to accept children that will -# receive immediately rejection (they will be executed asynchronously). -# -# #### Aliases -# -# The `then` method is the most generic alias: it accepts a block to be -# executed upon parent fulfillment and a callable to be executed upon parent -# rejection. At least one of them should be passed. The default block is `{ -# |result| result }` that fulfills the child with the parent value. The -# default callable is `{ |reason| raise reason }` that rejects the child with -# the parent reason. -# -# - `on_success { |result| ... }` is the same as `then {|result| ... }` -# - `rescue { |reason| ... }` is the same as `then(Proc.new { |reason| ... } )` -# - `rescue` is aliased by `catch` and `on_error` -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#190 -class Concurrent::Promise < ::Concurrent::IVar - # Initialize a new Promise with the provided options. - # - # @option opts - # @option opts - # @option opts - # @option opts - # @param opts [Hash] a customizable set of options - # @raise [ArgumentError] if no block is given - # @return [Promise] a new instance of Promise - # @see http://wiki.commonjs.org/wiki/Promises/A - # @see http://promises-aplus.github.io/promises-spec/ - # @yield The block operation to be performed asynchronously. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#210 - def initialize(opts = T.unsafe(nil), &block); end - - # Chain onto this promise an action to be undertaken on failure - # (rejection). - # - # @return [Promise] self - # @yield The block to execute - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#360 - def catch(&block); end - - # Execute an `:unscheduled` `Promise`. Immediately sets the state to `:pending` and - # passes the block to a new thread/thread pool for eventual execution. - # Does nothing if the `Promise` is in any state other than `:unscheduled`. - # - # @return [Promise] a reference to `self` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#246 - def execute; end - - # Set the `IVar` to failed due to some error and wake or notify all threads waiting on it. - # - # @param reason [Object] for the failure - # @raise [Concurrent::MultipleAssignmentError] if the `IVar` has already - # been set or otherwise completed - # @raise [Concurrent::PromiseExecutionError] if not the root promise - # @return [IVar] self - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#278 - def fail(reason = T.unsafe(nil)); end - - # Yield the successful result to the block that returns a promise. If that - # promise is also successful the result is the result of the yielded promise. - # If either part fails the whole also fails. - # - # @example - # Promise.execute { 1 }.flat_map { |v| Promise.execute { v + 2 } }.value! #=> 3 - # @return [Promise] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#375 - def flat_map(&block); end - - # Chain onto this promise an action to be undertaken on failure - # (rejection). - # - # @return [Promise] self - # @yield The block to execute - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#360 - def on_error(&block); end - - # Chain onto this promise an action to be undertaken on success - # (fulfillment). - # - # @raise [ArgumentError] - # @return [Promise] self - # @yield The block to execute - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#349 - def on_success(&block); end - - # Chain onto this promise an action to be undertaken on failure - # (rejection). - # - # @return [Promise] self - # @yield The block to execute - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#360 - def rescue(&block); end - - # Set the `IVar` to a value and wake or notify all threads waiting on it. - # - # @param value [Object] the value to store in the `IVar` - # @raise [ArgumentError] if both a value and a block are given - # @raise [Concurrent::MultipleAssignmentError] if the `IVar` has already - # been set or otherwise completed - # @raise [Concurrent::PromiseExecutionError] if not the root promise - # @return [IVar] self - # @yield A block operation to use for setting the value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#262 - def set(value = T.unsafe(nil), &block); end - - # Chain a new promise off the current promise. - # - # @overload then - # @overload then - # @raise [ArgumentError] - # @return [Promise] the new promise - # @yield The block operation to be performed asynchronously. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#314 - def then(*args, &block); end - - # Builds a promise that produces the result of self and others in an Array - # and fails if any of them fails. - # - # @overload zip - # @overload zip - # @return [Promise] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#440 - def zip(*others); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#551 - def complete(success, value, reason); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#545 - def notify_child(child); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#481 - def ns_initialize(value, opts); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#533 - def on_fulfill(result); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#539 - def on_reject(reason); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#562 - def realize(task); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#528 - def root?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#520 - def set_pending; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#570 - def set_state!(success, value, reason); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#576 - def synchronized_set_state!(success, value, reason); end - - class << self - # Aggregate a collection of zero or more promises under a composite promise, - # execute the aggregated promises and collect them into a standard Ruby array, - # call the given Ruby `Ennnumerable` predicate (such as `any?`, `all?`, `none?`, - # or `one?`) on the collection checking for the success or failure of each, - # then executing the composite's `#then` handlers if the predicate returns - # `true` or executing the composite's `#rescue` handlers if the predicate - # returns false. - # - # - # The returned promise will not yet have been executed. Additional `#then` - # and `#rescue` handlers may still be provided. Once the returned promise - # is execute the aggregate promises will be also be executed (if they have - # not been executed already). The results of the aggregate promises will - # be checked upon completion. The necessary `#then` and `#rescue` blocks - # on the aggregating promise will then be executed as appropriate. If the - # `#rescue` handlers are executed the raises exception will be - # `Concurrent::PromiseExecutionError`. - # - # @param promises [Array] Zero or more promises to aggregate - # @return [Promise] an unscheduled (not executed) promise that aggregates - # the promises given as arguments - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#505 - def aggregate(method, *promises); end - - # Aggregates a collection of promises and executes the `then` condition - # if all aggregated promises succeed. Executes the `rescue` handler with - # a `Concurrent::PromiseExecutionError` if any of the aggregated promises - # fail. Upon execution will execute any of the aggregate promises that - # were not already executed. - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#464 - def all?(*promises); end - - # Aggregates a collection of promises and executes the `then` condition - # if any aggregated promises succeed. Executes the `rescue` handler with - # a `Concurrent::PromiseExecutionError` if any of the aggregated promises - # fail. Upon execution will execute any of the aggregate promises that - # were not already executed. - # - # - # The returned promise will not yet have been executed. Additional `#then` - # and `#rescue` handlers may still be provided. Once the returned promise - # is execute the aggregate promises will be also be executed (if they have - # not been executed already). The results of the aggregate promises will - # be checked upon completion. The necessary `#then` and `#rescue` blocks - # on the aggregating promise will then be executed as appropriate. If the - # `#rescue` handlers are executed the raises exception will be - # `Concurrent::PromiseExecutionError`. - # - # @param promises [Array] Zero or more promises to aggregate - # @return [Promise] an unscheduled (not executed) promise that aggregates - # the promises given as arguments - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#475 - def any?(*promises); end - - # Create a new `Promise` object with the given block, execute it, and return the - # `:pending` object. - # - # @example - # promise = Concurrent::Promise.execute{ sleep(1); 42 } - # promise.state #=> :pending - # @option opts - # @option opts - # @option opts - # @option opts - # @param opts [Hash] a customizable set of options - # @raise [ArgumentError] if no block is given - # @return [Promise] the newly created `Promise` in the `:pending` state - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#296 - def execute(opts = T.unsafe(nil), &block); end - - # Create a new `Promise` and fulfill it immediately. - # - # @option opts - # @option opts - # @option opts - # @option opts - # @param opts [Hash] a customizable set of options - # @raise [ArgumentError] if no block is given - # @return [Promise] the newly created `Promise` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#224 - def fulfill(value, opts = T.unsafe(nil)); end - - # Create a new `Promise` and reject it immediately. - # - # @option opts - # @option opts - # @option opts - # @option opts - # @param opts [Hash] a customizable set of options - # @raise [ArgumentError] if no block is given - # @return [Promise] the newly created `Promise` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#237 - def reject(reason, opts = T.unsafe(nil)); end - - # Builds a promise that produces the result of promises in an Array - # and fails if any of them fails. - # - # @overload zip - # @overload zip - # @return [Promise] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#409 - def zip(*promises); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promise.rb#11 -class Concurrent::PromiseExecutionError < ::StandardError; end - -# {include:file:docs-source/promises-main.md} -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#13 -module Concurrent::Promises - extend ::Concurrent::Promises::FactoryMethods::Configuration - extend ::Concurrent::Promises::FactoryMethods -end - -# @abstract -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2047 -class Concurrent::Promises::AbstractAnyPromise < ::Concurrent::Promises::BlockedPromise; end - -# Common ancestor of {Event} and {Future} classes, many shared methods are defined here. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#513 -class Concurrent::Promises::AbstractEventFuture < ::Concurrent::Synchronization::Object - include ::Concurrent::Promises::InternalStates - extend ::Concurrent::Synchronization::SafeInitialization - - # @return [AbstractEventFuture] a new instance of AbstractEventFuture - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#522 - def initialize(promise, default_executor); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#137 - def __initialize_atomic_fields__; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#738 - def add_callback_clear_delayed_node(node); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#733 - def add_callback_notify_blocked(promise, index); end - - # For inspection. - # - # @return [Array] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#702 - def blocks; end - - # For inspection. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#710 - def callbacks; end - - # Shortcut of {#chain_on} with default `:io` executor supplied. - # - # @return [Future] - # @see #chain_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#596 - def chain(*args, &task); end - - # Chains the task to be executed asynchronously on executor after it is resolved. - # - # @overload an_event.chain_on - # @overload a_future.chain_on - # @param executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. The task is executed on it, default executor remains unchanged. - # @param args [Object] arguments which are passed to the task when it's executed. - # (It might be prepended with other arguments, see the @yield section). - # @return [Future] - # @yieldreturn will become result of the returned Future. - # Its returned value becomes {Future#value} fulfilling it, - # raised exception becomes {Future#reason} rejecting it. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#614 - def chain_on(executor, *args, &task); end - - # Resolves the resolvable when receiver is resolved. - # - # @param resolvable [Resolvable] - # @return [self] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#629 - def chain_resolvable(resolvable); end - - # Returns default executor. - # - # @return [Executor] default executor - # @see #with_default_executor - # @see FactoryMethods#future_on - # @see FactoryMethods#resolvable_future - # @see FactoryMethods#any_fulfilled_future_on - # @see similar - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#590 - def default_executor; end - - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#619 - def inspect; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#93 - def internal_state; end - - # Shortcut of {#on_resolution_using} with default `:io` executor supplied. - # - # @return [self] - # @see #on_resolution_using - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#637 - def on_resolution(*args, &callback); end - - # Stores the callback to be executed synchronously on resolving thread after it is - # resolved. - # - # @overload an_event.on_resolution! - # @overload a_future.on_resolution! - # @param args [Object] arguments which are passed to the task when it's executed. - # (It might be prepended with other arguments, see the @yield section). - # @return [self] - # @yieldreturn is forgotten. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#655 - def on_resolution!(*args, &callback); end - - # Stores the callback to be executed asynchronously on executor after it is resolved. - # - # @overload an_event.on_resolution_using - # @overload a_future.on_resolution_using - # @param executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. The task is executed on it, default executor remains unchanged. - # @param args [Object] arguments which are passed to the task when it's executed. - # (It might be prepended with other arguments, see the @yield section). - # @return [self] - # @yieldreturn is forgotten. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#673 - def on_resolution_using(executor, *args, &callback); end - - # Is it in pending state? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#549 - def pending?; end - - # For inspection. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#716 - def promise; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#688 - def resolve_with(state, raise_on_reassign = T.unsafe(nil), reserved = T.unsafe(nil)); end - - # Is it in resolved state? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#555 - def resolved?; end - - # Returns its state. - # - # @overload an_event.state - # @overload a_future.state - # @return [Symbol] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#543 - def state; end - - # Resolves the resolvable when receiver is resolved. - # - # @param resolvable [Resolvable] - # @return [self] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#629 - def tangle(resolvable); end - - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#619 - def to_s; end - - # Propagates touch. Requests all the delayed futures, which it depends on, to be - # executed. This method is called by any other method requiring resolved state, like {#wait}. - # - # @return [self] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#562 - def touch; end - - # For inspection. - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#722 - def touched?; end - - # Wait (block the Thread) until receiver is {#resolved?}. - # Calls {Concurrent::AbstractEventFuture#touch}. - # - # @note This function potentially blocks current thread until the Future is resolved. - # Be careful it can deadlock. Try to chain instead. - # @param timeout [Numeric] the maximum time in second to wait. - # @return [self, true, false] self implies timeout was not used, true implies timeout was used - # and it was resolved, false implies it was not resolved within timeout. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#578 - def wait(timeout = T.unsafe(nil)); end - - # For inspection. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#728 - def waiting_threads; end - - # Crates new object with same class with the executor set as its new default executor. - # Any futures depending on it will use the new default executor. - # - # @abstract - # @raise [NotImplementedError] - # @return [AbstractEventFuture] - # @see Event#with_default_executor - # @see Future#with_default_executor - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#683 - def with_default_executor(executor); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#743 - def with_hidden_resolvable; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#750 - def add_callback(method, *args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#812 - def async_callback_on_resolution(state, executor, args, callback); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#796 - def call_callback(method, state, args); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#800 - def call_callbacks(state); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#763 - def callback_clear_delayed_node(state, node); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#818 - def callback_notify_blocked(state, promise, index); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#105 - def compare_and_set_internal_state(expected, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#97 - def internal_state=(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#101 - def swap_internal_state(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#109 - def update_internal_state(&block); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#768 - def wait_until_resolved(timeout); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#808 - def with_async(executor, *args, &block); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1796 -class Concurrent::Promises::AbstractFlatPromise < ::Concurrent::Promises::BlockedPromise - # @return [AbstractFlatPromise] a new instance of AbstractFlatPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1798 - def initialize(delayed_because, blockers_count, event_or_future); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1808 - def touch; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1828 - def add_delayed_of(future); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1820 - def on_resolvable(resolved_future, index); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1824 - def resolvable?(countdown, future, index); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1816 - def touched?; end -end - -# @abstract -# @private -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1549 -class Concurrent::Promises::AbstractPromise < ::Concurrent::Synchronization::Object - include ::Concurrent::Promises::InternalStates - extend ::Concurrent::Synchronization::SafeInitialization - - # @return [AbstractPromise] a new instance of AbstractPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1553 - def initialize(future); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1564 - def default_executor; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1581 - def delayed_because; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1558 - def event; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1558 - def future; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1575 - def inspect; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1568 - def state; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1575 - def to_s; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1572 - def touch; end - - private - - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1592 - def evaluate_to(*args, block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1587 - def resolve_with(new_state, raise_on_reassign = T.unsafe(nil)); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2084 -class Concurrent::Promises::AnyFulfilledFuturePromise < ::Concurrent::Promises::AnyResolvedFuturePromise - private - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2088 - def resolvable?(countdown, event_or_future, index); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2050 -class Concurrent::Promises::AnyResolvedEventPromise < ::Concurrent::Promises::AbstractAnyPromise - # @return [AnyResolvedEventPromise] a new instance of AnyResolvedEventPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2054 - def initialize(delayed, blockers_count, default_executor); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2062 - def on_resolvable(resolved_future, index); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2058 - def resolvable?(countdown, future, index); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2067 -class Concurrent::Promises::AnyResolvedFuturePromise < ::Concurrent::Promises::AbstractAnyPromise - # @return [AnyResolvedFuturePromise] a new instance of AnyResolvedFuturePromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2071 - def initialize(delayed, blockers_count, default_executor); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2079 - def on_resolvable(resolved_future, index); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2075 - def resolvable?(countdown, future, index); end -end - -# @abstract -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1619 -class Concurrent::Promises::BlockedPromise < ::Concurrent::Promises::InnerPromise - # @return [BlockedPromise] a new instance of BlockedPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1661 - def initialize(delayed, blockers_count, future); end - - # for inspection only - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1683 - def blocked_by; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1674 - def delayed_because; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1667 - def on_blocker_resolution(future, index); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1678 - def touch; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1691 - def clear_and_propagate_touch(stack_or_element = T.unsafe(nil)); end - - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1710 - def on_resolvable(resolved_future, index); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1706 - def process_on_blocker_resolution(future, index); end - - # @return [true, false] if resolvable - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1702 - def resolvable?(countdown, future, index); end - - class << self - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1652 - def add_delayed(delayed1, delayed2); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1645 - def new_blocked_by(blockers, *args, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1623 - def new_blocked_by1(blocker, *args, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1630 - def new_blocked_by2(blocker1, blocker2, *args, &block); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/safe_initialization.rb#29 - def new(*args, &block); end - end -end - -# @abstract -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1716 -class Concurrent::Promises::BlockedTaskPromise < ::Concurrent::Promises::BlockedPromise - # @raise [ArgumentError] - # @return [BlockedTaskPromise] a new instance of BlockedTaskPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1717 - def initialize(delayed, blockers_count, default_executor, executor, args, &task); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1725 - def executor; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1766 -class Concurrent::Promises::ChainPromise < ::Concurrent::Promises::BlockedTaskPromise - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1769 - def on_resolvable(resolved_future, index); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2095 -class Concurrent::Promises::DelayPromise < ::Concurrent::Promises::InnerPromise - # @return [DelayPromise] a new instance of DelayPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2097 - def initialize(default_executor); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2108 - def delayed_because; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2104 - def touch; end -end - -# Represents an event which will happen in future (will be resolved). The event is either -# pending or resolved. It should be always resolved. Use {Future} to communicate rejections and -# cancellation. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#826 -class Concurrent::Promises::Event < ::Concurrent::Promises::AbstractEventFuture - # Creates a new event or a future which will be resolved when receiver and other are. - # Returns an event if receiver and other are events, otherwise returns a future. - # If just one of the parties is Future then the result - # of the returned future is equal to the result of the supplied future. If both are futures - # then the result is as described in {FactoryMethods#zip_futures_on}. - # - # @return [Future, Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#839 - def &(other); end - - # Creates a new event which will be resolved when the first of receiver, `event_or_future` - # resolves. - # - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#853 - def any(event_or_future); end - - # Creates new event dependent on receiver which will not evaluate until touched, see {#touch}. - # In other words, it inserts delay into the chain of Futures making rest of it lazy evaluated. - # - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#863 - def delay; end - - # Creates new event dependent on receiver scheduled to execute on/in intended_time. - # In time is interpreted from the moment the receiver is resolved, therefore it inserts - # delay into the chain. - # - # @param intended_time [Numeric, Time] `Numeric` means to run in `intended_time` seconds. - # `Time` means to run on `intended_time`. - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#875 - def schedule(intended_time); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#596 - def then(*args, &task); end - - # Returns self, since this is event - # - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#893 - def to_event; end - - # Converts event to a future. The future is fulfilled when the event is resolved, the future may never fail. - # - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#885 - def to_future; end - - # Crates new object with same class with the executor set as its new default executor. - # Any futures depending on it will use the new default executor. - # - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#899 - def with_default_executor(executor); end - - # Creates a new event or a future which will be resolved when receiver and other are. - # Returns an event if receiver and other are events, otherwise returns a future. - # If just one of the parties is Future then the result - # of the returned future is equal to the result of the supplied future. If both are futures - # then the result is as described in {FactoryMethods#zip_futures_on}. - # - # @return [Future, Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#839 - def zip(other); end - - # Creates a new event which will be resolved when the first of receiver, `event_or_future` - # resolves. - # - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#853 - def |(event_or_future); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#910 - def callback_on_resolution(state, args, callback); end - - # @raise [Concurrent::MultipleAssignmentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#905 - def rejected_resolution(raise_on_reassign, state); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1972 -class Concurrent::Promises::EventWrapperPromise < ::Concurrent::Promises::BlockedPromise - # @return [EventWrapperPromise] a new instance of EventWrapperPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1973 - def initialize(delayed, blockers_count, default_executor); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1979 - def on_resolvable(resolved_future, index); end -end - -# Container of all {Future}, {Event} factory methods. They are never constructed directly with -# new. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#46 -module Concurrent::Promises::FactoryMethods - include ::Concurrent::Promises::FactoryMethods::Configuration - extend ::Concurrent::ReInclude - extend ::Concurrent::Promises::FactoryMethods::Configuration - extend ::Concurrent::Promises::FactoryMethods - - # Shortcut of {#any_resolved_future_on} with default `:io` executor supplied. - # - # @return [Future] - # @see #any_resolved_future_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#278 - def any(*futures_and_or_events); end - - # Shortcut of {#any_event_on} with default `:io` executor supplied. - # - # @return [Event] - # @see #any_event_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#319 - def any_event(*futures_and_or_events); end - - # Creates a new event which becomes resolved after the first futures_and_or_events resolves. - # If resolved it does not propagate {Concurrent::AbstractEventFuture#touch}, leaving delayed - # futures un-executed if they are not required any more. - # - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @param futures_and_or_events [AbstractEventFuture] - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#329 - def any_event_on(default_executor, *futures_and_or_events); end - - # Shortcut of {#any_fulfilled_future_on} with default `:io` executor supplied. - # - # @return [Future] - # @see #any_fulfilled_future_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#300 - def any_fulfilled_future(*futures_and_or_events); end - - # Creates a new future which is resolved after the first futures_and_or_events is fulfilled. - # Its result equals the result of the first resolved future or if all futures_and_or_events reject, - # it has reason of the last rejected future. - # If resolved it does not propagate {Concurrent::AbstractEventFuture#touch}, leaving delayed - # futures un-executed if they are not required any more. - # If event is supplied, which does not have value and can be only resolved, it's - # represented as `:fulfilled` with value `nil`. - # - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @param futures_and_or_events [AbstractEventFuture] - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#313 - def any_fulfilled_future_on(default_executor, *futures_and_or_events); end - - # Shortcut of {#any_resolved_future_on} with default `:io` executor supplied. - # - # @return [Future] - # @see #any_resolved_future_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#278 - def any_resolved_future(*futures_and_or_events); end - - # Creates a new future which is resolved after the first futures_and_or_events is resolved. - # Its result equals the result of the first resolved future. - # If resolved it does not propagate {Concurrent::AbstractEventFuture#touch}, leaving delayed - # futures un-executed if they are not required any more. - # If event is supplied, which does not have value and can be only resolved, it's - # represented as `:fulfilled` with value `nil`. - # - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @param futures_and_or_events [AbstractEventFuture] - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#294 - def any_resolved_future_on(default_executor, *futures_and_or_events); end - - # Shortcut of {#delay_on} with default `:io` executor supplied. - # - # @return [Future, Event] - # @see #delay_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#190 - def delay(*args, &task); end - - # Creates a new event or future which is resolved only after it is touched, - # see {Concurrent::AbstractEventFuture#touch}. - # - # @overload delay_on - # @overload delay_on - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#207 - def delay_on(default_executor, *args, &task); end - - # Creates a resolved future which will be fulfilled with the given value. - # - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @param value [Object] - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#127 - def fulfilled_future(value, default_executor = T.unsafe(nil)); end - - # Shortcut of {#future_on} with default `:io` executor supplied. - # - # @return [Future] - # @see #future_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#94 - def future(*args, &task); end - - # Constructs a new Future which will be resolved after block is evaluated on default executor. - # Evaluation begins immediately. - # - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @param args [Object] arguments which are passed to the task when it's executed. - # (It might be prepended with other arguments, see the @yield section). - # @return [Future] - # @yield [*args] to the task. - # @yieldreturn will become result of the returned Future. - # Its returned value becomes {Future#value} fulfilling it, - # raised exception becomes {Future#reason} rejecting it. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#106 - def future_on(default_executor, *args, &task); end - - # General constructor. Behaves differently based on the argument's type. It's provided for convenience - # but it's better to be explicit. - # - # @overload make_future - # @overload make_future - # @overload make_future - # @overload make_future - # @overload make_future - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @return [Event, Future] - # @see rejected_future, resolved_event, fulfilled_future - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#174 - def make_future(argument = T.unsafe(nil), default_executor = T.unsafe(nil)); end - - # Creates a resolved future which will be rejected with the given reason. - # - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @param reason [Object] - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#136 - def rejected_future(reason, default_executor = T.unsafe(nil)); end - - # Shortcut of {#resolvable_event_on} with default `:io` executor supplied. - # - # @return [ResolvableEvent] - # @see #resolvable_event_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#63 - def resolvable_event; end - - # Creates a resolvable event, user is responsible for resolving the event once - # by calling {Promises::ResolvableEvent#resolve}. - # - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @return [ResolvableEvent] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#72 - def resolvable_event_on(default_executor = T.unsafe(nil)); end - - # Shortcut of {#resolvable_future_on} with default `:io` executor supplied. - # - # @return [ResolvableFuture] - # @see #resolvable_future_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#78 - def resolvable_future; end - - # Creates resolvable future, user is responsible for resolving the future once by - # {Promises::ResolvableFuture#resolve}, {Promises::ResolvableFuture#fulfill}, - # or {Promises::ResolvableFuture#reject} - # - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @return [ResolvableFuture] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#88 - def resolvable_future_on(default_executor = T.unsafe(nil)); end - - # Creates resolved event. - # - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#144 - def resolved_event(default_executor = T.unsafe(nil)); end - - # Creates a resolved future with will be either fulfilled with the given value or rejected with - # the given reason. - # - # @param fulfilled [true, false] - # @param value [Object] - # @param reason [Object] - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#118 - def resolved_future(fulfilled, value, reason, default_executor = T.unsafe(nil)); end - - # Shortcut of {#schedule_on} with default `:io` executor supplied. - # - # @return [Future, Event] - # @see #schedule_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#214 - def schedule(intended_time, *args, &task); end - - # Creates a new event or future which is resolved in intended_time. - # - # @overload schedule_on - # @overload schedule_on - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @param intended_time [Numeric, Time] `Numeric` means to run in `intended_time` seconds. - # `Time` means to run on `intended_time`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#233 - def schedule_on(default_executor, intended_time, *args, &task); end - - # Shortcut of {#zip_futures_on} with default `:io` executor supplied. - # - # @return [Future] - # @see #zip_futures_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#240 - def zip(*futures_and_or_events); end - - # Shortcut of {#zip_events_on} with default `:io` executor supplied. - # - # @return [Event] - # @see #zip_events_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#262 - def zip_events(*futures_and_or_events); end - - # Creates a new event which is resolved after all futures_and_or_events are resolved. - # (Future is resolved when fulfilled or rejected.) - # - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @param futures_and_or_events [AbstractEventFuture] - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#272 - def zip_events_on(default_executor, *futures_and_or_events); end - - # Shortcut of {#zip_futures_on} with default `:io` executor supplied. - # - # @return [Future] - # @see #zip_futures_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#240 - def zip_futures(*futures_and_or_events); end - - # Creates a new future which is resolved after all futures_and_or_events are resolved. - # Its value is an array of zipped future values. Its reason is an array of reasons for rejection. - # If there is an error it rejects. - # If event is supplied, which does not have value and can be only resolved, it's - # represented as `:fulfilled` with value `nil`. - # - # @param default_executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. Default executor propagates to chained futures unless overridden with - # executor parameter or changed with {AbstractEventFuture#with_default_executor}. - # @param futures_and_or_events [AbstractEventFuture] - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#254 - def zip_futures_on(default_executor, *futures_and_or_events); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#50 -module Concurrent::Promises::FactoryMethods::Configuration - # @return [Executor, :io, :fast] the executor which is used when none is supplied - # to a factory method. The method can be overridden in the receivers of - # `include FactoryMethod` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#54 - def default_executor; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1840 -class Concurrent::Promises::FlatEventPromise < ::Concurrent::Promises::AbstractFlatPromise - # @return [FlatEventPromise] a new instance of FlatEventPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1844 - def initialize(delayed, blockers_count, default_executor); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1848 - def process_on_blocker_resolution(future, index); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1873 -class Concurrent::Promises::FlatFuturePromise < ::Concurrent::Promises::AbstractFlatPromise - # @raise [ArgumentError] - # @return [FlatFuturePromise] a new instance of FlatFuturePromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1877 - def initialize(delayed, blockers_count, levels, default_executor); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1884 - def process_on_blocker_resolution(future, index); end -end - -# Represents a value which will become available in future. May reject with a reason instead, -# e.g. when the tasks raises an exception. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#917 -class Concurrent::Promises::Future < ::Concurrent::Promises::AbstractEventFuture - # Creates a new event or a future which will be resolved when receiver and other are. - # Returns an event if receiver and other are events, otherwise returns a future. - # If just one of the parties is Future then the result - # of the returned future is equal to the result of the supplied future. If both are futures - # then the result is as described in {FactoryMethods#zip_futures_on}. - # - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1070 - def &(other); end - - # Creates a new event which will be resolved when the first of receiver, `event_or_future` - # resolves. Returning future will have value nil if event_or_future is event and resolves - # first. - # - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1085 - def any(event_or_future); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1215 - def apply(args, block); end - - # Creates new future dependent on receiver which will not evaluate until touched, see {#touch}. - # In other words, it inserts delay into the chain of Futures making rest of it lazy evaluated. - # - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1095 - def delay; end - - # Allows rejected Future to be risen with `raise` method. - # If the reason is not an exception `Runtime.new(reason)` is returned. - # - # @example - # raise Promises.rejected_future(StandardError.new("boom")) - # raise Promises.rejected_future("or just boom") - # @raise [Concurrent::Error] when raising not rejected future - # @return [Exception] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1013 - def exception(*args); end - - # Creates new future which will have result of the future returned by receiver. If receiver - # rejects it will have its rejection. - # - # @param level [Integer] how many levels of futures should flatten - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1120 - def flat(level = T.unsafe(nil)); end - - # Creates new event which will be resolved when the returned event by receiver is. - # Be careful if the receiver rejects it will just resolve since Event does not hold reason. - # - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1130 - def flat_event; end - - # Creates new future which will have result of the future returned by receiver. If receiver - # rejects it will have its rejection. - # - # @param level [Integer] how many levels of futures should flatten - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1120 - def flat_future(level = T.unsafe(nil)); end - - # Is it in fulfilled state? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#921 - def fulfilled?; end - - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1235 - def inspect; end - - # Shortcut of {#on_fulfillment_using} with default `:io` executor supplied. - # - # @return [self] - # @see #on_fulfillment_using - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1136 - def on_fulfillment(*args, &callback); end - - # Stores the callback to be executed synchronously on resolving thread after it is - # fulfilled. Does nothing on rejection. - # - # @param args [Object] arguments which are passed to the task when it's executed. - # (It might be prepended with other arguments, see the @yield section). - # @return [self] - # @yield [value, *args] to the callback. - # @yieldreturn is forgotten. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1147 - def on_fulfillment!(*args, &callback); end - - # Stores the callback to be executed asynchronously on executor after it is - # fulfilled. Does nothing on rejection. - # - # @param executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. The task is executed on it, default executor remains unchanged. - # @param args [Object] arguments which are passed to the task when it's executed. - # (It might be prepended with other arguments, see the @yield section). - # @return [self] - # @yield [value, *args] to the callback. - # @yieldreturn is forgotten. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1159 - def on_fulfillment_using(executor, *args, &callback); end - - # Shortcut of {#on_rejection_using} with default `:io` executor supplied. - # - # @return [self] - # @see #on_rejection_using - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1165 - def on_rejection(*args, &callback); end - - # Stores the callback to be executed synchronously on resolving thread after it is - # rejected. Does nothing on fulfillment. - # - # @param args [Object] arguments which are passed to the task when it's executed. - # (It might be prepended with other arguments, see the @yield section). - # @return [self] - # @yield [reason, *args] to the callback. - # @yieldreturn is forgotten. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1176 - def on_rejection!(*args, &callback); end - - # Stores the callback to be executed asynchronously on executor after it is - # rejected. Does nothing on fulfillment. - # - # @param executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. The task is executed on it, default executor remains unchanged. - # @param args [Object] arguments which are passed to the task when it's executed. - # (It might be prepended with other arguments, see the @yield section). - # @return [self] - # @yield [reason, *args] to the callback. - # @yieldreturn is forgotten. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1188 - def on_rejection_using(executor, *args, &callback); end - - # Returns reason of future's rejection. - # Calls {Concurrent::AbstractEventFuture#touch}. - # - # @note This function potentially blocks current thread until the Future is resolved. - # Be careful it can deadlock. Try to chain instead. - # @note Make sure returned `nil` is not confused with timeout, no value when rejected, - # no reason when fulfilled, etc. - # Use more exact methods if needed, like {#wait}, {#value!}, {#result}, etc. - # @param timeout [Numeric] the maximum time in second to wait. - # @param timeout_value [Object] a value returned by the method when it times out - # @return [Object, timeout_value] the reason, or timeout_value on timeout, or nil on fulfillment. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#966 - def reason(timeout = T.unsafe(nil), timeout_value = T.unsafe(nil)); end - - # Is it in rejected state? - # - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#928 - def rejected?; end - - # Shortcut of {#rescue_on} with default `:io` executor supplied. - # - # @return [Future] - # @see #rescue_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1052 - def rescue(*args, &task); end - - # Chains the task to be executed asynchronously on executor after it rejects. Does not run - # the task if it fulfills. It will resolve though, triggering any dependent futures. - # - # @param executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. The task is executed on it, default executor remains unchanged. - # @param args [Object] arguments which are passed to the task when it's executed. - # (It might be prepended with other arguments, see the @yield section). - # @return [Future] - # @yield [reason, *args] to the task. - # @yieldreturn will become result of the returned Future. - # Its returned value becomes {Future#value} fulfilling it, - # raised exception becomes {Future#reason} rejecting it. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1064 - def rescue_on(executor, *args, &task); end - - # Returns triplet fulfilled?, value, reason. - # Calls {Concurrent::AbstractEventFuture#touch}. - # - # @note This function potentially blocks current thread until the Future is resolved. - # Be careful it can deadlock. Try to chain instead. - # @param timeout [Numeric] the maximum time in second to wait. - # @return [Array(Boolean, Object, Object), nil] triplet of fulfilled?, value, reason, or nil - # on timeout. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#981 - def result(timeout = T.unsafe(nil)); end - - # Allows to use futures as green threads. The receiver has to evaluate to a future which - # represents what should be done next. It basically flattens indefinitely until non Future - # values is returned which becomes result of the returned future. Any encountered exception - # will become reason of the returned future. - # - # @example - # body = lambda do |v| - # v += 1 - # v < 5 ? Promises.future(v, &body) : v - # end - # Promises.future(0, &body).run.value! # => 5 - # @param run_test [#call(value)] an object which when called returns either Future to keep running with - # or nil, then the run completes with the value. - # The run_test can be used to extract the Future from deeper structure, - # or to distinguish Future which is a resulting value from a future - # which is suppose to continue running. - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1210 - def run(run_test = T.unsafe(nil)); end - - # Creates new event dependent on receiver scheduled to execute on/in intended_time. - # In time is interpreted from the moment the receiver is resolved, therefore it inserts - # delay into the chain. - # - # @param intended_time [Numeric, Time] `Numeric` means to run in `intended_time` seconds. - # `Time` means to run on `intended_time`. - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1102 - def schedule(intended_time); end - - # Shortcut of {#then_on} with default `:io` executor supplied. - # - # @return [Future] - # @see #then_on - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1034 - def then(*args, &task); end - - # Chains the task to be executed asynchronously on executor after it fulfills. Does not run - # the task if it rejects. It will resolve though, triggering any dependent futures. - # - # @param executor [Executor, :io, :fast] Instance of an executor or a name of the - # global executor. The task is executed on it, default executor remains unchanged. - # @param args [Object] arguments which are passed to the task when it's executed. - # (It might be prepended with other arguments, see the @yield section). - # @return [Future] - # @yield [value, *args] to the task. - # @yieldreturn will become result of the returned Future. - # Its returned value becomes {Future#value} fulfilling it, - # raised exception becomes {Future#reason} rejecting it. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1046 - def then_on(executor, *args, &task); end - - # Converts future to event which is resolved when future is resolved by fulfillment or rejection. - # - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1222 - def to_event; end - - # Returns self, since this is a future - # - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1230 - def to_future; end - - # @return [String] Short string representation. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1235 - def to_s; end - - # Return value of the future. - # Calls {Concurrent::AbstractEventFuture#touch}. - # - # @note This function potentially blocks current thread until the Future is resolved. - # Be careful it can deadlock. Try to chain instead. - # @note Make sure returned `nil` is not confused with timeout, no value when rejected, - # no reason when fulfilled, etc. - # Use more exact methods if needed, like {#wait}, {#value!}, {#result}, etc. - # @param timeout [Numeric] the maximum time in second to wait. - # @param timeout_value [Object] a value returned by the method when it times out - # @return [Object, nil, timeout_value] the value of the Future when fulfilled, - # timeout_value on timeout, - # nil on rejection. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#950 - def value(timeout = T.unsafe(nil), timeout_value = T.unsafe(nil)); end - - # Return value of the future. - # Calls {Concurrent::AbstractEventFuture#touch}. - # - # @note This function potentially blocks current thread until the Future is resolved. - # Be careful it can deadlock. Try to chain instead. - # @note Make sure returned `nil` is not confused with timeout, no value when rejected, - # no reason when fulfilled, etc. - # Use more exact methods if needed, like {#wait}, {#value!}, {#result}, etc. - # @param timeout [Numeric] the maximum time in second to wait. - # @param timeout_value [Object] a value returned by the method when it times out - # @raise [Exception] {#reason} on rejection - # @return [Object, nil, timeout_value] the value of the Future when fulfilled, - # or nil on rejection, - # or timeout_value on timeout. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#997 - def value!(timeout = T.unsafe(nil), timeout_value = T.unsafe(nil)); end - - # Wait (block the Thread) until receiver is {#resolved?}. - # Calls {Concurrent::AbstractEventFuture#touch}. - # - # @note This function potentially blocks current thread until the Future is resolved. - # Be careful it can deadlock. Try to chain instead. - # @param timeout [Numeric] the maximum time in second to wait. - # @raise [Exception] {#reason} on rejection - # @return [self, true, false] self implies timeout was not used, true implies timeout was used - # and it was resolved, false implies it was not resolved within timeout. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#987 - def wait!(timeout = T.unsafe(nil)); end - - # Crates new object with same class with the executor set as its new default executor. - # Any futures depending on it will use the new default executor. - # - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1111 - def with_default_executor(executor); end - - # Creates a new event or a future which will be resolved when receiver and other are. - # Returns an event if receiver and other are events, otherwise returns a future. - # If just one of the parties is Future then the result - # of the returned future is equal to the result of the supplied future. If both are futures - # then the result is as described in {FactoryMethods#zip_futures_on}. - # - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1070 - def zip(other); end - - # Creates a new event which will be resolved when the first of receiver, `event_or_future` - # resolves. Returning future will have value nil if event_or_future is event and resolves - # first. - # - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1085 - def |(event_or_future); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1272 - def async_callback_on_fulfillment(state, executor, args, callback); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1278 - def async_callback_on_rejection(state, executor, args, callback); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1284 - def callback_on_fulfillment(state, args, callback); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1288 - def callback_on_rejection(state, args, callback); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1292 - def callback_on_resolution(state, args, callback); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1251 - def rejected_resolution(raise_on_reassign, state); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1247 - def run_test(v); end - - # @raise [self] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1266 - def wait_until_resolved!(timeout = T.unsafe(nil)); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1984 -class Concurrent::Promises::FutureWrapperPromise < ::Concurrent::Promises::BlockedPromise - # @return [FutureWrapperPromise] a new instance of FutureWrapperPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1985 - def initialize(delayed, blockers_count, default_executor); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1991 - def on_resolvable(resolved_future, index); end -end - -# will be immediately resolved -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1783 -class Concurrent::Promises::ImmediateEventPromise < ::Concurrent::Promises::InnerPromise - # @return [ImmediateEventPromise] a new instance of ImmediateEventPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1784 - def initialize(default_executor); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1789 -class Concurrent::Promises::ImmediateFuturePromise < ::Concurrent::Promises::InnerPromise - # @return [ImmediateFuturePromise] a new instance of ImmediateFuturePromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1790 - def initialize(default_executor, fulfilled, value, reason); end -end - -# @abstract -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1615 -class Concurrent::Promises::InnerPromise < ::Concurrent::Promises::AbstractPromise; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#338 -module Concurrent::Promises::InternalStates; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#397 -class Concurrent::Promises::InternalStates::Fulfilled < ::Concurrent::Promises::InternalStates::ResolvedWithResult - # @return [Fulfilled] a new instance of Fulfilled - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#399 - def initialize(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#407 - def apply(args, block); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#403 - def fulfilled?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#415 - def reason; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#419 - def to_sym; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#411 - def value; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#425 -class Concurrent::Promises::InternalStates::FulfilledArray < ::Concurrent::Promises::InternalStates::Fulfilled - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#426 - def apply(args, block); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#488 -Concurrent::Promises::InternalStates::PENDING = T.let(T.unsafe(nil), Concurrent::Promises::InternalStates::Pending) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#459 -class Concurrent::Promises::InternalStates::PartiallyRejected < ::Concurrent::Promises::InternalStates::ResolvedWithResult - # @return [PartiallyRejected] a new instance of PartiallyRejected - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#460 - def initialize(value, reason); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#482 - def apply(args, block); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#466 - def fulfilled?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#478 - def reason; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#470 - def to_sym; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#474 - def value; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#351 -class Concurrent::Promises::InternalStates::Pending < ::Concurrent::Promises::InternalStates::State - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#352 - def resolved?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#356 - def to_sym; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#490 -Concurrent::Promises::InternalStates::RESERVED = T.let(T.unsafe(nil), Concurrent::Promises::InternalStates::Reserved) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#492 -Concurrent::Promises::InternalStates::RESOLVED = T.let(T.unsafe(nil), Concurrent::Promises::InternalStates::Fulfilled) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#432 -class Concurrent::Promises::InternalStates::Rejected < ::Concurrent::Promises::InternalStates::ResolvedWithResult - # @return [Rejected] a new instance of Rejected - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#433 - def initialize(reason); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#453 - def apply(args, block); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#437 - def fulfilled?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#445 - def reason; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#449 - def to_sym; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#441 - def value; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#362 -class Concurrent::Promises::InternalStates::Reserved < ::Concurrent::Promises::InternalStates::Pending; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#366 -class Concurrent::Promises::InternalStates::ResolvedWithResult < ::Concurrent::Promises::InternalStates::State - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#391 - def apply; end - - # @raise [NotImplementedError] - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#379 - def fulfilled?; end - - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#387 - def reason; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#367 - def resolved?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#375 - def result; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#371 - def to_sym; end - - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#383 - def value; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#340 -class Concurrent::Promises::InternalStates::State - # @raise [NotImplementedError] - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#341 - def resolved?; end - - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#345 - def to_sym; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1748 -class Concurrent::Promises::RescuePromise < ::Concurrent::Promises::BlockedTaskPromise - # @return [RescuePromise] a new instance of RescuePromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1751 - def initialize(delayed, blockers_count, default_executor, executor, args, &task); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1755 - def on_resolvable(resolved_future, index); end -end - -# Marker module of Future, Event resolved manually. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1299 -module Concurrent::Promises::Resolvable - include ::Concurrent::Promises::InternalStates -end - -# A Event which can be resolved by user. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1304 -class Concurrent::Promises::ResolvableEvent < ::Concurrent::Promises::Event - include ::Concurrent::Promises::Resolvable - - # Makes the event resolved, which triggers all dependent futures. - # - # @param raise_on_reassign [Boolean] should method raise exception if already resolved - # @param reserved [true, false] Set to true if the resolvable is {#reserve}d by you, - # marks resolution of reserved resolvable events and futures explicitly. - # Advanced feature, ignore unless you use {Resolvable#reserve} from edge. - # @return [self, false] false is returned when raise_on_reassign is false and the receiver - # is already resolved. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1324 - def resolve(raise_on_reassign = T.unsafe(nil), reserved = T.unsafe(nil)); end - - # Behaves as {AbstractEventFuture#wait} but has one additional optional argument - # resolve_on_timeout. - # - # @param resolve_on_timeout [true, false] If it times out and the argument is true it will also resolve the event. - # @return [self, true, false] - # @see AbstractEventFuture#wait - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1342 - def wait(timeout = T.unsafe(nil), resolve_on_timeout = T.unsafe(nil)); end - - # Creates new event wrapping receiver, effectively hiding the resolve method. - # - # @return [Event] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1331 - def with_hidden_resolvable; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1600 -class Concurrent::Promises::ResolvableEventPromise < ::Concurrent::Promises::AbstractPromise - # @return [ResolvableEventPromise] a new instance of ResolvableEventPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1601 - def initialize(default_executor); end -end - -# A Future which can be resolved by user. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1354 -class Concurrent::Promises::ResolvableFuture < ::Concurrent::Promises::Future - include ::Concurrent::Promises::Resolvable - - # Evaluates the block and sets its result as future's value fulfilling, if the block raises - # an exception the future rejects with it. - # - # @return [self] - # @yield [*args] to the block. - # @yieldreturn [Object] value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1395 - def evaluate_to(*args, &block); end - - # Evaluates the block and sets its result as future's value fulfilling, if the block raises - # an exception the future rejects with it. - # - # @raise [Exception] also raise reason on rejection. - # @return [self] - # @yield [*args] to the block. - # @yieldreturn [Object] value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1406 - def evaluate_to!(*args, &block); end - - # Makes the future fulfilled with `value`, - # which triggers all dependent futures. - # - # @param value [Object] - # @param raise_on_reassign [Boolean] should method raise exception if already resolved - # @param reserved [true, false] Set to true if the resolvable is {#reserve}d by you, - # marks resolution of reserved resolvable events and futures explicitly. - # Advanced feature, ignore unless you use {Resolvable#reserve} from edge. - # @return [self, false] false is returned when raise_on_reassign is false and the receiver - # is already resolved. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1375 - def fulfill(value, raise_on_reassign = T.unsafe(nil), reserved = T.unsafe(nil)); end - - # Behaves as {Future#reason} but has one additional optional argument - # resolve_on_timeout. - # - # @param resolve_on_timeout [::Array(true, Object, nil), ::Array(false, nil, Exception), nil] If it times out and the argument is not nil it will also resolve the future - # to the provided resolution. - # @return [Exception, timeout_value, nil] - # @see Future#reason - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1503 - def reason(timeout = T.unsafe(nil), timeout_value = T.unsafe(nil), resolve_on_timeout = T.unsafe(nil)); end - - # Makes the future rejected with `reason`, - # which triggers all dependent futures. - # - # @param reason [Object] - # @param raise_on_reassign [Boolean] should method raise exception if already resolved - # @param reserved [true, false] Set to true if the resolvable is {#reserve}d by you, - # marks resolution of reserved resolvable events and futures explicitly. - # Advanced feature, ignore unless you use {Resolvable#reserve} from edge. - # @return [self, false] false is returned when raise_on_reassign is false and the receiver - # is already resolved. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1385 - def reject(reason, raise_on_reassign = T.unsafe(nil), reserved = T.unsafe(nil)); end - - # Makes the future resolved with result of triplet `fulfilled?`, `value`, `reason`, - # which triggers all dependent futures. - # - # @param fulfilled [true, false] - # @param value [Object] - # @param reason [Object] - # @param raise_on_reassign [Boolean] should method raise exception if already resolved - # @param reserved [true, false] Set to true if the resolvable is {#reserve}d by you, - # marks resolution of reserved resolvable events and futures explicitly. - # Advanced feature, ignore unless you use {Resolvable#reserve} from edge. - # @return [self, false] false is returned when raise_on_reassign is false and the receiver - # is already resolved. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1365 - def resolve(fulfilled = T.unsafe(nil), value = T.unsafe(nil), reason = T.unsafe(nil), raise_on_reassign = T.unsafe(nil), reserved = T.unsafe(nil)); end - - # Behaves as {Future#result} but has one additional optional argument - # resolve_on_timeout. - # - # @param resolve_on_timeout [::Array(true, Object, nil), ::Array(false, nil, Exception), nil] If it times out and the argument is not nil it will also resolve the future - # to the provided resolution. - # @return [::Array(Boolean, Object, Exception), nil] - # @see Future#result - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1524 - def result(timeout = T.unsafe(nil), resolve_on_timeout = T.unsafe(nil)); end - - # Behaves as {Future#value} but has one additional optional argument - # resolve_on_timeout. - # - # @param resolve_on_timeout [::Array(true, Object, nil), ::Array(false, nil, Exception), nil] If it times out and the argument is not nil it will also resolve the future - # to the provided resolution. - # @return [Object, timeout_value, nil] - # @see Future#value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1459 - def value(timeout = T.unsafe(nil), timeout_value = T.unsafe(nil), resolve_on_timeout = T.unsafe(nil)); end - - # Behaves as {Future#value!} but has one additional optional argument - # resolve_on_timeout. - # - # @param resolve_on_timeout [::Array(true, Object, nil), ::Array(false, nil, Exception), nil] If it times out and the argument is not nil it will also resolve the future - # to the provided resolution. - # @raise [Exception] {#reason} on rejection - # @return [Object, timeout_value, nil] - # @see Future#value! - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1481 - def value!(timeout = T.unsafe(nil), timeout_value = T.unsafe(nil), resolve_on_timeout = T.unsafe(nil)); end - - # Behaves as {AbstractEventFuture#wait} but has one additional optional argument - # resolve_on_timeout. - # - # @param resolve_on_timeout [::Array(true, Object, nil), ::Array(false, nil, Exception), nil] If it times out and the argument is not nil it will also resolve the future - # to the provided resolution. - # @return [self, true, false] - # @see AbstractEventFuture#wait - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1421 - def wait(timeout = T.unsafe(nil), resolve_on_timeout = T.unsafe(nil)); end - - # Behaves as {Future#wait!} but has one additional optional argument - # resolve_on_timeout. - # - # @param resolve_on_timeout [::Array(true, Object, nil), ::Array(false, nil, Exception), nil] If it times out and the argument is not nil it will also resolve the future - # to the provided resolution. - # @raise [Exception] {#reason} on rejection - # @return [self, true, false] - # @see Future#wait! - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1438 - def wait!(timeout = T.unsafe(nil), resolve_on_timeout = T.unsafe(nil)); end - - # Creates new future wrapping receiver, effectively hiding the resolve method and similar. - # - # @return [Future] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1542 - def with_hidden_resolvable; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1606 -class Concurrent::Promises::ResolvableFuturePromise < ::Concurrent::Promises::AbstractPromise - # @return [ResolvableFuturePromise] a new instance of ResolvableFuturePromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1607 - def initialize(default_executor); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1592 - def evaluate_to(*args, block); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1909 -class Concurrent::Promises::RunFuturePromise < ::Concurrent::Promises::AbstractFlatPromise - # @return [RunFuturePromise] a new instance of RunFuturePromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1913 - def initialize(delayed, blockers_count, default_executor, run_test); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1918 - def process_on_blocker_resolution(future, index); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2114 -class Concurrent::Promises::ScheduledPromise < ::Concurrent::Promises::InnerPromise - # @return [ScheduledPromise] a new instance of ScheduledPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2125 - def initialize(default_executor, intended_time); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2119 - def inspect; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2115 - def intended_time; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1730 -class Concurrent::Promises::ThenPromise < ::Concurrent::Promises::BlockedTaskPromise - # @return [ThenPromise] a new instance of ThenPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1733 - def initialize(delayed, blockers_count, default_executor, executor, args, &task); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1737 - def on_resolvable(resolved_future, index); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1940 -class Concurrent::Promises::ZipEventEventPromise < ::Concurrent::Promises::BlockedPromise - # @return [ZipEventEventPromise] a new instance of ZipEventEventPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1941 - def initialize(delayed, blockers_count, default_executor); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1947 - def on_resolvable(resolved_future, index); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2031 -class Concurrent::Promises::ZipEventsPromise < ::Concurrent::Promises::BlockedPromise - # @return [ZipEventsPromise] a new instance of ZipEventsPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2035 - def initialize(delayed, blockers_count, default_executor); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2041 - def on_resolvable(resolved_future, index); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1952 -class Concurrent::Promises::ZipFutureEventPromise < ::Concurrent::Promises::BlockedPromise - # @return [ZipFutureEventPromise] a new instance of ZipFutureEventPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1953 - def initialize(delayed, blockers_count, default_executor); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1967 - def on_resolvable(resolved_future, index); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1960 - def process_on_blocker_resolution(future, index); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#1996 -class Concurrent::Promises::ZipFuturesPromise < ::Concurrent::Promises::BlockedPromise - # @return [ZipFuturesPromise] a new instance of ZipFuturesPromise - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2000 - def initialize(delayed, blockers_count, default_executor); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2013 - def on_resolvable(resolved_future, index); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/promises.rb#2007 - def process_on_blocker_resolution(future, index); end -end - -# Methods form module A included to a module B, which is already included into class C, -# will not be visible in the C class. If this module is extended to B then A's methods -# are correctly made visible to C. -# -# @example -# module A -# def a -# :a -# end -# end -# -# module B1 -# end -# -# class C1 -# include B1 -# end -# -# module B2 -# extend Concurrent::ReInclude -# end -# -# class C2 -# include B2 -# end -# -# B1.send :include, A -# B2.send :include, A -# -# C1.new.respond_to? :a # => false -# C2.new.respond_to? :a # => true -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/re_include.rb#36 -module Concurrent::ReInclude - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/re_include.rb#44 - def extended(base); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/re_include.rb#50 - def include(*modules); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/re_include.rb#38 - def included(base); end -end - -# Ruby read-write lock implementation -# -# Allows any number of concurrent readers, but only one concurrent writer -# (And if the "write" lock is taken, any readers who come along will have to wait) -# -# If readers are already active when a writer comes along, the writer will wait for -# all the readers to finish before going ahead. -# Any additional readers that come when the writer is already waiting, will also -# wait (so writers are not starved). -# -# This implementation is based on `java.util.concurrent.ReentrantReadWriteLock`. -# -# @example -# lock = Concurrent::ReadWriteLock.new -# lock.with_read_lock { data.retrieve } -# lock.with_write_lock { data.modify! } -# @note Do **not** try to acquire the write lock while already holding a read lock -# **or** try to acquire the write lock while you already have it. -# This will lead to deadlock -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html java.util.concurrent.ReentrantReadWriteLock -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#31 -class Concurrent::ReadWriteLock < ::Concurrent::Synchronization::Object - extend ::Concurrent::Synchronization::SafeInitialization - - # Create a new `ReadWriteLock` in the unlocked state. - # - # @return [ReadWriteLock] a new instance of ReadWriteLock - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#59 - def initialize; end - - # Acquire a read lock. If a write lock has been acquired will block until - # it is released. Will not block if other read locks have been acquired. - # - # @raise [Concurrent::ResourceLimitError] if the maximum number of readers - # is exceeded. - # @return [Boolean] true if the lock is successfully acquired - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#111 - def acquire_read_lock; end - - # Acquire a write lock. Will block and wait for all active readers and writers. - # - # @raise [Concurrent::ResourceLimitError] if the maximum number of writers - # is exceeded. - # @return [Boolean] true if the lock is successfully acquired - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#160 - def acquire_write_lock; end - - # Queries whether any threads are waiting to acquire the read or write lock. - # - # @return [Boolean] true if any threads are waiting for a lock else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#214 - def has_waiters?; end - - # Release a previously acquired read lock. - # - # @return [Boolean] true if the lock is successfully released - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#140 - def release_read_lock; end - - # Release a previously acquired write lock. - # - # @return [Boolean] true if the lock is successfully released - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#196 - def release_write_lock; end - - # Execute a block operation within a read lock. - # - # @raise [ArgumentError] when no block is given. - # @raise [Concurrent::ResourceLimitError] if the maximum number of readers - # is exceeded. - # @return [Object] the result of the block operation. - # @yield the task to be performed within the lock. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#75 - def with_read_lock; end - - # Execute a block operation within a write lock. - # - # @raise [ArgumentError] when no block is given. - # @raise [Concurrent::ResourceLimitError] if the maximum number of readers - # is exceeded. - # @return [Object] the result of the block operation. - # @yield the task to be performed within the lock. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#94 - def with_write_lock; end - - # Queries if the write lock is held by any thread. - # - # @return [Boolean] true if the write lock is held else false` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#207 - def write_locked?; end - - private - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#246 - def max_readers?(c = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#251 - def max_writers?(c = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#221 - def running_readers(c = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#226 - def running_readers?(c = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#231 - def running_writer?(c = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#241 - def waiting_writer?(c = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#236 - def waiting_writers(c = T.unsafe(nil)); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#40 -Concurrent::ReadWriteLock::MAX_READERS = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#43 -Concurrent::ReadWriteLock::MAX_WRITERS = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#37 -Concurrent::ReadWriteLock::RUNNING_WRITER = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/read_write_lock.rb#34 -Concurrent::ReadWriteLock::WAITING_WRITER = T.let(T.unsafe(nil), Integer) - -# Re-entrant read-write lock implementation -# -# Allows any number of concurrent readers, but only one concurrent writer -# (And while the "write" lock is taken, no read locks can be obtained either. -# Hence, the write lock can also be called an "exclusive" lock.) -# -# If another thread has taken a read lock, any thread which wants a write lock -# will block until all the readers release their locks. However, once a thread -# starts waiting to obtain a write lock, any additional readers that come along -# will also wait (so writers are not starved). -# -# A thread can acquire both a read and write lock at the same time. A thread can -# also acquire a read lock OR a write lock more than once. Only when the read (or -# write) lock is released as many times as it was acquired, will the thread -# actually let it go, allowing other threads which might have been waiting -# to proceed. Therefore the lock can be upgraded by first acquiring -# read lock and then write lock and that the lock can be downgraded by first -# having both read and write lock a releasing just the write lock. -# -# If both read and write locks are acquired by the same thread, it is not strictly -# necessary to release them in the same order they were acquired. In other words, -# the following code is legal: -# -# This implementation was inspired by `java.util.concurrent.ReentrantReadWriteLock`. -# -# @example -# lock = Concurrent::ReentrantReadWriteLock.new -# lock.acquire_write_lock -# lock.acquire_read_lock -# lock.release_write_lock -# # At this point, the current thread is holding only a read lock, not a write -# # lock. So other threads can take read locks, but not a write lock. -# lock.release_read_lock -# # Now the current thread is not holding either a read or write lock, so -# # another thread could potentially acquire a write lock. -# @example -# lock = Concurrent::ReentrantReadWriteLock.new -# lock.with_read_lock { data.retrieve } -# lock.with_write_lock { data.modify! } -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html java.util.concurrent.ReentrantReadWriteLock -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#53 -class Concurrent::ReentrantReadWriteLock < ::Concurrent::Synchronization::Object - extend ::Concurrent::Synchronization::SafeInitialization - - # Create a new `ReentrantReadWriteLock` in the unlocked state. - # - # @return [ReentrantReadWriteLock] a new instance of ReentrantReadWriteLock - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#109 - def initialize; end - - # Acquire a read lock. If a write lock is held by another thread, will block - # until it is released. - # - # @raise [Concurrent::ResourceLimitError] if the maximum number of readers - # is exceeded. - # @return [Boolean] true if the lock is successfully acquired - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#162 - def acquire_read_lock; end - - # Acquire a write lock. Will block and wait for all active readers and writers. - # - # @raise [Concurrent::ResourceLimitError] if the maximum number of writers - # is exceeded. - # @return [Boolean] true if the lock is successfully acquired - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#257 - def acquire_write_lock; end - - # Release a previously acquired read lock. - # - # @return [Boolean] true if the lock is successfully released - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#236 - def release_read_lock; end - - # Release a previously acquired write lock. - # - # @return [Boolean] true if the lock is successfully released - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#329 - def release_write_lock; end - - # Try to acquire a read lock and return true if we succeed. If it cannot be - # acquired immediately, return false. - # - # @return [Boolean] true if the lock is successfully acquired - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#215 - def try_read_lock; end - - # Try to acquire a write lock and return true if we succeed. If it cannot be - # acquired immediately, return false. - # - # @return [Boolean] true if the lock is successfully acquired - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#310 - def try_write_lock; end - - # Execute a block operation within a read lock. - # - # @raise [ArgumentError] when no block is given. - # @raise [Concurrent::ResourceLimitError] if the maximum number of readers - # is exceeded. - # @return [Object] the result of the block operation. - # @yield the task to be performed within the lock. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#126 - def with_read_lock; end - - # Execute a block operation within a write lock. - # - # @raise [ArgumentError] when no block is given. - # @raise [Concurrent::ResourceLimitError] if the maximum number of readers - # is exceeded. - # @return [Object] the result of the block operation. - # @yield the task to be performed within the lock. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#145 - def with_write_lock; end - - private - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#370 - def max_readers?(c = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#375 - def max_writers?(c = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#345 - def running_readers(c = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#350 - def running_readers?(c = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#355 - def running_writer?(c = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#365 - def waiting_or_running_writer?(c = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#360 - def waiting_writers(c = T.unsafe(nil)); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#94 -Concurrent::ReentrantReadWriteLock::MAX_READERS = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#96 -Concurrent::ReentrantReadWriteLock::MAX_WRITERS = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#84 -Concurrent::ReentrantReadWriteLock::READER_BITS = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#102 -Concurrent::ReentrantReadWriteLock::READ_LOCK_MASK = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#92 -Concurrent::ReentrantReadWriteLock::RUNNING_WRITER = T.let(T.unsafe(nil), Integer) - -# Used with @Counter: -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#90 -Concurrent::ReentrantReadWriteLock::WAITING_WRITER = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#86 -Concurrent::ReentrantReadWriteLock::WRITER_BITS = T.let(T.unsafe(nil), Integer) - -# Used with @HeldCount: -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#100 -Concurrent::ReentrantReadWriteLock::WRITE_LOCK_HELD = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/reentrant_read_write_lock.rb#104 -Concurrent::ReentrantReadWriteLock::WRITE_LOCK_MASK = T.let(T.unsafe(nil), Integer) - -# Raised by an `Executor` when it is unable to process a given task, -# possibly because of a reject policy or other internal error. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#48 -class Concurrent::RejectedExecutionError < ::Concurrent::Error; end - -# Raised when any finite resource, such as a lock counter, exceeds its -# maximum limit/threshold. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#52 -class Concurrent::ResourceLimitError < ::Concurrent::Error; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#134 -class Concurrent::RubyExchanger < ::Concurrent::AbstractExchanger - extend ::Concurrent::Synchronization::SafeInitialization - - # @return [RubyExchanger] a new instance of RubyExchanger - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#159 - def initialize; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#137 - def __initialize_atomic_fields__; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#105 - def compare_and_set_slot(expected, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#93 - def slot; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#97 - def slot=(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#101 - def swap_slot(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#109 - def update_slot(&block); end - - private - - # Waits for another thread to arrive at this exchange point (unless the - # current thread is interrupted), and then transfers the given object to - # it, receiving its object in return. The timeout value indicates the - # approximate number of seconds the method should block while waiting - # for the exchange. When the timeout value is `nil` the method will - # block indefinitely. - # - # @param value [Object] the value to exchange with another thread - # @param timeout [Numeric, nil] in seconds, `nil` blocks indefinitely - # @return [Object, CANCEL] the value exchanged by the other thread; {CANCEL} on timeout - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#170 - def do_exchange(value, timeout); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#138 -class Concurrent::RubyExchanger::Node < ::Concurrent::Synchronization::Object - extend ::Concurrent::Synchronization::SafeInitialization - - # @return [Node] a new instance of Node - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#142 - def initialize(item); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#137 - def __initialize_atomic_fields__; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#105 - def compare_and_set_value(expected, value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#153 - def item; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#149 - def latch; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#101 - def swap_value(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#109 - def update_value(&block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#93 - def value; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#97 - def value=(value); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#8 -class Concurrent::RubyExecutorService < ::Concurrent::AbstractExecutorService - # @return [RubyExecutorService] a new instance of RubyExecutorService - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#11 - def initialize(*args, &block); end - - # Begin an immediate shutdown. In-progress tasks will be allowed to - # complete but enqueued tasks will be dismissed and no new tasks - # will be accepted. Has no additional effect if the thread pool is - # not running. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#42 - def kill; end - - # Submit a task to the executor for asynchronous processing. - # - # @param args [Array] zero or more arguments to be passed to the task - # @raise [ArgumentError] if no task is given - # @return [Boolean] `true` if the task is queued, `false` if the executor - # is not running - # @yield the asynchronous task to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#17 - def post(*args, &task); end - - # Begin an orderly shutdown. Tasks already in the queue will be executed, - # but no new tasks will be accepted. Has no additional effect if the - # thread pool is not running. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#33 - def shutdown; end - - # Block until executor shutdown is complete or until `timeout` seconds have - # passed. - # - # @note Does not initiate shutdown or termination. Either `shutdown` or `kill` - # must be called before this method (or on another thread). - # @param timeout [Integer] the maximum number of seconds to wait for shutdown to complete - # @return [Boolean] `true` if shutdown complete or false on `timeout` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#52 - def wait_for_termination(timeout = T.unsafe(nil)); end - - private - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#70 - def ns_running?; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#78 - def ns_shutdown?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#66 - def ns_shutdown_execution; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#74 - def ns_shuttingdown?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#58 - def stop_event; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#62 - def stopped_event; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_single_thread_executor.rb#8 -class Concurrent::RubySingleThreadExecutor < ::Concurrent::RubyThreadPoolExecutor - # @return [RubySingleThreadExecutor] a new instance of RubySingleThreadExecutor - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_single_thread_executor.rb#11 - def initialize(opts = T.unsafe(nil)); end -end - -# **Thread Pool Options** -# -# Thread pools support several configuration options: -# -# * `idletime`: The number of seconds that a thread may be idle before being reclaimed. -# * `name`: The name of the executor (optional). Printed in the executor's `#to_s` output and -# a `-worker-` name is given to its threads if supported by used Ruby -# implementation. `` is uniq for each thread. -# * `max_queue`: The maximum number of tasks that may be waiting in the work queue at -# any one time. When the queue size reaches `max_queue` and no new threads can be created, -# subsequent tasks will be rejected in accordance with the configured `fallback_policy`. -# * `auto_terminate`: When true (default), the threads started will be marked as daemon. -# * `fallback_policy`: The policy defining how rejected tasks are handled. -# -# Three fallback policies are supported: -# -# * `:abort`: Raise a `RejectedExecutionError` exception and discard the task. -# * `:discard`: Discard the task and return false. -# * `:caller_runs`: Execute the task on the calling thread. -# -# **Shutting Down Thread Pools** -# -# Killing a thread pool while tasks are still being processed, either by calling -# the `#kill` method or at application exit, will have unpredictable results. There -# is no way for the thread pool to know what resources are being used by the -# in-progress tasks. When those tasks are killed the impact on those resources -# cannot be predicted. The *best* practice is to explicitly shutdown all thread -# pools using the provided methods: -# -# * Call `#shutdown` to initiate an orderly termination of all in-progress tasks -# * Call `#wait_for_termination` with an appropriate timeout interval an allow -# the orderly shutdown to complete -# * Call `#kill` *only when* the thread pool fails to shutdown in the allotted time -# -# On some runtime platforms (most notably the JVM) the application will not -# exit until all thread pools have been shutdown. To prevent applications from -# "hanging" on exit, all threads can be marked as daemon according to the -# `:auto_terminate` option. -# -# ```ruby -# pool1 = Concurrent::FixedThreadPool.new(5) # threads will be marked as daemon -# pool2 = Concurrent::FixedThreadPool.new(5, auto_terminate: false) # mark threads as non-daemon -# ``` -# -# @note Failure to properly shutdown a thread pool can lead to unpredictable results. -# Please read *Shutting Down Thread Pools* for more information. -# @see http://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html Java Tutorials: Thread Pools -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html Java Executors class -# @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html Java ExecutorService interface -# @see https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#setDaemon-boolean- -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#12 -class Concurrent::RubyThreadPoolExecutor < ::Concurrent::RubyExecutorService - # @return [RubyThreadPoolExecutor] a new instance of RubyThreadPoolExecutor - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#45 - def initialize(opts = T.unsafe(nil)); end - - # The number of threads that are actively executing tasks. - # - # @return [Integer] The number of threads that are actively executing tasks. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#65 - def active_count; end - - # Does the task queue have a maximum size? - # - # @return [Boolean] True if the task queue has a maximum size else false. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#72 - def can_overflow?; end - - # The number of tasks that have been completed by the pool since construction. - # - # @return [Integer] The number of tasks that have been completed by the pool since construction. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#60 - def completed_task_count; end - - # The number of seconds that a thread may be idle before being reclaimed. - # - # @return [Integer] The number of seconds that a thread may be idle before being reclaimed. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#36 - def idletime; end - - # The largest number of threads that have been created in the pool since construction. - # - # @return [Integer] The largest number of threads that have been created in the pool since construction. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#50 - def largest_length; end - - # The number of threads currently in the pool. - # - # @return [Integer] The number of threads currently in the pool. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#77 - def length; end - - # The maximum number of threads that may be created in the pool. - # - # @return [Integer] The maximum number of threads that may be created in the pool. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#30 - def max_length; end - - # The maximum number of tasks that may be waiting in the work queue at any one time. - # When the queue size reaches `max_queue` subsequent tasks will be rejected in - # accordance with the configured `fallback_policy`. - # - # @return [Integer] The maximum number of tasks that may be waiting in the work queue at any one time. - # When the queue size reaches `max_queue` subsequent tasks will be rejected in - # accordance with the configured `fallback_policy`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#39 - def max_queue; end - - # The minimum number of threads that may be retained in the pool. - # - # @return [Integer] The minimum number of threads that may be retained in the pool. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#33 - def min_length; end - - # Prune the thread pool of unneeded threads - # - # What is being pruned is controlled by the min_threads and idletime - # parameters passed at pool creation time - # - # This is a no-op on some pool implementation (e.g. the Java one). The Ruby - # pool will auto-prune each time a new job is posted. You will need to call - # this method explicitely in case your application post jobs in bursts (a - # lot of jobs and then nothing for long periods) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#118 - def prune_pool; end - - # The number of tasks in the queue awaiting execution. - # - # @return [Integer] The number of tasks in the queue awaiting execution. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#82 - def queue_length; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#103 - def ready_worker(worker, last_message); end - - # Number of tasks that may be enqueued before reaching `max_queue` and rejecting - # new tasks. A value of -1 indicates that the queue may grow without bound. - # - # @return [Integer] Number of tasks that may be enqueued before reaching `max_queue` and rejecting - # new tasks. A value of -1 indicates that the queue may grow without bound. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#87 - def remaining_capacity; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#98 - def remove_busy_worker(worker); end - - # The number of tasks that have been scheduled for execution on the pool since construction. - # - # @return [Integer] The number of tasks that have been scheduled for execution on the pool since construction. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#55 - def scheduled_task_count; end - - # Whether or not a value of 0 for :max_queue option means the queue must perform direct hand-off or rather unbounded queue. - # - # @return [true, false] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#42 - def synchronous; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#108 - def worker_died(worker); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#113 - def worker_task_completed; end - - private - - # creates new worker which has to receive work to do after it's added - # - # @return [nil, Worker] nil of max capacity is reached - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#241 - def ns_add_busy_worker; end - - # tries to assign task to a worker, tries to get one from @ready or to create new one - # - # @return [true, false] if task is assigned to a worker - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#201 - def ns_assign_worker(*args, &task); end - - # tries to enqueue task - # - # @return [true, false] if enqueued - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#219 - def ns_enqueue(*args, &task); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#160 - def ns_execute(*args, &task); end - - # @raise [ArgumentError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#125 - def ns_initialize(opts); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#189 - def ns_kill_execution; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#155 - def ns_limited_queue?; end - - # try oldest worker if it is idle for enough time, it's returned back at the start - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#280 - def ns_prune_pool; end - - # handle ready worker, giving it new job or assigning back to @ready - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#253 - def ns_ready_worker(worker, last_message, success = T.unsafe(nil)); end - - # removes a worker which is not in not tracked in @ready - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#271 - def ns_remove_busy_worker(worker); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#296 - def ns_reset_if_forked; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#174 - def ns_shutdown_execution; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#231 - def ns_worker_died(worker); end -end - -# Default maximum number of threads that will be created in the pool. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#15 -Concurrent::RubyThreadPoolExecutor::DEFAULT_MAX_POOL_SIZE = T.let(T.unsafe(nil), Integer) - -# Default maximum number of tasks that may be added to the task queue. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#21 -Concurrent::RubyThreadPoolExecutor::DEFAULT_MAX_QUEUE_SIZE = T.let(T.unsafe(nil), Integer) - -# Default minimum number of threads that will be retained in the pool. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#18 -Concurrent::RubyThreadPoolExecutor::DEFAULT_MIN_POOL_SIZE = T.let(T.unsafe(nil), Integer) - -# Default value of the :synchronous option. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#27 -Concurrent::RubyThreadPoolExecutor::DEFAULT_SYNCHRONOUS = T.let(T.unsafe(nil), FalseClass) - -# Default maximum number of seconds a thread in the pool may remain idle -# before being reclaimed. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#24 -Concurrent::RubyThreadPoolExecutor::DEFAULT_THREAD_IDLETIMEOUT = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#310 -class Concurrent::RubyThreadPoolExecutor::Worker - include ::Logger::Severity - include ::Concurrent::Concern::Logging - - # @return [Worker] a new instance of Worker - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#313 - def initialize(pool, id); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#324 - def <<(message); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#332 - def kill; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#328 - def stop; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#338 - def create_worker(queue, pool, idletime); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb#358 - def run_task(pool, task, args); end -end - -# A simple utility class that executes a callable and returns and array of three elements: -# success - indicating if the callable has been executed without errors -# value - filled by the callable result if it has been executed without errors, nil otherwise -# reason - the error risen by the callable if it has been executed with errors, nil otherwise -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb#9 -class Concurrent::SafeTaskExecutor < ::Concurrent::Synchronization::LockableObject - # @return [SafeTaskExecutor] a new instance of SafeTaskExecutor - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb#11 - def initialize(task, opts = T.unsafe(nil)); end - - # @return [Array] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb#18 - def execute(*args); end -end - -# `ScheduledTask` is a close relative of `Concurrent::Future` but with one -# important difference: A `Future` is set to execute as soon as possible -# whereas a `ScheduledTask` is set to execute after a specified delay. This -# implementation is loosely based on Java's -# [ScheduledExecutorService](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledExecutorService.html). -# It is a more feature-rich variant of {Concurrent.timer}. -# -# The *intended* schedule time of task execution is set on object construction -# with the `delay` argument. The delay is a numeric (floating point or integer) -# representing a number of seconds in the future. Any other value or a numeric -# equal to or less than zero will result in an exception. The *actual* schedule -# time of task execution is set when the `execute` method is called. -# -# The constructor can also be given zero or more processing options. Currently -# the only supported options are those recognized by the -# [Dereferenceable](Dereferenceable) module. -# -# The final constructor argument is a block representing the task to be performed. -# If no block is given an `ArgumentError` will be raised. -# -# **States** -# -# `ScheduledTask` mixes in the [Obligation](Obligation) module thus giving it -# "future" behavior. This includes the expected lifecycle states. `ScheduledTask` -# has one additional state, however. While the task (block) is being executed the -# state of the object will be `:processing`. This additional state is necessary -# because it has implications for task cancellation. -# -# **Cancellation** -# -# A `:pending` task can be cancelled using the `#cancel` method. A task in any -# other state, including `:processing`, cannot be cancelled. The `#cancel` -# method returns a boolean indicating the success of the cancellation attempt. -# A cancelled `ScheduledTask` cannot be restarted. It is immutable. -# -# **Obligation and Observation** -# -# The result of a `ScheduledTask` can be obtained either synchronously or -# asynchronously. `ScheduledTask` mixes in both the [Obligation](Obligation) -# module and the -# [Observable](http://ruby-doc.org/stdlib-2.0/libdoc/observer/rdoc/Observable.html) -# module from the Ruby standard library. With one exception `ScheduledTask` -# behaves identically to [Future](Observable) with regard to these modules. -# -# @example Basic usage -# -# require 'concurrent/scheduled_task' -# require 'csv' -# require 'open-uri' -# -# class Ticker -# def get_year_end_closing(symbol, year, api_key) -# uri = "https://www.alphavantage.co/query?function=TIME_SERIES_MONTHLY&symbol=#{symbol}&apikey=#{api_key}&datatype=csv" -# data = [] -# csv = URI.parse(uri).read -# if csv.include?('call frequency') -# return :rate_limit_exceeded -# end -# CSV.parse(csv, headers: true) do |row| -# data << row['close'].to_f if row['timestamp'].include?(year.to_s) -# end -# year_end = data.first -# year_end -# rescue => e -# p e -# end -# end -# -# api_key = ENV['ALPHAVANTAGE_KEY'] -# abort(error_message) unless api_key -# -# # Future -# price = Concurrent::Future.execute{ Ticker.new.get_year_end_closing('TWTR', 2013, api_key) } -# price.state #=> :pending -# price.pending? #=> true -# price.value(0) #=> nil (does not block) -# -# sleep(1) # do other stuff -# -# price.value #=> 63.65 (after blocking if necessary) -# price.state #=> :fulfilled -# price.fulfilled? #=> true -# price.value #=> 63.65 -# @example Successful task execution -# -# task = Concurrent::ScheduledTask.new(2){ 'What does the fox say?' } -# task.state #=> :unscheduled -# task.execute -# task.state #=> pending -# -# # wait for it... -# sleep(3) -# -# task.unscheduled? #=> false -# task.pending? #=> false -# task.fulfilled? #=> true -# task.rejected? #=> false -# task.value #=> 'What does the fox say?' -# @example One line creation and execution -# -# task = Concurrent::ScheduledTask.new(2){ 'What does the fox say?' }.execute -# task.state #=> pending -# -# task = Concurrent::ScheduledTask.execute(2){ 'What do you get when you multiply 6 by 9?' } -# task.state #=> pending -# @example Failed task execution -# -# task = Concurrent::ScheduledTask.execute(2){ raise StandardError.new('Call me maybe?') } -# task.pending? #=> true -# -# # wait for it... -# sleep(3) -# -# task.unscheduled? #=> false -# task.pending? #=> false -# task.fulfilled? #=> false -# task.rejected? #=> true -# task.value #=> nil -# task.reason #=> # -# @example Task execution with observation -# -# observer = Class.new{ -# def update(time, value, reason) -# puts "The task completed at #{time} with value '#{value}'" -# end -# }.new -# -# task = Concurrent::ScheduledTask.new(2){ 'What does the fox say?' } -# task.add_observer(observer) -# task.execute -# task.pending? #=> true -# -# # wait for it... -# sleep(3) -# -# #>> The task completed at 2013-11-07 12:26:09 -0500 with value 'What does the fox say?' -# @see Concurrent.timer -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#158 -class Concurrent::ScheduledTask < ::Concurrent::IVar - include ::Comparable - - # Schedule a task for execution at a specified future time. - # - # @option opts - # @param delay [Float] the number of seconds to wait for before executing the task - # @param opts [Hash] a customizable set of options - # @raise [ArgumentError] When no block is given - # @raise [ArgumentError] When given a time that is in the past - # @return [ScheduledTask] a new instance of ScheduledTask - # @yield the task to be performed - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#178 - def initialize(delay, opts = T.unsafe(nil), &task); end - - # Comparator which orders by schedule time. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#213 - def <=>(other); end - - # Cancel this task and prevent it from executing. A task can only be - # cancelled if it is pending or unscheduled. - # - # @return [Boolean] true if successfully cancelled else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#235 - def cancel; end - - # Has the task been cancelled? - # - # @return [Boolean] true if the task is in the given state else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#220 - def cancelled?; end - - # Execute an `:unscheduled` `ScheduledTask`. Immediately sets the state to `:pending` - # and starts counting down toward execution. Does nothing if the `ScheduledTask` is - # in any state other than `:unscheduled`. - # - # @return [ScheduledTask] a reference to `self` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#273 - def execute; end - - # The executor on which to execute the task. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#163 - def executor; end - - # The `delay` value given at instanciation. - # - # @return [Float] the initial delay. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#199 - def initial_delay; end - - # Execute the task. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#297 - def process_task; end - - # In the task execution in progress? - # - # @return [Boolean] true if the task is in the given state else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#227 - def processing?; end - - # Reschedule the task using the given delay and the current time. - # A task can only be reset while it is `:pending`. - # - # @param delay [Float] the number of seconds to wait for before executing the task - # @raise [ArgumentError] When given a time that is in the past - # @return [Boolean] true if successfully rescheduled else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#262 - def reschedule(delay); end - - # Reschedule the task using the original delay and the current time. - # A task can only be reset while it is `:pending`. - # - # @return [Boolean] true if successfully rescheduled else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#250 - def reset; end - - # The monotonic time at which the the task is scheduled to be executed. - # - # @return [Float] the schedule time or nil if `unscheduled` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#206 - def schedule_time; end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#135 - def fail(reason = T.unsafe(nil)); end - - # Reschedule the task using the given delay and the current time. - # A task can only be reset while it is `:pending`. - # - # @param delay [Float] the number of seconds to wait for before executing the task - # @return [Boolean] true if successfully rescheduled else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#326 - def ns_reschedule(delay); end - - # Schedule the task using the given delay and the current time. - # - # @param delay [Float] the number of seconds to wait for before executing the task - # @return [Boolean] true if successfully rescheduled else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#312 - def ns_schedule(delay); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#113 - def set(value = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/ivar.rb#145 - def try_set(value = T.unsafe(nil), &block); end - - class << self - # Create a new `ScheduledTask` object with the given block, execute it, and return the - # `:pending` object. - # - # @param delay [Float] the number of seconds to wait for before executing the task - # @raise [ArgumentError] if no block is given - # @return [ScheduledTask] the newly created `ScheduledTask` in the `:pending` state - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/scheduled_task.rb#290 - def execute(delay, opts = T.unsafe(nil), &task); end - end -end - -# A counting semaphore. Conceptually, a semaphore maintains a set of -# permits. Each {#acquire} blocks if necessary until a permit is -# available, and then takes it. Each {#release} adds a permit, potentially -# releasing a blocking acquirer. -# However, no actual permit objects are used; the Semaphore just keeps a -# count of the number available and acts accordingly. -# Alternatively, permits may be acquired within a block, and automatically -# released after the block finishes executing. -# -# @example -# semaphore = Concurrent::Semaphore.new(2) -# -# t1 = Thread.new do -# semaphore.acquire -# puts "Thread 1 acquired semaphore" -# end -# -# t2 = Thread.new do -# semaphore.acquire -# puts "Thread 2 acquired semaphore" -# end -# -# t3 = Thread.new do -# semaphore.acquire -# puts "Thread 3 acquired semaphore" -# end -# -# t4 = Thread.new do -# sleep(2) -# puts "Thread 4 releasing semaphore" -# semaphore.release -# end -# -# [t1, t2, t3, t4].each(&:join) -# -# # prints: -# # Thread 3 acquired semaphore -# # Thread 2 acquired semaphore -# # Thread 4 releasing semaphore -# # Thread 1 acquired semaphore -# @example -# semaphore = Concurrent::Semaphore.new(1) -# -# puts semaphore.available_permits -# semaphore.acquire do -# puts semaphore.available_permits -# end -# puts semaphore.available_permits -# -# # prints: -# # 1 -# # 0 -# # 1 -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/semaphore.rb#161 -class Concurrent::Semaphore < ::Concurrent::MutexSemaphore; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/semaphore.rb#96 -Concurrent::SemaphoreImplementation = Concurrent::MutexSemaphore - -# Indicates that the including `ExecutorService` guarantees -# that all operations will occur in the order they are post and that no -# two operations may occur simultaneously. This module provides no -# functionality and provides no guarantees. That is the responsibility -# of the including class. This module exists solely to allow the including -# object to be interrogated for its serialization status. -# -# @example -# class Foo -# include Concurrent::SerialExecutor -# end -# -# foo = Foo.new -# -# foo.is_a? Concurrent::ExecutorService #=> true -# foo.is_a? Concurrent::SerialExecutor #=> true -# foo.serialized? #=> true -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serial_executor_service.rb#24 -module Concurrent::SerialExecutorService - include ::Logger::Severity - include ::Concurrent::Concern::Logging - include ::Concurrent::ExecutorService - - # Does this executor guarantee serialization of its operations? - # - # @note Always returns `true` - # @return [Boolean] True if the executor guarantees that all operations - # will be post in the order they are received and no two operations may - # occur simultaneously. Else false. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serial_executor_service.rb#30 - def serialized?; end -end - -# Ensures passed jobs in a serialized order never running at the same time. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution.rb#8 -class Concurrent::SerializedExecution < ::Concurrent::Synchronization::LockableObject - include ::Logger::Severity - include ::Concurrent::Concern::Logging - - # @return [SerializedExecution] a new instance of SerializedExecution - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution.rb#11 - def initialize; end - - # Submit a task to the executor for asynchronous processing. - # - # @param executor [Executor] to be used for this job - # @param args [Array] zero or more arguments to be passed to the task - # @raise [ArgumentError] if no task is given - # @return [Boolean] `true` if the task is queued, `false` if the executor - # is not running - # @yield the asynchronous task to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution.rb#34 - def post(executor, *args, &task); end - - # As {#post} but allows to submit multiple tasks at once, it's guaranteed that they will not - # be interleaved by other tasks. - # - # @param posts [Array, Proc)>] array of triplets where - # first is a {ExecutorService}, second is array of args for task, third is a task (Proc) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution.rb#44 - def posts(posts); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution.rb#75 - def call_job(job); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution.rb#70 - def ns_initialize; end - - # ensures next job is executed if any is stashed - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution.rb#95 - def work(job); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution.rb#16 -class Concurrent::SerializedExecution::Job < ::Struct - # Returns the value of attribute args - # - # @return [Object] the current value of args - def args; end - - # Sets the attribute args - # - # @param value [Object] the value to set the attribute args to. - # @return [Object] the newly set value - def args=(_); end - - # Returns the value of attribute block - # - # @return [Object] the current value of block - def block; end - - # Sets the attribute block - # - # @param value [Object] the value to set the attribute block to. - # @return [Object] the newly set value - def block=(_); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution.rb#17 - def call; end - - # Returns the value of attribute executor - # - # @return [Object] the current value of executor - def executor; end - - # Sets the attribute executor - # - # @param value [Object] the value to set the attribute executor to. - # @return [Object] the newly set value - def executor=(_); end - - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# A wrapper/delegator for any `ExecutorService` that -# guarantees serialized execution of tasks. -# -# @see [SimpleDelegator](http://www.ruby-doc.org/stdlib-2.1.2/libdoc/delegate/rdoc/SimpleDelegator.html) -# @see Concurrent::SerializedExecution -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution_delegator.rb#12 -class Concurrent::SerializedExecutionDelegator < ::SimpleDelegator - include ::Logger::Severity - include ::Concurrent::Concern::Logging - include ::Concurrent::ExecutorService - include ::Concurrent::SerialExecutorService - - # @return [SerializedExecutionDelegator] a new instance of SerializedExecutionDelegator - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution_delegator.rb#15 - def initialize(executor); end - - # Submit a task to the executor for asynchronous processing. - # - # @param args [Array] zero or more arguments to be passed to the task - # @raise [ArgumentError] if no task is given - # @return [Boolean] `true` if the task is queued, `false` if the executor - # is not running - # @yield the asynchronous task to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/serialized_execution_delegator.rb#22 - def post(*args, &task); end -end - -# A thread-safe subclass of Set. This version locks against the object -# itself for every method call, ensuring only one thread can be reading -# or writing at a time. This includes iteration methods like `#each`. -# -# @note `a += b` is **not** a **thread-safe** operation on -# `Concurrent::Set`. It reads Set `a`, then it creates new `Concurrent::Set` -# which is union of `a` and `b`, then it writes the union to `a`. -# The read and write are independent operations they do not form a single atomic -# operation therefore when two `+=` operations are executed concurrently updates -# may be lost. Use `#merge` instead. -# @see http://ruby-doc.org/stdlib-2.4.0/libdoc/set/rdoc/Set.html Ruby standard library `Set` -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/set.rb#61 -class Concurrent::Set < ::Concurrent::CRubySet; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/set.rb#23 -Concurrent::SetImplementation = Concurrent::CRubySet - -# An thread-safe, write-once variation of Ruby's standard `Struct`. -# Each member can have its value set at most once, either at construction -# or any time thereafter. Attempting to assign a value to a member -# that has already been set will result in a `Concurrent::ImmutabilityError`. -# -# @see http://ruby-doc.org/core/Struct.html Ruby standard library `Struct` -# @see http://en.wikipedia.org/wiki/Final_(Java) Java `final` keyword -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#14 -module Concurrent::SettableStruct - include ::Concurrent::Synchronization::AbstractStruct - - # Equality - # - # @return [Boolean] true if other has the same struct subclass and has - # equal member values (according to `Object#==`) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#50 - def ==(other); end - - # Attribute Reference - # - # @param member [Symbol, String, Integer] the string or symbol name of the member - # for which to obtain the value or the member's index - # @raise [NameError] if the member does not exist - # @raise [IndexError] if the index is out of range. - # @return [Object] the value of the given struct member or the member at the given index. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#45 - def [](member); end - - # Attribute Assignment - # - # Sets the value of the given struct member or the member at the given index. - # - # @param member [Symbol, String, Integer] the string or symbol name of the member - # for which to obtain the value or the member's index - # @raise [NameError] if the name does not exist - # @raise [IndexError] if the index is out of range. - # @raise [Concurrent::ImmutabilityError] if the given member has already been set - # @return [Object] the value of the given struct member or the member at the given index. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#75 - def []=(member, value); end - - # Yields the value of each struct member in order. If no block is given - # an enumerator is returned. - # - # @yield the operation to be performed on each struct member - # @yieldparam value [Object] each struct value (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#55 - def each(&block); end - - # Yields the name and value of each struct member in order. If no block is - # given an enumerator is returned. - # - # @yield the operation to be performed on each struct member/value pair - # @yieldparam member [Object] each struct member (in order) - # @yieldparam value [Object] each struct value (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#61 - def each_pair(&block); end - - # Describe the contents of this struct in a string. - # - # @return [String] the contents of this struct in a string - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#29 - def inspect; end - - # Returns a new struct containing the contents of `other` and the contents - # of `self`. If no block is specified, the value for entries with duplicate - # keys will be that of `other`. Otherwise the value for each duplicate key - # is determined by calling the block with the key, its value in `self` and - # its value in `other`. - # - # @param other [Hash] the hash from which to set the new values - # @raise [ArgumentError] of given a member that is not defined in the struct - # @return [Synchronization::AbstractStruct] a new struct with the new values - # @yield an options block for resolving duplicate keys - # @yieldparam member [String, Symbol] the name of the member which is duplicated - # @yieldparam selfvalue [Object] the value of the member in `self` - # @yieldparam othervalue [Object] the value of the member in `other` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#35 - def merge(other, &block); end - - # Yields each member value from the struct to the block and returns an Array - # containing the member values from the struct for which the given block - # returns a true value (equivalent to `Enumerable#select`). - # - # @return [Array] an array containing each value for which the block returns true - # @yield the operation to be performed on each struct member - # @yieldparam value [Object] each struct value (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#67 - def select(&block); end - - # Returns the values for this struct as an Array. - # - # @return [Array] the values for this struct - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#18 - def to_a; end - - # Returns a hash containing the names and values for the struct’s members. - # - # @return [Hash] the names and values for the struct’s members - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#40 - def to_h; end - - # Describe the contents of this struct in a string. - # - # @return [String] the contents of this struct in a string - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#29 - def to_s; end - - # Returns the values for this struct as an Array. - # - # @return [Array] the values for this struct - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#18 - def values; end - - # Returns the struct member values for each selector as an Array. - # - # A selector may be either an Integer offset or a Range of offsets (as in `Array#values_at`). - # - # @param indexes [Fixnum, Range] the index(es) from which to obatin the values (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#24 - def values_at(*indexes); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#97 - def initialize_copy(original); end - - class << self - # Factory for creating new struct classes. - # - # ``` - # new([class_name] [, member_name]+>) -> StructClass click to toggle source - # new([class_name] [, member_name]+>) {|StructClass| block } -> StructClass - # new(value, ...) -> obj - # StructClass[value, ...] -> obj - # ``` - # - # The first two forms are used to create a new struct subclass `class_name` - # that can contain a value for each member_name . This subclass can be - # used to create instances of the structure like any other Class . - # - # If the `class_name` is omitted an anonymous struct class will be created. - # Otherwise, the name of this struct will appear as a constant in the struct class, - # so it must be unique for all structs under this base class and must start with a - # capital letter. Assigning a struct class to a constant also gives the class - # the name of the constant. - # - # If a block is given it will be evaluated in the context of `StructClass`, passing - # the created class as a parameter. This is the recommended way to customize a struct. - # Subclassing an anonymous struct creates an extra anonymous class that will never be used. - # - # The last two forms create a new instance of a struct subclass. The number of value - # parameters must be less than or equal to the number of attributes defined for the - # struct. Unset parameters default to nil. Passing more parameters than number of attributes - # will raise an `ArgumentError`. - # - # @see http://ruby-doc.org/core/Struct.html#method-c-new Ruby standard library `Struct#new` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#105 - def new(*args, &block); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/settable_struct.rb#115 -Concurrent::SettableStruct::FACTORY = T.let(T.unsafe(nil), T.untyped) - -# An executor service in which every operation spawns a new, -# independently operating thread. -# -# This is perhaps the most inefficient executor service in this -# library. It exists mainly for testing an debugging. Thread creation -# and management is expensive in Ruby and this executor performs no -# resource pooling. This can be very beneficial during testing and -# debugging because it decouples the using code from the underlying -# executor implementation. In production this executor will likely -# lead to suboptimal performance. -# -# @note Intended for use primarily in testing and debugging. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#21 -class Concurrent::SimpleExecutorService < ::Concurrent::RubyExecutorService - # Submit a task to the executor for asynchronous processing. - # - # @param task [Proc] the asynchronous task to perform - # @return [self] returns itself - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#56 - def <<(task); end - - # Begin an immediate shutdown. In-progress tasks will be allowed to - # complete but enqueued tasks will be dismissed and no new tasks - # will be accepted. Has no additional effect if the thread pool is - # not running. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#84 - def kill; end - - # Submit a task to the executor for asynchronous processing. - # - # @param args [Array] zero or more arguments to be passed to the task - # @raise [ArgumentError] if no task is given - # @return [Boolean] `true` if the task is queued, `false` if the executor - # is not running - # @yield the asynchronous task to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#40 - def post(*args, &task); end - - # Is the executor running? - # - # @return [Boolean] `true` when running, `false` when shutting down or shutdown - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#62 - def running?; end - - # Begin an orderly shutdown. Tasks already in the queue will be executed, - # but no new tasks will be accepted. Has no additional effect if the - # thread pool is not running. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#77 - def shutdown; end - - # Is the executor shutdown? - # - # @return [Boolean] `true` when shutdown, `false` when shutting down or running - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#72 - def shutdown?; end - - # Is the executor shuttingdown? - # - # @return [Boolean] `true` when not running and not shutdown, else `false` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#67 - def shuttingdown?; end - - # Block until executor shutdown is complete or until `timeout` seconds have - # passed. - # - # @note Does not initiate shutdown or termination. Either `shutdown` or `kill` - # must be called before this method (or on another thread). - # @param timeout [Integer] the maximum number of seconds to wait for shutdown to complete - # @return [Boolean] `true` if shutdown complete or false on `timeout` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#91 - def wait_for_termination(timeout = T.unsafe(nil)); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#97 - def ns_initialize(*args); end - - class << self - # Submit a task to the executor for asynchronous processing. - # - # @param task [Proc] the asynchronous task to perform - # @return [self] returns itself - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#34 - def <<(task); end - - # Submit a task to the executor for asynchronous processing. - # - # @param args [Array] zero or more arguments to be passed to the task - # @raise [ArgumentError] if no task is given - # @return [Boolean] `true` if the task is queued, `false` if the executor - # is not running - # @yield the asynchronous task to perform - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/simple_executor_service.rb#24 - def post(*args); end - end -end - -# A thread pool with a single thread an unlimited queue. Should the thread -# die for any reason it will be removed and replaced, thus ensuring that -# the executor will always remain viable and available to process jobs. -# -# A common pattern for background processing is to create a single thread -# on which an infinite loop is run. The thread's loop blocks on an input -# source (perhaps blocking I/O or a queue) and processes each input as it -# is received. This pattern has several issues. The thread itself is highly -# susceptible to errors during processing. Also, the thread itself must be -# constantly monitored and restarted should it die. `SingleThreadExecutor` -# encapsulates all these bahaviors. The task processor is highly resilient -# to errors from within tasks. Also, should the thread die it will -# automatically be restarted. -# -# The API and behavior of this class are based on Java's `SingleThreadExecutor`. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/single_thread_executor.rb#37 -class Concurrent::SingleThreadExecutor < ::Concurrent::RubySingleThreadExecutor; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/single_thread_executor.rb#10 -Concurrent::SingleThreadExecutorImplementation = Concurrent::RubySingleThreadExecutor - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_object.rb#2 -module Concurrent::Synchronization - class << self - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/full_memory_barrier.rb#7 - def full_memory_barrier; end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_lockable_object.rb#9 -class Concurrent::Synchronization::AbstractLockableObject < ::Concurrent::Synchronization::Object - protected - - # Broadcast to all waiting threads. - # - # @note only to be used inside synchronized block - # @note to provide direct access to this method in a descendant add method - # ``` - # def broadcast - # synchronize { ns_broadcast } - # end - # ``` - # @raise [NotImplementedError] - # @return [self] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_lockable_object.rb#96 - def ns_broadcast; end - - # Signal one waiting thread. - # - # @note only to be used inside synchronized block - # @note to provide direct access to this method in a descendant add method - # ``` - # def signal - # synchronize { ns_signal } - # end - # ``` - # @raise [NotImplementedError] - # @return [self] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_lockable_object.rb#81 - def ns_signal; end - - # Wait until another thread calls #signal or #broadcast, - # spurious wake-ups can happen. - # - # @note only to be used inside synchronized block - # @note to provide direct access to this method in a descendant add method - # ``` - # def wait(timeout = nil) - # synchronize { ns_wait(timeout) } - # end - # ``` - # @param timeout [Numeric, nil] in seconds, `nil` means no timeout - # @raise [NotImplementedError] - # @return [self] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_lockable_object.rb#66 - def ns_wait(timeout = T.unsafe(nil)); end - - # Wait until condition is met or timeout passes, - # protects against spurious wake-ups. - # - # @note only to be used inside synchronized block - # @note to provide direct access to this method in a descendant add method - # ``` - # def wait_until(timeout = nil, &condition) - # synchronize { ns_wait_until(timeout, &condition) } - # end - # ``` - # @param timeout [Numeric, nil] in seconds, `nil` means no timeout - # @return [true, false] if condition met - # @yield condition to be met - # @yieldreturn [true, false] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_lockable_object.rb#37 - def ns_wait_until(timeout = T.unsafe(nil), &condition); end - - # @note can by made public in descendants if required by `public :synchronize` - # @raise [NotImplementedError] - # @yield runs the block synchronized against this object, - # equivalent of java's `synchronize(this) {}` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_lockable_object.rb#18 - def synchronize; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_object.rb#6 -class Concurrent::Synchronization::AbstractObject - # @return [AbstractObject] a new instance of AbstractObject - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_object.rb#7 - def initialize; end - - # @abstract - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_object.rb#13 - def full_memory_barrier; end - - class << self - # @raise [NotImplementedError] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_object.rb#17 - def attr_volatile(*names); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#6 -module Concurrent::Synchronization::AbstractStruct - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#9 - def initialize(*values); end - - # Returns the number of struct members. - # - # @return [Fixnum] the number of struct members - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#19 - def length; end - - # Returns the struct members as an array of symbols. - # - # @return [Array] the struct members as an array of symbols - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#29 - def members; end - - # Returns the number of struct members. - # - # @return [Fixnum] the number of struct members - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#19 - def size; end - - protected - - # Yields the value of each struct member in order. If no block is given - # an enumerator is returned. - # - # @yield the operation to be performed on each struct member - # @yieldparam value [Object] each struct value (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#82 - def ns_each; end - - # Yields the name and value of each struct member in order. If no block is - # given an enumerator is returned. - # - # @yield the operation to be performed on each struct member/value pair - # @yieldparam member [Object] each struct member (in order) - # @yieldparam value [Object] each struct value (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#89 - def ns_each_pair; end - - # Equality - # - # @return [Boolean] true if other has the same struct subclass and has - # equal member values (according to `Object#==`) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#75 - def ns_equality(other); end - - # Attribute Reference - # - # @param member [Symbol, String, Integer] the string or symbol name of the member - # for which to obtain the value or the member's index - # @raise [NameError] if the member does not exist - # @raise [IndexError] if the index is out of range. - # @return [Object] the value of the given struct member or the member at the given index. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#59 - def ns_get(member); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#119 - def ns_initialize_copy; end - - # Describe the contents of this struct in a string. - # - # @return [String] the contents of this struct in a string - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#105 - def ns_inspect; end - - # Returns a new struct containing the contents of `other` and the contents - # of `self`. If no block is specified, the value for entries with duplicate - # keys will be that of `other`. Otherwise the value for each duplicate key - # is determined by calling the block with the key, its value in `self` and - # its value in `other`. - # - # @param other [Hash] the hash from which to set the new values - # @raise [ArgumentError] of given a member that is not defined in the struct - # @return [Synchronization::AbstractStruct] a new struct with the new values - # @yield an options block for resolving duplicate keys - # @yieldparam member [String, Symbol] the name of the member which is duplicated - # @yieldparam selfvalue [Object] the value of the member in `self` - # @yieldparam othervalue [Object] the value of the member in `other` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#114 - def ns_merge(other, &block); end - - # Yields each member value from the struct to the block and returns an Array - # containing the member values from the struct for which the given block - # returns a true value (equivalent to `Enumerable#select`). - # - # @return [Array] an array containing each value for which the block returns true - # @yield the operation to be performed on each struct member - # @yieldparam value [Object] each struct value (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#98 - def ns_select; end - - # Returns a hash containing the names and values for the struct’s members. - # - # @return [Hash] the names and values for the struct’s members - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#52 - def ns_to_h; end - - # Returns the values for this struct as an Array. - # - # @return [Array] the values for this struct - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#38 - def ns_values; end - - # Returns the struct member values for each selector as an Array. - # - # A selector may be either an Integer offset or a Range of offsets (as in `Array#values_at`). - # - # @param indexes [Fixnum, Range] the index(es) from which to obatin the values (in order) - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#45 - def ns_values_at(indexes); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#130 - def pr_underscore(clazz); end - - class << self - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_struct.rb#141 - def define_struct_class(parent, base, name, members, &block); end - end -end - -# TODO (pitr-ch 04-Dec-2016): should be in edge -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/condition.rb#8 -class Concurrent::Synchronization::Condition < ::Concurrent::Synchronization::LockableObject - # @return [Condition] a new instance of Condition - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/condition.rb#18 - def initialize(lock); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/condition.rb#47 - def broadcast; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/condition.rb#51 - def ns_broadcast; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/condition.rb#43 - def ns_signal; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/condition.rb#27 - def ns_wait(timeout = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/condition.rb#35 - def ns_wait_until(timeout = T.unsafe(nil), &condition); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/condition.rb#39 - def signal; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/condition.rb#23 - def wait(timeout = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/condition.rb#31 - def wait_until(timeout = T.unsafe(nil), &condition); end - - class << self - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/safe_initialization.rb#29 - def private_new(*args, &block); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/safe_initialization.rb#29 - def new(*args, &block); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#8 -module Concurrent::Synchronization::ConditionSignalling - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#16 - def ns_broadcast; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#11 - def ns_signal; end -end - -# TODO (pitr-ch 04-Dec-2016): should be in edge -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/lock.rb#9 -class Concurrent::Synchronization::Lock < ::Concurrent::Synchronization::LockableObject - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/lock.rb#31 - def broadcast; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#16 - def ns_broadcast; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#11 - def ns_signal; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#52 - def ns_wait(timeout = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/abstract_lockable_object.rb#37 - def ns_wait_until(timeout = T.unsafe(nil), &condition); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/lock.rb#25 - def signal; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#44 - def synchronize; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/lock.rb#13 - def wait(timeout = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/lock.rb#19 - def wait_until(timeout = T.unsafe(nil), &condition); end -end - -# Safe synchronization under any Ruby implementation. -# It provides methods like {#synchronize}, {#wait}, {#signal} and {#broadcast}. -# Provides a single layer which can improve its implementation over time without changes needed to -# the classes using it. Use {Synchronization::Object} not this abstract class. -# -# @note this object does not support usage together with -# [`Thread#wakeup`](http://ruby-doc.org/core/Thread.html#method-i-wakeup) -# and [`Thread#raise`](http://ruby-doc.org/core/Thread.html#method-i-raise). -# `Thread#sleep` and `Thread#wakeup` will work as expected but mixing `Synchronization::Object#wait` and -# `Thread#wakeup` will not work on all platforms. -# -# @see Event implementation as an example of this class use -# -# @example simple -# class AnClass < Synchronization::Object -# def initialize -# super -# synchronize { @value = 'asd' } -# end -# -# def value -# synchronize { @value } -# end -# end -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/lockable_object.rb#50 -class Concurrent::Synchronization::LockableObject < ::Concurrent::Synchronization::MutexLockableObject - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/condition.rb#57 - def new_condition; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/lockable_object.rb#11 -Concurrent::Synchronization::LockableObjectImplementation = Concurrent::Synchronization::MutexLockableObject - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#60 -class Concurrent::Synchronization::MonitorLockableObject < ::Concurrent::Synchronization::AbstractLockableObject - include ::Concurrent::Synchronization::ConditionSignalling - extend ::Concurrent::Synchronization::SafeInitialization - - # @return [MonitorLockableObject] a new instance of MonitorLockableObject - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#65 - def initialize; end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#83 - def ns_wait(timeout = T.unsafe(nil)); end - - # TODO may be a problem with lock.synchronize { lock.wait } - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#79 - def synchronize; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#71 - def initialize_copy(other); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#25 -class Concurrent::Synchronization::MutexLockableObject < ::Concurrent::Synchronization::AbstractLockableObject - include ::Concurrent::Synchronization::ConditionSignalling - extend ::Concurrent::Synchronization::SafeInitialization - - # @return [MutexLockableObject] a new instance of MutexLockableObject - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#30 - def initialize; end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#52 - def ns_wait(timeout = T.unsafe(nil)); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#44 - def synchronize; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb#36 - def initialize_copy(other); end -end - -# Abstract object providing final, volatile, ans CAS extensions to build other concurrent abstractions. -# - final instance variables see {Object.safe_initialization!} -# - volatile instance variables see {Object.attr_volatile} -# - volatile instance variables see {Object.attr_atomic} -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#15 -class Concurrent::Synchronization::Object < ::Concurrent::Synchronization::AbstractObject - include ::Concurrent::Synchronization::Volatile - extend ::Concurrent::Synchronization::Volatile::ClassMethods - - # Has to be called by children. - # - # @return [Object] a new instance of Object - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#28 - def initialize; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#146 - def __initialize_atomic_fields__; end - - class << self - # @return [true, false] is the attribute with name atomic? - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#125 - def atomic_attribute?(name); end - - # @param inherited [true, false] should inherited volatile with CAS fields be returned? - # @return [::Array] Returns defined volatile with CAS fields on this class. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#119 - def atomic_attributes(inherited = T.unsafe(nil)); end - - # Creates methods for reading and writing to a instance variable with - # volatile (Java) semantic as {.attr_volatile} does. - # The instance variable should be accessed oly through generated methods. - # This method generates following methods: `value`, `value=(new_value) #=> new_value`, - # `swap_value(new_value) #=> old_value`, - # `compare_and_set_value(expected, value) #=> true || false`, `update_value(&block)`. - # - # @param names [::Array] of the instance variables to be volatile with CAS. - # @return [::Array] names of defined method names. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#84 - def attr_atomic(*names); end - - # For testing purposes, quite slow. Injects assert code to new method which will raise if class instance contains - # any instance variables with CamelCase names and isn't {.safe_initialization?}. - # - # @raise when offend found - # @return [true] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#45 - def ensure_safe_initialization_when_final_fields_are_present; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#33 - def safe_initialization!; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#37 - def safe_initialization?; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/object.rb#131 - def define_initialize_atomic_fields; end - end -end - -# By extending this module, a class and all its children are marked to be constructed safely. Meaning that -# all writes (ivar initializations) are made visible to all readers of newly constructed object. It ensures -# same behaviour as Java's final fields. -# -# Due to using Kernel#extend, the module is not included again if already present in the ancestors, -# which avoids extra overhead. -# -# @example -# class AClass < Concurrent::Synchronization::Object -# extend Concurrent::Synchronization::SafeInitialization -# -# def initialize -# @AFinalValue = 'value' # published safely, #foo will never return nil -# end -# -# def foo -# @AFinalValue -# end -# end -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/safe_initialization.rb#28 -module Concurrent::Synchronization::SafeInitialization - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/safe_initialization.rb#29 - def new(*args, &block); end -end - -# Volatile adds the attr_volatile class method when included. -# -# foo = Foo.new -# foo.bar -# => 1 -# foo.bar = 2 -# => 2 -# -# @example -# class Foo -# include Concurrent::Synchronization::Volatile -# -# attr_volatile :bar -# -# def initialize -# self.bar = 1 -# end -# end -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/volatile.rb#28 -module Concurrent::Synchronization::Volatile - mixes_in_class_methods ::Concurrent::Synchronization::Volatile::ClassMethods - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/volatile.rb#33 - def full_memory_barrier; end - - class << self - # @private - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/volatile.rb#29 - def included(base); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/volatile.rb#37 -module Concurrent::Synchronization::Volatile::ClassMethods - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/synchronization/volatile.rb#39 - def attr_volatile(*names); end -end - -# This class provides a trivial way to synchronize all calls to a given object -# by wrapping it with a `Delegator` that performs `Monitor#enter/exit` calls -# around the delegated `#send`. Example: -# -# array = [] # not thread-safe on many impls -# array = SynchronizedDelegator.new([]) # thread-safe -# -# A simple `Monitor` provides a very coarse-grained way to synchronize a given -# object, in that it will cause synchronization for methods that have no need -# for it, but this is a trivial way to get thread-safety where none may exist -# currently on some implementations. -# -# This class is currently being considered for inclusion into stdlib, via -# https://bugs.ruby-lang.org/issues/8556 -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/synchronized_delegator.rb#21 -class Concurrent::SynchronizedDelegator < ::SimpleDelegator - # @return [SynchronizedDelegator] a new instance of SynchronizedDelegator - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/synchronized_delegator.rb#31 - def initialize(obj); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/synchronized_delegator.rb#36 - def method_missing(method, *args, &block); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/synchronized_delegator.rb#22 - def setup; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/synchronized_delegator.rb#27 - def teardown; end -end - -# A `TVar` is a transactional variable - a single-element container that -# is used as part of a transaction - see `Concurrent::atomically`. -# -# -# ## Thread-safe Variable Classes -# -# Each of the thread-safe variable classes is designed to solve a different -# problem. In general: -# -# * *{Concurrent::Agent}:* Shared, mutable variable providing independent, -# uncoordinated, *asynchronous* change of individual values. Best used when -# the value will undergo frequent, complex updates. Suitable when the result -# of an update does not need to be known immediately. -# * *{Concurrent::Atom}:* Shared, mutable variable providing independent, -# uncoordinated, *synchronous* change of individual values. Best used when -# the value will undergo frequent reads but only occasional, though complex, -# updates. Suitable when the result of an update must be known immediately. -# * *{Concurrent::AtomicReference}:* A simple object reference that can be updated -# atomically. Updates are synchronous but fast. Best used when updates a -# simple set operations. Not suitable when updates are complex. -# {Concurrent::AtomicBoolean} and {Concurrent::AtomicFixnum} are similar -# but optimized for the given data type. -# * *{Concurrent::Exchanger}:* Shared, stateless synchronization point. Used -# when two or more threads need to exchange data. The threads will pair then -# block on each other until the exchange is complete. -# * *{Concurrent::MVar}:* Shared synchronization point. Used when one thread -# must give a value to another, which must take the value. The threads will -# block on each other until the exchange is complete. -# * *{Concurrent::ThreadLocalVar}:* Shared, mutable, isolated variable which -# holds a different value for each thread which has access. Often used as -# an instance variable in objects which must maintain different state -# for different threads. -# * *{Concurrent::TVar}:* Shared, mutable variables which provide -# *coordinated*, *synchronous*, change of *many* stated. Used when multiple -# value must change together, in an all-or-nothing transaction. -# {include:file:docs-source/tvar.md} -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#12 -class Concurrent::TVar < ::Concurrent::Synchronization::Object - extend ::Concurrent::Synchronization::SafeInitialization - - # Create a new `TVar` with an initial value. - # - # @return [TVar] a new instance of TVar - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#16 - def initialize(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#46 - def unsafe_lock; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#36 - def unsafe_value; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#41 - def unsafe_value=(value); end - - # Get the value of a `TVar`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#22 - def value; end - - # Set the value of a `TVar`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#29 - def value=(value); end -end - -# A `ThreadLocalVar` is a variable where the value is different for each thread. -# Each variable may have a default value, but when you modify the variable only -# the current thread will ever see that change. -# -# This is similar to Ruby's built-in thread-local variables (`Thread#thread_variable_get`), -# but with these major advantages: -# * `ThreadLocalVar` has its own identity, it doesn't need a Symbol. -# * Each Ruby's built-in thread-local variable leaks some memory forever (it's a Symbol held forever on the thread), -# so it's only OK to create a small amount of them. -# `ThreadLocalVar` has no such issue and it is fine to create many of them. -# * Ruby's built-in thread-local variables leak forever the value set on each thread (unless set to nil explicitly). -# `ThreadLocalVar` automatically removes the mapping for each thread once the `ThreadLocalVar` instance is GC'd. -# -# -# ## Thread-safe Variable Classes -# -# Each of the thread-safe variable classes is designed to solve a different -# problem. In general: -# -# * *{Concurrent::Agent}:* Shared, mutable variable providing independent, -# uncoordinated, *asynchronous* change of individual values. Best used when -# the value will undergo frequent, complex updates. Suitable when the result -# of an update does not need to be known immediately. -# * *{Concurrent::Atom}:* Shared, mutable variable providing independent, -# uncoordinated, *synchronous* change of individual values. Best used when -# the value will undergo frequent reads but only occasional, though complex, -# updates. Suitable when the result of an update must be known immediately. -# * *{Concurrent::AtomicReference}:* A simple object reference that can be updated -# atomically. Updates are synchronous but fast. Best used when updates a -# simple set operations. Not suitable when updates are complex. -# {Concurrent::AtomicBoolean} and {Concurrent::AtomicFixnum} are similar -# but optimized for the given data type. -# * *{Concurrent::Exchanger}:* Shared, stateless synchronization point. Used -# when two or more threads need to exchange data. The threads will pair then -# block on each other until the exchange is complete. -# * *{Concurrent::MVar}:* Shared synchronization point. Used when one thread -# must give a value to another, which must take the value. The threads will -# block on each other until the exchange is complete. -# * *{Concurrent::ThreadLocalVar}:* Shared, mutable, isolated variable which -# holds a different value for each thread which has access. Often used as -# an instance variable in objects which must maintain different state -# for different threads. -# * *{Concurrent::TVar}:* Shared, mutable variables which provide -# *coordinated*, *synchronous*, change of *many* stated. Used when multiple -# value must change together, in an all-or-nothing transaction. -# -# @example -# v = ThreadLocalVar.new(14) -# v.value #=> 14 -# v.value = 2 -# v.value #=> 2 -# @example -# v = ThreadLocalVar.new(14) -# -# t1 = Thread.new do -# v.value #=> 14 -# v.value = 1 -# v.value #=> 1 -# end -# -# t2 = Thread.new do -# v.value #=> 14 -# v.value = 2 -# v.value #=> 2 -# end -# -# v.value #=> 14 -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/thread_local_var.rb#43 -class Concurrent::ThreadLocalVar - # Creates a thread local variable. - # - # @param default [Object] the default value when otherwise unset - # @param default_block [Proc] Optional block that gets called to obtain the - # default value for each thread - # @return [ThreadLocalVar] a new instance of ThreadLocalVar - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/thread_local_var.rb#51 - def initialize(default = T.unsafe(nil), &default_block); end - - # Bind the given value to thread local storage during - # execution of the given block. - # - # @param value [Object] the value to bind - # @return [Object] the value - # @yield the operation to be performed with the bound variable - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/thread_local_var.rb#88 - def bind(value); end - - # Returns the value in the current thread's copy of this thread-local variable. - # - # @return [Object] the current value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/thread_local_var.rb#70 - def value; end - - # Sets the current thread's copy of this thread-local variable to the specified value. - # - # @param value [Object] the value to set - # @return [Object] the new value - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/thread_local_var.rb#78 - def value=(value); end - - protected - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/thread_local_var.rb#103 - def default; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/thread_local_var.rb#44 -Concurrent::ThreadLocalVar::LOCALS = T.let(T.unsafe(nil), Concurrent::ThreadLocals) - -# An array-backed storage of indexed variables per thread. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#141 -class Concurrent::ThreadLocals < ::Concurrent::AbstractLocals - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#142 - def locals; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#146 - def locals!; end -end - -# An abstraction composed of one or more threads and a task queue. Tasks -# (blocks or `proc` objects) are submitted to the pool and added to the queue. -# The threads in the pool remove the tasks and execute them in the order -# they were received. -# -# A `ThreadPoolExecutor` will automatically adjust the pool size according -# to the bounds set by `min-threads` and `max-threads`. When a new task is -# submitted and fewer than `min-threads` threads are running, a new thread -# is created to handle the request, even if other worker threads are idle. -# If there are more than `min-threads` but less than `max-threads` threads -# running, a new thread will be created only if the queue is full. -# -# Threads that are idle for too long will be garbage collected, down to the -# configured minimum options. Should a thread crash it, too, will be garbage collected. -# -# `ThreadPoolExecutor` is based on the Java class of the same name. From -# the official Java documentation; -# -# > Thread pools address two different problems: they usually provide -# > improved performance when executing large numbers of asynchronous tasks, -# > due to reduced per-task invocation overhead, and they provide a means -# > of bounding and managing the resources, including threads, consumed -# > when executing a collection of tasks. Each ThreadPoolExecutor also -# > maintains some basic statistics, such as the number of completed tasks. -# > -# > To be useful across a wide range of contexts, this class provides many -# > adjustable parameters and extensibility hooks. However, programmers are -# > urged to use the more convenient Executors factory methods -# > [CachedThreadPool] (unbounded thread pool, with automatic thread reclamation), -# > [FixedThreadPool] (fixed size thread pool) and [SingleThreadExecutor] (single -# > background thread), that preconfigure settings for the most common usage -# > scenarios. -# -# **Thread Pool Options** -# -# Thread pools support several configuration options: -# -# * `idletime`: The number of seconds that a thread may be idle before being reclaimed. -# * `name`: The name of the executor (optional). Printed in the executor's `#to_s` output and -# a `-worker-` name is given to its threads if supported by used Ruby -# implementation. `` is uniq for each thread. -# * `max_queue`: The maximum number of tasks that may be waiting in the work queue at -# any one time. When the queue size reaches `max_queue` and no new threads can be created, -# subsequent tasks will be rejected in accordance with the configured `fallback_policy`. -# * `auto_terminate`: When true (default), the threads started will be marked as daemon. -# * `fallback_policy`: The policy defining how rejected tasks are handled. -# -# Three fallback policies are supported: -# -# * `:abort`: Raise a `RejectedExecutionError` exception and discard the task. -# * `:discard`: Discard the task and return false. -# * `:caller_runs`: Execute the task on the calling thread. -# -# **Shutting Down Thread Pools** -# -# Killing a thread pool while tasks are still being processed, either by calling -# the `#kill` method or at application exit, will have unpredictable results. There -# is no way for the thread pool to know what resources are being used by the -# in-progress tasks. When those tasks are killed the impact on those resources -# cannot be predicted. The *best* practice is to explicitly shutdown all thread -# pools using the provided methods: -# -# * Call `#shutdown` to initiate an orderly termination of all in-progress tasks -# * Call `#wait_for_termination` with an appropriate timeout interval an allow -# the orderly shutdown to complete -# * Call `#kill` *only when* the thread pool fails to shutdown in the allotted time -# -# On some runtime platforms (most notably the JVM) the application will not -# exit until all thread pools have been shutdown. To prevent applications from -# "hanging" on exit, all threads can be marked as daemon according to the -# `:auto_terminate` option. -# -# ```ruby -# pool1 = Concurrent::FixedThreadPool.new(5) # threads will be marked as daemon -# pool2 = Concurrent::FixedThreadPool.new(5, auto_terminate: false) # mark threads as non-daemon -# ``` -# -# @note Failure to properly shutdown a thread pool can lead to unpredictable results. -# Please read *Shutting Down Thread Pools* for more information. -# @see http://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html Java Tutorials: Thread Pools -# @see http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Executors.html Java Executors class -# @see http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html Java ExecutorService interface -# @see https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#setDaemon-boolean- -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/thread_pool_executor.rb#56 -class Concurrent::ThreadPoolExecutor < ::Concurrent::RubyThreadPoolExecutor; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/thread_pool_executor.rb#10 -Concurrent::ThreadPoolExecutorImplementation = Concurrent::RubyThreadPoolExecutor - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util.rb#4 -module Concurrent::ThreadSafe; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util.rb#7 -module Concurrent::ThreadSafe::Util - class << self - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#16 - def make_synchronized_on_cruby(klass); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util/data_structures.rb#41 - def make_synchronized_on_truffleruby(klass); end - end -end - -# TODO (pitr-ch 15-Oct-2016): migrate to Utility::ProcessorCounter -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util.rb#13 -Concurrent::ThreadSafe::Util::CPU_COUNT = T.let(T.unsafe(nil), Integer) - -# TODO (pitr-ch 15-Oct-2016): migrate to Utility::NativeInteger -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util.rb#10 -Concurrent::ThreadSafe::Util::FIXNUM_BIT_SIZE = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/thread_safe/util.rb#11 -Concurrent::ThreadSafe::Util::MAX_INT = T.let(T.unsafe(nil), Integer) - -# Raised when an operation times out. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/errors.rb#55 -class Concurrent::TimeoutError < ::Concurrent::Error; end - -# Executes a collection of tasks, each after a given delay. A master task -# monitors the set and schedules each task for execution at the appropriate -# time. Tasks are run on the global thread pool or on the supplied executor. -# Each task is represented as a `ScheduledTask`. -# -# @see Concurrent::ScheduledTask -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/timer_set.rb#19 -class Concurrent::TimerSet < ::Concurrent::RubyExecutorService - # Create a new set of timed tasks. - # - # @option opts - # @param opts [Hash] the options used to specify the executor on which to perform actions - # @return [TimerSet] a new instance of TimerSet - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/timer_set.rb#30 - def initialize(opts = T.unsafe(nil)); end - - # Begin an immediate shutdown. In-progress tasks will be allowed to - # complete but enqueued tasks will be dismissed and no new tasks - # will be accepted. Has no additional effect if the thread pool is - # not running. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/timer_set.rb#62 - def kill; end - - # Post a task to be execute run after a given delay (in seconds). If the - # delay is less than 1/100th of a second the task will be immediately post - # to the executor. - # - # @param delay [Float] the number of seconds to wait for before executing the task. - # @param args [Array] the arguments passed to the task on execution. - # @raise [ArgumentError] if the intended execution time is not in the future. - # @raise [ArgumentError] if no block is given. - # @return [Concurrent::ScheduledTask, false] IVar representing the task if the post - # is successful; false after shutdown. - # @yield the task to be performed. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/timer_set.rb#48 - def post(delay, *args, &task); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/executor_service.rb#166 - def <<(task); end - - # Initialize the object. - # - # @param opts [Hash] the options to create the object with. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/timer_set.rb#74 - def ns_initialize(opts); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/timer_set.rb#94 - def ns_post_task(task); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/timer_set.rb#129 - def ns_reset_if_forked; end - - # `ExecutorService` callback called during shutdown. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/timer_set.rb#122 - def ns_shutdown_execution; end - - # Post the task to the internal queue. - # - # @note This is intended as a callback method from ScheduledTask - # only. It is not intended to be used directly. Post a task - # by using the `SchedulesTask#execute` method. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/timer_set.rb#89 - def post_task(task); end - - # Run a loop and execute tasks in the scheduled order and at the approximate - # scheduled time. If no tasks remain the thread will exit gracefully so that - # garbage collection can occur. If there are no ready tasks it will sleep - # for up to 60 seconds waiting for the next scheduled task. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/timer_set.rb#143 - def process_tasks; end - - # Remove the given task from the queue. - # - # @note This is intended as a callback method from `ScheduledTask` - # only. It is not intended to be used directly. Cancel a task - # by using the `ScheduledTask#cancel` method. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/timer_set.rb#115 - def remove_task(task); end -end - -# A very common concurrency pattern is to run a thread that performs a task at -# regular intervals. The thread that performs the task sleeps for the given -# interval then wakes up and performs the task. Lather, rinse, repeat... This -# pattern causes two problems. First, it is difficult to test the business -# logic of the task because the task itself is tightly coupled with the -# concurrency logic. Second, an exception raised while performing the task can -# cause the entire thread to abend. In a long-running application where the -# task thread is intended to run for days/weeks/years a crashed task thread -# can pose a significant problem. `TimerTask` alleviates both problems. -# -# When a `TimerTask` is launched it starts a thread for monitoring the -# execution interval. The `TimerTask` thread does not perform the task, -# however. Instead, the TimerTask launches the task on a separate thread. -# Should the task experience an unrecoverable crash only the task thread will -# crash. This makes the `TimerTask` very fault tolerant. Additionally, the -# `TimerTask` thread can respond to the success or failure of the task, -# performing logging or ancillary operations. -# -# One other advantage of `TimerTask` is that it forces the business logic to -# be completely decoupled from the concurrency logic. The business logic can -# be tested separately then passed to the `TimerTask` for scheduling and -# running. -# -# A `TimerTask` supports two different types of interval calculations. -# A fixed delay will always wait the same amount of time between the -# completion of one task and the start of the next. A fixed rate will -# attempt to maintain a constant rate of execution regardless of the -# duration of the task. For example, if a fixed rate task is scheduled -# to run every 60 seconds but the task itself takes 10 seconds to -# complete, the next task will be scheduled to run 50 seconds after -# the start of the previous task. If the task takes 70 seconds to -# complete, the next task will be start immediately after the previous -# task completes. Tasks will not be executed concurrently. -# -# In some cases it may be necessary for a `TimerTask` to affect its own -# execution cycle. To facilitate this, a reference to the TimerTask instance -# is passed as an argument to the provided block every time the task is -# executed. -# -# The `TimerTask` class includes the `Dereferenceable` mixin module so the -# result of the last execution is always available via the `#value` method. -# Dereferencing options can be passed to the `TimerTask` during construction or -# at any later time using the `#set_deref_options` method. -# -# `TimerTask` supports notification through the Ruby standard library -# {http://ruby-doc.org/stdlib-2.0/libdoc/observer/rdoc/Observable.html -# Observable} module. On execution the `TimerTask` will notify the observers -# with three arguments: time of execution, the result of the block (or nil on -# failure), and any raised exceptions (or nil on success). -# -# @example Basic usage -# task = Concurrent::TimerTask.new{ puts 'Boom!' } -# task.execute -# -# task.execution_interval #=> 60 (default) -# -# # wait 60 seconds... -# #=> 'Boom!' -# -# task.shutdown #=> true -# @example Configuring `:execution_interval` -# task = Concurrent::TimerTask.new(execution_interval: 5) do -# puts 'Boom!' -# end -# -# task.execution_interval #=> 5 -# @example Immediate execution with `:run_now` -# task = Concurrent::TimerTask.new(run_now: true){ puts 'Boom!' } -# task.execute -# -# #=> 'Boom!' -# @example Configuring `:interval_type` with either :fixed_delay or :fixed_rate, default is :fixed_delay -# task = Concurrent::TimerTask.new(execution_interval: 5, interval_type: :fixed_rate) do -# puts 'Boom!' -# end -# task.interval_type #=> :fixed_rate -# @example Last `#value` and `Dereferenceable` mixin -# task = Concurrent::TimerTask.new( -# dup_on_deref: true, -# execution_interval: 5 -# ){ Time.now } -# -# task.execute -# Time.now #=> 2013-11-07 18:06:50 -0500 -# sleep(10) -# task.value #=> 2013-11-07 18:06:55 -0500 -# @example Controlling execution from within the block -# timer_task = Concurrent::TimerTask.new(execution_interval: 1) do |task| -# task.execution_interval.to_i.times{ print 'Boom! ' } -# print "\n" -# task.execution_interval += 1 -# if task.execution_interval > 5 -# puts 'Stopping...' -# task.shutdown -# end -# end -# -# timer_task.execute -# #=> Boom! -# #=> Boom! Boom! -# #=> Boom! Boom! Boom! -# #=> Boom! Boom! Boom! Boom! -# #=> Boom! Boom! Boom! Boom! Boom! -# #=> Stopping... -# @example Observation -# class TaskObserver -# def update(time, result, ex) -# if result -# print "(#{time}) Execution successfully returned #{result}\n" -# else -# print "(#{time}) Execution failed with error #{ex}\n" -# end -# end -# end -# -# task = Concurrent::TimerTask.new(execution_interval: 1){ 42 } -# task.add_observer(TaskObserver.new) -# task.execute -# sleep 4 -# -# #=> (2013-10-13 19:08:58 -0400) Execution successfully returned 42 -# #=> (2013-10-13 19:08:59 -0400) Execution successfully returned 42 -# #=> (2013-10-13 19:09:00 -0400) Execution successfully returned 42 -# task.shutdown -# -# task = Concurrent::TimerTask.new(execution_interval: 1){ sleep } -# task.add_observer(TaskObserver.new) -# task.execute -# -# #=> (2013-10-13 19:07:25 -0400) Execution timed out -# #=> (2013-10-13 19:07:27 -0400) Execution timed out -# #=> (2013-10-13 19:07:29 -0400) Execution timed out -# task.shutdown -# -# task = Concurrent::TimerTask.new(execution_interval: 1){ raise StandardError } -# task.add_observer(TaskObserver.new) -# task.execute -# -# #=> (2013-10-13 19:09:37 -0400) Execution failed with error StandardError -# #=> (2013-10-13 19:09:38 -0400) Execution failed with error StandardError -# #=> (2013-10-13 19:09:39 -0400) Execution failed with error StandardError -# task.shutdown -# @see http://ruby-doc.org/stdlib-2.0/libdoc/observer/rdoc/Observable.html -# @see http://docs.oracle.com/javase/7/docs/api/java/util/TimerTask.html -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#165 -class Concurrent::TimerTask < ::Concurrent::RubyExecutorService - include ::Concurrent::Concern::Dereferenceable - include ::Concurrent::Concern::Observable - - # Create a new TimerTask with the given task and configuration. - # - # @option opts - # @option opts - # @option opts - # @param opts [Hash] the options defining task execution. - # @raise ArgumentError when no block is given. - # @return [TimerTask] the new `TimerTask` - # @yield to the block after :execution_interval seconds have passed since - # the last yield - # @yieldparam task a reference to the `TimerTask` instance so that the - # block can control its own lifecycle. Necessary since `self` will - # refer to the execution context of the block rather than the running - # `TimerTask`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#209 - def initialize(opts = T.unsafe(nil), &task); end - - # Execute a previously created `TimerTask`. - # - # @example Instance and execute in separate steps - # task = Concurrent::TimerTask.new(execution_interval: 10){ print "Hello World\n" } - # task.running? #=> false - # task.execute - # task.running? #=> true - # @example Instance and execute in one line - # task = Concurrent::TimerTask.new(execution_interval: 10){ print "Hello World\n" }.execute - # task.running? #=> true - # @return [TimerTask] a reference to `self` - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#235 - def execute; end - - # @return [Fixnum] Number of seconds after the task completes before the - # task is performed again. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#259 - def execution_interval; end - - # @return [Fixnum] Number of seconds after the task completes before the - # task is performed again. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#266 - def execution_interval=(value); end - - # @return [Symbol] method to calculate the interval between executions - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#276 - def interval_type; end - - # Is the executor running? - # - # @return [Boolean] `true` when running, `false` when shutting down or shutdown - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#218 - def running?; end - - # @return [Fixnum] Number of seconds the task can run before it is - # considered to have failed. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#281 - def timeout_interval; end - - # @return [Fixnum] Number of seconds the task can run before it is - # considered to have failed. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#288 - def timeout_interval=(value); end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/executor_service.rb#166 - def <<(task); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#352 - def calculate_next_interval(start_time); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#336 - def execute_task(completion); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#296 - def ns_initialize(opts, &task); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#324 - def ns_kill_execution; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#318 - def ns_shutdown_execution; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/ruby_executor_service.rb#17 - def post(*args, &task); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#330 - def schedule_next_task(interval = T.unsafe(nil)); end - - class << self - # Create and execute a new `TimerTask`. - # - # @example - # task = Concurrent::TimerTask.execute(execution_interval: 10){ print "Hello World\n" } - # task.running? #=> true - # @option opts - # @option opts - # @option opts - # @param opts [Hash] the options defining task execution. - # @raise ArgumentError when no block is given. - # @return [TimerTask] the new `TimerTask` - # @yield to the block after :execution_interval seconds have passed since - # the last yield - # @yieldparam task a reference to the `TimerTask` instance so that the - # block can control its own lifecycle. Necessary since `self` will - # refer to the execution context of the block rather than the running - # `TimerTask`. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#252 - def execute(opts = T.unsafe(nil), &task); end - end -end - -# Default `:interval_type` -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#181 -Concurrent::TimerTask::DEFAULT_INTERVAL_TYPE = T.let(T.unsafe(nil), Symbol) - -# Default `:execution_interval` in seconds. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#170 -Concurrent::TimerTask::EXECUTION_INTERVAL = T.let(T.unsafe(nil), Integer) - -# Maintain the interval between the end of one execution and the start of the next execution. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#173 -Concurrent::TimerTask::FIXED_DELAY = T.let(T.unsafe(nil), Symbol) - -# Maintain the interval between the start of one execution and the start of the next. -# If execution time exceeds the interval, the next execution will start immediately -# after the previous execution finishes. Executions will not run concurrently. -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/timer_task.rb#178 -Concurrent::TimerTask::FIXED_RATE = T.let(T.unsafe(nil), Symbol) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#153 -class Concurrent::Transaction - # @return [Transaction] a new instance of Transaction - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#162 - def initialize; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#192 - def abort; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#196 - def commit; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#177 - def open(tvar); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#166 - def read(tvar); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#206 - def unlock; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#171 - def write(tvar, value); end - - class << self - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#212 - def current; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#216 - def current=(transaction); end - end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#155 -Concurrent::Transaction::ABORTED = T.let(T.unsafe(nil), Object) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#159 -class Concurrent::Transaction::AbortError < ::StandardError; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#160 -class Concurrent::Transaction::LeaveError < ::StandardError; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#157 -class Concurrent::Transaction::OpenEntry < ::Struct - # Returns the value of attribute modified - # - # @return [Object] the current value of modified - def modified; end - - # Sets the attribute modified - # - # @param value [Object] the value to set the attribute modified to. - # @return [Object] the newly set value - def modified=(_); 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 - -# A fixed size array with volatile (synchronized, thread safe) getters/setters. -# Mixes in Ruby's `Enumerable` module for enhanced search, sort, and traversal. -# -# @example -# tuple = Concurrent::Tuple.new(16) -# -# tuple.set(0, :foo) #=> :foo | volatile write -# tuple.get(0) #=> :foo | volatile read -# tuple.compare_and_set(0, :foo, :bar) #=> true | strong CAS -# tuple.cas(0, :foo, :baz) #=> false | strong CAS -# tuple.get(0) #=> :bar | volatile read -# @see https://en.wikipedia.org/wiki/Tuple Tuple entry at Wikipedia -# @see http://www.erlang.org/doc/reference_manual/data_types.html#id70396 Erlang Tuple -# @see http://ruby-doc.org/core-2.2.2/Enumerable.html Enumerable -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/tuple.rb#20 -class Concurrent::Tuple - include ::Enumerable - - # Create a new tuple of the given size. - # - # @param size [Integer] the number of elements in the tuple - # @return [Tuple] a new instance of Tuple - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tuple.rb#29 - def initialize(size); end - - # Set the value at the given index to the new value if and only if the current - # value matches the given old value. - # - # @param i [Integer] the index for the element to set - # @param old_value [Object] the value to compare against the current value - # @param new_value [Object] the value to set at the given index - # @return [Boolean] true if the value at the given element was set else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tuple.rb#69 - def cas(i, old_value, new_value); end - - # Set the value at the given index to the new value if and only if the current - # value matches the given old value. - # - # @param i [Integer] the index for the element to set - # @param old_value [Object] the value to compare against the current value - # @param new_value [Object] the value to set at the given index - # @return [Boolean] true if the value at the given element was set else false - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tuple.rb#69 - def compare_and_set(i, old_value, new_value); end - - # Calls the given block once for each element in self, passing that element as a parameter. - # - # @yieldparam ref [Object] the `Concurrent::AtomicReference` object at the current index - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tuple.rb#78 - def each; end - - # Get the value of the element at the given index. - # - # @param i [Integer] the index from which to retrieve the value - # @return [Object] the value at the given index or nil if the index is out of bounds - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tuple.rb#43 - def get(i); end - - # Set the element at the given index to the given value - # - # @param i [Integer] the index for the element to set - # @param value [Object] the value to set at the given index - # @return [Object] the new value of the element at the given index or nil if the index is out of bounds - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tuple.rb#55 - def set(i, value); end - - # The (fixed) size of the tuple. - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tuple.rb#24 - def size; end - - # Get the value of the element at the given index. - # - # @param i [Integer] the index from which to retrieve the value - # @return [Object] the value at the given index or nil if the index is out of bounds - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tuple.rb#43 - def volatile_get(i); end - - # Set the element at the given index to the given value - # - # @param i [Integer] the index for the element to set - # @param value [Object] the value to set at the given index - # @return [Object] the new value of the element at the given index or nil if the index is out of bounds - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tuple.rb#55 - def volatile_set(i, value); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/engine.rb#3 -module Concurrent::Utility; end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/engine.rb#6 -module Concurrent::Utility::EngineDetector - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/engine.rb#7 - def on_cruby?; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/engine.rb#11 - def on_jruby?; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/engine.rb#27 - def on_linux?; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/engine.rb#23 - def on_osx?; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/engine.rb#15 - def on_truffleruby?; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/engine.rb#19 - def on_windows?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/engine.rb#31 - def ruby_version(version = T.unsafe(nil), comparison, major, minor, patch); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb#9 -module Concurrent::Utility::NativeExtensionLoader - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb#11 - def allow_c_extensions?; end - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb#15 - def c_extensions_loaded?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb#19 - def load_native_extensions; end - - private - - # @return [Boolean] - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb#50 - def java_extensions_loaded?; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb#38 - def load_error_path(error); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb#46 - def set_c_extensions_loaded; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb#54 - def set_java_extensions_loaded; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_extension_loader.rb#58 - def try_load_c_extension(path); end -end - -# @private -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_integer.rb#5 -module Concurrent::Utility::NativeInteger - extend ::Concurrent::Utility::NativeInteger - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_integer.rb#24 - def ensure_integer(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_integer.rb#31 - def ensure_integer_and_bounds(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_integer.rb#17 - def ensure_lower_bound(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_integer.rb#37 - def ensure_positive(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_integer.rb#44 - def ensure_positive_and_no_zero(value); end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_integer.rb#10 - def ensure_upper_bound(value); end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_integer.rb#8 -Concurrent::Utility::NativeInteger::MAX_VALUE = T.let(T.unsafe(nil), Integer) - -# http://stackoverflow.com/questions/535721/ruby-max-integer -# -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/native_integer.rb#7 -Concurrent::Utility::NativeInteger::MIN_VALUE = T.let(T.unsafe(nil), Integer) - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#10 -class Concurrent::Utility::ProcessorCounter - # @return [ProcessorCounter] a new instance of ProcessorCounter - # - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#11 - def initialize; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#20 - def physical_processor_count; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#16 - def processor_count; end - - private - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#34 - def compute_physical_processor_count; end - - # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#26 - def compute_processor_count; end -end - -# source://concurrent-ruby//lib/concurrent-ruby/concurrent/version.rb#2 -Concurrent::VERSION = T.let(T.unsafe(nil), String) diff --git a/Library/Homebrew/sorbet/rbi/gems/i18n@1.14.1.rbi b/Library/Homebrew/sorbet/rbi/gems/i18n@1.14.1.rbi deleted file mode 100644 index e6c7fbd413..0000000000 --- a/Library/Homebrew/sorbet/rbi/gems/i18n@1.14.1.rbi +++ /dev/null @@ -1,2325 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `i18n` gem. -# Please instead update this file by running `bin/tapioca gem i18n`. - -# source://i18n//lib/i18n/gettext/po_parser.rb#15 -module GetText; end - -# source://i18n//lib/i18n/gettext/po_parser.rb#17 -class GetText::PoParser < ::Racc::Parser - # source://i18n//lib/i18n/gettext/po_parser.rb#19 - def _(x); end - - def _reduce_10(val, _values, result); end - def _reduce_12(val, _values, result); end - def _reduce_13(val, _values, result); end - def _reduce_14(val, _values, result); end - def _reduce_15(val, _values, result); end - def _reduce_5(val, _values, result); end - def _reduce_8(val, _values, result); end - def _reduce_9(val, _values, result); end - - # source://i18n//lib/i18n/gettext/po_parser.rb#323 - def _reduce_none(val, _values, result); end - - def next_token; end - def on_comment(comment); end - def on_message(msgid, msgstr); end - def parse(str, data, ignore_fuzzy = T.unsafe(nil)); end - def unescape(orig); end -end - -# source://i18n//lib/i18n/gettext/po_parser.rb#184 -GetText::PoParser::Racc_arg = T.let(T.unsafe(nil), Array) - -# source://i18n//lib/i18n/gettext/po_parser.rb#221 -GetText::PoParser::Racc_debug_parser = T.let(T.unsafe(nil), TrueClass) - -# source://i18n//lib/i18n/gettext/po_parser.rb#200 -GetText::PoParser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array) - -# Simple Locale tag implementation that computes subtags by simply splitting -# the locale tag at '-' occurrences. -# -# source://i18n//lib/i18n/version.rb#3 -module I18n - extend ::I18n::Base - - class << self - # source://i18n//lib/i18n/backend/cache.rb#64 - def cache_key_digest; end - - # source://i18n//lib/i18n/backend/cache.rb#68 - def cache_key_digest=(key_digest); end - - # source://i18n//lib/i18n/backend/cache.rb#56 - def cache_namespace; end - - # source://i18n//lib/i18n/backend/cache.rb#60 - def cache_namespace=(namespace); end - - # source://i18n//lib/i18n/backend/cache.rb#48 - def cache_store; end - - # source://i18n//lib/i18n/backend/cache.rb#52 - def cache_store=(store); end - - # Returns the current fallbacks implementation. Defaults to +I18n::Locale::Fallbacks+. - # - # source://i18n//lib/i18n/backend/fallbacks.rb#17 - def fallbacks; end - - # Sets the current fallbacks implementation. Use this to set a different fallbacks implementation. - # - # source://i18n//lib/i18n/backend/fallbacks.rb#23 - def fallbacks=(fallbacks); end - - # Return String or raises MissingInterpolationArgument exception. - # Missing argument's logic is handled by I18n.config.missing_interpolation_argument_handler. - # - # @raise [ReservedInterpolationKey] - # - # source://i18n//lib/i18n/interpolate/ruby.rb#23 - def interpolate(string, values); end - - # source://i18n//lib/i18n/interpolate/ruby.rb#29 - def interpolate_hash(string, values); end - - # source://i18n//lib/i18n.rb#37 - def new_double_nested_cache; end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/cache.rb#72 - def perform_caching?; end - - # Marks a key as reserved. Reserved keys are used internally, - # and can't also be used for interpolation. If you are using any - # extra keys as I18n options, you should call I18n.reserve_key - # before any I18n.translate (etc) calls are made. - # - # source://i18n//lib/i18n.rb#45 - def reserve_key(key); end - - # source://i18n//lib/i18n.rb#50 - def reserved_keys_pattern; end - end -end - -# source://i18n//lib/i18n/exceptions.rb#16 -class I18n::ArgumentError < ::ArgumentError; end - -# source://i18n//lib/i18n/backend.rb#4 -module I18n::Backend; end - -# source://i18n//lib/i18n/backend/base.rb#8 -module I18n::Backend::Base - include ::I18n::Backend::Transliterator - - # Returns an array of locales for which translations are available - # ignoring the reserved translation meta data key :i18n. - # - # @raise [NotImplementedError] - # - # source://i18n//lib/i18n/backend/base.rb#94 - def available_locales; end - - # source://i18n//lib/i18n/backend/base.rb#102 - def eager_load!; end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/base.rb#68 - def exists?(locale, key, options = T.unsafe(nil)); end - - # Accepts a list of paths to translation files. Loads translations from - # plain Ruby (*.rb), YAML files (*.yml), or JSON files (*.json). See #load_rb, #load_yml, and #load_json - # for details. - # - # source://i18n//lib/i18n/backend/base.rb#14 - def load_translations(*filenames); end - - # Acts the same as +strftime+, but uses a localized version of the - # format string. Takes a key from the date/time formats translations as - # a format argument (e.g., :short in :'date.formats'). - # - # @raise [ArgumentError] - # - # source://i18n//lib/i18n/backend/base.rb#75 - def localize(locale, object, format = T.unsafe(nil), options = T.unsafe(nil)); end - - # source://i18n//lib/i18n/backend/base.rb#98 - def reload!; end - - # This method receives a locale, a data hash and options for storing translations. - # Should be implemented - # - # @raise [NotImplementedError] - # - # source://i18n//lib/i18n/backend/base.rb#24 - def store_translations(locale, data, options = T.unsafe(nil)); end - - # @raise [I18n::ArgumentError] - # - # source://i18n//lib/i18n/backend/base.rb#28 - def translate(locale, key, options = T.unsafe(nil)); end - - protected - - # Deep interpolation - # - # deep_interpolate { people: { ann: "Ann is %{ann}", john: "John is %{john}" } }, - # ann: 'good', john: 'big' - # #=> { people: { ann: "Ann is good", john: "John is big" } } - # - # source://i18n//lib/i18n/backend/base.rb#207 - def deep_interpolate(locale, data, values = T.unsafe(nil)); end - - # Evaluates defaults. - # If given subject is an Array, it walks the array and returns the - # first translation that can be resolved. Otherwise it tries to resolve - # the translation directly. - # - # source://i18n//lib/i18n/backend/base.rb#125 - def default(locale, object, subject, options = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/base.rb#108 - def eager_loaded?; end - - # Interpolates values into a given subject. - # - # if the given subject is a string then: - # method interpolates "file %{file} opened by %%{user}", :file => 'test.txt', :user => 'Mr. X' - # # => "file test.txt opened by %{user}" - # - # if the given subject is an array then: - # each element of the array is recursively interpolated (until it finds a string) - # method interpolates ["yes, %{user}", ["maybe no, %{user}, "no, %{user}"]], :user => "bartuz" - # # => "["yes, bartuz",["maybe no, bartuz", "no, bartuz"]]" - # - # source://i18n//lib/i18n/backend/base.rb#191 - def interpolate(locale, subject, values = T.unsafe(nil)); end - - # Loads a single translations file by delegating to #load_rb or - # #load_yml depending on the file extension and directly merges the - # data to the existing translations. Raises I18n::UnknownFileType - # for all other file extensions. - # - # @raise [UnknownFileType] - # - # source://i18n//lib/i18n/backend/base.rb#230 - def load_file(filename); end - - # Loads a JSON translations file. The data must have locales as - # toplevel keys. - # - # source://i18n//lib/i18n/backend/base.rb#266 - def load_json(filename); end - - # Loads a plain Ruby translations file. eval'ing the file must yield - # a Hash containing translation data with locales as toplevel keys. - # - # source://i18n//lib/i18n/backend/base.rb#244 - def load_rb(filename); end - - # Loads a YAML translations file. The data must have locales as - # toplevel keys. - # - # source://i18n//lib/i18n/backend/base.rb#251 - def load_yaml(filename); end - - # Loads a YAML translations file. The data must have locales as - # toplevel keys. - # - # source://i18n//lib/i18n/backend/base.rb#251 - def load_yml(filename); end - - # The method which actually looks up for the translation in the store. - # - # @raise [NotImplementedError] - # - # source://i18n//lib/i18n/backend/base.rb#113 - def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end - - # source://i18n//lib/i18n/backend/base.rb#298 - def pluralization_key(entry, count); end - - # Picks a translation from a pluralized mnemonic subkey according to English - # pluralization rules : - # - It will pick the :one subkey if count is equal to 1. - # - It will pick the :other subkey otherwise. - # - It will pick the :zero subkey in the special case where count is - # equal to 0 and there is a :zero subkey present. This behaviour is - # not standard with regards to the CLDR pluralization rules. - # Other backends can implement more flexible or complex pluralization rules. - # - # @raise [InvalidPluralizationData] - # - # source://i18n//lib/i18n/backend/base.rb#172 - def pluralize(locale, entry, count); end - - # Resolves a translation. - # If the given subject is a Symbol, it will be translated with the - # given options. If it is a Proc then it will be evaluated. All other - # subjects will be returned directly. - # - # source://i18n//lib/i18n/backend/base.rb#147 - def resolve(locale, object, subject, options = T.unsafe(nil)); end - - # Resolves a translation. - # If the given subject is a Symbol, it will be translated with the - # given options. If it is a Proc then it will be evaluated. All other - # subjects will be returned directly. - # - # source://i18n//lib/i18n/backend/base.rb#147 - def resolve_entry(locale, object, subject, options = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/base.rb#117 - def subtrees?; end - - # source://i18n//lib/i18n/backend/base.rb#279 - def translate_localization_format(locale, object, format, options); end -end - -# TODO Should the cache be cleared if new translations are stored? -# -# source://i18n//lib/i18n/backend/cache.rb#79 -module I18n::Backend::Cache - # source://i18n//lib/i18n/backend/cache.rb#80 - def translate(locale, key, options = T.unsafe(nil)); end - - protected - - # source://i18n//lib/i18n/backend/cache.rb#93 - def _fetch(cache_key, &block); end - - # source://i18n//lib/i18n/backend/cache.rb#101 - def cache_key(locale, key, options); end - - # source://i18n//lib/i18n/backend/cache.rb#86 - def fetch(cache_key, &block); end - - private - - # source://i18n//lib/i18n/backend/cache.rb#108 - def digest_item(key); end -end - -# Overwrites the Base load_file method to cache loaded file contents. -# -# source://i18n//lib/i18n/backend/cache_file.rb#8 -module I18n::Backend::CacheFile - # Optionally provide path_roots array to normalize filename paths, - # to make the cached i18n data portable across environments. - # - # source://i18n//lib/i18n/backend/cache_file.rb#11 - def path_roots; end - - # Optionally provide path_roots array to normalize filename paths, - # to make the cached i18n data portable across environments. - # - # source://i18n//lib/i18n/backend/cache_file.rb#11 - def path_roots=(_arg0); end - - protected - - # Track loaded translation files in the `i18n.load_file` scope, - # and skip loading the file if its contents are still up-to-date. - # - # source://i18n//lib/i18n/backend/cache_file.rb#17 - def load_file(filename); end - - # Translate absolute filename to relative path for i18n key. - # - # source://i18n//lib/i18n/backend/cache_file.rb#28 - def normalized_path(file); end -end - -# source://i18n//lib/i18n/backend/cascade.rb#35 -module I18n::Backend::Cascade - # source://i18n//lib/i18n/backend/cascade.rb#36 - def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end -end - -# Backend that chains multiple other backends and checks each of them when -# a translation needs to be looked up. This is useful when you want to use -# standard translations with a Simple backend but store custom application -# translations in a database or other backends. -# -# To use the Chain backend instantiate it and set it to the I18n module. -# You can add chained backends through the initializer or backends -# accessor: -# -# # preserves the existing Simple backend set to I18n.backend -# I18n.backend = I18n::Backend::Chain.new(I18n::Backend::ActiveRecord.new, I18n.backend) -# -# The implementation assumes that all backends added to the Chain implement -# a lookup method with the same API as Simple backend does. -# -# Fallback translations using the :default option are only used by the last backend of a chain. -# -# source://i18n//lib/i18n/backend/chain.rb#21 -class I18n::Backend::Chain - include ::I18n::Backend::Transliterator - include ::I18n::Backend::Base - include ::I18n::Backend::Chain::Implementation -end - -# source://i18n//lib/i18n/backend/chain.rb#22 -module I18n::Backend::Chain::Implementation - include ::I18n::Backend::Transliterator - include ::I18n::Backend::Base - - # source://i18n//lib/i18n/backend/chain.rb#27 - def initialize(*backends); end - - # source://i18n//lib/i18n/backend/chain.rb#52 - def available_locales; end - - # Returns the value of attribute backends. - # - # source://i18n//lib/i18n/backend/chain.rb#25 - def backends; end - - # Sets the attribute backends - # - # @param value the value to set the attribute backends to. - # - # source://i18n//lib/i18n/backend/chain.rb#25 - def backends=(_arg0); end - - # source://i18n//lib/i18n/backend/chain.rb#44 - def eager_load!; end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/chain.rb#76 - def exists?(locale, key, options = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/chain.rb#31 - def initialized?; end - - # source://i18n//lib/i18n/backend/chain.rb#82 - def localize(locale, object, format = T.unsafe(nil), options = T.unsafe(nil)); end - - # source://i18n//lib/i18n/backend/chain.rb#40 - def reload!; end - - # source://i18n//lib/i18n/backend/chain.rb#48 - def store_translations(locale, data, options = T.unsafe(nil)); end - - # source://i18n//lib/i18n/backend/chain.rb#56 - def translate(locale, key, default_options = T.unsafe(nil)); end - - protected - - # source://i18n//lib/i18n/backend/chain.rb#92 - def init_translations; end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/chain.rb#108 - def namespace_lookup?(result, options); end - - # source://i18n//lib/i18n/backend/chain.rb#98 - def translations; end - - private - - # This is approximately what gets used in ActiveSupport. - # However since we are not guaranteed to run in an ActiveSupport context - # it is wise to have our own copy. We underscore it - # to not pollute the namespace of the including class. - # - # source://i18n//lib/i18n/backend/chain.rb#117 - def _deep_merge(hash, other_hash); end -end - -# source://i18n//lib/i18n/backend/fallbacks.rb#30 -module I18n::Backend::Fallbacks - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/fallbacks.rb#94 - def exists?(locale, key, options = T.unsafe(nil)); end - - # source://i18n//lib/i18n/backend/fallbacks.rb#85 - def extract_non_symbol_default!(options); end - - # source://i18n//lib/i18n/backend/fallbacks.rb#67 - def resolve_entry(locale, object, subject, options = T.unsafe(nil)); end - - # Overwrites the Base backend translate method so that it will try each - # locale given by I18n.fallbacks for the given locale. E.g. for the - # locale :"de-DE" it might try the locales :"de-DE", :de and :en - # (depends on the fallbacks implementation) until it finds a result with - # the given options. If it does not find any result for any of the - # locales it will then throw MissingTranslation as usual. - # - # The default option takes precedence over fallback locales only when - # it's a Symbol. When the default contains a String, Proc or Hash - # it is evaluated last after all the fallback locales have been tried. - # - # source://i18n//lib/i18n/backend/fallbacks.rb#41 - def translate(locale, key, options = T.unsafe(nil)); end - - private - - # Overwrite on_fallback to add specified logic when the fallback succeeds. - # - # source://i18n//lib/i18n/backend/fallbacks.rb#110 - def on_fallback(_original_locale, _fallback_locale, _key, _options); end -end - -# This module contains several helpers to assist flattening translations. -# You may want to flatten translations for: -# -# 1) speed up lookups, as in the Memoize backend; -# 2) In case you want to store translations in a data store, as in ActiveRecord backend; -# -# You can check both backends above for some examples. -# This module also keeps all links in a hash so they can be properly resolved when flattened. -# -# source://i18n//lib/i18n/backend/flatten.rb#13 -module I18n::Backend::Flatten - # Flatten keys for nested Hashes by chaining up keys: - # - # >> { "a" => { "b" => { "c" => "d", "e" => "f" }, "g" => "h" }, "i" => "j"}.wind - # => { "a.b.c" => "d", "a.b.e" => "f", "a.g" => "h", "i" => "j" } - # - # source://i18n//lib/i18n/backend/flatten.rb#59 - def flatten_keys(hash, escape, prev_key = T.unsafe(nil), &block); end - - # Receives a hash of translations (where the key is a locale and - # the value is another hash) and return a hash with all - # translations flattened. - # - # Nested hashes are included in the flattened hash just if subtree - # is true and Symbols are automatically stored as links. - # - # source://i18n//lib/i18n/backend/flatten.rb#74 - def flatten_translations(locale, data, escape, subtree); end - - # Store flattened links. - # - # source://i18n//lib/i18n/backend/flatten.rb#50 - def links; end - - # Shortcut to I18n::Backend::Flatten.normalize_flat_keys - # and then resolve_links. - # - # source://i18n//lib/i18n/backend/flatten.rb#44 - def normalize_flat_keys(locale, key, scope, separator); end - - protected - - # source://i18n//lib/i18n/backend/flatten.rb#112 - def escape_default_separator(key); end - - # source://i18n//lib/i18n/backend/flatten.rb#106 - def find_link(locale, key); end - - # source://i18n//lib/i18n/backend/flatten.rb#93 - def resolve_link(locale, key); end - - # source://i18n//lib/i18n/backend/flatten.rb#89 - def store_link(locale, key, link); end - - class << self - # Receives a string and escape the default separator. - # - # source://i18n//lib/i18n/backend/flatten.rb#38 - def escape_default_separator(key); end - - # normalize_keys the flatten way. This method is significantly faster - # and creates way less objects than the one at I18n.normalize_keys. - # It also handles escaping the translation keys. - # - # source://i18n//lib/i18n/backend/flatten.rb#20 - def normalize_flat_keys(locale, key, scope, separator); end - end -end - -# source://i18n//lib/i18n/backend/flatten.rb#15 -I18n::Backend::Flatten::FLATTEN_SEPARATOR = T.let(T.unsafe(nil), String) - -# source://i18n//lib/i18n/backend/flatten.rb#14 -I18n::Backend::Flatten::SEPARATOR_ESCAPE_CHAR = T.let(T.unsafe(nil), String) - -# Experimental support for using Gettext po files to store translations. -# -# To use this you can simply include the module to the Simple backend - or -# whatever other backend you are using. -# -# I18n::Backend::Simple.include(I18n::Backend::Gettext) -# -# Now you should be able to include your Gettext translation (*.po) files to -# the +I18n.load_path+ so they're loaded to the backend and you can use them as -# usual: -# -# I18n.load_path += Dir["path/to/locales/*.po"] -# -# Following the Gettext convention this implementation expects that your -# translation files are named by their locales. E.g. the file en.po would -# contain the translations for the English locale. -# -# To translate text you must use one of the translate methods provided by -# I18n::Gettext::Helpers. -# -# include I18n::Gettext::Helpers -# puts _("some string") -# -# Without it strings containing periods (".") will not be translated. -# -# source://i18n//lib/i18n/backend/gettext.rb#33 -module I18n::Backend::Gettext - protected - - # source://i18n//lib/i18n/backend/gettext.rb#41 - def load_po(filename); end - - # source://i18n//lib/i18n/backend/gettext.rb#51 - def normalize(locale, data); end - - # source://i18n//lib/i18n/backend/gettext.rb#68 - def normalize_pluralization(locale, key, value); end - - # source://i18n//lib/i18n/backend/gettext.rb#47 - def parse(filename); end -end - -# source://i18n//lib/i18n/backend/gettext.rb#34 -class I18n::Backend::Gettext::PoData < ::Hash - # source://i18n//lib/i18n/backend/gettext.rb#35 - def set_comment(msgid_or_sym, comment); end -end - -# source://i18n//lib/i18n/backend/interpolation_compiler.rb#20 -module I18n::Backend::InterpolationCompiler - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#99 - def interpolate(locale, string, values); end - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#109 - def store_translations(locale, data, options = T.unsafe(nil)); end - - protected - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#115 - def compile_all_strings_in(data); end -end - -# source://i18n//lib/i18n/backend/interpolation_compiler.rb#21 -module I18n::Backend::InterpolationCompiler::Compiler - extend ::I18n::Backend::InterpolationCompiler::Compiler - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#27 - def compile_if_an_interpolation(string); end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#39 - def interpolated_str?(str); end - - protected - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#60 - def compile_interpolation_token(key); end - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#49 - def compiled_interpolation_body(str); end - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#73 - def direct_key(key); end - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#93 - def escape_key_sym(key); end - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#89 - def escape_plain_str(str); end - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#55 - def handle_interpolation_token(interpolation, matchdata); end - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#69 - def interpolate_key(key); end - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#64 - def interpolate_or_raise_missing(key); end - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#81 - def missing_key(key); end - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#77 - def nil_key(key); end - - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#85 - def reserved_key(key); end - - # tokenize("foo %{bar} baz %%{buz}") # => ["foo ", "%{bar}", " baz ", "%%{buz}"] - # - # source://i18n//lib/i18n/backend/interpolation_compiler.rb#45 - def tokenize(str); end -end - -# source://i18n//lib/i18n/backend/interpolation_compiler.rb#25 -I18n::Backend::InterpolationCompiler::Compiler::INTERPOLATION_SYNTAX_PATTERN = T.let(T.unsafe(nil), Regexp) - -# source://i18n//lib/i18n/backend/interpolation_compiler.rb#24 -I18n::Backend::InterpolationCompiler::Compiler::TOKENIZER = T.let(T.unsafe(nil), Regexp) - -# This is a basic backend for key value stores. It receives on -# initialization the store, which should respond to three methods: -# -# * store#[](key) - Used to get a value -# * store#[]=(key, value) - Used to set a value -# * store#keys - Used to get all keys -# -# Since these stores only supports string, all values are converted -# to JSON before being stored, allowing it to also store booleans, -# hashes and arrays. However, this store does not support Procs. -# -# As the ActiveRecord backend, Symbols are just supported when loading -# translations from the filesystem or through explicit store translations. -# -# Also, avoid calling I18n.available_locales since it's a somehow -# expensive operation in most stores. -# -# == Example -# -# To setup I18n to use TokyoCabinet in memory is quite straightforward: -# -# require 'rufus/tokyo/cabinet' # gem install rufus-tokyo -# I18n.backend = I18n::Backend::KeyValue.new(Rufus::Tokyo::Cabinet.new('*')) -# -# == Performance -# -# You may make this backend even faster by including the Memoize module. -# However, notice that you should properly clear the cache if you change -# values directly in the key-store. -# -# == Subtrees -# -# In most backends, you are allowed to retrieve part of a translation tree: -# -# I18n.backend.store_translations :en, :foo => { :bar => :baz } -# I18n.t "foo" #=> { :bar => :baz } -# -# This backend supports this feature by default, but it slows down the storage -# of new data considerably and makes hard to delete entries. That said, you are -# allowed to disable the storage of subtrees on initialization: -# -# I18n::Backend::KeyValue.new(@store, false) -# -# This is useful if you are using a KeyValue backend chained to a Simple backend. -# -# source://i18n//lib/i18n/backend/key_value.rb#69 -class I18n::Backend::KeyValue - include ::I18n::Backend::Flatten - include ::I18n::Backend::Transliterator - include ::I18n::Backend::Base - include ::I18n::Backend::KeyValue::Implementation -end - -# source://i18n//lib/i18n/backend/key_value.rb#70 -module I18n::Backend::KeyValue::Implementation - include ::I18n::Backend::Flatten - include ::I18n::Backend::Transliterator - include ::I18n::Backend::Base - - # source://i18n//lib/i18n/backend/key_value.rb#75 - def initialize(store, subtrees = T.unsafe(nil)); end - - # source://i18n//lib/i18n/backend/key_value.rb#102 - def available_locales; end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/key_value.rb#79 - def initialized?; end - - # Returns the value of attribute store. - # - # source://i18n//lib/i18n/backend/key_value.rb#71 - def store; end - - # Sets the attribute store - # - # @param value the value to set the attribute store to. - # - # source://i18n//lib/i18n/backend/key_value.rb#71 - def store=(_arg0); end - - # source://i18n//lib/i18n/backend/key_value.rb#83 - def store_translations(locale, data, options = T.unsafe(nil)); end - - protected - - # source://i18n//lib/i18n/backend/key_value.rb#124 - def init_translations; end - - # source://i18n//lib/i18n/backend/key_value.rb#136 - def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end - - # source://i18n//lib/i18n/backend/key_value.rb#150 - def pluralize(locale, entry, count); end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/key_value.rb#132 - def subtrees?; end - - # Queries the translations from the key-value store and converts - # them into a hash such as the one returned from loading the - # haml files - # - # source://i18n//lib/i18n/backend/key_value.rb#115 - def translations; end -end - -# source://i18n//lib/i18n/backend/key_value.rb#161 -class I18n::Backend::KeyValue::SubtreeProxy - # @return [SubtreeProxy] a new instance of SubtreeProxy - # - # source://i18n//lib/i18n/backend/key_value.rb#162 - def initialize(master_key, store); end - - # source://i18n//lib/i18n/backend/key_value.rb#172 - def [](key); end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/key_value.rb#168 - def has_key?(key); end - - # source://i18n//lib/i18n/backend/key_value.rb#196 - def inspect; end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/key_value.rb#188 - def instance_of?(klass); end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/key_value.rb#183 - def is_a?(klass); end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/key_value.rb#183 - def kind_of?(klass); end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/key_value.rb#192 - def nil?; end -end - -# source://i18n//lib/i18n/backend/lazy_loadable.rb#65 -class I18n::Backend::LazyLoadable < ::I18n::Backend::Simple - # @return [LazyLoadable] a new instance of LazyLoadable - # - # source://i18n//lib/i18n/backend/lazy_loadable.rb#66 - def initialize(lazy_load: T.unsafe(nil)); end - - # Parse the load path and extract all locales. - # - # source://i18n//lib/i18n/backend/lazy_loadable.rb#99 - def available_locales; end - - # Eager loading is not supported in the lazy context. - # - # source://i18n//lib/i18n/backend/lazy_loadable.rb#90 - def eager_load!; end - - # Returns whether the current locale is initialized. - # - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/lazy_loadable.rb#71 - def initialized?; end - - # source://i18n//lib/i18n/backend/lazy_loadable.rb#107 - def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end - - # Clean up translations and uninitialize all locales. - # - # source://i18n//lib/i18n/backend/lazy_loadable.rb#80 - def reload!; end - - protected - - # Load translations from files that belong to the current locale. - # - # @raise [InvalidFilenames] - # - # source://i18n//lib/i18n/backend/lazy_loadable.rb#121 - def init_translations; end - - # source://i18n//lib/i18n/backend/lazy_loadable.rb#133 - def initialized_locales; end - - private - - # Checks if a filename is named in correspondence to the translations it loaded. - # The locale extracted from the path must be the single locale loaded in the translations. - # - # @raise [FilenameIncorrect] - # - # source://i18n//lib/i18n/backend/lazy_loadable.rb#175 - def assert_file_named_correctly!(file, translations); end - - # Select all files from I18n load path that belong to current locale. - # These files must start with the locale identifier (ie. "en", "pt-BR"), - # followed by an "_" demarcation to separate proceeding text. - # - # source://i18n//lib/i18n/backend/lazy_loadable.rb#167 - def filenames_for_current_locale; end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/lazy_loadable.rb#139 - def lazy_load?; end - - # Loads each file supplied and asserts that the file only loads - # translations as expected by the name. The method returns a list of - # errors corresponding to offending files. - # - # source://i18n//lib/i18n/backend/lazy_loadable.rb#152 - def load_translations_and_collect_file_errors(files); end -end - -# source://i18n//lib/i18n/backend/lazy_loadable.rb#143 -class I18n::Backend::LazyLoadable::FilenameIncorrect < ::StandardError - # @return [FilenameIncorrect] a new instance of FilenameIncorrect - # - # source://i18n//lib/i18n/backend/lazy_loadable.rb#144 - def initialize(file, expected_locale, unexpected_locales); end -end - -# Backend that lazy loads translations based on the current locale. This -# implementation avoids loading all translations up front. Instead, it only -# loads the translations that belong to the current locale. This offers a -# performance incentive in local development and test environments for -# applications with many translations for many different locales. It's -# particularly useful when the application only refers to a single locales' -# translations at a time (ex. A Rails workload). The implementation -# identifies which translation files from the load path belong to the -# current locale by pattern matching against their path name. -# -# Specifically, a translation file is considered to belong to a locale if: -# a) the filename is in the I18n load path -# b) the filename ends in a supported extension (ie. .yml, .json, .po, .rb) -# c) the filename starts with the locale identifier -# d) the locale identifier and optional proceeding text is separated by an underscore, ie. "_". -# -# Examples: -# Valid files that will be selected by this backend: -# -# "files/locales/en_translation.yml" (Selected for locale "en") -# "files/locales/fr.po" (Selected for locale "fr") -# -# Invalid files that won't be selected by this backend: -# -# "files/locales/translation-file" -# "files/locales/en-translation.unsupported" -# "files/locales/french/translation.yml" -# "files/locales/fr/translation.yml" -# -# The implementation uses this assumption to defer the loading of -# translation files until the current locale actually requires them. -# -# The backend has two working modes: lazy_load and eager_load. -# -# Note: This backend should only be enabled in test environments! -# When the mode is set to false, the backend behaves exactly like the -# Simple backend, with an additional check that the paths being loaded -# abide by the format. If paths can't be matched to the format, an error is raised. -# -# You can configure lazy loaded backends through the initializer or backends -# accessor: -# -# # In test environments -# -# I18n.backend = I18n::Backend::LazyLoadable.new(lazy_load: true) -# -# # In other environments, such as production and CI -# -# I18n.backend = I18n::Backend::LazyLoadable.new(lazy_load: false) # default -# -# source://i18n//lib/i18n/backend/lazy_loadable.rb#55 -class I18n::Backend::LocaleExtractor - class << self - # source://i18n//lib/i18n/backend/lazy_loadable.rb#57 - def locale_from_path(path); end - end -end - -# source://i18n//lib/i18n/backend/memoize.rb#14 -module I18n::Backend::Memoize - # source://i18n//lib/i18n/backend/memoize.rb#15 - def available_locales; end - - # source://i18n//lib/i18n/backend/memoize.rb#29 - def eager_load!; end - - # source://i18n//lib/i18n/backend/memoize.rb#24 - def reload!; end - - # source://i18n//lib/i18n/backend/memoize.rb#19 - def store_translations(locale, data, options = T.unsafe(nil)); end - - protected - - # source://i18n//lib/i18n/backend/memoize.rb#37 - def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end - - # source://i18n//lib/i18n/backend/memoize.rb#44 - def memoized_lookup; end - - # source://i18n//lib/i18n/backend/memoize.rb#48 - def reset_memoizations!(locale = T.unsafe(nil)); end -end - -# source://i18n//lib/i18n/backend/metadata.rb#21 -module I18n::Backend::Metadata - # source://i18n//lib/i18n/backend/metadata.rb#52 - def interpolate(locale, entry, values = T.unsafe(nil)); end - - # source://i18n//lib/i18n/backend/metadata.rb#57 - def pluralize(locale, entry, count); end - - # source://i18n//lib/i18n/backend/metadata.rb#40 - def translate(locale, key, options = T.unsafe(nil)); end - - protected - - # source://i18n//lib/i18n/backend/metadata.rb#63 - def with_metadata(metadata, &block); end - - class << self - # @private - # - # source://i18n//lib/i18n/backend/metadata.rb#23 - def included(base); end - end -end - -# source://i18n//lib/i18n/backend/pluralization.rb#16 -module I18n::Backend::Pluralization - # Overwrites the Base backend translate method so that it will check the - # translation meta data space (:i18n) for a locale specific pluralization - # rule and use it to pluralize the given entry. I.e., the library expects - # pluralization rules to be stored at I18n.t(:'i18n.plural.rule') - # - # Pluralization rules are expected to respond to #call(count) and - # return a pluralization key. Valid keys depend on the pluralization - # rules for the locale, as defined in the CLDR. - # As of v41, 6 locale-specific plural categories are defined: - # :few, :many, :one, :other, :two, :zero - # - # n.b., The :one plural category does not imply the number 1. - # Instead, :one is a category for any number that behaves like 1 in - # that locale. For example, in some locales, :one is used for numbers - # that end in "1" (like 1, 21, 151) but that don't end in - # 11 (like 11, 111, 10311). - # Similar notes apply to the :two, and :zero plural categories. - # - # If you want to have different strings for the categories of count == 0 - # (e.g. "I don't have any cars") or count == 1 (e.g. "I have a single car") - # use the explicit `"0"` and `"1"` keys. - # https://unicode-org.github.io/cldr/ldml/tr35-numbers.html#Explicit_0_1_rules - # - # source://i18n//lib/i18n/backend/pluralization.rb#39 - def pluralize(locale, entry, count); end - - protected - - # source://i18n//lib/i18n/backend/pluralization.rb#81 - def pluralizer(locale); end - - # source://i18n//lib/i18n/backend/pluralization.rb#77 - def pluralizers; end - - private - - # Normalizes categories of 0.0 and 1.0 - # and returns the symbolic version - # - # source://i18n//lib/i18n/backend/pluralization.rb#89 - def symbolic_count(count); end -end - -# A simple backend that reads translations from YAML files and stores them in -# an in-memory hash. Relies on the Base backend. -# -# The implementation is provided by a Implementation module allowing to easily -# extend Simple backend's behavior by including modules. E.g.: -# -# module I18n::Backend::Pluralization -# def pluralize(*args) -# # extended pluralization logic -# super -# end -# end -# -# I18n::Backend::Simple.include(I18n::Backend::Pluralization) -# -# source://i18n//lib/i18n/backend/simple.rb#21 -class I18n::Backend::Simple - include ::I18n::Backend::Transliterator - include ::I18n::Backend::Base - include ::I18n::Backend::Simple::Implementation -end - -# source://i18n//lib/i18n/backend/simple.rb#22 -module I18n::Backend::Simple::Implementation - include ::I18n::Backend::Transliterator - include ::I18n::Backend::Base - - # Get available locales from the translations hash - # - # source://i18n//lib/i18n/backend/simple.rb#49 - def available_locales; end - - # source://i18n//lib/i18n/backend/simple.rb#64 - def eager_load!; end - - # @return [Boolean] - # - # source://i18n//lib/i18n/backend/simple.rb#28 - def initialized?; end - - # Clean up translations hash and set initialized to false on reload! - # - # source://i18n//lib/i18n/backend/simple.rb#58 - def reload!; end - - # Stores translations for the given locale in memory. - # This uses a deep merge for the translations hash, so existing - # translations will be overwritten by new ones only at the deepest - # level of the hash. - # - # source://i18n//lib/i18n/backend/simple.rb#36 - def store_translations(locale, data, options = T.unsafe(nil)); end - - # source://i18n//lib/i18n/backend/simple.rb#69 - def translations(do_init: T.unsafe(nil)); end - - protected - - # source://i18n//lib/i18n/backend/simple.rb#83 - def init_translations; end - - # Looks up a translation from the translations hash. Returns nil if - # either key is nil, or locale, scope or key do not exist as a key in the - # nested translations hash. Splits keys or scopes containing dots - # into multiple keys, i.e. currency.format is regarded the same as - # %w(currency format). - # - # source://i18n//lib/i18n/backend/simple.rb#93 - def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end -end - -# Mutex to ensure that concurrent translations loading will be thread-safe -# -# source://i18n//lib/i18n/backend/simple.rb#26 -I18n::Backend::Simple::Implementation::MUTEX = T.let(T.unsafe(nil), Thread::Mutex) - -# source://i18n//lib/i18n/backend/transliterator.rb#6 -module I18n::Backend::Transliterator - # Given a locale and a UTF-8 string, return the locale's ASCII - # approximation for the string. - # - # source://i18n//lib/i18n/backend/transliterator.rb#11 - def transliterate(locale, string, replacement = T.unsafe(nil)); end - - class << self - # Get a transliterator instance. - # - # source://i18n//lib/i18n/backend/transliterator.rb#19 - def get(rule = T.unsafe(nil)); end - end -end - -# source://i18n//lib/i18n/backend/transliterator.rb#7 -I18n::Backend::Transliterator::DEFAULT_REPLACEMENT_CHAR = T.let(T.unsafe(nil), String) - -# A transliterator which accepts a Hash of characters as its translation -# rule. -# -# source://i18n//lib/i18n/backend/transliterator.rb#42 -class I18n::Backend::Transliterator::HashTransliterator - # @return [HashTransliterator] a new instance of HashTransliterator - # - # source://i18n//lib/i18n/backend/transliterator.rb#74 - def initialize(rule = T.unsafe(nil)); end - - # source://i18n//lib/i18n/backend/transliterator.rb#80 - def transliterate(string, replacement = T.unsafe(nil)); end - - private - - # Add transliteration rules to the approximations hash. - # - # source://i18n//lib/i18n/backend/transliterator.rb#100 - def add(hash); end - - # source://i18n//lib/i18n/backend/transliterator.rb#93 - def add_default_approximations; end - - # source://i18n//lib/i18n/backend/transliterator.rb#89 - def approximations; end -end - -# source://i18n//lib/i18n/backend/transliterator.rb#43 -I18n::Backend::Transliterator::HashTransliterator::DEFAULT_APPROXIMATIONS = T.let(T.unsafe(nil), Hash) - -# A transliterator which accepts a Proc as its transliteration rule. -# -# source://i18n//lib/i18n/backend/transliterator.rb#30 -class I18n::Backend::Transliterator::ProcTransliterator - # @return [ProcTransliterator] a new instance of ProcTransliterator - # - # source://i18n//lib/i18n/backend/transliterator.rb#31 - def initialize(rule); end - - # source://i18n//lib/i18n/backend/transliterator.rb#35 - def transliterate(string, replacement = T.unsafe(nil)); end -end - -# source://i18n//lib/i18n.rb#54 -module I18n::Base - # source://i18n//lib/i18n.rb#69 - def available_locales; end - - # source://i18n//lib/i18n.rb#73 - def available_locales=(value); end - - # @return [Boolean] - # - # source://i18n//lib/i18n.rb#355 - def available_locales_initialized?; end - - # source://i18n//lib/i18n.rb#69 - def backend; end - - # source://i18n//lib/i18n.rb#73 - def backend=(value); end - - # Gets I18n configuration object. - # - # source://i18n//lib/i18n.rb#56 - def config; end - - # Sets I18n configuration object. - # - # source://i18n//lib/i18n.rb#61 - def config=(value); end - - # source://i18n//lib/i18n.rb#69 - def default_locale; end - - # source://i18n//lib/i18n.rb#73 - def default_locale=(value); end - - # source://i18n//lib/i18n.rb#69 - def default_separator; end - - # source://i18n//lib/i18n.rb#73 - def default_separator=(value); end - - # Tells the backend to load translations now. Used in situations like the - # Rails production environment. Backends can implement whatever strategy - # is useful. - # - # source://i18n//lib/i18n.rb#90 - def eager_load!; end - - # source://i18n//lib/i18n.rb#69 - def enforce_available_locales; end - - # Raises an InvalidLocale exception when the passed locale is not available. - # - # source://i18n//lib/i18n.rb#349 - def enforce_available_locales!(locale); end - - # source://i18n//lib/i18n.rb#73 - def enforce_available_locales=(value); end - - # source://i18n//lib/i18n.rb#69 - def exception_handler; end - - # source://i18n//lib/i18n.rb#73 - def exception_handler=(value); end - - # Returns true if a translation exists for a given key, otherwise returns false. - # - # @raise [Disabled] - # @return [Boolean] - # - # source://i18n//lib/i18n.rb#235 - def exists?(key, _locale = T.unsafe(nil), locale: T.unsafe(nil), **options); end - - # Localizes certain objects, such as dates and numbers to local formatting. - # - # @raise [Disabled] - # - # source://i18n//lib/i18n.rb#304 - def l(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end - - # source://i18n//lib/i18n.rb#69 - def load_path; end - - # source://i18n//lib/i18n.rb#73 - def load_path=(value); end - - # source://i18n//lib/i18n.rb#69 - def locale; end - - # source://i18n//lib/i18n.rb#73 - def locale=(value); end - - # Returns true when the passed locale, which can be either a String or a - # Symbol, is in the list of available locales. Returns false otherwise. - # - # @return [Boolean] - # - # source://i18n//lib/i18n.rb#344 - def locale_available?(locale); end - - # Localizes certain objects, such as dates and numbers to local formatting. - # - # @raise [Disabled] - # - # source://i18n//lib/i18n.rb#304 - def localize(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end - - # Merges the given locale, key and scope into a single array of keys. - # Splits keys that contain dots into multiple keys. Makes sure all - # keys are Symbols. - # - # source://i18n//lib/i18n.rb#332 - def normalize_keys(locale, key, scope, separator = T.unsafe(nil)); end - - # Tells the backend to reload translations. Used in situations like the - # Rails development environment. Backends can implement whatever strategy - # is useful. - # - # source://i18n//lib/i18n.rb#82 - def reload!; end - - # Translates, pluralizes and interpolates a given key using a given locale, - # scope, and default, as well as interpolation values. - # - # *LOOKUP* - # - # Translation data is organized as a nested hash using the upper-level keys - # as namespaces. E.g., ActionView ships with the translation: - # :date => {:formats => {:short => "%b %d"}}. - # - # Translations can be looked up at any level of this hash using the key argument - # and the scope option. E.g., in this example I18n.t :date - # returns the whole translations hash {:formats => {:short => "%b %d"}}. - # - # Key can be either a single key or a dot-separated key (both Strings and Symbols - # work). E.g., the short format can be looked up using both: - # I18n.t 'date.formats.short' - # I18n.t :'date.formats.short' - # - # Scope can be either a single key, a dot-separated key or an array of keys - # or dot-separated keys. Keys and scopes can be combined freely. So these - # examples will all look up the same short date format: - # I18n.t 'date.formats.short' - # I18n.t 'formats.short', :scope => 'date' - # I18n.t 'short', :scope => 'date.formats' - # I18n.t 'short', :scope => %w(date formats) - # - # *INTERPOLATION* - # - # Translations can contain interpolation variables which will be replaced by - # values passed to #translate as part of the options hash, with the keys matching - # the interpolation variable names. - # - # E.g., with a translation :foo => "foo %{bar}" the option - # value for the key +bar+ will be interpolated into the translation: - # I18n.t :foo, :bar => 'baz' # => 'foo baz' - # - # *PLURALIZATION* - # - # Translation data can contain pluralized translations. Pluralized translations - # are arrays of singular/plural versions of translations like ['Foo', 'Foos']. - # - # Note that I18n::Backend::Simple only supports an algorithm for English - # pluralization rules. Other algorithms can be supported by custom backends. - # - # This returns the singular version of a pluralized translation: - # I18n.t :foo, :count => 1 # => 'Foo' - # - # These both return the plural version of a pluralized translation: - # I18n.t :foo, :count => 0 # => 'Foos' - # I18n.t :foo, :count => 2 # => 'Foos' - # - # The :count option can be used both for pluralization and interpolation. - # E.g., with the translation - # :foo => ['%{count} foo', '%{count} foos'], count will - # be interpolated to the pluralized translation: - # I18n.t :foo, :count => 1 # => '1 foo' - # - # *DEFAULTS* - # - # This returns the translation for :foo or default if no translation was found: - # I18n.t :foo, :default => 'default' - # - # This returns the translation for :foo or the translation for :bar if no - # translation for :foo was found: - # I18n.t :foo, :default => :bar - # - # Returns the translation for :foo or the translation for :bar - # or default if no translations for :foo and :bar were found. - # I18n.t :foo, :default => [:bar, 'default'] - # - # *BULK LOOKUP* - # - # This returns an array with the translations for :foo and :bar. - # I18n.t [:foo, :bar] - # - # Can be used with dot-separated nested keys: - # I18n.t [:'baz.foo', :'baz.bar'] - # - # Which is the same as using a scope option: - # I18n.t [:foo, :bar], :scope => :baz - # - # *LAMBDAS* - # - # Both translations and defaults can be given as Ruby lambdas. Lambdas will be - # called and passed the key and options. - # - # E.g. assuming the key :salutation resolves to: - # lambda { |key, options| options[:gender] == 'm' ? "Mr. #{options[:name]}" : "Mrs. #{options[:name]}" } - # - # Then I18n.t(:salutation, :gender => 'w', :name => 'Smith') will result in "Mrs. Smith". - # - # Note that the string returned by lambda will go through string interpolation too, - # so the following lambda would give the same result: - # lambda { |key, options| options[:gender] == 'm' ? "Mr. %{name}" : "Mrs. %{name}" } - # - # It is recommended to use/implement lambdas in an "idempotent" way. E.g. when - # a cache layer is put in front of I18n.translate it will generate a cache key - # from the argument values passed to #translate. Therefore your lambdas should - # always return the same translations/values per unique combination of argument - # values. - # - # *Ruby 2.7+ keyword arguments warning* - # - # This method uses keyword arguments. - # There is a breaking change in ruby that produces warning with ruby 2.7 and won't work as expected with ruby 3.0 - # The "hash" parameter must be passed as keyword argument. - # - # Good: - # I18n.t(:salutation, :gender => 'w', :name => 'Smith') - # I18n.t(:salutation, **{ :gender => 'w', :name => 'Smith' }) - # I18n.t(:salutation, **any_hash) - # - # Bad: - # I18n.t(:salutation, { :gender => 'w', :name => 'Smith' }) - # I18n.t(:salutation, any_hash) - # - # @raise [Disabled] - # - # source://i18n//lib/i18n.rb#210 - def t(key = T.unsafe(nil), throw: T.unsafe(nil), raise: T.unsafe(nil), locale: T.unsafe(nil), **options); end - - # Wrapper for translate that adds :raise => true. With - # this option, if no translation is found, it will raise I18n::MissingTranslationData - # - # source://i18n//lib/i18n.rb#229 - def t!(key, **options); end - - # Translates, pluralizes and interpolates a given key using a given locale, - # scope, and default, as well as interpolation values. - # - # *LOOKUP* - # - # Translation data is organized as a nested hash using the upper-level keys - # as namespaces. E.g., ActionView ships with the translation: - # :date => {:formats => {:short => "%b %d"}}. - # - # Translations can be looked up at any level of this hash using the key argument - # and the scope option. E.g., in this example I18n.t :date - # returns the whole translations hash {:formats => {:short => "%b %d"}}. - # - # Key can be either a single key or a dot-separated key (both Strings and Symbols - # work). E.g., the short format can be looked up using both: - # I18n.t 'date.formats.short' - # I18n.t :'date.formats.short' - # - # Scope can be either a single key, a dot-separated key or an array of keys - # or dot-separated keys. Keys and scopes can be combined freely. So these - # examples will all look up the same short date format: - # I18n.t 'date.formats.short' - # I18n.t 'formats.short', :scope => 'date' - # I18n.t 'short', :scope => 'date.formats' - # I18n.t 'short', :scope => %w(date formats) - # - # *INTERPOLATION* - # - # Translations can contain interpolation variables which will be replaced by - # values passed to #translate as part of the options hash, with the keys matching - # the interpolation variable names. - # - # E.g., with a translation :foo => "foo %{bar}" the option - # value for the key +bar+ will be interpolated into the translation: - # I18n.t :foo, :bar => 'baz' # => 'foo baz' - # - # *PLURALIZATION* - # - # Translation data can contain pluralized translations. Pluralized translations - # are arrays of singular/plural versions of translations like ['Foo', 'Foos']. - # - # Note that I18n::Backend::Simple only supports an algorithm for English - # pluralization rules. Other algorithms can be supported by custom backends. - # - # This returns the singular version of a pluralized translation: - # I18n.t :foo, :count => 1 # => 'Foo' - # - # These both return the plural version of a pluralized translation: - # I18n.t :foo, :count => 0 # => 'Foos' - # I18n.t :foo, :count => 2 # => 'Foos' - # - # The :count option can be used both for pluralization and interpolation. - # E.g., with the translation - # :foo => ['%{count} foo', '%{count} foos'], count will - # be interpolated to the pluralized translation: - # I18n.t :foo, :count => 1 # => '1 foo' - # - # *DEFAULTS* - # - # This returns the translation for :foo or default if no translation was found: - # I18n.t :foo, :default => 'default' - # - # This returns the translation for :foo or the translation for :bar if no - # translation for :foo was found: - # I18n.t :foo, :default => :bar - # - # Returns the translation for :foo or the translation for :bar - # or default if no translations for :foo and :bar were found. - # I18n.t :foo, :default => [:bar, 'default'] - # - # *BULK LOOKUP* - # - # This returns an array with the translations for :foo and :bar. - # I18n.t [:foo, :bar] - # - # Can be used with dot-separated nested keys: - # I18n.t [:'baz.foo', :'baz.bar'] - # - # Which is the same as using a scope option: - # I18n.t [:foo, :bar], :scope => :baz - # - # *LAMBDAS* - # - # Both translations and defaults can be given as Ruby lambdas. Lambdas will be - # called and passed the key and options. - # - # E.g. assuming the key :salutation resolves to: - # lambda { |key, options| options[:gender] == 'm' ? "Mr. #{options[:name]}" : "Mrs. #{options[:name]}" } - # - # Then I18n.t(:salutation, :gender => 'w', :name => 'Smith') will result in "Mrs. Smith". - # - # Note that the string returned by lambda will go through string interpolation too, - # so the following lambda would give the same result: - # lambda { |key, options| options[:gender] == 'm' ? "Mr. %{name}" : "Mrs. %{name}" } - # - # It is recommended to use/implement lambdas in an "idempotent" way. E.g. when - # a cache layer is put in front of I18n.translate it will generate a cache key - # from the argument values passed to #translate. Therefore your lambdas should - # always return the same translations/values per unique combination of argument - # values. - # - # *Ruby 2.7+ keyword arguments warning* - # - # This method uses keyword arguments. - # There is a breaking change in ruby that produces warning with ruby 2.7 and won't work as expected with ruby 3.0 - # The "hash" parameter must be passed as keyword argument. - # - # Good: - # I18n.t(:salutation, :gender => 'w', :name => 'Smith') - # I18n.t(:salutation, **{ :gender => 'w', :name => 'Smith' }) - # I18n.t(:salutation, **any_hash) - # - # Bad: - # I18n.t(:salutation, { :gender => 'w', :name => 'Smith' }) - # I18n.t(:salutation, any_hash) - # - # @raise [Disabled] - # - # source://i18n//lib/i18n.rb#210 - def translate(key = T.unsafe(nil), throw: T.unsafe(nil), raise: T.unsafe(nil), locale: T.unsafe(nil), **options); end - - # Wrapper for translate that adds :raise => true. With - # this option, if no translation is found, it will raise I18n::MissingTranslationData - # - # source://i18n//lib/i18n.rb#229 - def translate!(key, **options); end - - # Transliterates UTF-8 characters to ASCII. By default this method will - # transliterate only Latin strings to an ASCII approximation: - # - # I18n.transliterate("Ærøskøbing") - # # => "AEroskobing" - # - # I18n.transliterate("日本語") - # # => "???" - # - # It's also possible to add support for per-locale transliterations. I18n - # expects transliteration rules to be stored at - # i18n.transliterate.rule. - # - # Transliteration rules can either be a Hash or a Proc. Procs must accept a - # single string argument. Hash rules inherit the default transliteration - # rules, while Procs do not. - # - # *Examples* - # - # Setting a Hash in .yml: - # - # i18n: - # transliterate: - # rule: - # ü: "ue" - # ö: "oe" - # - # Setting a Hash using Ruby: - # - # store_translations(:de, i18n: { - # transliterate: { - # rule: { - # 'ü' => 'ue', - # 'ö' => 'oe' - # } - # } - # }) - # - # Setting a Proc: - # - # translit = lambda {|string| MyTransliterator.transliterate(string) } - # store_translations(:xx, :i18n => {:transliterate => {:rule => translit}) - # - # Transliterating strings: - # - # I18n.locale = :en - # I18n.transliterate("Jürgen") # => "Jurgen" - # I18n.locale = :de - # I18n.transliterate("Jürgen") # => "Juergen" - # I18n.transliterate("Jürgen", :locale => :en) # => "Jurgen" - # I18n.transliterate("Jürgen", :locale => :de) # => "Juergen" - # - # source://i18n//lib/i18n.rb#293 - def transliterate(key, throw: T.unsafe(nil), raise: T.unsafe(nil), locale: T.unsafe(nil), replacement: T.unsafe(nil), **options); end - - # Executes block with given I18n.locale set. - # - # source://i18n//lib/i18n.rb#315 - def with_locale(tmp_locale = T.unsafe(nil)); end - - private - - # Any exceptions thrown in translate will be sent to the @@exception_handler - # which can be a Symbol, a Proc or any other Object unless they're forced to - # be raised or thrown (MissingTranslation). - # - # If exception_handler is a Symbol then it will simply be sent to I18n as - # a method call. A Proc will simply be called. In any other case the - # method #call will be called on the exception_handler object. - # - # Examples: - # - # I18n.exception_handler = :custom_exception_handler # this is the default - # I18n.custom_exception_handler(exception, locale, key, options) # will be called like this - # - # I18n.exception_handler = lambda { |*args| ... } # a lambda - # I18n.exception_handler.call(exception, locale, key, options) # will be called like this - # - # I18n.exception_handler = I18nExceptionHandler.new # an object - # I18n.exception_handler.call(exception, locale, key, options) # will be called like this - # - # source://i18n//lib/i18n.rb#391 - def handle_exception(handling, exception, locale, key, options); end - - # source://i18n//lib/i18n.rb#409 - def normalize_key(key, separator); end - - # source://i18n//lib/i18n.rb#361 - def translate_key(key, throw, raise, locale, backend, options); end -end - -# source://i18n//lib/i18n/config.rb#6 -class I18n::Config - # Returns an array of locales for which translations are available. - # Unless you explicitly set these through I18n.available_locales= - # the call will be delegated to the backend. - # - # source://i18n//lib/i18n/config.rb#43 - def available_locales; end - - # Sets the available locales. - # - # source://i18n//lib/i18n/config.rb#57 - def available_locales=(locales); end - - # Returns true if the available_locales have been initialized - # - # @return [Boolean] - # - # source://i18n//lib/i18n/config.rb#64 - def available_locales_initialized?; end - - # Caches the available locales list as both strings and symbols in a Set, so - # that we can have faster lookups to do the available locales enforce check. - # - # source://i18n//lib/i18n/config.rb#50 - def available_locales_set; end - - # Returns the current backend. Defaults to +Backend::Simple+. - # - # source://i18n//lib/i18n/config.rb#20 - def backend; end - - # Sets the current backend. Used to set a custom backend. - # - # source://i18n//lib/i18n/config.rb#25 - def backend=(backend); end - - # Clears the available locales set so it can be recomputed again after I18n - # gets reloaded. - # - # source://i18n//lib/i18n/config.rb#70 - def clear_available_locales_set; end - - # Returns the current default locale. Defaults to :'en' - # - # source://i18n//lib/i18n/config.rb#30 - def default_locale; end - - # Sets the current default locale. Used to set a custom default locale. - # - # source://i18n//lib/i18n/config.rb#35 - def default_locale=(locale); end - - # Returns the current default scope separator. Defaults to '.' - # - # source://i18n//lib/i18n/config.rb#75 - def default_separator; end - - # Sets the current default scope separator. - # - # source://i18n//lib/i18n/config.rb#80 - def default_separator=(separator); end - - # source://i18n//lib/i18n/config.rb#141 - def enforce_available_locales; end - - # source://i18n//lib/i18n/config.rb#145 - def enforce_available_locales=(enforce_available_locales); end - - # Returns the current exception handler. Defaults to an instance of - # I18n::ExceptionHandler. - # - # source://i18n//lib/i18n/config.rb#86 - def exception_handler; end - - # Sets the exception handler. - # - # source://i18n//lib/i18n/config.rb#91 - def exception_handler=(exception_handler); end - - # Returns the current interpolation patterns. Defaults to - # I18n::DEFAULT_INTERPOLATION_PATTERNS. - # - # source://i18n//lib/i18n/config.rb#151 - def interpolation_patterns; end - - # Sets the current interpolation patterns. Used to set a interpolation - # patterns. - # - # E.g. using {{}} as a placeholder like "{{hello}}, world!": - # - # I18n.config.interpolation_patterns << /\{\{(\w+)\}\}/ - # - # source://i18n//lib/i18n/config.rb#161 - def interpolation_patterns=(interpolation_patterns); end - - # Allow clients to register paths providing translation data sources. The - # backend defines acceptable sources. - # - # E.g. the provided SimpleBackend accepts a list of paths to translation - # files which are either named *.rb and contain plain Ruby Hashes or are - # named *.yml and contain YAML data. So for the SimpleBackend clients may - # register translation files like this: - # I18n.load_path << 'path/to/locale/en.yml' - # - # source://i18n//lib/i18n/config.rb#126 - def load_path; end - - # Sets the load path instance. Custom implementations are expected to - # behave like a Ruby Array. - # - # source://i18n//lib/i18n/config.rb#132 - def load_path=(load_path); end - - # The only configuration value that is not global and scoped to thread is :locale. - # It defaults to the default_locale. - # - # source://i18n//lib/i18n/config.rb#9 - def locale; end - - # Sets the current locale pseudo-globally, i.e. in the Thread.current hash. - # - # source://i18n//lib/i18n/config.rb#14 - def locale=(locale); end - - # Returns the current handler for situations when interpolation argument - # is missing. MissingInterpolationArgument will be raised by default. - # - # source://i18n//lib/i18n/config.rb#97 - def missing_interpolation_argument_handler; end - - # Sets the missing interpolation argument handler. It can be any - # object that responds to #call. The arguments that will be passed to #call - # are the same as for MissingInterpolationArgument initializer. Use +Proc.new+ - # if you don't care about arity. - # - # == Example: - # You can suppress raising an exception and return string instead: - # - # I18n.config.missing_interpolation_argument_handler = Proc.new do |key| - # "#{key} is missing" - # end - # - # source://i18n//lib/i18n/config.rb#114 - def missing_interpolation_argument_handler=(exception_handler); end -end - -# source://i18n//lib/i18n/interpolate/ruby.rb#7 -I18n::DEFAULT_INTERPOLATION_PATTERNS = T.let(T.unsafe(nil), Array) - -# source://i18n//lib/i18n/exceptions.rb#18 -class I18n::Disabled < ::I18n::ArgumentError - # @return [Disabled] a new instance of Disabled - # - # source://i18n//lib/i18n/exceptions.rb#19 - def initialize(method); end -end - -# source://i18n//lib/i18n.rb#35 -I18n::EMPTY_HASH = T.let(T.unsafe(nil), Hash) - -# source://i18n//lib/i18n/exceptions.rb#6 -class I18n::ExceptionHandler - # source://i18n//lib/i18n/exceptions.rb#7 - def call(exception, _locale, _key, _options); end -end - -# source://i18n//lib/i18n/gettext.rb#4 -module I18n::Gettext - class << self - # source://i18n//lib/i18n/gettext.rb#21 - def extract_scope(msgid, separator); end - - # returns an array of plural keys for the given locale or the whole hash - # of locale mappings to plural keys so that we can convert from gettext's - # integer-index based style - # TODO move this information to the pluralization module - # - # source://i18n//lib/i18n/gettext.rb#17 - def plural_keys(*args); end - end -end - -# source://i18n//lib/i18n/gettext.rb#6 -I18n::Gettext::CONTEXT_SEPARATOR = T.let(T.unsafe(nil), String) - -# Implements classical Gettext style accessors. To use this include the -# module to the global namespace or wherever you want to use it. -# -# include I18n::Gettext::Helpers -# -# source://i18n//lib/i18n/gettext/helpers.rb#11 -module I18n::Gettext::Helpers - # Makes dynamic translation messages readable for the gettext parser. - # _(fruit) cannot be understood by the gettext parser. To help the parser find all your translations, - # you can add fruit = N_("Apple") which does not translate, but tells the parser: "Apple" needs translation. - # * msgid: the message id. - # * Returns: msgid. - # - # source://i18n//lib/i18n/gettext/helpers.rb#17 - def N_(msgsid); end - - # source://i18n//lib/i18n/gettext/helpers.rb#21 - def _(msgid, options = T.unsafe(nil)); end - - # source://i18n//lib/i18n/gettext/helpers.rb#21 - def gettext(msgid, options = T.unsafe(nil)); end - - # source://i18n//lib/i18n/gettext/helpers.rb#38 - def n_(msgid, msgid_plural, n = T.unsafe(nil)); end - - # source://i18n//lib/i18n/gettext/helpers.rb#38 - def ngettext(msgid, msgid_plural, n = T.unsafe(nil)); end - - # Method signatures: - # npgettext('Fruits', 'apple', 'apples', 2) - # npgettext('Fruits', ['apple', 'apples'], 2) - # - # source://i18n//lib/i18n/gettext/helpers.rb#61 - def np_(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end - - # Method signatures: - # npgettext('Fruits', 'apple', 'apples', 2) - # npgettext('Fruits', ['apple', 'apples'], 2) - # - # source://i18n//lib/i18n/gettext/helpers.rb#61 - def npgettext(msgctxt, msgid, msgid_plural, n = T.unsafe(nil)); end - - # Method signatures: - # nsgettext('Fruits|apple', 'apples', 2) - # nsgettext(['Fruits|apple', 'apples'], 2) - # - # source://i18n//lib/i18n/gettext/helpers.rb#46 - def ns_(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end - - # Method signatures: - # nsgettext('Fruits|apple', 'apples', 2) - # nsgettext(['Fruits|apple', 'apples'], 2) - # - # source://i18n//lib/i18n/gettext/helpers.rb#46 - def nsgettext(msgid, msgid_plural, n = T.unsafe(nil), separator = T.unsafe(nil)); end - - # source://i18n//lib/i18n/gettext/helpers.rb#32 - def p_(msgctxt, msgid); end - - # source://i18n//lib/i18n/gettext/helpers.rb#32 - def pgettext(msgctxt, msgid); end - - # source://i18n//lib/i18n/gettext/helpers.rb#26 - def s_(msgid, separator = T.unsafe(nil)); end - - # source://i18n//lib/i18n/gettext/helpers.rb#26 - def sgettext(msgid, separator = T.unsafe(nil)); end -end - -# source://i18n//lib/i18n/gettext.rb#5 -I18n::Gettext::PLURAL_SEPARATOR = T.let(T.unsafe(nil), String) - -# source://i18n//lib/i18n/interpolate/ruby.rb#12 -I18n::INTERPOLATION_PATTERN = T.let(T.unsafe(nil), Regexp) - -# source://i18n//lib/i18n/interpolate/ruby.rb#15 -I18n::INTERPOLATION_PATTERNS_CACHE = T.let(T.unsafe(nil), Hash) - -# source://i18n//lib/i18n/exceptions.rb#134 -class I18n::InvalidFilenames < ::I18n::ArgumentError - # @return [InvalidFilenames] a new instance of InvalidFilenames - # - # source://i18n//lib/i18n/exceptions.rb#136 - def initialize(file_errors); end -end - -# source://i18n//lib/i18n/exceptions.rb#135 -I18n::InvalidFilenames::NUMBER_OF_ERRORS_SHOWN = T.let(T.unsafe(nil), Integer) - -# source://i18n//lib/i18n/exceptions.rb#32 -class I18n::InvalidLocale < ::I18n::ArgumentError - # @return [InvalidLocale] a new instance of InvalidLocale - # - # source://i18n//lib/i18n/exceptions.rb#34 - def initialize(locale); end - - # Returns the value of attribute locale. - # - # source://i18n//lib/i18n/exceptions.rb#33 - def locale; end -end - -# source://i18n//lib/i18n/exceptions.rb#40 -class I18n::InvalidLocaleData < ::I18n::ArgumentError - # @return [InvalidLocaleData] a new instance of InvalidLocaleData - # - # source://i18n//lib/i18n/exceptions.rb#42 - def initialize(filename, exception_message); end - - # Returns the value of attribute filename. - # - # source://i18n//lib/i18n/exceptions.rb#41 - def filename; end -end - -# source://i18n//lib/i18n/exceptions.rb#92 -class I18n::InvalidPluralizationData < ::I18n::ArgumentError - # @return [InvalidPluralizationData] a new instance of InvalidPluralizationData - # - # source://i18n//lib/i18n/exceptions.rb#94 - def initialize(entry, count, key); end - - # Returns the value of attribute count. - # - # source://i18n//lib/i18n/exceptions.rb#93 - def count; end - - # Returns the value of attribute entry. - # - # source://i18n//lib/i18n/exceptions.rb#93 - def entry; end - - # Returns the value of attribute key. - # - # source://i18n//lib/i18n/exceptions.rb#93 - def key; end -end - -# source://i18n//lib/i18n/backend/key_value.rb#21 -I18n::JSON = ActiveSupport::JSON - -# source://i18n//lib/i18n/locale.rb#4 -module I18n::Locale; end - -# source://i18n//lib/i18n/locale/fallbacks.rb#48 -class I18n::Locale::Fallbacks < ::Hash - # @return [Fallbacks] a new instance of Fallbacks - # - # source://i18n//lib/i18n/locale/fallbacks.rb#49 - def initialize(*mappings); end - - # @raise [InvalidLocale] - # - # source://i18n//lib/i18n/locale/fallbacks.rb#60 - def [](locale); end - - # Returns the value of attribute defaults. - # - # source://i18n//lib/i18n/locale/fallbacks.rb#58 - def defaults; end - - # source://i18n//lib/i18n/locale/fallbacks.rb#55 - def defaults=(defaults); end - - # source://i18n//lib/i18n/locale/fallbacks.rb#67 - def map(*args, &block); end - - protected - - # source://i18n//lib/i18n/locale/fallbacks.rb#84 - def compute(tags, include_defaults = T.unsafe(nil), exclude = T.unsafe(nil)); end -end - -# source://i18n//lib/i18n/locale/tag.rb#5 -module I18n::Locale::Tag - class << self - # Returns the current locale tag implementation. Defaults to +I18n::Locale::Tag::Simple+. - # - # source://i18n//lib/i18n/locale/tag.rb#12 - def implementation; end - - # Sets the current locale tag implementation. Use this to set a different locale tag implementation. - # - # source://i18n//lib/i18n/locale/tag.rb#17 - def implementation=(implementation); end - - # Factory method for locale tags. Delegates to the current locale tag implementation. - # - # source://i18n//lib/i18n/locale/tag.rb#22 - def tag(tag); end - end -end - -# source://i18n//lib/i18n/locale/tag/parents.rb#4 -module I18n::Locale::Tag::Parents - # source://i18n//lib/i18n/locale/tag/parents.rb#5 - def parent; end - - # source://i18n//lib/i18n/locale/tag/parents.rb#18 - def parents; end - - # source://i18n//lib/i18n/locale/tag/parents.rb#14 - def self_and_parents; end -end - -# source://i18n//lib/i18n/locale/tag/rfc4646.rb#12 -I18n::Locale::Tag::RFC4646_FORMATS = T.let(T.unsafe(nil), Hash) - -# source://i18n//lib/i18n/locale/tag/rfc4646.rb#11 -I18n::Locale::Tag::RFC4646_SUBTAGS = T.let(T.unsafe(nil), Array) - -# source://i18n//lib/i18n/locale/tag/rfc4646.rb#14 -class I18n::Locale::Tag::Rfc4646 < ::Struct - include ::I18n::Locale::Tag::Parents - - # source://i18n//lib/i18n/locale/tag/rfc4646.rb#35 - def language; end - - # source://i18n//lib/i18n/locale/tag/rfc4646.rb#35 - def region; end - - # source://i18n//lib/i18n/locale/tag/rfc4646.rb#35 - def script; end - - # source://i18n//lib/i18n/locale/tag/rfc4646.rb#46 - def to_a; end - - # source://i18n//lib/i18n/locale/tag/rfc4646.rb#42 - def to_s; end - - # source://i18n//lib/i18n/locale/tag/rfc4646.rb#38 - def to_sym; end - - # source://i18n//lib/i18n/locale/tag/rfc4646.rb#35 - def variant; end - - class << self - # source://i18n//lib/i18n/locale/tag/rfc4646.rb#23 - def parser; end - - # source://i18n//lib/i18n/locale/tag/rfc4646.rb#27 - def parser=(parser); end - - # Parses the given tag and returns a Tag instance if it is valid. - # Returns false if the given tag is not valid according to RFC 4646. - # - # source://i18n//lib/i18n/locale/tag/rfc4646.rb#18 - def tag(tag); end - end -end - -# source://i18n//lib/i18n/locale/tag/rfc4646.rb#50 -module I18n::Locale::Tag::Rfc4646::Parser - class << self - # source://i18n//lib/i18n/locale/tag/rfc4646.rb#63 - def match(tag); end - end -end - -# source://i18n//lib/i18n/locale/tag/rfc4646.rb#51 -I18n::Locale::Tag::Rfc4646::Parser::PATTERN = T.let(T.unsafe(nil), Regexp) - -# source://i18n//lib/i18n/locale/tag/simple.rb#6 -class I18n::Locale::Tag::Simple - include ::I18n::Locale::Tag::Parents - - # @return [Simple] a new instance of Simple - # - # source://i18n//lib/i18n/locale/tag/simple.rb#17 - def initialize(*tag); end - - # source://i18n//lib/i18n/locale/tag/simple.rb#21 - def subtags; end - - # Returns the value of attribute tag. - # - # source://i18n//lib/i18n/locale/tag/simple.rb#15 - def tag; end - - # source://i18n//lib/i18n/locale/tag/simple.rb#33 - def to_a; end - - # source://i18n//lib/i18n/locale/tag/simple.rb#29 - def to_s; end - - # source://i18n//lib/i18n/locale/tag/simple.rb#25 - def to_sym; end - - class << self - # source://i18n//lib/i18n/locale/tag/simple.rb#8 - def tag(tag); end - end -end - -# source://i18n//lib/i18n/middleware.rb#4 -class I18n::Middleware - # @return [Middleware] a new instance of Middleware - # - # source://i18n//lib/i18n/middleware.rb#6 - def initialize(app); end - - # source://i18n//lib/i18n/middleware.rb#10 - def call(env); end -end - -# source://i18n//lib/i18n/exceptions.rb#100 -class I18n::MissingInterpolationArgument < ::I18n::ArgumentError - # @return [MissingInterpolationArgument] a new instance of MissingInterpolationArgument - # - # source://i18n//lib/i18n/exceptions.rb#102 - def initialize(key, values, string); end - - # Returns the value of attribute key. - # - # source://i18n//lib/i18n/exceptions.rb#101 - def key; end - - # Returns the value of attribute string. - # - # source://i18n//lib/i18n/exceptions.rb#101 - def string; end - - # Returns the value of attribute values. - # - # source://i18n//lib/i18n/exceptions.rb#101 - def values; end -end - -# source://i18n//lib/i18n/exceptions.rb#48 -class I18n::MissingTranslation < ::I18n::ArgumentError - include ::I18n::MissingTranslation::Base -end - -# source://i18n//lib/i18n/exceptions.rb#49 -module I18n::MissingTranslation::Base - # source://i18n//lib/i18n/exceptions.rb#54 - def initialize(locale, key, options = T.unsafe(nil)); end - - # Returns the value of attribute key. - # - # source://i18n//lib/i18n/exceptions.rb#52 - def key; end - - # source://i18n//lib/i18n/exceptions.rb#59 - def keys; end - - # Returns the value of attribute locale. - # - # source://i18n//lib/i18n/exceptions.rb#52 - def locale; end - - # source://i18n//lib/i18n/exceptions.rb#65 - def message; end - - # source://i18n//lib/i18n/exceptions.rb#74 - def normalized_option(key); end - - # Returns the value of attribute options. - # - # source://i18n//lib/i18n/exceptions.rb#52 - def options; end - - # source://i18n//lib/i18n/exceptions.rb#80 - def to_exception; end - - # source://i18n//lib/i18n/exceptions.rb#65 - def to_s; end -end - -# source://i18n//lib/i18n/exceptions.rb#50 -I18n::MissingTranslation::Base::PERMITTED_KEYS = T.let(T.unsafe(nil), Array) - -# source://i18n//lib/i18n/exceptions.rb#88 -class I18n::MissingTranslationData < ::I18n::ArgumentError - include ::I18n::MissingTranslation::Base -end - -# source://i18n//lib/i18n.rb#19 -I18n::RESERVED_KEYS = T.let(T.unsafe(nil), Array) - -# source://i18n//lib/i18n/exceptions.rb#108 -class I18n::ReservedInterpolationKey < ::I18n::ArgumentError - # @return [ReservedInterpolationKey] a new instance of ReservedInterpolationKey - # - # source://i18n//lib/i18n/exceptions.rb#110 - def initialize(key, string); end - - # Returns the value of attribute key. - # - # source://i18n//lib/i18n/exceptions.rb#109 - def key; end - - # Returns the value of attribute string. - # - # source://i18n//lib/i18n/exceptions.rb#109 - def string; end -end - -# source://i18n//lib/i18n/tests.rb#4 -module I18n::Tests; end - -# source://i18n//lib/i18n/tests/localization.rb#3 -module I18n::Tests::Localization - class << self - # @private - # - # source://i18n//lib/i18n/tests/localization.rb#9 - def included(base); end - end -end - -# source://i18n//lib/i18n/exceptions.rb#116 -class I18n::UnknownFileType < ::I18n::ArgumentError - # @return [UnknownFileType] a new instance of UnknownFileType - # - # source://i18n//lib/i18n/exceptions.rb#118 - def initialize(type, filename); end - - # Returns the value of attribute filename. - # - # source://i18n//lib/i18n/exceptions.rb#117 - def filename; end - - # Returns the value of attribute type. - # - # source://i18n//lib/i18n/exceptions.rb#117 - def type; end -end - -# source://i18n//lib/i18n/exceptions.rb#124 -class I18n::UnsupportedMethod < ::I18n::ArgumentError - # @return [UnsupportedMethod] a new instance of UnsupportedMethod - # - # source://i18n//lib/i18n/exceptions.rb#126 - def initialize(method, backend_klass, msg); end - - # Returns the value of attribute backend_klass. - # - # source://i18n//lib/i18n/exceptions.rb#125 - def backend_klass; end - - # Returns the value of attribute method. - # - # source://i18n//lib/i18n/exceptions.rb#125 - def method; end - - # Returns the value of attribute msg. - # - # source://i18n//lib/i18n/exceptions.rb#125 - def msg; end -end - -# source://i18n//lib/i18n/utils.rb#4 -module I18n::Utils - class << self - # source://i18n//lib/i18n/utils.rb#18 - def deep_merge(hash, other_hash, &block); end - - # source://i18n//lib/i18n/utils.rb#22 - def deep_merge!(hash, other_hash, &block); end - - # source://i18n//lib/i18n/utils.rb#34 - def deep_symbolize_keys(hash); end - - # source://i18n//lib/i18n/utils.rb#7 - def except(hash, *keys); end - - private - - # source://i18n//lib/i18n/utils.rb#43 - def deep_symbolize_keys_in_object(value); end - end -end - -# source://i18n//lib/i18n/version.rb#4 -I18n::VERSION = T.let(T.unsafe(nil), String) diff --git a/Library/Homebrew/sorbet/rbi/gems/rack@3.0.8.rbi b/Library/Homebrew/sorbet/rbi/gems/rack@3.0.8.rbi deleted file mode 100644 index 1b8c57e096..0000000000 --- a/Library/Homebrew/sorbet/rbi/gems/rack@3.0.8.rbi +++ /dev/null @@ -1,5183 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `rack` gem. -# Please instead update this file by running `bin/tapioca gem rack`. - -# The Rack main module, serving as a namespace for all core Rack -# modules and classes. -# -# All modules meant for use in your application are autoloaded here, -# so it should be enough just to require 'rack' in your code. -# -# source://rack//lib/rack/query_parser.rb#5 -module Rack - class << self - # Return the Rack release as a dotted string. - # - # source://rack//lib/rack/version.rb#31 - def release; end - - # The Rack protocol version number implemented. - # - # source://rack//lib/rack/version.rb#23 - def version; end - end -end - -# source://rack//lib/rack.rb#65 -module Rack::Auth; end - -# Rack::Auth::AbstractHandler implements common authentication functionality. -# -# +realm+ should be set for all handlers. -# -# source://rack//lib/rack/auth/abstract/handler.rb#11 -class Rack::Auth::AbstractHandler - # @return [AbstractHandler] a new instance of AbstractHandler - # - # source://rack//lib/rack/auth/abstract/handler.rb#15 - def initialize(app, realm = T.unsafe(nil), &authenticator); end - - # Returns the value of attribute realm. - # - # source://rack//lib/rack/auth/abstract/handler.rb#13 - def realm; end - - # Sets the attribute realm - # - # @param value the value to set the attribute realm to. - # - # source://rack//lib/rack/auth/abstract/handler.rb#13 - def realm=(_arg0); end - - private - - # source://rack//lib/rack/auth/abstract/handler.rb#31 - def bad_request; end - - # source://rack//lib/rack/auth/abstract/handler.rb#22 - def unauthorized(www_authenticate = T.unsafe(nil)); end -end - -# source://rack//lib/rack/auth/abstract/request.rb#7 -class Rack::Auth::AbstractRequest - # @return [AbstractRequest] a new instance of AbstractRequest - # - # source://rack//lib/rack/auth/abstract/request.rb#9 - def initialize(env); end - - # source://rack//lib/rack/auth/abstract/request.rb#33 - def params; end - - # source://rack//lib/rack/auth/abstract/request.rb#25 - def parts; end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/abstract/request.rb#17 - def provided?; end - - # source://rack//lib/rack/auth/abstract/request.rb#13 - def request; end - - # source://rack//lib/rack/auth/abstract/request.rb#29 - def scheme; end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/abstract/request.rb#21 - def valid?; end - - private - - # source://rack//lib/rack/auth/abstract/request.rb#42 - def authorization_key; end -end - -# source://rack//lib/rack/auth/abstract/request.rb#40 -Rack::Auth::AbstractRequest::AUTHORIZATION_KEYS = T.let(T.unsafe(nil), Array) - -# Rack::Auth::Basic implements HTTP Basic Authentication, as per RFC 2617. -# -# Initialize with the Rack application that you want protecting, -# and a block that checks if a username and password pair are valid. -# -# source://rack//lib/rack/auth/basic.rb#14 -class Rack::Auth::Basic < ::Rack::Auth::AbstractHandler - # source://rack//lib/rack/auth/basic.rb#16 - def call(env); end - - private - - # source://rack//lib/rack/auth/basic.rb#35 - def challenge; end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/basic.rb#39 - def valid?(auth); end -end - -# source://rack//lib/rack/auth/basic.rb#43 -class Rack::Auth::Basic::Request < ::Rack::Auth::AbstractRequest - # @return [Boolean] - # - # source://rack//lib/rack/auth/basic.rb#44 - def basic?; end - - # source://rack//lib/rack/auth/basic.rb#48 - def credentials; end - - # source://rack//lib/rack/auth/basic.rb#52 - def username; end -end - -# source://rack//lib/rack/auth/digest.rb#12 -module Rack::Auth::Digest; end - -# Rack::Auth::Digest::MD5 implements the MD5 algorithm version of -# HTTP Digest Authentication, as per RFC 2617. -# -# Initialize with the [Rack] application that you want protecting, -# and a block that looks up a plaintext password for a given username. -# -# +opaque+ needs to be set to a constant base64/hexadecimal string. -# -# source://rack//lib/rack/auth/digest.rb#144 -class Rack::Auth::Digest::MD5 < ::Rack::Auth::AbstractHandler - # @return [MD5] a new instance of MD5 - # - # source://rack//lib/rack/auth/digest.rb#150 - def initialize(app, realm = T.unsafe(nil), opaque = T.unsafe(nil), &authenticator); end - - # source://rack//lib/rack/auth/digest.rb#163 - def call(env); end - - # Returns the value of attribute opaque. - # - # source://rack//lib/rack/auth/digest.rb#146 - def opaque; end - - # Sets the attribute opaque - # - # @param value the value to set the attribute opaque to. - # - # source://rack//lib/rack/auth/digest.rb#146 - def opaque=(_arg0); end - - # Sets the attribute passwords_hashed - # - # @param value the value to set the attribute passwords_hashed to. - # - # source://rack//lib/rack/auth/digest.rb#148 - def passwords_hashed=(_arg0); end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#159 - def passwords_hashed?; end - - private - - # source://rack//lib/rack/auth/digest.rb#238 - def A1(auth, password); end - - # source://rack//lib/rack/auth/digest.rb#242 - def A2(auth); end - - # source://rack//lib/rack/auth/digest.rb#228 - def H(data); end - - # source://rack//lib/rack/auth/digest.rb#234 - def KD(secret, data); end - - # source://rack//lib/rack/auth/digest.rb#203 - def challenge(hash = T.unsafe(nil)); end - - # source://rack//lib/rack/auth/digest.rb#246 - def digest(auth, password); end - - # source://rack//lib/rack/auth/digest.rb#228 - def md5(data); end - - # source://rack//lib/rack/auth/digest.rb#192 - def params(hash = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#207 - def valid?(auth); end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#223 - def valid_digest?(auth); end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#219 - def valid_nonce?(auth); end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#215 - def valid_opaque?(auth); end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#211 - def valid_qop?(auth); end -end - -# source://rack//lib/rack/auth/digest.rb#190 -Rack::Auth::Digest::MD5::QOP = T.let(T.unsafe(nil), String) - -# Rack::Auth::Digest::Nonce is the default nonce generator for the -# Rack::Auth::Digest::MD5 authentication handler. -# -# +private_key+ needs to set to a constant string. -# -# +time_limit+ can be optionally set to an integer (number of seconds), -# to limit the validity of the generated nonces. -# -# source://rack//lib/rack/auth/digest.rb#21 -class Rack::Auth::Digest::Nonce - # @return [Nonce] a new instance of Nonce - # - # source://rack//lib/rack/auth/digest.rb#31 - def initialize(timestamp = T.unsafe(nil), given_digest = T.unsafe(nil)); end - - # source://rack//lib/rack/auth/digest.rb#39 - def digest; end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#51 - def fresh?; end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#47 - def stale?; end - - # source://rack//lib/rack/auth/digest.rb#35 - def to_s; end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#43 - def valid?; end - - class << self - # source://rack//lib/rack/auth/digest.rb#27 - def parse(string); end - - # Returns the value of attribute private_key. - # - # source://rack//lib/rack/auth/digest.rb#24 - def private_key; end - - # Sets the attribute private_key - # - # @param value the value to set the attribute private_key to. - # - # source://rack//lib/rack/auth/digest.rb#24 - def private_key=(_arg0); end - - # Returns the value of attribute time_limit. - # - # source://rack//lib/rack/auth/digest.rb#24 - def time_limit; end - - # Sets the attribute time_limit - # - # @param value the value to set the attribute time_limit to. - # - # source://rack//lib/rack/auth/digest.rb#24 - def time_limit=(_arg0); end - end -end - -# source://rack//lib/rack/auth/digest.rb#57 -class Rack::Auth::Digest::Params < ::Hash - # @return [Params] a new instance of Params - # @yield [_self] - # @yieldparam _self [Rack::Auth::Digest::Params] the object that the method was called on - # - # source://rack//lib/rack/auth/digest.rb#76 - def initialize; end - - # source://rack//lib/rack/auth/digest.rb#82 - def [](k); end - - # source://rack//lib/rack/auth/digest.rb#86 - def []=(k, v); end - - # From WEBrick::HTTPUtils - # - # source://rack//lib/rack/auth/digest.rb#98 - def quote(str); end - - # source://rack//lib/rack/auth/digest.rb#92 - def to_s; end - - class << self - # From WEBrick::HTTPUtils - # - # source://rack//lib/rack/auth/digest.rb#66 - def dequote(str); end - - # source://rack//lib/rack/auth/digest.rb#59 - def parse(str); end - - # source://rack//lib/rack/auth/digest.rb#72 - def split_header_value(str); end - end -end - -# source://rack//lib/rack/auth/digest.rb#90 -Rack::Auth::Digest::Params::UNQUOTED = T.let(T.unsafe(nil), Array) - -# source://rack//lib/rack/auth/digest.rb#104 -class Rack::Auth::Digest::Request < ::Rack::Auth::AbstractRequest - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#113 - def correct_uri?; end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#109 - def digest?; end - - # source://rack//lib/rack/auth/digest.rb#105 - def method; end - - # @raise [ArgumentError] - # - # source://rack//lib/rack/auth/digest.rb#129 - def method_missing(sym, *args); end - - # source://rack//lib/rack/auth/digest.rb#117 - def nonce; end - - # source://rack//lib/rack/auth/digest.rb#121 - def params; end - - # @return [Boolean] - # - # source://rack//lib/rack/auth/digest.rb#125 - def respond_to?(sym, *_arg1); end -end - -# Proxy for response bodies allowing calling a block when -# the response body is closed (after the response has been fully -# sent to the client). -# -# source://rack//lib/rack/body_proxy.rb#7 -class Rack::BodyProxy - # Set the response body to wrap, and the block to call when the - # response has been fully sent. - # - # @return [BodyProxy] a new instance of BodyProxy - # - # source://rack//lib/rack/body_proxy.rb#10 - def initialize(body, &block); end - - # If not already closed, close the wrapped body and - # then call the block the proxy was initialized with. - # - # source://rack//lib/rack/body_proxy.rb#23 - def close; end - - # Whether the proxy is closed. The proxy starts as not closed, - # and becomes closed on the first call to close. - # - # @return [Boolean] - # - # source://rack//lib/rack/body_proxy.rb#35 - def closed?; end - - # Delegate missing methods to the wrapped body. - # - # source://rack//lib/rack/body_proxy.rb#40 - def method_missing(method_name, *args, **_arg2, &block); end - - private - - # Return whether the wrapped body responds to the method. - # - # @return [Boolean] - # - # source://rack//lib/rack/body_proxy.rb#17 - def respond_to_missing?(method_name, include_all = T.unsafe(nil)); end -end - -# Rack::Builder provides a domain-specific language (DSL) to construct Rack -# applications. It is primarily used to parse +config.ru+ files which -# instantiate several middleware and a final application which are hosted -# by a Rack-compatible web server. -# -# Example: -# -# app = Rack::Builder.new do -# use Rack::CommonLogger -# map "/ok" do -# run lambda { |env| [200, {'content-type' => 'text/plain'}, ['OK']] } -# end -# end -# -# run app -# -# Or -# -# app = Rack::Builder.app do -# use Rack::CommonLogger -# run lambda { |env| [200, {'content-type' => 'text/plain'}, ['OK']] } -# end -# -# run app -# -# +use+ adds middleware to the stack, +run+ dispatches to an application. -# You can use +map+ to construct a Rack::URLMap in a convenient way. -# -# source://rack//lib/rack/builder.rb#33 -class Rack::Builder - # Initialize a new Rack::Builder instance. +default_app+ specifies the - # default application if +run+ is not called later. If a block - # is given, it is evaluated in the context of the instance. - # - # @return [Builder] a new instance of Builder - # - # source://rack//lib/rack/builder.rb#111 - def initialize(default_app = T.unsafe(nil), &block); end - - # Call the Rack application generated by this builder instance. Note that - # this rebuilds the Rack application and runs the warmup code (if any) - # every time it is called, so it should not be used if performance is important. - # - # source://rack//lib/rack/builder.rb#263 - def call(env); end - - # Freeze the app (set using run) and all middleware instances when building the application - # in to_app. - # - # source://rack//lib/rack/builder.rb#246 - def freeze_app; end - - # Creates a route within the application. Routes under the mapped path will be sent to - # the Rack application specified by run inside the block. Other requests will be sent to the - # default application specified by run outside the block. - # - # class App - # def call(env) - # [200, {'content-type' => 'text/plain'}, ["Hello World"]] - # end - # end - # - # class Heartbeat - # def call(env) - # [200, { "content-type" => "text/plain" }, ["OK"]] - # end - # end - # - # app = Rack::Builder.app do - # map '/heartbeat' do - # run Heartbeat.new - # end - # run App.new - # end - # - # run app - # - # The +use+ method can also be used inside the block to specify middleware to run under a specific path: - # - # app = Rack::Builder.app do - # map '/heartbeat' do - # use Middleware - # run Heartbeat.new - # end - # run App.new - # end - # - # This example includes a piece of middleware which will run before +/heartbeat+ requests hit +Heartbeat+. - # - # Note that providing a +path+ of +/+ will ignore any default application given in a +run+ statement - # outside the block. - # - # source://rack//lib/rack/builder.rb#239 - def map(path, &block); end - - # Takes a block or argument that is an object that responds to #call and - # returns a Rack response. - # - # You can use a block: - # - # run do |env| - # [200, { "content-type" => "text/plain" }, ["Hello World!"]] - # end - # - # You can also provide a lambda: - # - # run lambda { |env| [200, { "content-type" => "text/plain" }, ["OK"]] } - # - # You can also provide a class instance: - # - # class Heartbeat - # def call(env) - # [200, { "content-type" => "text/plain" }, ["OK"]] - # end - # end - # - # run Heartbeat.new - # - # @raise [ArgumentError] - # - # source://rack//lib/rack/builder.rb#180 - def run(app = T.unsafe(nil), &block); end - - # Return the Rack application generated by this instance. - # - # source://rack//lib/rack/builder.rb#251 - def to_app; end - - # Specifies middleware to use in a stack. - # - # class Middleware - # def initialize(app) - # @app = app - # end - # - # def call(env) - # env["rack.some_header"] = "setting an example" - # @app.call(env) - # end - # end - # - # use Middleware - # run lambda { |env| [200, { "content-type" => "text/plain" }, ["OK"]] } - # - # All requests through to this application will first be processed by the middleware class. - # The +call+ method in this example sets an additional environment key which then can be - # referenced in the application if required. - # - # source://rack//lib/rack/builder.rb#146 - def use(middleware, *args, **_arg2, &block); end - - # Takes a lambda or block that is used to warm-up the application. This block is called - # before the Rack application is returned by to_app. - # - # warmup do |app| - # client = Rack::MockRequest.new(app) - # client.get('/') - # end - # - # use SomeMiddleware - # run MyApp - # - # source://rack//lib/rack/builder.rb#196 - def warmup(prc = T.unsafe(nil), &block); end - - private - - # Generate a URLMap instance by generating new Rack applications for each - # map block in this instance. - # - # source://rack//lib/rack/builder.rb#271 - def generate_map(default_app, mapping); end - - class << self - # Create a new Rack::Builder instance and return the Rack application - # generated from it. - # - # source://rack//lib/rack/builder.rb#123 - def app(default_app = T.unsafe(nil), &block); end - - # Load the given file as a rackup file, treating the - # contents as if specified inside a Rack::Builder block. - # - # Ignores content in the file after +__END__+, so that - # use of +__END__+ will not result in a syntax error. - # - # Example config.ru file: - # - # $ cat config.ru - # - # use Rack::ContentLength - # require './app.rb' - # run App - # - # source://rack//lib/rack/builder.rb#84 - def load_file(path); end - - # Evaluate the given +builder_script+ string in the context of - # a Rack::Builder block, returning a Rack application. - # - # source://rack//lib/rack/builder.rb#99 - def new_from_string(builder_script, file = T.unsafe(nil)); end - - # Parse the given config file to get a Rack application. - # - # If the config file ends in +.ru+, it is treated as a - # rackup file and the contents will be treated as if - # specified inside a Rack::Builder block. - # - # If the config file does not end in +.ru+, it is - # required and Rack will use the basename of the file - # to guess which constant will be the Rack application to run. - # - # Examples: - # - # Rack::Builder.parse_file('config.ru') - # # Rack application built using Rack::Builder.new - # - # Rack::Builder.parse_file('app.rb') - # # requires app.rb, which can be anywhere in Ruby's - # # load path. After requiring, assumes App constant - # # contains Rack application - # - # Rack::Builder.parse_file('./my_app.rb') - # # requires ./my_app.rb, which should be in the - # # process's current directory. After requiring, - # # assumes MyApp constant contains Rack application - # - # source://rack//lib/rack/builder.rb#62 - def parse_file(path); end - end -end - -# https://stackoverflow.com/questions/2223882/whats-the-difference-between-utf-8-and-utf-8-without-bom -# -# source://rack//lib/rack/builder.rb#36 -Rack::Builder::UTF_8_BOM = T.let(T.unsafe(nil), String) - -# Response Header Keys -# -# source://rack//lib/rack/constants.rb#19 -Rack::CACHE_CONTROL = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#20 -Rack::CONTENT_LENGTH = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#21 -Rack::CONTENT_TYPE = T.let(T.unsafe(nil), String) - -# Rack::Cascade tries a request on several apps, and returns the -# first response that is not 404 or 405 (or in a list of configured -# status codes). If all applications tried return one of the configured -# status codes, return the last response. -# -# source://rack//lib/rack/cascade.rb#11 -class Rack::Cascade - # Set the apps to send requests to, and what statuses result in - # cascading. Arguments: - # - # apps: An enumerable of rack applications. - # cascade_for: The statuses to use cascading for. If a response is received - # from an app, the next app is tried. - # - # @return [Cascade] a new instance of Cascade - # - # source://rack//lib/rack/cascade.rb#24 - def initialize(apps, cascade_for = T.unsafe(nil)); end - - # Append an app to the list of apps to cascade. This app will - # be tried last. - # - # source://rack//lib/rack/cascade.rb#59 - def <<(app); end - - # Append an app to the list of apps to cascade. This app will - # be tried last. - # - # source://rack//lib/rack/cascade.rb#59 - def add(app); end - - # An array of applications to try in order. - # - # source://rack//lib/rack/cascade.rb#16 - def apps; end - - # Call each app in order. If the responses uses a status that requires - # cascading, try the next app. If all responses require cascading, - # return the response from the last app. - # - # source://rack//lib/rack/cascade.rb#35 - def call(env); end - - # Whether the given app is one of the apps to cascade to. - # - # @return [Boolean] - # - # source://rack//lib/rack/cascade.rb#64 - def include?(app); end -end - -# deprecated, no longer used -# -# source://rack//lib/rack/cascade.rb#13 -Rack::Cascade::NotFound = T.let(T.unsafe(nil), Array) - -# Middleware that applies chunked transfer encoding to response bodies -# when the response does not include a content-length header. -# -# This supports the trailer response header to allow the use of trailing -# headers in the chunked encoding. However, using this requires you manually -# specify a response body that supports a +trailers+ method. Example: -# -# [200, { 'trailer' => 'expires'}, ["Hello", "World"]] -# # error raised -# -# body = ["Hello", "World"] -# def body.trailers -# { 'expires' => Time.now.to_s } -# end -# [200, { 'trailer' => 'expires'}, body] -# # No exception raised -# -# source://rack//lib/rack/chunked.rb#25 -class Rack::Chunked - include ::Rack::Utils - - # @return [Chunked] a new instance of Chunked - # - # source://rack//lib/rack/chunked.rb#82 - def initialize(app); end - - # If the rack app returns a response that should have a body, - # but does not have content-length or transfer-encoding headers, - # modify the response to use chunked transfer-encoding. - # - # source://rack//lib/rack/chunked.rb#101 - def call(env); end - - # Whether the HTTP version supports chunked encoding (HTTP 1.1 does). - # - # @return [Boolean] - # - # source://rack//lib/rack/chunked.rb#87 - def chunkable_version?(ver); end -end - -# A body wrapper that emits chunked responses. -# -# source://rack//lib/rack/chunked.rb#29 -class Rack::Chunked::Body - # Store the response body to be chunked. - # - # @return [Body] a new instance of Body - # - # source://rack//lib/rack/chunked.rb#34 - def initialize(body); end - - # Close the response body if the response body supports it. - # - # source://rack//lib/rack/chunked.rb#54 - def close; end - - # For each element yielded by the response body, yield - # the element in chunked encoding. - # - # @yield [TAIL] - # - # source://rack//lib/rack/chunked.rb#40 - def each(&block); end - - private - - # Do nothing as this class does not support trailer headers. - # - # source://rack//lib/rack/chunked.rb#61 - def yield_trailers; end -end - -# source://rack//lib/rack/chunked.rb#31 -Rack::Chunked::Body::TAIL = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/chunked.rb#30 -Rack::Chunked::Body::TERM = T.let(T.unsafe(nil), String) - -# A body wrapper that emits chunked responses and also supports -# sending Trailer headers. Note that the response body provided to -# initialize must have a +trailers+ method that returns a hash -# of trailer headers, and the rack response itself should have a -# Trailer header listing the headers that the +trailers+ method -# will return. -# -# source://rack//lib/rack/chunked.rb#71 -class Rack::Chunked::TrailerBody < ::Rack::Chunked::Body - private - - # Yield strings for each trailer header. - # - # source://rack//lib/rack/chunked.rb#75 - def yield_trailers; end -end - -# Rack::CommonLogger forwards every request to the given +app+, and -# logs a line in the -# {Apache common log format}[http://httpd.apache.org/docs/1.3/logs.html#common] -# to the configured logger. -# -# source://rack//lib/rack/common_logger.rb#13 -class Rack::CommonLogger - # +logger+ can be any object that supports the +write+ or +<<+ methods, - # which includes the standard library Logger. These methods are called - # with a single string argument, the log message. - # If +logger+ is nil, CommonLogger will fall back env['rack.errors']. - # - # @return [CommonLogger] a new instance of CommonLogger - # - # source://rack//lib/rack/common_logger.rb#29 - def initialize(app, logger = T.unsafe(nil)); end - - # Log all requests in common_log format after a response has been - # returned. Note that if the app raises an exception, the request - # will not be logged, so if exception handling middleware are used, - # they should be loaded after this middleware. Additionally, because - # the logging happens after the request body has been fully sent, any - # exceptions raised during the sending of the response body will - # cause the request not to be logged. - # - # source://rack//lib/rack/common_logger.rb#41 - def call(env); end - - private - - # Attempt to determine the content length for the response to - # include it in the logged data. - # - # source://rack//lib/rack/common_logger.rb#83 - def extract_content_length(headers); end - - # Log the request to the configured logger. - # - # source://rack//lib/rack/common_logger.rb#52 - def log(env, status, response_headers, began_at); end -end - -# Common Log Format: http://httpd.apache.org/docs/1.3/logs.html#common -# -# lilith.local - - [07/Aug/2006 23:58:02 -0400] "GET / HTTP/1.1" 500 - -# -# %{%s - %s [%s] "%s %s%s %s" %d %s\n} % -# -# The actual format is slightly different than the above due to the -# separation of SCRIPT_NAME and PATH_INFO, and because the elapsed -# time in seconds is included at the end. -# -# source://rack//lib/rack/common_logger.rb#23 -Rack::CommonLogger::FORMAT = T.let(T.unsafe(nil), String) - -# Middleware that enables conditional GET using if-none-match and -# if-modified-since. The application should set either or both of the -# last-modified or etag response headers according to RFC 2616. When -# either of the conditions is met, the response body is set to be zero -# length and the response status is set to 304 Not Modified. -# -# Applications that defer response body generation until the body's each -# message is received will avoid response body generation completely when -# a conditional GET matches. -# -# Adapted from Michael Klishin's Merb implementation: -# https://github.com/wycats/merb/blob/master/merb-core/lib/merb-core/rack/middleware/conditional_get.rb -# -# source://rack//lib/rack/conditional_get.rb#21 -class Rack::ConditionalGet - # @return [ConditionalGet] a new instance of ConditionalGet - # - # source://rack//lib/rack/conditional_get.rb#22 - def initialize(app); end - - # Return empty 304 response if the response has not been - # modified since the last request. - # - # source://rack//lib/rack/conditional_get.rb#28 - def call(env); end - - private - - # Whether the etag response header matches the if-none-match request header. - # If so, the request has not been modified. - # - # @return [Boolean] - # - # source://rack//lib/rack/conditional_get.rb#62 - def etag_matches?(none_match, headers); end - - # Return whether the response has not been modified since the - # last request. - # - # @return [Boolean] - # - # source://rack//lib/rack/conditional_get.rb#51 - def fresh?(env, headers); end - - # Whether the last-modified response header matches the if-modified-since - # request header. If so, the request has not been modified. - # - # @return [Boolean] - # - # source://rack//lib/rack/conditional_get.rb#68 - def modified_since?(modified_since, headers); end - - # Return a Time object for the given string (which should be in RFC2822 - # format), or nil if the string cannot be parsed. - # - # source://rack//lib/rack/conditional_get.rb#75 - def to_rfc2822(since); end -end - -# Rack::Config modifies the environment using the block given during -# initialization. -# -# Example: -# use Rack::Config do |env| -# env['my-key'] = 'some-value' -# end -# -# source://rack//lib/rack/config.rb#11 -class Rack::Config - # @return [Config] a new instance of Config - # - # source://rack//lib/rack/config.rb#12 - def initialize(app, &block); end - - # source://rack//lib/rack/config.rb#17 - def call(env); end -end - -# Sets the content-length header on responses that do not specify -# a content-length or transfer-encoding header. Note that this -# does not fix responses that have an invalid content-length -# header specified. -# -# source://rack//lib/rack/content_length.rb#12 -class Rack::ContentLength - include ::Rack::Utils - - # @return [ContentLength] a new instance of ContentLength - # - # source://rack//lib/rack/content_length.rb#15 - def initialize(app); end - - # source://rack//lib/rack/content_length.rb#19 - def call(env); end -end - -# Sets the content-type header on responses which don't have one. -# -# Builder Usage: -# use Rack::ContentType, "text/plain" -# -# When no content type argument is provided, "text/html" is the -# default. -# -# source://rack//lib/rack/content_type.rb#15 -class Rack::ContentType - include ::Rack::Utils - - # @return [ContentType] a new instance of ContentType - # - # source://rack//lib/rack/content_type.rb#18 - def initialize(app, content_type = T.unsafe(nil)); end - - # source://rack//lib/rack/content_type.rb#23 - def call(env); end -end - -# source://rack//lib/rack/constants.rb#32 -Rack::DELETE = T.let(T.unsafe(nil), String) - -# This middleware enables content encoding of http responses, -# usually for purposes of compression. -# -# Currently supported encodings: -# -# * gzip -# * identity (no transformation) -# -# This middleware automatically detects when encoding is supported -# and allowed. For example no encoding is made when a cache -# directive of 'no-transform' is present, when the response status -# code is one that doesn't allow an entity body, or when the body -# is empty. -# -# Note that despite the name, Deflater does not support the +deflate+ -# encoding. -# -# source://rack//lib/rack/deflater.rb#28 -class Rack::Deflater - # Creates Rack::Deflater middleware. Options: - # - # :if :: a lambda enabling / disabling deflation based on returned boolean value - # (e.g use Rack::Deflater, :if => lambda { |*, body| sum=0; body.each { |i| sum += i.length }; sum > 512 }). - # However, be aware that calling `body.each` inside the block will break cases where `body.each` is not idempotent, - # such as when it is an +IO+ instance. - # :include :: a list of content types that should be compressed. By default, all content types are compressed. - # :sync :: determines if the stream is going to be flushed after every chunk. Flushing after every chunk reduces - # latency for time-sensitive streaming applications, but hurts compression and throughput. - # Defaults to +true+. - # - # @return [Deflater] a new instance of Deflater - # - # source://rack//lib/rack/deflater.rb#39 - def initialize(app, options = T.unsafe(nil)); end - - # source://rack//lib/rack/deflater.rb#46 - def call(env); end - - private - - # Whether the body should be compressed. - # - # @return [Boolean] - # - # source://rack//lib/rack/deflater.rb#136 - def should_deflate?(env, status, headers, body); end -end - -# Body class used for gzip encoded responses. -# -# source://rack//lib/rack/deflater.rb#83 -class Rack::Deflater::GzipStream - # Initialize the gzip stream. Arguments: - # body :: Response body to compress with gzip - # mtime :: The modification time of the body, used to set the - # modification time in the gzip header. - # sync :: Whether to flush each gzip chunk as soon as it is ready. - # - # @return [GzipStream] a new instance of GzipStream - # - # source://rack//lib/rack/deflater.rb#92 - def initialize(body, mtime, sync); end - - # Close the original body if possible. - # - # source://rack//lib/rack/deflater.rb#128 - def close; end - - # Yield gzip compressed strings to the given block. - # - # source://rack//lib/rack/deflater.rb#99 - def each(&block); end - - # Call the block passed to #each with the gzipped data. - # - # source://rack//lib/rack/deflater.rb#123 - def write(data); end -end - -# source://rack//lib/rack/deflater.rb#85 -Rack::Deflater::GzipStream::BUFFER_LENGTH = T.let(T.unsafe(nil), Integer) - -# Rack::Directory serves entries below the +root+ given, according to the -# path info of the Rack request. If a directory is found, the file's contents -# will be presented in an html based index. If a file is found, the env will -# be passed to the specified +app+. -# -# If +app+ is not specified, a Rack::Files of the same +root+ will be used. -# -# source://rack//lib/rack/directory.rb#19 -class Rack::Directory - # Set the root directory and application for serving files. - # - # @return [Directory] a new instance of Directory - # - # source://rack//lib/rack/directory.rb#83 - def initialize(root, app = T.unsafe(nil)); end - - # source://rack//lib/rack/directory.rb#89 - def call(env); end - - # Rack response to use for requests with invalid paths, or nil if path is valid. - # - # source://rack//lib/rack/directory.rb#109 - def check_bad_request(path_info); end - - # Rack response to use for requests with paths outside the root, or nil if path is inside the root. - # - # source://rack//lib/rack/directory.rb#119 - def check_forbidden(path_info); end - - # Rack response to use for unreadable and non-file, non-directory entries. - # - # source://rack//lib/rack/directory.rb#181 - def entity_not_found(path_info); end - - # Provide human readable file sizes - # - # source://rack//lib/rack/directory.rb#197 - def filesize_format(int); end - - # Internals of request handling. Similar to call but does - # not remove body for HEAD requests. - # - # source://rack//lib/rack/directory.rb#96 - def get(env); end - - # Rack response to use for directories under the root. - # - # source://rack//lib/rack/directory.rb#130 - def list_directory(path_info, path, script_name); end - - # Rack response to use for files and directories under the root. - # Unreadable and non-file, non-directory entries will get a 404 response. - # - # source://rack//lib/rack/directory.rb#171 - def list_path(env, path, path_info, script_name); end - - # The root of the directory hierarchy. Only requests for files and - # directories inside of the root directory are supported. - # - # source://rack//lib/rack/directory.rb#80 - def root; end - - # File::Stat for the given path, but return nil for missing/bad entries. - # - # source://rack//lib/rack/directory.rb#163 - def stat(path); end -end - -# source://rack//lib/rack/directory.rb#20 -Rack::Directory::DIR_FILE = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/directory.rb#43 -Rack::Directory::DIR_PAGE_FOOTER = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/directory.rb#21 -Rack::Directory::DIR_PAGE_HEADER = T.let(T.unsafe(nil), String) - -# Body class for directory entries, showing an index page with links -# to each file. -# -# source://rack//lib/rack/directory.rb#52 -class Rack::Directory::DirectoryBody < ::Struct - # Yield strings for each part of the directory entry - # - # @yield [DIR_PAGE_HEADER % [ show_path, show_path ]] - # - # source://rack//lib/rack/directory.rb#53 - def each; end - - private - - # Escape each element in the array of html strings. - # - # source://rack//lib/rack/directory.rb#73 - def DIR_FILE_escape(htmls); end -end - -# Stolen from Ramaze -# -# source://rack//lib/rack/directory.rb#189 -Rack::Directory::FILESIZE_FORMAT = T.let(T.unsafe(nil), Array) - -# source://rack//lib/rack/constants.rb#22 -Rack::ETAG = T.let(T.unsafe(nil), String) - -# Automatically sets the etag header on all String bodies. -# -# The etag header is skipped if etag or last-modified headers are sent or if -# a sendfile body (body.responds_to :to_path) is given (since such cases -# should be handled by apache/nginx). -# -# On initialization, you can pass two parameters: a cache-control directive -# used when etag is absent and a directive when it is present. The first -# defaults to nil, while the second defaults to "max-age=0, private, must-revalidate" -# -# source://rack//lib/rack/etag.rb#18 -class Rack::ETag - # @return [ETag] a new instance of ETag - # - # source://rack//lib/rack/etag.rb#22 - def initialize(app, no_cache_control = T.unsafe(nil), cache_control = T.unsafe(nil)); end - - # source://rack//lib/rack/etag.rb#28 - def call(env); end - - private - - # source://rack//lib/rack/etag.rb#58 - def digest_body(body); end - - # @return [Boolean] - # - # source://rack//lib/rack/etag.rb#50 - def etag_status?(status); end - - # @return [Boolean] - # - # source://rack//lib/rack/etag.rb#54 - def skip_caching?(headers); end -end - -# source://rack//lib/rack/etag.rb#20 -Rack::ETag::DEFAULT_CACHE_CONTROL = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/etag.rb#19 -Rack::ETag::ETAG_STRING = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#23 -Rack::EXPIRES = T.let(T.unsafe(nil), String) - -# This middleware provides hooks to certain places in the request / -# response lifecycle. This is so that middleware that don't need to filter -# the response data can safely leave it alone and not have to send messages -# down the traditional "rack stack". -# -# The events are: -# -# * on_start(request, response) -# -# This event is sent at the start of the request, before the next -# middleware in the chain is called. This method is called with a request -# object, and a response object. Right now, the response object is always -# nil, but in the future it may actually be a real response object. -# -# * on_commit(request, response) -# -# The response has been committed. The application has returned, but the -# response has not been sent to the webserver yet. This method is always -# called with a request object and the response object. The response -# object is constructed from the rack triple that the application returned. -# Changes may still be made to the response object at this point. -# -# * on_send(request, response) -# -# The webserver has started iterating over the response body and presumably -# has started sending data over the wire. This method is always called with -# a request object and the response object. The response object is -# constructed from the rack triple that the application returned. Changes -# SHOULD NOT be made to the response object as the webserver has already -# started sending data. Any mutations will likely result in an exception. -# -# * on_finish(request, response) -# -# The webserver has closed the response, and all data has been written to -# the response socket. The request and response object should both be -# read-only at this point. The body MAY NOT be available on the response -# object as it may have been flushed to the socket. -# -# * on_error(request, response, error) -# -# An exception has occurred in the application or an `on_commit` event. -# This method will get the request, the response (if available) and the -# exception that was raised. -# -# ## Order -# -# `on_start` is called on the handlers in the order that they were passed to -# the constructor. `on_commit`, on_send`, `on_finish`, and `on_error` are -# called in the reverse order. `on_finish` handlers are called inside an -# `ensure` block, so they are guaranteed to be called even if something -# raises an exception. If something raises an exception in a `on_finish` -# method, then nothing is guaranteed. -# -# source://rack//lib/rack/events.rb#61 -class Rack::Events - # @return [Events] a new instance of Events - # - # source://rack//lib/rack/events.rb#106 - def initialize(app, handlers); end - - # source://rack//lib/rack/events.rb#111 - def call(env); end - - private - - # source://rack//lib/rack/events.rb#149 - def make_request(env); end - - # source://rack//lib/rack/events.rb#153 - def make_response(status, headers, body); end - - # source://rack//lib/rack/events.rb#137 - def on_commit(request, response); end - - # source://rack//lib/rack/events.rb#133 - def on_error(request, response, e); end - - # source://rack//lib/rack/events.rb#145 - def on_finish(request, response); end - - # source://rack//lib/rack/events.rb#141 - def on_start(request, response); end -end - -# source://rack//lib/rack/events.rb#62 -module Rack::Events::Abstract - # source://rack//lib/rack/events.rb#66 - def on_commit(req, res); end - - # source://rack//lib/rack/events.rb#75 - def on_error(req, res, e); end - - # source://rack//lib/rack/events.rb#72 - def on_finish(req, res); end - - # source://rack//lib/rack/events.rb#69 - def on_send(req, res); end - - # source://rack//lib/rack/events.rb#63 - def on_start(req, res); end -end - -# source://rack//lib/rack/events.rb#95 -class Rack::Events::BufferedResponse < ::Rack::Response::Raw - # @return [BufferedResponse] a new instance of BufferedResponse - # - # source://rack//lib/rack/events.rb#98 - def initialize(status, headers, body); end - - # Returns the value of attribute body. - # - # source://rack//lib/rack/events.rb#96 - def body; end - - # source://rack//lib/rack/events.rb#103 - def to_a; end -end - -# source://rack//lib/rack/events.rb#79 -class Rack::Events::EventedBodyProxy < ::Rack::BodyProxy - # @return [EventedBodyProxy] a new instance of EventedBodyProxy - # - # source://rack//lib/rack/events.rb#82 - def initialize(body, request, response, handlers, &block); end - - # source://rack//lib/rack/events.rb#89 - def each; end - - # Returns the value of attribute request. - # - # source://rack//lib/rack/events.rb#80 - def request; end - - # Returns the value of attribute response. - # - # source://rack//lib/rack/events.rb#80 - def response; end -end - -# source://rack//lib/rack/file.rb#8 -Rack::File = Rack::Files - -# Rack::Files serves files below the +root+ directory given, according to the -# path info of the Rack request. -# e.g. when Rack::Files.new("/etc") is used, you can access 'passwd' file -# as http://localhost:9292/passwd -# -# Handlers can detect if bodies are a Rack::Files, and use mechanisms -# like sendfile on the +path+. -# -# source://rack//lib/rack/files.rb#20 -class Rack::Files - # @return [Files] a new instance of Files - # - # source://rack//lib/rack/files.rb#27 - def initialize(root, headers = T.unsafe(nil), default_mime = T.unsafe(nil)); end - - # source://rack//lib/rack/files.rb#34 - def call(env); end - - # source://rack//lib/rack/files.rb#39 - def get(env); end - - # Returns the value of attribute root. - # - # source://rack//lib/rack/files.rb#25 - def root; end - - # source://rack//lib/rack/files.rb#68 - def serving(request, path); end - - private - - # source://rack//lib/rack/files.rb#190 - def fail(status, body, headers = T.unsafe(nil)); end - - # source://rack//lib/rack/files.rb#209 - def filesize(path); end - - # The MIME type for the contents of the file located at @path - # - # source://rack//lib/rack/files.rb#205 - def mime_type(path, default_mime); end -end - -# source://rack//lib/rack/files.rb#21 -Rack::Files::ALLOWED_VERBS = T.let(T.unsafe(nil), Array) - -# source://rack//lib/rack/files.rb#22 -Rack::Files::ALLOW_HEADER = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/files.rb#121 -class Rack::Files::BaseIterator - # @return [BaseIterator] a new instance of BaseIterator - # - # source://rack//lib/rack/files.rb#124 - def initialize(path, ranges, options); end - - # source://rack//lib/rack/files.rb#144 - def bytesize; end - - # source://rack//lib/rack/files.rb#153 - def close; end - - # source://rack//lib/rack/files.rb#130 - def each; end - - # Returns the value of attribute options. - # - # source://rack//lib/rack/files.rb#122 - def options; end - - # Returns the value of attribute path. - # - # source://rack//lib/rack/files.rb#122 - def path; end - - # Returns the value of attribute ranges. - # - # source://rack//lib/rack/files.rb#122 - def ranges; end - - private - - # source://rack//lib/rack/files.rb#171 - def each_range_part(file, range); end - - # @return [Boolean] - # - # source://rack//lib/rack/files.rb#157 - def multipart?; end - - # source://rack//lib/rack/files.rb#161 - def multipart_heading(range); end -end - -# source://rack//lib/rack/files.rb#184 -class Rack::Files::Iterator < ::Rack::Files::BaseIterator - # source://rack//lib/rack/files.rb#122 - def to_path; end -end - -# source://rack//lib/rack/files.rb#23 -Rack::Files::MULTIPART_BOUNDARY = T.let(T.unsafe(nil), String) - -# Rack::ForwardRequest gets caught by Rack::Recursive and redirects -# the current request to the app at +url+. -# -# raise ForwardRequest.new("/not-found") -# -# source://rack//lib/rack/recursive.rb#14 -class Rack::ForwardRequest < ::Exception - # @return [ForwardRequest] a new instance of ForwardRequest - # - # source://rack//lib/rack/recursive.rb#17 - def initialize(url, env = T.unsafe(nil)); end - - # Returns the value of attribute env. - # - # source://rack//lib/rack/recursive.rb#15 - def env; end - - # Returns the value of attribute url. - # - # source://rack//lib/rack/recursive.rb#15 - def url; end -end - -# HTTP method verbs -# -# source://rack//lib/rack/constants.rb#28 -Rack::GET = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#33 -Rack::HEAD = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#7 -Rack::HTTPS = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#16 -Rack::HTTP_COOKIE = T.let(T.unsafe(nil), String) - -# Request env keys -# -# source://rack//lib/rack/constants.rb#5 -Rack::HTTP_HOST = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#6 -Rack::HTTP_PORT = T.let(T.unsafe(nil), String) - -# Rack::Head returns an empty body for all HEAD requests. It leaves -# all other requests unchanged. -# -# source://rack//lib/rack/head.rb#9 -class Rack::Head - # @return [Head] a new instance of Head - # - # source://rack//lib/rack/head.rb#10 - def initialize(app); end - - # source://rack//lib/rack/head.rb#14 - def call(env); end -end - -# Rack::Headers is a Hash subclass that downcases all keys. It's designed -# to be used by rack applications that don't implement the Rack 3 SPEC -# (by using non-lowercase response header keys), automatically handling -# the downcasing of keys. -# -# source://rack//lib/rack/headers.rb#6 -class Rack::Headers < ::Hash - # source://rack//lib/rack/headers.rb#26 - def [](key); end - - # source://rack//lib/rack/headers.rb#30 - def []=(key, value); end - - # source://rack//lib/rack/headers.rb#35 - def assoc(key); end - - # @raise [TypeError] - # - # source://rack//lib/rack/headers.rb#39 - def compare_by_identity; end - - # source://rack//lib/rack/headers.rb#43 - def delete(key); end - - # source://rack//lib/rack/headers.rb#47 - def dig(key, *a); end - - # :nocov: - # - # source://rack//lib/rack/headers.rb#143 - def except(*a); end - - # source://rack//lib/rack/headers.rb#51 - def fetch(key, *default, &block); end - - # source://rack//lib/rack/headers.rb#56 - def fetch_values(*a); end - - # @return [Boolean] - # - # source://rack//lib/rack/headers.rb#60 - def has_key?(key); end - - # @return [Boolean] - # - # source://rack//lib/rack/headers.rb#60 - def include?(key); end - - # source://rack//lib/rack/headers.rb#67 - def invert; end - - # @return [Boolean] - # - # source://rack//lib/rack/headers.rb#60 - def key?(key); end - - # @return [Boolean] - # - # source://rack//lib/rack/headers.rb#60 - def member?(key); end - - # source://rack//lib/rack/headers.rb#73 - def merge(hash, &block); end - - # source://rack//lib/rack/headers.rb#102 - def merge!(hash, &block); end - - # source://rack//lib/rack/headers.rb#77 - def reject(&block); end - - # source://rack//lib/rack/headers.rb#83 - def replace(hash); end - - # source://rack//lib/rack/headers.rb#88 - def select(&block); end - - # :nocov: - # - # source://rack//lib/rack/headers.rb#121 - def slice(*a); end - - # source://rack//lib/rack/headers.rb#30 - def store(key, value); end - - # source://rack//lib/rack/headers.rb#94 - def to_proc; end - - # source://rack//lib/rack/headers.rb#127 - def transform_keys(&block); end - - # source://rack//lib/rack/headers.rb#131 - def transform_keys!; end - - # source://rack//lib/rack/headers.rb#98 - def transform_values(&block); end - - # source://rack//lib/rack/headers.rb#102 - def update(hash, &block); end - - # source://rack//lib/rack/headers.rb#114 - def values_at(*keys); end - - private - - # source://rack//lib/rack/headers.rb#150 - def downcase_key(key); end - - class << self - # source://rack//lib/rack/headers.rb#7 - def [](*items); end - end -end - -# source://rack//lib/rack/constants.rb#35 -Rack::LINK = T.let(T.unsafe(nil), String) - -# Rack::Lint validates your application and the requests and -# responses according to the Rack spec. -# -# source://rack//lib/rack/lint.rb#12 -class Rack::Lint - # @return [Lint] a new instance of Lint - # - # source://rack//lib/rack/lint.rb#13 - def initialize(app); end - - # AUTHORS: n.b. The trailing whitespace between paragraphs is important and - # should not be removed. The whitespace creates paragraphs in the RDoc - # output. - # - # This specification aims to formalize the Rack protocol. You - # can (and should) use Rack::Lint to enforce it. - # - # When you develop middleware, be sure to add a Lint before and - # after to catch all mistakes. - # - # = Rack applications - # - # A Rack application is a Ruby object (not a class) that - # responds to +call+. - # - # source://rack//lib/rack/lint.rb#34 - def call(env = T.unsafe(nil)); end -end - -# :stopdoc: -# -# source://rack//lib/rack/lint.rb#19 -class Rack::Lint::LintError < ::RuntimeError; end - -# source://rack//lib/rack/lint.rb#38 -class Rack::Lint::Wrapper - # @return [Wrapper] a new instance of Wrapper - # - # source://rack//lib/rack/lint.rb#39 - def initialize(app, env); end - - # ==== Streaming Body - # - # @raise [LintError] - # - # source://rack//lib/rack/lint.rb#855 - def call(stream); end - - # === The content-length - # - # source://rack//lib/rack/lint.rb#693 - def check_content_length(status, headers); end - - # === The content-type - # - # source://rack//lib/rack/lint.rb#677 - def check_content_type(status, headers); end - - # == The Environment - # - # @raise [LintError] - # - # source://rack//lib/rack/lint.rb#97 - def check_environment(env); end - - # === The Error Stream - # - # source://rack//lib/rack/lint.rb#491 - def check_error(error); end - - # source://rack//lib/rack/lint.rb#667 - def check_header_value(key, value); end - - # === The Headers - # - # source://rack//lib/rack/lint.rb#627 - def check_headers(headers); end - - # === Hijacking - # - # The hijacking interfaces provides a means for an application to take - # control of the HTTP connection. There are two distinct hijack - # interfaces: full hijacking where the application takes over the raw - # connection, and partial hijacking where the application takes over - # just the response body stream. In both cases, the application is - # responsible for closing the hijacked stream. - # - # Full hijacking only works with HTTP/1. Partial hijacking is functionally - # equivalent to streaming bodies, and is still optionally supported for - # backwards compatibility with older Rack versions. - # - # ==== Full Hijack - # - # Full hijack is used to completely take over an HTTP/1 connection. It - # occurs before any headers are written and causes the request to - # ignores any response generated by the application. - # - # It is intended to be used when applications need access to raw HTTP/1 - # connection. - # - # source://rack//lib/rack/lint.rb#551 - def check_hijack(env); end - - # ==== Partial Hijack - # - # Partial hijack is used for bi-directional streaming of the request and - # response body. It occurs after the status and headers are written by - # the server and causes the server to ignore the Body of the response. - # - # It is intended to be used when applications need bi-directional - # streaming. - # - # source://rack//lib/rack/lint.rb#579 - def check_hijack_response(headers, env); end - - # === The Input Stream - # - # The input stream is an IO-like object which contains the raw HTTP - # POST data. - # - # source://rack//lib/rack/lint.rb#387 - def check_input(input); end - - # == The Response - # - # === The Status - # - # source://rack//lib/rack/lint.rb#616 - def check_status(status); end - - # === The Body - # - # The Body is typically an +Array+ of +String+ instances, an enumerable - # that yields +String+ instances, a +Proc+ instance, or a File-like - # object. - # - # The Body must respond to +each+ or +call+. It may optionally respond - # to +to_path+ or +to_ary+. A Body that responds to +each+ is considered - # to be an Enumerable Body. A Body that responds to +call+ is considered - # to be a Streaming Body. - # - # A Body that responds to both +each+ and +call+ must be treated as an - # Enumerable Body, not a Streaming Body. If it responds to +each+, you - # must call +each+ and not +call+. If the Body doesn't respond to - # +each+, then you can assume it responds to +call+. - # - # The Body must either be consumed or returned. The Body is consumed by - # optionally calling either +each+ or +call+. - # Then, if the Body responds to +close+, it must be called to release - # any resources associated with the generation of the body. - # In other words, +close+ must always be called at least once; typically - # after the web server has sent the response to the client, but also in - # cases where the Rack application makes internal/virtual requests and - # discards the response. - # - # source://rack//lib/rack/lint.rb#744 - def close; end - - # ==== Enumerable Body - # - # @raise [LintError] - # - # source://rack//lib/rack/lint.rb#778 - def each; end - - # @return [Boolean] - # - # source://rack//lib/rack/lint.rb#826 - def respond_to?(name, *_arg1); end - - # @raise [LintError] - # - # source://rack//lib/rack/lint.rb#54 - def response; end - - # If the Body responds to +to_ary+, it must return an +Array+ whose - # contents are identical to that produced by calling +each+. - # Middleware may call +to_ary+ directly on the Body and return a new - # Body in its place. In other words, middleware can only process the - # Body directly if it responds to +to_ary+. If the Body responds to both - # +to_ary+ and +close+, its implementation of +to_ary+ must call - # +close+. - # - # source://rack//lib/rack/lint.rb#842 - def to_ary; end - - # source://rack//lib/rack/lint.rb#822 - def to_path; end - - # source://rack//lib/rack/lint.rb#706 - def verify_content_length(size); end - - # source://rack//lib/rack/lint.rb#760 - def verify_to_path; end -end - -# source://rack//lib/rack/lint.rb#820 -Rack::Lint::Wrapper::BODY_METHODS = T.let(T.unsafe(nil), Hash) - -# source://rack//lib/rack/lint.rb#500 -class Rack::Lint::Wrapper::ErrorWrapper - # @return [ErrorWrapper] a new instance of ErrorWrapper - # - # source://rack//lib/rack/lint.rb#501 - def initialize(error); end - - # * +close+ must never be called on the error stream. - # - # @raise [LintError] - # - # source://rack//lib/rack/lint.rb#523 - def close(*args); end - - # * +flush+ must be called without arguments and must be called - # in order to make the error appear for sure. - # - # source://rack//lib/rack/lint.rb#518 - def flush; end - - # * +puts+ must be called with a single argument that responds to +to_s+. - # - # source://rack//lib/rack/lint.rb#506 - def puts(str); end - - # * +write+ must be called with a single argument that is a String. - # - # @raise [LintError] - # - # source://rack//lib/rack/lint.rb#511 - def write(str); end -end - -# source://rack//lib/rack/lint.rb#405 -class Rack::Lint::Wrapper::InputWrapper - # @return [InputWrapper] a new instance of InputWrapper - # - # source://rack//lib/rack/lint.rb#406 - def initialize(input); end - - # * +close+ can be called on the input stream to indicate that the - # any remaining input is not needed. - # - # source://rack//lib/rack/lint.rb#483 - def close(*args); end - - # * +each+ must be called without arguments and only yield Strings. - # - # @raise [LintError] - # - # source://rack//lib/rack/lint.rb#471 - def each(*args); end - - # * +gets+ must be called without arguments and return a string, - # or +nil+ on EOF. - # - # @raise [LintError] - # - # source://rack//lib/rack/lint.rb#412 - def gets(*args); end - - # * +read+ behaves like IO#read. - # Its signature is read([length, [buffer]]). - # - # If given, +length+ must be a non-negative Integer (>= 0) or +nil+, - # and +buffer+ must be a String and may not be nil. - # - # If +length+ is given and not nil, then this method reads at most - # +length+ bytes from the input stream. - # - # If +length+ is not given or nil, then this method reads - # all data until EOF. - # - # When EOF is reached, this method returns nil if +length+ is given - # and not nil, or "" if +length+ is not given or is nil. - # - # If +buffer+ is given, then the read data will be placed - # into +buffer+ instead of a newly created String object. - # - # source://rack//lib/rack/lint.rb#438 - def read(*args); end -end - -# source://rack//lib/rack/lint.rb#875 -class Rack::Lint::Wrapper::StreamWrapper - extend ::Forwardable - - # @return [StreamWrapper] a new instance of StreamWrapper - # - # source://rack//lib/rack/lint.rb#890 - def initialize(stream); end - - # source://forwardable/1.3.2/forwardable.rb#229 - def <<(*args, **_arg1, &block); end - - # source://forwardable/1.3.2/forwardable.rb#229 - def close(*args, **_arg1, &block); end - - # source://forwardable/1.3.2/forwardable.rb#229 - def close_read(*args, **_arg1, &block); end - - # source://forwardable/1.3.2/forwardable.rb#229 - def close_write(*args, **_arg1, &block); end - - # source://forwardable/1.3.2/forwardable.rb#229 - def closed?(*args, **_arg1, &block); end - - # source://forwardable/1.3.2/forwardable.rb#229 - def flush(*args, **_arg1, &block); end - - # source://forwardable/1.3.2/forwardable.rb#229 - def read(*args, **_arg1, &block); end - - # source://forwardable/1.3.2/forwardable.rb#229 - def write(*args, **_arg1, &block); end -end - -# The semantics of these IO methods must be a best effort match to -# those of a normal Ruby IO or Socket object, using standard arguments -# and raising standard exceptions. Servers are encouraged to simply -# pass on real IO objects, although it is recognized that this approach -# is not directly compatible with HTTP/2. -# -# source://rack//lib/rack/lint.rb#883 -Rack::Lint::Wrapper::StreamWrapper::REQUIRED_METHODS = T.let(T.unsafe(nil), Array) - -# Rack::Lock locks every request inside a mutex, so that every request -# will effectively be executed synchronously. -# -# source://rack//lib/rack/lock.rb#8 -class Rack::Lock - # @return [Lock] a new instance of Lock - # - # source://rack//lib/rack/lock.rb#9 - def initialize(app, mutex = T.unsafe(nil)); end - - # source://rack//lib/rack/lock.rb#13 - def call(env); end - - private - - # source://rack//lib/rack/lock.rb#25 - def unlock; end -end - -# Sets up rack.logger to write to rack.errors stream -# -# source://rack//lib/rack/logger.rb#9 -class Rack::Logger - # @return [Logger] a new instance of Logger - # - # source://rack//lib/rack/logger.rb#10 - def initialize(app, level = T.unsafe(nil)); end - - # source://rack//lib/rack/logger.rb#14 - def call(env); end -end - -# Rack::MediaType parse media type and parameters out of content_type string -# -# source://rack//lib/rack/media_type.rb#6 -class Rack::MediaType - class << self - # The media type parameters provided in CONTENT_TYPE as a Hash, or - # an empty Hash if no CONTENT_TYPE or media-type parameters were - # provided. e.g., when the CONTENT_TYPE is "text/plain;charset=utf-8", - # this method responds with the following Hash: - # { 'charset' => 'utf-8' } - # - # source://rack//lib/rack/media_type.rb#26 - def params(content_type); end - - # The media type (type/subtype) portion of the CONTENT_TYPE header - # without any media type parameters. e.g., when CONTENT_TYPE is - # "text/plain;charset=utf-8", the media-type is "text/plain". - # - # For more information on the use of media types in HTTP, see: - # http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7 - # - # source://rack//lib/rack/media_type.rb#16 - def type(content_type); end - - private - - # source://rack//lib/rack/media_type.rb#38 - def strip_doublequotes(str); end - end -end - -# source://rack//lib/rack/media_type.rb#7 -Rack::MediaType::SPLIT_PATTERN = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/method_override.rb#8 -class Rack::MethodOverride - # @return [MethodOverride] a new instance of MethodOverride - # - # source://rack//lib/rack/method_override.rb#15 - def initialize(app); end - - # source://rack//lib/rack/method_override.rb#19 - def call(env); end - - # source://rack//lib/rack/method_override.rb#31 - def method_override(env); end - - private - - # source://rack//lib/rack/method_override.rb#44 - def allowed_methods; end - - # source://rack//lib/rack/method_override.rb#48 - def method_override_param(req); end -end - -# source://rack//lib/rack/method_override.rb#13 -Rack::MethodOverride::ALLOWED_METHODS = T.let(T.unsafe(nil), Array) - -# source://rack//lib/rack/method_override.rb#9 -Rack::MethodOverride::HTTP_METHODS = T.let(T.unsafe(nil), Array) - -# source://rack//lib/rack/method_override.rb#12 -Rack::MethodOverride::HTTP_METHOD_OVERRIDE_HEADER = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/method_override.rb#11 -Rack::MethodOverride::METHOD_OVERRIDE_PARAM_KEY = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/mime.rb#4 -module Rack::Mime - private - - # Returns true if the given value is a mime match for the given mime match - # specification, false otherwise. - # - # Rack::Mime.match?('text/html', 'text/*') => true - # Rack::Mime.match?('text/plain', '*') => true - # Rack::Mime.match?('text/html', 'application/json') => false - # - # @return [Boolean] - # - # source://rack//lib/rack/mime.rb#30 - def match?(value, matcher); end - - # Returns String with mime type if found, otherwise use +fallback+. - # +ext+ should be filename extension in the '.ext' format that - # File.extname(file) returns. - # +fallback+ may be any object - # - # Also see the documentation for MIME_TYPES - # - # Usage: - # Rack::Mime.mime_type('.foo') - # - # This is a shortcut for: - # Rack::Mime::MIME_TYPES.fetch('.foo', 'application/octet-stream') - # - # source://rack//lib/rack/mime.rb#18 - def mime_type(ext, fallback = T.unsafe(nil)); end - - class << self - # Returns true if the given value is a mime match for the given mime match - # specification, false otherwise. - # - # Rack::Mime.match?('text/html', 'text/*') => true - # Rack::Mime.match?('text/plain', '*') => true - # Rack::Mime.match?('text/html', 'application/json') => false - # - # @return [Boolean] - # - # source://rack//lib/rack/mime.rb#30 - def match?(value, matcher); end - - # Returns String with mime type if found, otherwise use +fallback+. - # +ext+ should be filename extension in the '.ext' format that - # File.extname(file) returns. - # +fallback+ may be any object - # - # Also see the documentation for MIME_TYPES - # - # Usage: - # Rack::Mime.mime_type('.foo') - # - # This is a shortcut for: - # Rack::Mime::MIME_TYPES.fetch('.foo', 'application/octet-stream') - # - # source://rack//lib/rack/mime.rb#18 - def mime_type(ext, fallback = T.unsafe(nil)); end - end -end - -# List of most common mime-types, selected various sources -# according to their usefulness in a webserving scope for Ruby -# users. -# -# To amend this list with your local mime.types list you can use: -# -# require 'webrick/httputils' -# list = WEBrick::HTTPUtils.load_mime_types('/etc/mime.types') -# Rack::Mime::MIME_TYPES.merge!(list) -# -# N.B. On Ubuntu the mime.types file does not include the leading period, so -# users may need to modify the data before merging into the hash. -# -# source://rack//lib/rack/mime.rb#51 -Rack::Mime::MIME_TYPES = T.let(T.unsafe(nil), Hash) - -# Rack::MockRequest helps testing your Rack application without -# actually using HTTP. -# -# After performing a request on a URL with get/post/put/patch/delete, it -# returns a MockResponse with useful helper methods for effective -# testing. -# -# You can pass a hash with additional configuration to the -# get/post/put/patch/delete. -# :input:: A String or IO-like to be used as rack.input. -# :fatal:: Raise a FatalWarning if the app writes to rack.errors. -# :lint:: If true, wrap the application in a Rack::Lint. -# -# source://rack//lib/rack/mock_request.rb#23 -class Rack::MockRequest - # @return [MockRequest] a new instance of MockRequest - # - # source://rack//lib/rack/mock_request.rb#49 - def initialize(app); end - - # Make a DELETE request and return a MockResponse. See #request. - # - # source://rack//lib/rack/mock_request.rb#62 - def delete(uri, opts = T.unsafe(nil)); end - - # Make a GET request and return a MockResponse. See #request. - # - # source://rack//lib/rack/mock_request.rb#54 - def get(uri, opts = T.unsafe(nil)); end - - # Make a HEAD request and return a MockResponse. See #request. - # - # source://rack//lib/rack/mock_request.rb#64 - def head(uri, opts = T.unsafe(nil)); end - - # Make an OPTIONS request and return a MockResponse. See #request. - # - # source://rack//lib/rack/mock_request.rb#66 - def options(uri, opts = T.unsafe(nil)); end - - # Make a PATCH request and return a MockResponse. See #request. - # - # source://rack//lib/rack/mock_request.rb#60 - def patch(uri, opts = T.unsafe(nil)); end - - # Make a POST request and return a MockResponse. See #request. - # - # source://rack//lib/rack/mock_request.rb#56 - def post(uri, opts = T.unsafe(nil)); end - - # Make a PUT request and return a MockResponse. See #request. - # - # source://rack//lib/rack/mock_request.rb#58 - def put(uri, opts = T.unsafe(nil)); end - - # Make a request using the given request method for the given - # uri to the rack application and return a MockResponse. - # Options given are passed to MockRequest.env_for. - # - # source://rack//lib/rack/mock_request.rb#71 - def request(method = T.unsafe(nil), uri = T.unsafe(nil), opts = T.unsafe(nil)); end - - class << self - # Return the Rack environment used for a request to +uri+. - # All options that are strings are added to the returned environment. - # Options: - # :fatal :: Whether to raise an exception if request outputs to rack.errors - # :input :: The rack.input to set - # :http_version :: The SERVER_PROTOCOL to set - # :method :: The HTTP request method to use - # :params :: The params to use - # :script_name :: The SCRIPT_NAME to set - # - # source://rack//lib/rack/mock_request.rb#103 - def env_for(uri = T.unsafe(nil), opts = T.unsafe(nil)); end - - # For historical reasons, we're pinning to RFC 2396. - # URI::Parser = URI::RFC2396_Parser - # - # source://rack//lib/rack/mock_request.rb#89 - def parse_uri_rfc2396(uri); end - end -end - -# source://rack//lib/rack/mock_request.rb#44 -Rack::MockRequest::DEFAULT_ENV = T.let(T.unsafe(nil), Hash) - -# source://rack//lib/rack/mock_request.rb#27 -class Rack::MockRequest::FatalWarner - # source://rack//lib/rack/mock_request.rb#36 - def flush; end - - # @raise [FatalWarning] - # - # source://rack//lib/rack/mock_request.rb#28 - def puts(warning); end - - # source://rack//lib/rack/mock_request.rb#39 - def string; end - - # @raise [FatalWarning] - # - # source://rack//lib/rack/mock_request.rb#32 - def write(warning); end -end - -# source://rack//lib/rack/mock_request.rb#24 -class Rack::MockRequest::FatalWarning < ::RuntimeError; end - -# Rack::MockResponse provides useful helpers for testing your apps. -# Usually, you don't create the MockResponse on your own, but use -# MockRequest. -# -# source://rack//lib/rack/mock_response.rb#13 -class Rack::MockResponse < ::Rack::Response - # @return [MockResponse] a new instance of MockResponse - # - # source://rack//lib/rack/mock_response.rb#24 - def initialize(status, headers, body, errors = T.unsafe(nil)); end - - # source://rack//lib/rack/mock_response.rb#39 - def =~(other); end - - # source://rack//lib/rack/mock_response.rb#47 - def body; end - - # source://rack//lib/rack/mock_response.rb#73 - def cookie(name); end - - # Headers - # - # source://rack//lib/rack/mock_response.rb#19 - def cookies; end - - # @return [Boolean] - # - # source://rack//lib/rack/mock_response.rb#69 - def empty?; end - - # Errors - # - # source://rack//lib/rack/mock_response.rb#22 - def errors; end - - # Errors - # - # source://rack//lib/rack/mock_response.rb#22 - def errors=(_arg0); end - - # source://rack//lib/rack/mock_response.rb#43 - def match(other); end - - # Headers - # - # source://rack//lib/rack/mock_response.rb#19 - def original_headers; end - - private - - # source://rack//lib/rack/mock_response.rb#102 - def identify_cookie_attributes(cookie_filling); end - - # source://rack//lib/rack/mock_response.rb#79 - def parse_cookies_from_header; end - - class << self - def [](*_arg0); end - end -end - -# A multipart form data parser, adapted from IOWA. -# -# Usually, Rack::Request#POST takes care of calling this. -# -# source://rack//lib/rack/multipart/parser.rb#8 -module Rack::Multipart - class << self - # source://rack//lib/rack/multipart.rb#39 - def build_multipart(params, first = T.unsafe(nil)); end - - # source://rack//lib/rack/multipart.rb#35 - def extract_multipart(request, params = T.unsafe(nil)); end - - # source://rack//lib/rack/multipart.rb#17 - def parse_multipart(env, params = T.unsafe(nil)); end - end -end - -# source://rack//lib/rack/multipart/parser.rb#32 -Rack::Multipart::ATTRIBUTE = T.let(T.unsafe(nil), Regexp) - -# Updated definitions from RFC 2231 -# -# source://rack//lib/rack/multipart/parser.rb#31 -Rack::Multipart::ATTRIBUTE_CHAR = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#26 -Rack::Multipart::BROKEN = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#24 -Rack::Multipart::CONDISP = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#43 -Rack::Multipart::DISPPARM = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#21 -Rack::Multipart::EOL = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/multipart/parser.rb#39 -Rack::Multipart::EXTENDED_INITIAL_NAME = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#41 -Rack::Multipart::EXTENDED_INITIAL_PARAMETER = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#40 -Rack::Multipart::EXTENDED_INITIAL_VALUE = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#36 -Rack::Multipart::EXTENDED_OTHER_NAME = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#38 -Rack::Multipart::EXTENDED_OTHER_PARAMETER = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#37 -Rack::Multipart::EXTENDED_OTHER_VALUE = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#42 -Rack::Multipart::EXTENDED_PARAMETER = T.let(T.unsafe(nil), Regexp) - -# Use specific error class when parsing multipart request -# that ends early. -# -# source://rack//lib/rack/multipart/parser.rb#15 -class Rack::Multipart::EmptyContentError < ::EOFError; end - -# Base class for multipart exceptions that do not subclass from -# other exception classes for backwards compatibility. -# -# source://rack//lib/rack/multipart/parser.rb#19 -class Rack::Multipart::Error < ::StandardError; end - -# source://rack//lib/rack/multipart/generator.rb#7 -class Rack::Multipart::Generator - # @return [Generator] a new instance of Generator - # - # source://rack//lib/rack/multipart/generator.rb#8 - def initialize(params, first = T.unsafe(nil)); end - - # source://rack//lib/rack/multipart/generator.rb#16 - def dump; end - - private - - # source://rack//lib/rack/multipart/generator.rb#89 - def content_for_other(file, name); end - - # source://rack//lib/rack/multipart/generator.rb#77 - def content_for_tempfile(io, file, name); end - - # source://rack//lib/rack/multipart/generator.rb#52 - def flattened_params; end - - # @return [Boolean] - # - # source://rack//lib/rack/multipart/generator.rb#37 - def multipart?; end -end - -# source://rack//lib/rack/multipart/parser.rb#22 -Rack::Multipart::MULTIPART = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart.rb#14 -Rack::Multipart::MULTIPART_BOUNDARY = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/multipart/parser.rb#28 -Rack::Multipart::MULTIPART_CONTENT_DISPOSITION = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#29 -Rack::Multipart::MULTIPART_CONTENT_ID = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#27 -Rack::Multipart::MULTIPART_CONTENT_TYPE = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#9 -class Rack::Multipart::MultipartPartLimitError < ::Errno::EMFILE; end - -# source://rack//lib/rack/multipart/parser.rb#11 -class Rack::Multipart::MultipartTotalPartLimitError < ::StandardError; end - -# source://rack//lib/rack/multipart/parser.rb#46 -class Rack::Multipart::Parser - # @return [Parser] a new instance of Parser - # - # source://rack//lib/rack/multipart/parser.rb#205 - def initialize(boundary, tempfile, bufsize, query_parser); end - - # source://rack//lib/rack/multipart/parser.rb#220 - def parse(io); end - - # source://rack//lib/rack/multipart/parser.rb#243 - def result; end - - # Returns the value of attribute state. - # - # source://rack//lib/rack/multipart/parser.rb#203 - def state; end - - private - - # Scan until the we find the start or end of the boundary. - # If we find it, return the appropriate symbol for the start or - # end of the boundary. If we don't find the start or end of the - # boundary, clear the buffer and return nil. - # - # source://rack//lib/rack/multipart/parser.rb#346 - def consume_boundary; end - - # From WEBrick::HTTPUtils - # - # source://rack//lib/rack/multipart/parser.rb#255 - def dequote(str); end - - # source://rack//lib/rack/multipart/parser.rb#355 - def get_filename(head); end - - # source://rack//lib/rack/multipart/parser.rb#290 - def handle_consume_token; end - - # source://rack//lib/rack/multipart/parser.rb#427 - def handle_empty_content!(content); end - - # This handles the initial parser state. We read until we find the starting - # boundary, then we can transition to the next state. If we find the ending - # boundary, this is an invalid multipart upload, but keep scanning for opening - # boundary in that case. If no boundary found, we need to keep reading data - # and retry. It's highly unlikely the initial read will not consume the - # boundary. The client would have to deliberately craft a response - # with the opening boundary beyond the buffer size for that to happen. - # - # source://rack//lib/rack/multipart/parser.rb#274 - def handle_fast_forward; end - - # source://rack//lib/rack/multipart/parser.rb#323 - def handle_mime_body; end - - # source://rack//lib/rack/multipart/parser.rb#300 - def handle_mime_head; end - - # source://rack//lib/rack/multipart/parser.rb#261 - def read_data(io, outbuf); end - - # source://rack//lib/rack/multipart/parser.rb#393 - def tag_multipart_encoding(filename, content_type, name, body); end - - class << self - # source://rack//lib/rack/multipart/parser.rb#92 - def parse(io, content_length, content_type, tmpfile, bufsize, qp); end - - # source://rack//lib/rack/multipart/parser.rb#85 - def parse_boundary(content_type); end - end -end - -# source://rack//lib/rack/multipart/parser.rb#47 -Rack::Multipart::Parser::BUFSIZE = T.let(T.unsafe(nil), Integer) - -# source://rack//lib/rack/multipart/parser.rb#53 -class Rack::Multipart::Parser::BoundedIO - # @return [BoundedIO] a new instance of BoundedIO - # - # source://rack//lib/rack/multipart/parser.rb#54 - def initialize(io, content_length); end - - # source://rack//lib/rack/multipart/parser.rb#60 - def read(size, outbuf = T.unsafe(nil)); end -end - -# source://rack//lib/rack/multipart/parser.rb#390 -Rack::Multipart::Parser::CHARSET = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/multipart/parser.rb#112 -class Rack::Multipart::Parser::Collector - include ::Enumerable - - # @return [Collector] a new instance of Collector - # - # source://rack//lib/rack/multipart/parser.rb#148 - def initialize(tempfile); end - - # source://rack//lib/rack/multipart/parser.rb#154 - def each; end - - # source://rack//lib/rack/multipart/parser.rb#174 - def on_mime_body(mime_index, content); end - - # source://rack//lib/rack/multipart/parser.rb#178 - def on_mime_finish(mime_index); end - - # source://rack//lib/rack/multipart/parser.rb#158 - def on_mime_head(mime_index, head, filename, content_type, name); end - - private - - # source://rack//lib/rack/multipart/parser.rb#183 - def check_part_limits; end -end - -# source://rack//lib/rack/multipart/parser.rb#136 -class Rack::Multipart::Parser::Collector::BufferPart < ::Rack::Multipart::Parser::Collector::MimePart - # source://rack//lib/rack/multipart/parser.rb#138 - def close; end - - # @return [Boolean] - # - # source://rack//lib/rack/multipart/parser.rb#137 - def file?; end -end - -# source://rack//lib/rack/multipart/parser.rb#113 -class Rack::Multipart::Parser::Collector::MimePart < ::Struct - # @yield [data] - # - # source://rack//lib/rack/multipart/parser.rb#114 - def get_data; end -end - -# source://rack//lib/rack/multipart/parser.rb#141 -class Rack::Multipart::Parser::Collector::TempfilePart < ::Rack::Multipart::Parser::Collector::MimePart - # source://rack//lib/rack/multipart/parser.rb#143 - def close; end - - # @return [Boolean] - # - # source://rack//lib/rack/multipart/parser.rb#142 - def file?; end -end - -# source://rack//lib/rack/multipart/parser.rb#83 -Rack::Multipart::Parser::EMPTY = T.let(T.unsafe(nil), Rack::Multipart::Parser::MultipartInfo) - -# source://rack//lib/rack/multipart/parser.rb#82 -class Rack::Multipart::Parser::MultipartInfo < ::Struct - # Returns the value of attribute params - # - # @return [Object] the current value of params - def params; end - - # Sets the attribute params - # - # @param value [Object] the value to set the attribute params to. - # @return [Object] the newly set value - def params=(_); end - - # Returns the value of attribute tmp_files - # - # @return [Object] the current value of tmp_files - def tmp_files; end - - # Sets the attribute tmp_files - # - # @param value [Object] the value to set the attribute tmp_files to. - # @return [Object] the newly set value - def tmp_files=(_); end - - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# source://rack//lib/rack/multipart/parser.rb#49 -Rack::Multipart::Parser::TEMPFILE_FACTORY = T.let(T.unsafe(nil), Proc) - -# source://rack//lib/rack/multipart/parser.rb#48 -Rack::Multipart::Parser::TEXT_PLAIN = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/multipart/parser.rb#35 -Rack::Multipart::REGULAR_PARAMETER = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#34 -Rack::Multipart::REGULAR_PARAMETER_NAME = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#44 -Rack::Multipart::RFC2183 = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#33 -Rack::Multipart::SECTION = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/parser.rb#23 -Rack::Multipart::TOKEN = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/multipart/uploaded_file.rb#8 -class Rack::Multipart::UploadedFile - # @return [UploadedFile] a new instance of UploadedFile - # - # source://rack//lib/rack/multipart/uploaded_file.rb#16 - def initialize(filepath = T.unsafe(nil), ct = T.unsafe(nil), bin = T.unsafe(nil), path: T.unsafe(nil), content_type: T.unsafe(nil), binary: T.unsafe(nil), filename: T.unsafe(nil), io: T.unsafe(nil)); end - - # The content type of the "uploaded" file - # - # source://rack//lib/rack/multipart/uploaded_file.rb#14 - def content_type; end - - # The content type of the "uploaded" file - # - # source://rack//lib/rack/multipart/uploaded_file.rb#14 - def content_type=(_arg0); end - - # source://rack//lib/rack/multipart/uploaded_file.rb#31 - def local_path; end - - # source://rack//lib/rack/multipart/uploaded_file.rb#40 - def method_missing(method_name, *args, &block); end - - # The filename, *not* including the path, of the "uploaded" file - # - # source://rack//lib/rack/multipart/uploaded_file.rb#11 - def original_filename; end - - # source://rack//lib/rack/multipart/uploaded_file.rb#31 - def path; end - - # @return [Boolean] - # - # source://rack//lib/rack/multipart/uploaded_file.rb#36 - def respond_to?(*args); end -end - -# source://rack//lib/rack/multipart/parser.rb#25 -Rack::Multipart::VALUE = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/null_logger.rb#6 -class Rack::NullLogger - # @return [NullLogger] a new instance of NullLogger - # - # source://rack//lib/rack/null_logger.rb#7 - def initialize(app); end - - # source://rack//lib/rack/null_logger.rb#45 - def <<(msg); end - - # source://rack//lib/rack/null_logger.rb#43 - def add(severity, message = T.unsafe(nil), progname = T.unsafe(nil), &block); end - - # source://rack//lib/rack/null_logger.rb#11 - def call(env); end - - # source://rack//lib/rack/null_logger.rb#42 - def close; end - - # source://rack//lib/rack/null_logger.rb#34 - def datetime_format; end - - # source://rack//lib/rack/null_logger.rb#39 - def datetime_format=(datetime_format); end - - # source://rack//lib/rack/null_logger.rb#17 - def debug(progname = T.unsafe(nil), &block); end - - # source://rack//lib/rack/null_logger.rb#27 - def debug!; end - - # @return [Boolean] - # - # source://rack//lib/rack/null_logger.rb#23 - def debug?; end - - # source://rack//lib/rack/null_logger.rb#19 - def error(progname = T.unsafe(nil), &block); end - - # source://rack//lib/rack/null_logger.rb#28 - def error!; end - - # @return [Boolean] - # - # source://rack//lib/rack/null_logger.rb#25 - def error?; end - - # source://rack//lib/rack/null_logger.rb#20 - def fatal(progname = T.unsafe(nil), &block); end - - # source://rack//lib/rack/null_logger.rb#29 - def fatal!; end - - # @return [Boolean] - # - # source://rack//lib/rack/null_logger.rb#26 - def fatal?; end - - # source://rack//lib/rack/null_logger.rb#35 - def formatter; end - - # source://rack//lib/rack/null_logger.rb#40 - def formatter=(formatter); end - - # source://rack//lib/rack/null_logger.rb#16 - def info(progname = T.unsafe(nil), &block); end - - # source://rack//lib/rack/null_logger.rb#30 - def info!; end - - # @return [Boolean] - # - # source://rack//lib/rack/null_logger.rb#22 - def info?; end - - # source://rack//lib/rack/null_logger.rb#32 - def level; end - - # source://rack//lib/rack/null_logger.rb#37 - def level=(level); end - - # source://rack//lib/rack/null_logger.rb#44 - def log(severity, message = T.unsafe(nil), progname = T.unsafe(nil), &block); end - - # source://rack//lib/rack/null_logger.rb#33 - def progname; end - - # source://rack//lib/rack/null_logger.rb#38 - def progname=(progname); end - - # source://rack//lib/rack/null_logger.rb#46 - def reopen(logdev = T.unsafe(nil)); end - - # source://rack//lib/rack/null_logger.rb#36 - def sev_threshold; end - - # source://rack//lib/rack/null_logger.rb#41 - def sev_threshold=(sev_threshold); end - - # source://rack//lib/rack/null_logger.rb#21 - def unknown(progname = T.unsafe(nil), &block); end - - # source://rack//lib/rack/null_logger.rb#18 - def warn(progname = T.unsafe(nil), &block); end - - # source://rack//lib/rack/null_logger.rb#31 - def warn!; end - - # @return [Boolean] - # - # source://rack//lib/rack/null_logger.rb#24 - def warn?; end -end - -# source://rack//lib/rack/constants.rb#34 -Rack::OPTIONS = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#31 -Rack::PATCH = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#8 -Rack::PATH_INFO = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#29 -Rack::POST = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#30 -Rack::PUT = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#12 -Rack::QUERY_STRING = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/query_parser.rb#6 -class Rack::QueryParser - # @return [QueryParser] a new instance of QueryParser - # - # source://rack//lib/rack/query_parser.rb#33 - def initialize(params_class, _key_space_limit = T.unsafe(nil), param_depth_limit); end - - # source://rack//lib/rack/query_parser.rb#167 - def make_params; end - - # source://rack//lib/rack/query_parser.rb#171 - def new_depth_limit(param_depth_limit); end - - # normalize_params recursively expands parameters into structural types. If - # the structural types represented by two different parameter names are in - # conflict, a ParameterTypeError is raised. The depth argument is deprecated - # and should no longer be used, it is kept for backwards compatibility with - # earlier versions of rack. - # - # source://rack//lib/rack/query_parser.rb#95 - def normalize_params(params, name, v, _depth = T.unsafe(nil)); end - - # Returns the value of attribute param_depth_limit. - # - # source://rack//lib/rack/query_parser.rb#31 - def param_depth_limit; end - - # parse_nested_query expands a query string into structural types. Supported - # types are Arrays, Hashes and basic value types. It is possible to supply - # query strings with parameters of conflicting types, in this case a - # ParameterTypeError is raised. Users are encouraged to return a 400 in this - # case. - # - # source://rack//lib/rack/query_parser.rb#74 - def parse_nested_query(qs, separator = T.unsafe(nil)); end - - # Stolen from Mongrel, with some small modifications: - # Parses a query string by breaking it up at the '&'. You can also use this - # to parse cookies by changing the characters used in the second parameter - # (which defaults to '&'). - # - # source://rack//lib/rack/query_parser.rb#46 - def parse_query(qs, separator = T.unsafe(nil), &unescaper); end - - private - - # @raise [ParamsTooDeepError] - # - # source://rack//lib/rack/query_parser.rb#99 - def _normalize_params(params, name, v, depth); end - - # @return [Boolean] - # - # source://rack//lib/rack/query_parser.rb#181 - def params_hash_has_key?(hash, key); end - - # @return [Boolean] - # - # source://rack//lib/rack/query_parser.rb#177 - def params_hash_type?(obj); end - - # source://rack//lib/rack/query_parser.rb#193 - def unescape(string, encoding = T.unsafe(nil)); end - - class << self - # source://rack//lib/rack/query_parser.rb#23 - def make_default(_key_space_limit = T.unsafe(nil), param_depth_limit); end - end -end - -# source://rack//lib/rack/query_parser.rb#8 -Rack::QueryParser::COMMON_SEP = T.let(T.unsafe(nil), Hash) - -# source://rack//lib/rack/query_parser.rb#7 -Rack::QueryParser::DEFAULT_SEP = T.let(T.unsafe(nil), Regexp) - -# InvalidParameterError is the error that is raised when incoming structural -# parameters (parsed by parse_nested_query) contain invalid format or byte -# sequence. -# -# source://rack//lib/rack/query_parser.rb#17 -class Rack::QueryParser::InvalidParameterError < ::ArgumentError; end - -# ParameterTypeError is the error that is raised when incoming structural -# parameters (parsed by parse_nested_query) contain conflicting types. -# -# source://rack//lib/rack/query_parser.rb#12 -class Rack::QueryParser::ParameterTypeError < ::TypeError; end - -# source://rack//lib/rack/query_parser.rb#197 -class Rack::QueryParser::Params - # @return [Params] a new instance of Params - # - # source://rack//lib/rack/query_parser.rb#198 - def initialize; end - - # source://rack//lib/rack/query_parser.rb#203 - def [](key); end - - # source://rack//lib/rack/query_parser.rb#207 - def []=(key, value); end - - # @return [Boolean] - # - # source://rack//lib/rack/query_parser.rb#211 - def key?(key); end - - # Recursively unwraps nested `Params` objects and constructs an object - # of the same shape, but using the objects' internal representations - # (Ruby hashes) in place of the objects. The result is a hash consisting - # purely of Ruby primitives. - # - # Mutation warning! - # - # 1. This method mutates the internal representation of the `Params` - # objects in order to save object allocations. - # - # 2. The value you get back is a reference to the internal hash - # representation, not a copy. - # - # 3. Because the `Params` object's internal representation is mutable - # through the `#[]=` method, it is not thread safe. The result of - # getting the hash representation while another thread is adding a - # key to it is non-deterministic. - # - # source://rack//lib/rack/query_parser.rb#233 - def to_h; end - - # Recursively unwraps nested `Params` objects and constructs an object - # of the same shape, but using the objects' internal representations - # (Ruby hashes) in place of the objects. The result is a hash consisting - # purely of Ruby primitives. - # - # Mutation warning! - # - # 1. This method mutates the internal representation of the `Params` - # objects in order to save object allocations. - # - # 2. The value you get back is a reference to the internal hash - # representation, not a copy. - # - # 3. Because the `Params` object's internal representation is mutable - # through the `#[]=` method, it is not thread safe. The result of - # getting the hash representation while another thread is adding a - # key to it is non-deterministic. - # - # source://rack//lib/rack/query_parser.rb#233 - def to_params_hash; end -end - -# ParamsTooDeepError is the error that is raised when params are recursively -# nested over the specified limit. -# -# source://rack//lib/rack/query_parser.rb#21 -class Rack::QueryParser::ParamsTooDeepError < ::RangeError; end - -# source://rack//lib/rack/constants.rb#42 -Rack::RACK_ERRORS = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#49 -Rack::RACK_HIJACK = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#44 -Rack::RACK_INPUT = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#50 -Rack::RACK_IS_HIJACK = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#43 -Rack::RACK_LOGGER = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#63 -Rack::RACK_METHODOVERRIDE_ORIGINAL_METHOD = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#52 -Rack::RACK_MULTIPART_BUFFER_SIZE = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#53 -Rack::RACK_MULTIPART_TEMPFILE_FACTORY = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#51 -Rack::RACK_RECURSIVE_INCLUDE = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#59 -Rack::RACK_REQUEST_COOKIE_HASH = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#60 -Rack::RACK_REQUEST_COOKIE_STRING = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#58 -Rack::RACK_REQUEST_FORM_ERROR = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#56 -Rack::RACK_REQUEST_FORM_HASH = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#55 -Rack::RACK_REQUEST_FORM_INPUT = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#57 -Rack::RACK_REQUEST_FORM_VARS = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#61 -Rack::RACK_REQUEST_QUERY_HASH = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#62 -Rack::RACK_REQUEST_QUERY_STRING = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#54 -Rack::RACK_RESPONSE_FINISHED = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#45 -Rack::RACK_SESSION = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#46 -Rack::RACK_SESSION_OPTIONS = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#47 -Rack::RACK_SHOWSTATUS_DETAIL = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#41 -Rack::RACK_TEMPFILES = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#48 -Rack::RACK_URL_SCHEME = T.let(T.unsafe(nil), String) - -# Rack environment variables -# -# source://rack//lib/rack/constants.rb#40 -Rack::RACK_VERSION = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/version.rb#28 -Rack::RELEASE = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#9 -Rack::REQUEST_METHOD = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#10 -Rack::REQUEST_PATH = T.let(T.unsafe(nil), String) - -# Rack::Recursive allows applications called down the chain to -# include data from other applications (by using -# rack['rack.recursive.include'][...] or raise a -# ForwardRequest to redirect internally. -# -# source://rack//lib/rack/recursive.rb#36 -class Rack::Recursive - # @return [Recursive] a new instance of Recursive - # - # source://rack//lib/rack/recursive.rb#37 - def initialize(app); end - - # source://rack//lib/rack/recursive.rb#45 - def _call(env); end - - # source://rack//lib/rack/recursive.rb#41 - def call(env); end - - # source://rack//lib/rack/recursive.rb#52 - def include(env, path); end -end - -# High performant source reloader -# -# This class acts as Rack middleware. -# -# What makes it especially suited for use in a production environment is that -# any file will only be checked once and there will only be made one system -# call stat(2). -# -# Please note that this will not reload files in the background, it does so -# only when actively called. -# -# It is performing a check/reload cycle at the start of every request, but -# also respects a cool down time, during which nothing will be done. -# -# source://rack//lib/rack/reloader.rb#24 -class Rack::Reloader - # @return [Reloader] a new instance of Reloader - # - # source://rack//lib/rack/reloader.rb#25 - def initialize(app, cooldown = T.unsafe(nil), backend = T.unsafe(nil)); end - - # source://rack//lib/rack/reloader.rb#36 - def call(env); end - - # source://rack//lib/rack/reloader.rb#50 - def reload!(stderr = T.unsafe(nil)); end - - # A safe Kernel::load, issuing the hooks depending on the results - # - # source://rack//lib/rack/reloader.rb#58 - def safe_load(file, mtime, stderr = T.unsafe(nil)); end -end - -# source://rack//lib/rack/reloader.rb#68 -module Rack::Reloader::Stat - # Takes a relative or absolute +file+ name, a couple possible +paths+ that - # the +file+ might reside in. Returns the full path and File::Stat for the - # path. - # - # source://rack//lib/rack/reloader.rb#88 - def figure_path(file, paths); end - - # source://rack//lib/rack/reloader.rb#69 - def rotation; end - - # source://rack//lib/rack/reloader.rb#103 - def safe_stat(file); end -end - -# Rack::Request provides a convenient interface to a Rack -# environment. It is stateless, the environment +env+ passed to the -# constructor will be directly modified. -# -# req = Rack::Request.new(env) -# req.post? -# req.params["data"] -# -# source://rack//lib/rack/request.rb#16 -class Rack::Request - include ::Rack::Request::Env - include ::Rack::Request::Helpers - - # @return [Request] a new instance of Request - # - # source://rack//lib/rack/request.rb#62 - def initialize(env); end - - # source://rack//lib/rack/request.rb#76 - def delete_param(k); end - - # source://rack//lib/rack/request.rb#67 - def params; end - - # source://rack//lib/rack/request.rb#71 - def update_param(k, v); end - - class << self - # The priority when checking forwarded headers. The default - # is [:forwarded, :x_forwarded], which means, check the - # +Forwarded+ header first, followed by the appropriate - # X-Forwarded-* header. You can revert the priority by - # reversing the priority, or remove checking of either - # or both headers by removing elements from the array. - # - # This should be set as appropriate in your environment - # based on what reverse proxies are in use. If you are not - # using reverse proxies, you should probably use an empty - # array. - # - # source://rack//lib/rack/request.rb#31 - def forwarded_priority; end - - # The priority when checking forwarded headers. The default - # is [:forwarded, :x_forwarded], which means, check the - # +Forwarded+ header first, followed by the appropriate - # X-Forwarded-* header. You can revert the priority by - # reversing the priority, or remove checking of either - # or both headers by removing elements from the array. - # - # This should be set as appropriate in your environment - # based on what reverse proxies are in use. If you are not - # using reverse proxies, you should probably use an empty - # array. - # - # source://rack//lib/rack/request.rb#31 - def forwarded_priority=(_arg0); end - - # Returns the value of attribute ip_filter. - # - # source://rack//lib/rack/request.rb#18 - def ip_filter; end - - # Sets the attribute ip_filter - # - # @param value the value to set the attribute ip_filter to. - # - # source://rack//lib/rack/request.rb#18 - def ip_filter=(_arg0); end - - # The priority when checking either the X-Forwarded-Proto - # or X-Forwarded-Scheme header for the forwarded protocol. - # The default is [:proto, :scheme], to try the - # X-Forwarded-Proto header before the - # X-Forwarded-Scheme header. Rack 2 had behavior - # similar to [:scheme, :proto]. You can remove either or - # both of the entries in array to ignore that respective header. - # - # source://rack//lib/rack/request.rb#40 - def x_forwarded_proto_priority; end - - # The priority when checking either the X-Forwarded-Proto - # or X-Forwarded-Scheme header for the forwarded protocol. - # The default is [:proto, :scheme], to try the - # X-Forwarded-Proto header before the - # X-Forwarded-Scheme header. Rack 2 had behavior - # similar to [:scheme, :proto]. You can remove either or - # both of the entries in array to ignore that respective header. - # - # source://rack//lib/rack/request.rb#40 - def x_forwarded_proto_priority=(_arg0); end - end -end - -# source://rack//lib/rack/request.rb#60 -Rack::Request::ALLOWED_SCHEMES = T.let(T.unsafe(nil), Array) - -# source://rack//lib/rack/request.rb#82 -module Rack::Request::Env - # source://rack//lib/rack/request.rb#86 - def initialize(env); end - - # Add a header that may have multiple values. - # - # Example: - # request.add_header 'Accept', 'image/png' - # request.add_header 'Accept', '*/*' - # - # assert_equal 'image/png,*/*', request.get_header('Accept') - # - # http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 - # - # source://rack//lib/rack/request.rb#129 - def add_header(key, v); end - - # Delete a request specific value for `name`. - # - # source://rack//lib/rack/request.rb#140 - def delete_header(name); end - - # Loops through each key / value pair in the request specific data. - # - # source://rack//lib/rack/request.rb#111 - def each_header(&block); end - - # The environment of the request. - # - # source://rack//lib/rack/request.rb#84 - def env; end - - # If a block is given, it yields to the block if the value hasn't been set - # on the request. - # - # source://rack//lib/rack/request.rb#106 - def fetch_header(name, &block); end - - # Get a request specific value for `name`. - # - # source://rack//lib/rack/request.rb#100 - def get_header(name); end - - # Predicate method to test to see if `name` has been set as request - # specific data - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#95 - def has_header?(name); end - - # Set a request specific value for `name` to `v` - # - # source://rack//lib/rack/request.rb#116 - def set_header(name, v); end - - private - - # source://rack//lib/rack/request.rb#144 - def initialize_copy(other); end -end - -# source://rack//lib/rack/request.rb#149 -module Rack::Request::Helpers - # Returns the data received in the query string. - # - # source://rack//lib/rack/request.rb#484 - def GET; end - - # Returns the data received in the request body. - # - # This method support both application/x-www-form-urlencoded and - # multipart/form-data. - # - # source://rack//lib/rack/request.rb#498 - def POST; end - - # shortcut for request.params[key] - # - # source://rack//lib/rack/request.rb#609 - def [](key); end - - # shortcut for request.params[key] = value - # - # Note that modifications will not be persisted in the env. Use update_param or delete_param if you want to destructively modify params. - # - # source://rack//lib/rack/request.rb#618 - def []=(key, value); end - - # source://rack//lib/rack/request.rb#596 - def accept_encoding; end - - # source://rack//lib/rack/request.rb#600 - def accept_language; end - - # The authority of the incoming request as defined by RFC3976. - # https://tools.ietf.org/html/rfc3986#section-3.2 - # - # In HTTP/1, this is the `host` header. - # In HTTP/2, this is the `:authority` pseudo-header. - # - # source://rack//lib/rack/request.rb#266 - def authority; end - - # source://rack//lib/rack/request.rb#579 - def base_url; end - - # source://rack//lib/rack/request.rb#190 - def body; end - - # The character set of the request body if a "charset" media type - # parameter was given, or nil if no "charset" was specified. Note - # that, per RFC2616, text/* media types that specify no explicit - # charset are to be considered ISO-8859-1. - # - # source://rack//lib/rack/request.rb#458 - def content_charset; end - - # source://rack//lib/rack/request.rb#199 - def content_length; end - - # source://rack//lib/rack/request.rb#308 - def content_type; end - - # source://rack//lib/rack/request.rb#293 - def cookies; end - - # Checks the HTTP request method (or verb) to see if it was of type DELETE - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#220 - def delete?; end - - # Destructively delete a parameter, whether it's in GET or POST. Returns the value of the deleted parameter. - # - # If the parameter is in both GET and POST, the POST value takes precedence since that's how #params works. - # - # env['rack.input'] is not touched. - # - # source://rack//lib/rack/request.rb#574 - def delete_param(k); end - - # Determine whether the request body contains form-data by checking - # the request content-type for one of the media-types: - # "application/x-www-form-urlencoded" or "multipart/form-data". The - # list of form-data media types can be modified through the - # +FORM_DATA_MEDIA_TYPES+ array. - # - # A request body is also assumed to contain form-data when no - # content-type header is provided and the request_method is POST. - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#470 - def form_data?; end - - # source://rack//lib/rack/request.rb#393 - def forwarded_authority; end - - # source://rack//lib/rack/request.rb#353 - def forwarded_for; end - - # source://rack//lib/rack/request.rb#374 - def forwarded_port; end - - # source://rack//lib/rack/request.rb#592 - def fullpath; end - - # Checks the HTTP request method (or verb) to see if it was of type GET - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#223 - def get?; end - - # Checks the HTTP request method (or verb) to see if it was of type HEAD - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#226 - def head?; end - - # Returns a formatted host, suitable for being used in a URI. - # - # source://rack//lib/rack/request.rb#333 - def host; end - - # The `HTTP_HOST` header. - # - # source://rack//lib/rack/request.rb#318 - def host_authority; end - - # source://rack//lib/rack/request.rb#322 - def host_with_port(authority = T.unsafe(nil)); end - - # Returns an address suitable for being to resolve to an address. - # In the case of a domain name or IPv4 address, the result is the same - # as +host+. In the case of IPv6 or future address formats, the square - # brackets are removed. - # - # source://rack//lib/rack/request.rb#341 - def hostname; end - - # source://rack//lib/rack/request.rb#414 - def ip; end - - # Checks the HTTP request method (or verb) to see if it was of type LINK - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#232 - def link?; end - - # source://rack//lib/rack/request.rb#200 - def logger; end - - # The media type (type/subtype) portion of the CONTENT_TYPE header - # without any media type parameters. e.g., when CONTENT_TYPE is - # "text/plain;charset=utf-8", the media-type is "text/plain". - # - # For more information on the use of media types in HTTP, see: - # http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7 - # - # source://rack//lib/rack/request.rb#441 - def media_type; end - - # The media type parameters provided in CONTENT_TYPE as a Hash, or - # an empty Hash if no CONTENT_TYPE or media-type parameters were - # provided. e.g., when the CONTENT_TYPE is "text/plain;charset=utf-8", - # this method responds with the following Hash: - # { 'charset' => 'utf-8' } - # - # source://rack//lib/rack/request.rb#450 - def media_type_params; end - - # Checks the HTTP request method (or verb) to see if it was of type OPTIONS - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#229 - def options?; end - - # The union of GET and POST data. - # - # Note that modifications will not be persisted in the env. Use update_param or delete_param if you want to destructively modify params. - # - # source://rack//lib/rack/request.rb#545 - def params; end - - # Determine whether the request body contains data by checking - # the request media_type against registered parse-data media-types - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#479 - def parseable_data?; end - - # Checks the HTTP request method (or verb) to see if it was of type PATCH - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#235 - def patch?; end - - # source://rack//lib/rack/request.rb#588 - def path; end - - # source://rack//lib/rack/request.rb#194 - def path_info; end - - # source://rack//lib/rack/request.rb#195 - def path_info=(s); end - - # source://rack//lib/rack/request.rb#345 - def port; end - - # Checks the HTTP request method (or verb) to see if it was of type POST - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#238 - def post?; end - - # Checks the HTTP request method (or verb) to see if it was of type PUT - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#241 - def put?; end - - # source://rack//lib/rack/request.rb#198 - def query_string; end - - # the referer of the client - # - # source://rack//lib/rack/request.rb#204 - def referer; end - - # the referer of the client - # - # source://rack//lib/rack/request.rb#204 - def referrer; end - - # source://rack//lib/rack/request.rb#197 - def request_method; end - - # source://rack//lib/rack/request.rb#249 - def scheme; end - - # source://rack//lib/rack/request.rb#191 - def script_name; end - - # source://rack//lib/rack/request.rb#192 - def script_name=(s); end - - # The authority as defined by the `SERVER_NAME` and `SERVER_PORT` - # variables. - # - # source://rack//lib/rack/request.rb#272 - def server_authority; end - - # source://rack//lib/rack/request.rb#285 - def server_name; end - - # source://rack//lib/rack/request.rb#289 - def server_port; end - - # source://rack//lib/rack/request.rb#207 - def session; end - - # source://rack//lib/rack/request.rb#213 - def session_options; end - - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#410 - def ssl?; end - - # Checks the HTTP request method (or verb) to see if it was of type TRACE - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#244 - def trace?; end - - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#604 - def trusted_proxy?(ip); end - - # Checks the HTTP request method (or verb) to see if it was of type UNLINK - # - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#247 - def unlink?; end - - # Destructively update a parameter, whether it's in GET and/or POST. Returns nil. - # - # The parameter is updated wherever it was previous defined, so GET, POST, or both. If it wasn't previously defined, it's inserted into GET. - # - # env['rack.input'] is not touched. - # - # source://rack//lib/rack/request.rb#554 - def update_param(k, v); end - - # Tries to return a remake of the original request URL as a string. - # - # source://rack//lib/rack/request.rb#584 - def url; end - - # source://rack//lib/rack/request.rb#201 - def user_agent; end - - # like Hash#values_at - # - # source://rack//lib/rack/request.rb#625 - def values_at(*keys); end - - # @return [Boolean] - # - # source://rack//lib/rack/request.rb#313 - def xhr?; end - - private - - # source://rack//lib/rack/request.rb#757 - def allowed_scheme(header); end - - # source://rack//lib/rack/request.rb#631 - def default_session; end - - # source://rack//lib/rack/request.rb#761 - def forwarded_priority; end - - # source://rack//lib/rack/request.rb#733 - def forwarded_scheme; end - - # Get an array of values set in the RFC 7239 `Forwarded` request header. - # - # source://rack//lib/rack/request.rb#659 - def get_http_forwarded(token); end - - # source://rack//lib/rack/request.rb#647 - def parse_http_accept_header(header); end - - # source://rack//lib/rack/request.rb#671 - def parse_multipart; end - - # source://rack//lib/rack/request.rb#667 - def parse_query(qs, d = T.unsafe(nil)); end - - # source://rack//lib/rack/request.rb#663 - def query_parser; end - - # source://rack//lib/rack/request.rb#724 - def reject_trusted_ip_addresses(ip_addresses); end - - # source://rack//lib/rack/request.rb#718 - def split_authority(authority); end - - # source://rack//lib/rack/request.rb#675 - def split_header(value); end - - # Assist with compatibility when processing `X-Forwarded-For`. - # - # source://rack//lib/rack/request.rb#634 - def wrap_ipv6(host); end - - # source://rack//lib/rack/request.rb#765 - def x_forwarded_proto_priority; end -end - -# source://rack//lib/rack/request.rb#703 -Rack::Request::Helpers::AUTHORITY = T.let(T.unsafe(nil), Regexp) - -# Default ports depending on scheme. Used to decide whether or not -# to include the port in a generated URI. -# -# source://rack//lib/rack/request.rb#168 -Rack::Request::Helpers::DEFAULT_PORTS = T.let(T.unsafe(nil), Hash) - -# The set of form-data media-types. Requests that do not indicate -# one of the media types present in this list will not be eligible -# for form-data / param parsing. -# -# source://rack//lib/rack/request.rb#153 -Rack::Request::Helpers::FORM_DATA_MEDIA_TYPES = T.let(T.unsafe(nil), Array) - -# source://rack//lib/rack/request.rb#728 -Rack::Request::Helpers::FORWARDED_SCHEME_HEADERS = T.let(T.unsafe(nil), Hash) - -# source://rack//lib/rack/request.rb#176 -Rack::Request::Helpers::HTTP_FORWARDED = T.let(T.unsafe(nil), String) - -# The address of the client which connected to the proxy. -# -# source://rack//lib/rack/request.rb#171 -Rack::Request::Helpers::HTTP_X_FORWARDED_FOR = T.let(T.unsafe(nil), String) - -# The contents of the host/:authority header sent to the proxy. -# -# source://rack//lib/rack/request.rb#174 -Rack::Request::Helpers::HTTP_X_FORWARDED_HOST = T.let(T.unsafe(nil), String) - -# The port used to connect to the proxy. -# -# source://rack//lib/rack/request.rb#185 -Rack::Request::Helpers::HTTP_X_FORWARDED_PORT = T.let(T.unsafe(nil), String) - -# The protocol used to connect to the proxy. -# -# source://rack//lib/rack/request.rb#182 -Rack::Request::Helpers::HTTP_X_FORWARDED_PROTO = T.let(T.unsafe(nil), String) - -# The value of the scheme sent to the proxy. -# -# source://rack//lib/rack/request.rb#179 -Rack::Request::Helpers::HTTP_X_FORWARDED_SCHEME = T.let(T.unsafe(nil), String) - -# Another way for specifying https scheme was used. -# -# source://rack//lib/rack/request.rb#188 -Rack::Request::Helpers::HTTP_X_FORWARDED_SSL = T.let(T.unsafe(nil), String) - -# The set of media-types. Requests that do not indicate -# one of the media types present in this list will not be eligible -# for param parsing like soap attachments or generic multiparts -# -# source://rack//lib/rack/request.rb#161 -Rack::Request::Helpers::PARSEABLE_DATA_MEDIA_TYPES = T.let(T.unsafe(nil), Array) - -# Rack::Response provides a convenient interface to create a Rack -# response. -# -# It allows setting of headers and cookies, and provides useful -# defaults (an OK response with empty headers and body). -# -# You can use Response#write to iteratively generate your response, -# but note that this is buffered by Rack::Response until you call -# +finish+. +finish+ however can take a block inside which calls to -# +write+ are synchronous with the Rack response. -# -# Your application's +call+ should end returning Response#finish. -# -# source://rack//lib/rack/response.rb#23 -class Rack::Response - include ::Rack::Response::Helpers - - # Initialize the response object with the specified +body+, +status+ - # and +headers+. - # - # If the +body+ is +nil+, construct an empty response object with internal - # buffering. - # - # If the +body+ responds to +to_str+, assume it's a string-like object and - # construct a buffered response object containing using that string as the - # initial contents of the buffer. - # - # Otherwise it is expected +body+ conforms to the normal requirements of a - # Rack response body, typically implementing one of +each+ (enumerable - # body) or +call+ (streaming body). - # - # The +status+ defaults to +200+ which is the "OK" HTTP status code. You - # can provide any other valid status code. - # - # The +headers+ must be a +Hash+ of key-value header pairs which conform to - # the Rack specification for response headers. The key must be a +String+ - # instance and the value can be either a +String+ or +Array+ instance. - # - # @return [Response] a new instance of Response - # @yield [_self] - # @yieldparam _self [Rack::Response] the object that the method was called on - # - # source://rack//lib/rack/response.rb#61 - def initialize(body = T.unsafe(nil), status = T.unsafe(nil), headers = T.unsafe(nil)); end - - # @raise [ArgumentError] - # - # source://rack//lib/rack/response.rb#163 - def [](key); end - - # @raise [ArgumentError] - # - # source://rack//lib/rack/response.rb#167 - def []=(key, value); end - - # Returns the value of attribute body. - # - # source://rack//lib/rack/response.rb#31 - def body; end - - # Sets the attribute body - # - # @param value the value to set the attribute body to. - # - # source://rack//lib/rack/response.rb#31 - def body=(_arg0); end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#101 - def chunked?; end - - # source://rack//lib/rack/response.rb#151 - def close; end - - # @raise [ArgumentError] - # - # source://rack//lib/rack/response.rb#171 - def delete_header(key); end - - # source://rack//lib/rack/response.rb#131 - def each(&callback); end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#155 - def empty?; end - - # Generate a response array consistent with the requirements of the SPEC. - # which is suitable to be returned from the middleware `#call(env)` method. - # - # @return [Array] a 3-tuple suitable of `[status, headers, body]` - # - # source://rack//lib/rack/response.rb#113 - def finish(&block); end - - # @raise [ArgumentError] - # - # source://rack//lib/rack/response.rb#163 - def get_header(key); end - - # @raise [ArgumentError] - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#159 - def has_header?(key); end - - # Deprecated, use headers instead. - # - # source://rack//lib/rack/response.rb#35 - def header; end - - # Returns the value of attribute headers. - # - # source://rack//lib/rack/response.rb#32 - def headers; end - - # Returns the value of attribute length. - # - # source://rack//lib/rack/response.rb#31 - def length; end - - # Sets the attribute length - # - # @param value the value to set the attribute length to. - # - # source://rack//lib/rack/response.rb#31 - def length=(_arg0); end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#105 - def no_entity_body?; end - - # source://rack//lib/rack/response.rb#96 - def redirect(target, status = T.unsafe(nil)); end - - # @raise [ArgumentError] - # - # source://rack//lib/rack/response.rb#167 - def set_header(key, value); end - - # Returns the value of attribute status. - # - # source://rack//lib/rack/response.rb#31 - def status; end - - # Sets the attribute status - # - # @param value the value to set the attribute status to. - # - # source://rack//lib/rack/response.rb#31 - def status=(_arg0); end - - # Generate a response array consistent with the requirements of the SPEC. - # which is suitable to be returned from the middleware `#call(env)` method. - # For *response - # - # @return [Array] a 3-tuple suitable of `[status, headers, body]` - # - # source://rack//lib/rack/response.rb#113 - def to_a(&block); end - - # Append to body and update content-length. - # - # NOTE: Do not mix #write and direct #body access! - # - # source://rack//lib/rack/response.rb#145 - def write(chunk); end - - class << self - # source://rack//lib/rack/response.rb#24 - def [](status, headers, body); end - end -end - -# source://rack//lib/rack/response.rb#28 -Rack::Response::CHUNKED = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/response.rb#179 -module Rack::Response::Helpers - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#190 - def accepted?; end - - # Add a header that may have multiple values. - # - # Example: - # response.add_header 'vary', 'accept-encoding' - # response.add_header 'vary', 'cookie' - # - # assert_equal 'accept-encoding,cookie', response.get_header('vary') - # - # http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 - # - # @raise [ArgumentError] - # - # source://rack//lib/rack/response.rb#218 - def add_header(key, value); end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#193 - def bad_request?; end - - # Specify that the content should be cached. - # - # @option directive - # @param duration [Integer] The number of seconds until the cache expires. - # @param directive [Hash] a customizable set of options - # - # source://rack//lib/rack/response.rb#306 - def cache!(duration = T.unsafe(nil), directive: T.unsafe(nil)); end - - # source://rack//lib/rack/response.rb#289 - def cache_control; end - - # source://rack//lib/rack/response.rb#293 - def cache_control=(value); end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#185 - def client_error?; end - - # source://rack//lib/rack/response.rb#256 - def content_length; end - - # Get the content type of the response. - # - # source://rack//lib/rack/response.rb#239 - def content_type; end - - # Set the content type of the response. - # - # source://rack//lib/rack/response.rb#244 - def content_type=(content_type); end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#189 - def created?; end - - # source://rack//lib/rack/response.rb#273 - def delete_cookie(key, value = T.unsafe(nil)); end - - # Specifies that the content shouldn't be cached. Overrides `cache!` if already called. - # - # source://rack//lib/rack/response.rb#298 - def do_not_cache!; end - - # source://rack//lib/rack/response.rb#313 - def etag; end - - # source://rack//lib/rack/response.rb#317 - def etag=(value); end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#195 - def forbidden?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#205 - def include?(header); end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#182 - def informational?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#180 - def invalid?; end - - # source://rack//lib/rack/response.rb#261 - def location; end - - # source://rack//lib/rack/response.rb#265 - def location=(location); end - - # source://rack//lib/rack/response.rb#248 - def media_type; end - - # source://rack//lib/rack/response.rb#252 - def media_type_params; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#197 - def method_not_allowed?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#192 - def moved_permanently?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#191 - def no_content?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#198 - def not_acceptable?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#196 - def not_found?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#188 - def ok?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#200 - def precondition_failed?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#203 - def redirect?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#184 - def redirection?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#199 - def request_timeout?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#186 - def server_error?; end - - # source://rack//lib/rack/response.rb#269 - def set_cookie(key, value); end - - # source://rack//lib/rack/response.rb#281 - def set_cookie_header; end - - # source://rack//lib/rack/response.rb#285 - def set_cookie_header=(value); end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#183 - def successful?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#194 - def unauthorized?; end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#201 - def unprocessable?; end - - protected - - # source://rack//lib/rack/response.rb#351 - def append(chunk); end - - # source://rack//lib/rack/response.rb#323 - def buffered_body!; end -end - -# source://rack//lib/rack/response.rb#365 -class Rack::Response::Raw - include ::Rack::Response::Helpers - - # @return [Raw] a new instance of Raw - # - # source://rack//lib/rack/response.rb#371 - def initialize(status, headers); end - - # source://rack//lib/rack/response.rb#388 - def delete_header(key); end - - # source://rack//lib/rack/response.rb#380 - def get_header(key); end - - # @return [Boolean] - # - # source://rack//lib/rack/response.rb#376 - def has_header?(key); end - - # Returns the value of attribute headers. - # - # source://rack//lib/rack/response.rb#368 - def headers; end - - # source://rack//lib/rack/response.rb#384 - def set_header(key, value); end - - # Returns the value of attribute status. - # - # source://rack//lib/rack/response.rb#369 - def status; end - - # Sets the attribute status - # - # @param value the value to set the attribute status to. - # - # source://rack//lib/rack/response.rb#369 - def status=(_arg0); end -end - -# source://rack//lib/rack/response.rb#29 -Rack::Response::STATUS_WITH_NO_ENTITY_BODY = T.let(T.unsafe(nil), Hash) - -# Class which can make any IO object rewindable, including non-rewindable ones. It does -# this by buffering the data into a tempfile, which is rewindable. -# -# Don't forget to call #close when you're done. This frees up temporary resources that -# RewindableInput uses, though it does *not* close the original IO object. -# -# source://rack//lib/rack/rewindable_input.rb#14 -class Rack::RewindableInput - # @return [RewindableInput] a new instance of RewindableInput - # - # source://rack//lib/rack/rewindable_input.rb#29 - def initialize(io); end - - # Closes this RewindableInput object without closing the originally - # wrapped IO object. Cleans up any temporary resources that this RewindableInput - # has created. - # - # This method may be called multiple times. It does nothing on subsequent calls. - # - # source://rack//lib/rack/rewindable_input.rb#65 - def close; end - - # source://rack//lib/rack/rewindable_input.rb#45 - def each(&block); end - - # source://rack//lib/rack/rewindable_input.rb#35 - def gets; end - - # source://rack//lib/rack/rewindable_input.rb#40 - def read(*args); end - - # source://rack//lib/rack/rewindable_input.rb#50 - def rewind; end - - # source://rack//lib/rack/rewindable_input.rb#55 - def size; end - - private - - # @return [Boolean] - # - # source://rack//lib/rack/rewindable_input.rb#109 - def filesystem_has_posix_semantics?; end - - # source://rack//lib/rack/rewindable_input.rb#78 - def make_rewindable; end -end - -# Makes rack.input rewindable, for compatibility with applications and middleware -# designed for earlier versions of Rack (where rack.input was required to be -# rewindable). -# -# source://rack//lib/rack/rewindable_input.rb#18 -class Rack::RewindableInput::Middleware - # @return [Middleware] a new instance of Middleware - # - # source://rack//lib/rack/rewindable_input.rb#19 - def initialize(app); end - - # source://rack//lib/rack/rewindable_input.rb#23 - def call(env); end -end - -# Sets an "x-runtime" response header, indicating the response -# time of the request, in seconds -# -# You can put it right before the application to see the processing -# time, or before all the other middlewares to include time for them, -# too. -# -# source://rack//lib/rack/runtime.rb#12 -class Rack::Runtime - # @return [Runtime] a new instance of Runtime - # - # source://rack//lib/rack/runtime.rb#16 - def initialize(app, name = T.unsafe(nil)); end - - # source://rack//lib/rack/runtime.rb#22 - def call(env); end -end - -# source://rack//lib/rack/runtime.rb#13 -Rack::Runtime::FORMAT_STRING = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/runtime.rb#14 -Rack::Runtime::HEADER_NAME = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#11 -Rack::SCRIPT_NAME = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#14 -Rack::SERVER_NAME = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#15 -Rack::SERVER_PORT = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#13 -Rack::SERVER_PROTOCOL = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#24 -Rack::SET_COOKIE = T.let(T.unsafe(nil), String) - -# = Sendfile -# -# The Sendfile middleware intercepts responses whose body is being -# served from a file and replaces it with a server specific x-sendfile -# header. The web server is then responsible for writing the file contents -# to the client. This can dramatically reduce the amount of work required -# by the Ruby backend and takes advantage of the web server's optimized file -# delivery code. -# -# In order to take advantage of this middleware, the response body must -# respond to +to_path+ and the request must include an x-sendfile-type -# header. Rack::Files and other components implement +to_path+ so there's -# rarely anything you need to do in your application. The x-sendfile-type -# header is typically set in your web servers configuration. The following -# sections attempt to document -# -# === Nginx -# -# Nginx supports the x-accel-redirect header. This is similar to x-sendfile -# but requires parts of the filesystem to be mapped into a private URL -# hierarchy. -# -# The following example shows the Nginx configuration required to create -# a private "/files/" area, enable x-accel-redirect, and pass the special -# x-sendfile-type and x-accel-mapping headers to the backend: -# -# location ~ /files/(.*) { -# internal; -# alias /var/www/$1; -# } -# -# location / { -# proxy_redirect off; -# -# proxy_set_header Host $host; -# proxy_set_header X-Real-IP $remote_addr; -# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -# -# proxy_set_header x-sendfile-type x-accel-redirect; -# proxy_set_header x-accel-mapping /var/www/=/files/; -# -# proxy_pass http://127.0.0.1:8080/; -# } -# -# Note that the x-sendfile-type header must be set exactly as shown above. -# The x-accel-mapping header should specify the location on the file system, -# followed by an equals sign (=), followed name of the private URL pattern -# that it maps to. The middleware performs a simple substitution on the -# resulting path. -# -# See Also: https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile -# -# === lighttpd -# -# Lighttpd has supported some variation of the x-sendfile header for some -# time, although only recent version support x-sendfile in a reverse proxy -# configuration. -# -# $HTTP["host"] == "example.com" { -# proxy-core.protocol = "http" -# proxy-core.balancer = "round-robin" -# proxy-core.backends = ( -# "127.0.0.1:8000", -# "127.0.0.1:8001", -# ... -# ) -# -# proxy-core.allow-x-sendfile = "enable" -# proxy-core.rewrite-request = ( -# "x-sendfile-type" => (".*" => "x-sendfile") -# ) -# } -# -# See Also: http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModProxyCore -# -# === Apache -# -# x-sendfile is supported under Apache 2.x using a separate module: -# -# https://tn123.org/mod_xsendfile/ -# -# Once the module is compiled and installed, you can enable it using -# XSendFile config directive: -# -# RequestHeader Set x-sendfile-type x-sendfile -# ProxyPassReverse / http://localhost:8001/ -# XSendFile on -# -# === Mapping parameter -# -# The third parameter allows for an overriding extension of the -# x-accel-mapping header. Mappings should be provided in tuples of internal to -# external. The internal values may contain regular expression syntax, they -# will be matched with case indifference. -# -# source://rack//lib/rack/sendfile.rb#104 -class Rack::Sendfile - # @return [Sendfile] a new instance of Sendfile - # - # source://rack//lib/rack/sendfile.rb#105 - def initialize(app, variation = T.unsafe(nil), mappings = T.unsafe(nil)); end - - # source://rack//lib/rack/sendfile.rb#113 - def call(env); end - - private - - # source://rack//lib/rack/sendfile.rb#154 - def map_accel_path(env, path); end - - # source://rack//lib/rack/sendfile.rb#148 - def variation(env); end -end - -# Rack::ShowExceptions catches all exceptions raised from the app it -# wraps. It shows a useful backtrace with the sourcefile and -# clickable context, the whole Rack environment and the request -# data. -# -# Be careful when you use this on public-facing sites as it could -# reveal information helpful to attackers. -# -# source://rack//lib/rack/show_exceptions.rb#19 -class Rack::ShowExceptions - # @return [ShowExceptions] a new instance of ShowExceptions - # - # source://rack//lib/rack/show_exceptions.rb#22 - def initialize(app); end - - # source://rack//lib/rack/show_exceptions.rb#26 - def call(env); end - - # source://rack//lib/rack/show_exceptions.rb#61 - def dump_exception(exception); end - - # source://rack//lib/rack/show_exceptions.rb#112 - def h(obj); end - - # @return [Boolean] - # - # source://rack//lib/rack/show_exceptions.rb#52 - def prefers_plaintext?(env); end - - # source://rack//lib/rack/show_exceptions.rb#72 - def pretty(env, exception); end - - # source://rack//lib/rack/show_exceptions.rb#108 - def template; end - - private - - # @return [Boolean] - # - # source://rack//lib/rack/show_exceptions.rb#56 - def accepts_html?(env); end -end - -# source://rack//lib/rack/show_exceptions.rb#20 -Rack::ShowExceptions::CONTEXT = T.let(T.unsafe(nil), Integer) - -# source://rack//lib/rack/show_exceptions.rb#127 -Rack::ShowExceptions::TEMPLATE = T.let(T.unsafe(nil), ERB) - -# Rack::ShowStatus catches all empty responses and replaces them -# with a site explaining the error. -# -# Additional details can be put into rack.showstatus.detail -# and will be shown as HTML. If such details exist, the error page -# is always rendered, even if the reply was not empty. -# -# source://rack//lib/rack/show_status.rb#18 -class Rack::ShowStatus - # @return [ShowStatus] a new instance of ShowStatus - # - # source://rack//lib/rack/show_status.rb#19 - def initialize(app); end - - # source://rack//lib/rack/show_status.rb#24 - def call(env); end - - # source://rack//lib/rack/show_status.rb#54 - def h(obj); end -end - -# source://rack//lib/rack/show_status.rb#69 -Rack::ShowStatus::TEMPLATE = T.let(T.unsafe(nil), String) - -# The Rack::Static middleware intercepts requests for static files -# (javascript files, images, stylesheets, etc) based on the url prefixes or -# route mappings passed in the options, and serves them using a Rack::Files -# object. This allows a Rack stack to serve both static and dynamic content. -# -# Examples: -# -# Serve all requests beginning with /media from the "media" folder located -# in the current directory (ie media/*): -# -# use Rack::Static, :urls => ["/media"] -# -# Same as previous, but instead of returning 404 for missing files under -# /media, call the next middleware: -# -# use Rack::Static, :urls => ["/media"], :cascade => true -# -# Serve all requests beginning with /css or /images from the folder "public" -# in the current directory (ie public/css/* and public/images/*): -# -# use Rack::Static, :urls => ["/css", "/images"], :root => "public" -# -# Serve all requests to / with "index.html" from the folder "public" in the -# current directory (ie public/index.html): -# -# use Rack::Static, :urls => {"/" => 'index.html'}, :root => 'public' -# -# Serve all requests normally from the folder "public" in the current -# directory but uses index.html as default route for "/" -# -# use Rack::Static, :urls => [""], :root => 'public', :index => -# 'index.html' -# -# Set custom HTTP Headers for based on rules: -# -# use Rack::Static, :root => 'public', -# :header_rules => [ -# [rule, {header_field => content, header_field => content}], -# [rule, {header_field => content}] -# ] -# -# Rules for selecting files: -# -# 1) All files -# Provide the :all symbol -# :all => Matches every file -# -# 2) Folders -# Provide the folder path as a string -# '/folder' or '/folder/subfolder' => Matches files in a certain folder -# -# 3) File Extensions -# Provide the file extensions as an array -# ['css', 'js'] or %w(css js) => Matches files ending in .css or .js -# -# 4) Regular Expressions / Regexp -# Provide a regular expression -# %r{\.(?:css|js)\z} => Matches files ending in .css or .js -# /\.(?:eot|ttf|otf|woff2|woff|svg)\z/ => Matches files ending in -# the most common web font formats (.eot, .ttf, .otf, .woff2, .woff, .svg) -# Note: This Regexp is available as a shortcut, using the :fonts rule -# -# 5) Font Shortcut -# Provide the :fonts symbol -# :fonts => Uses the Regexp rule stated right above to match all common web font endings -# -# Rule Ordering: -# Rules are applied in the order that they are provided. -# List rather general rules above special ones. -# -# Complete example use case including HTTP header rules: -# -# use Rack::Static, :root => 'public', -# :header_rules => [ -# # Cache all static files in public caches (e.g. Rack::Cache) -# # as well as in the browser -# [:all, {'cache-control' => 'public, max-age=31536000'}], -# -# # Provide web fonts with cross-origin access-control-headers -# # Firefox requires this when serving assets using a Content Delivery Network -# [:fonts, {'access-control-allow-origin' => '*'}] -# ] -# -# source://rack//lib/rack/static.rb#92 -class Rack::Static - # @return [Static] a new instance of Static - # - # source://rack//lib/rack/static.rb#93 - def initialize(app, options = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://rack//lib/rack/static.rb#109 - def add_index_root?(path); end - - # Convert HTTP header rules to HTTP headers - # - # source://rack//lib/rack/static.rb#166 - def applicable_rules(path); end - - # source://rack//lib/rack/static.rb#125 - def call(env); end - - # source://rack//lib/rack/static.rb#121 - def can_serve(path); end - - # source://rack//lib/rack/static.rb#113 - def overwrite_file_path(path); end - - # source://rack//lib/rack/static.rb#117 - def route_file(path); end -end - -# source://rack//lib/rack/constants.rb#37 -Rack::TRACE = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/constants.rb#25 -Rack::TRANSFER_ENCODING = T.let(T.unsafe(nil), String) - -# Middleware tracks and cleans Tempfiles created throughout a request (i.e. Rack::Multipart) -# Ideas/strategy based on posts by Eric Wong and Charles Oliver Nutter -# https://groups.google.com/forum/#!searchin/rack-devel/temp/rack-devel/brK8eh-MByw/sw61oJJCGRMJ -# -# source://rack//lib/rack/tempfile_reaper.rb#11 -class Rack::TempfileReaper - # @return [TempfileReaper] a new instance of TempfileReaper - # - # source://rack//lib/rack/tempfile_reaper.rb#12 - def initialize(app); end - - # source://rack//lib/rack/tempfile_reaper.rb#16 - def call(env); end -end - -# source://rack//lib/rack/constants.rb#36 -Rack::UNLINK = T.let(T.unsafe(nil), String) - -# Rack::URLMap takes a hash mapping urls or paths to apps, and -# dispatches accordingly. Support for HTTP/1.1 host names exists if -# the URLs start with http:// or https://. -# -# URLMap modifies the SCRIPT_NAME and PATH_INFO such that the part -# relevant for dispatch is in the SCRIPT_NAME, and the rest in the -# PATH_INFO. This should be taken care of when you need to -# reconstruct the URL in order to create links. -# -# URLMap dispatches in such a way that the longest paths are tried -# first, since they are most specific. -# -# source://rack//lib/rack/urlmap.rb#20 -class Rack::URLMap - # @return [URLMap] a new instance of URLMap - # - # source://rack//lib/rack/urlmap.rb#21 - def initialize(map = T.unsafe(nil)); end - - # source://rack//lib/rack/urlmap.rb#48 - def call(env); end - - # source://rack//lib/rack/urlmap.rb#25 - def remap(map); end - - private - - # @return [Boolean] - # - # source://rack//lib/rack/urlmap.rb#87 - def casecmp?(v1, v2); end -end - -# Rack::Utils contains a grab-bag of useful methods for writing web -# applications adopted from all kinds of Ruby libraries. -# -# source://rack//lib/rack/utils.rb#19 -module Rack::Utils - private - - # source://rack//lib/rack/utils.rb#254 - def add_cookie_to_header(header, key, value); end - - # source://rack//lib/rack/utils.rb#389 - def add_remove_cookie_to_header(header, key, value = T.unsafe(nil)); end - - # Return best accept value to use, based on the algorithm - # in RFC 2616 Section 14. If there are multiple best - # matches (same specificity and quality), the value returned - # is arbitrary. - # - # source://rack//lib/rack/utils.rb#173 - def best_q_match(q_value_header, available_mimes); end - - # source://rack//lib/rack/utils.rb#127 - def build_nested_query(value, prefix = T.unsafe(nil)); end - - # source://rack//lib/rack/utils.rb#117 - def build_query(params); end - - # Parses the "Range:" header, if present, into an array of Range objects. - # Returns nil if the header is missing or syntactically invalid. - # Returns an empty array if none of the ranges are satisfiable. - # - # source://rack//lib/rack/utils.rb#431 - def byte_ranges(env, size); end - - # source://rack//lib/rack/utils.rb#632 - def clean_path_info(path_info); end - - # :nocov: - # - # source://rack//lib/rack/utils.rb#98 - def clock_time; end - - # source://rack//lib/rack/utils.rb#383 - def delete_cookie_header!(headers, key, value = T.unsafe(nil)); end - - # :call-seq: - # delete_set_cookie_header(key, value = {}) -> encoded string - # - # Generate an encoded string based on the given +key+ and +value+ using - # set_cookie_header for the purpose of causing the specified cookie to be - # deleted. The +value+ may be an instance of +Hash+ and can include - # attributes as outlined by set_cookie_header. The encoded cookie will have - # a +max_age+ of 0 seconds, an +expires+ date in the past and an empty - # +value+. When used with the +set-cookie+ header, it will cause the client - # to *remove* any matching cookie. - # - # delete_set_cookie_header("myname") - # # => "myname=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT" - # - # source://rack//lib/rack/utils.rb#373 - def delete_set_cookie_header(key, value = T.unsafe(nil)); end - - # :call-seq: - # delete_set_cookie_header!(header, key, value = {}) -> header value - # - # Set an expired cookie in the specified headers with the given cookie - # +key+ and +value+ using delete_set_cookie_header. This causes - # the client to immediately delete the specified cookie. - # - # delete_set_cookie_header!(nil, "mycookie") - # # => "mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT" - # - # If the header is non-nil, it will be modified in place. - # - # header = [] - # delete_set_cookie_header!(header, "mycookie") - # # => ["mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT"] - # header - # # => ["mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT"] - # - # source://rack//lib/rack/utils.rb#413 - def delete_set_cookie_header!(header, key, value = T.unsafe(nil)); end - - # URI escapes. (CGI style space to +) - # - # source://rack//lib/rack/utils.rb#38 - def escape(s); end - - # Escape ampersands, brackets and quotes to their HTML/XML entities. - # - # source://rack//lib/rack/utils.rb#198 - def escape_html(string); end - - # Like URI escaping, but with %20 instead of +. Strictly speaking this is - # true URI escaping. - # - # source://rack//lib/rack/utils.rb#44 - def escape_path(s); end - - # source://rack//lib/rack/utils.rb#156 - def forwarded_values(forwarded_header); end - - # source://rack//lib/rack/utils.rb#435 - def get_byte_ranges(http_range, size); end - - # source://rack//lib/rack/utils.rb#377 - def make_delete_cookie_header(header, key, value); end - - # :call-seq: - # parse_cookies(env) -> hash - # - # Parse cookies from the provided request environment using - # parse_cookies_header. Returns a map of cookie +key+ to cookie +value+. - # - # parse_cookies({'HTTP_COOKIE' => 'myname=myvalue'}) - # # => {'myname' => 'myvalue'} - # - # source://rack//lib/rack/utils.rb#278 - def parse_cookies(env); end - - # :call-seq: - # parse_cookies_header(value) -> hash - # - # Parse cookies from the provided header +value+ according to RFC6265. The - # syntax for cookie headers only supports semicolons. Returns a map of - # cookie +key+ to cookie +value+. - # - # parse_cookies_header('myname=myvalue; max-age=0') - # # => {"myname"=>"myvalue", "max-age"=>"0"} - # - # source://rack//lib/rack/utils.rb#244 - def parse_cookies_header(value); end - - # source://rack//lib/rack/utils.rb#113 - def parse_nested_query(qs, d = T.unsafe(nil)); end - - # source://rack//lib/rack/utils.rb#109 - def parse_query(qs, d = T.unsafe(nil), &unescaper); end - - # source://rack//lib/rack/utils.rb#145 - def q_values(q_value_header); end - - # source://rack//lib/rack/utils.rb#424 - def rfc2822(time); end - - # :nocov: - # - # source://rack//lib/rack/utils.rb#472 - def secure_compare(a, b); end - - # source://rack//lib/rack/utils.rb#202 - def select_best_encoding(available_encodings, accept_encoding); end - - # :call-seq: - # set_cookie_header(key, value) -> encoded string - # - # Generate an encoded string using the provided +key+ and +value+ suitable - # for the +set-cookie+ header according to RFC6265. The +value+ may be an - # instance of either +String+ or +Hash+. - # - # If the cookie +value+ is an instance of +Hash+, it considers the following - # cookie attribute keys: +domain+, +max_age+, +expires+ (must be instance - # of +Time+), +secure+, +http_only+, +same_site+ and +value+. For more - # details about the interpretation of these fields, consult - # [RFC6265 Section 5.2](https://datatracker.ietf.org/doc/html/rfc6265#section-5.2). - # - # An extra cookie attribute +escape_key+ can be provided to control whether - # or not the cookie key is URL encoded. If explicitly set to +false+, the - # cookie key name will not be url encoded (escaped). The default is +true+. - # - # set_cookie_header("myname", "myvalue") - # # => "myname=myvalue" - # - # set_cookie_header("myname", {value: "myvalue", max_age: 10}) - # # => "myname=myvalue; max-age=10" - # - # source://rack//lib/rack/utils.rb#305 - def set_cookie_header(key, value); end - - # :call-seq: - # set_cookie_header!(headers, key, value) -> header value - # - # Append a cookie in the specified headers with the given cookie +key+ and - # +value+ using set_cookie_header. - # - # If the headers already contains a +set-cookie+ key, it will be converted - # to an +Array+ if not already, and appended to. - # - # source://rack//lib/rack/utils.rb#347 - def set_cookie_header!(headers, key, value); end - - # source://rack//lib/rack/utils.rb#622 - def status_code(status); end - - # Unescapes a URI escaped string with +encoding+. +encoding+ will be the - # target encoding of the string returned, and it defaults to UTF-8 - # - # source://rack//lib/rack/utils.rb#56 - def unescape(s, encoding = T.unsafe(nil)); end - - # Unescapes the **path** component of a URI. See Rack::Utils.unescape for - # unescaping query parameters or form components. - # - # source://rack//lib/rack/utils.rb#50 - def unescape_path(s); end - - # source://rack//lib/rack/utils.rb#649 - def valid_path?(path); end - - class << self - # source://rack//lib/rack/utils.rb#254 - def add_cookie_to_header(header, key, value); end - - # source://rack//lib/rack/utils.rb#389 - def add_remove_cookie_to_header(header, key, value = T.unsafe(nil)); end - - # Return best accept value to use, based on the algorithm - # in RFC 2616 Section 14. If there are multiple best - # matches (same specificity and quality), the value returned - # is arbitrary. - # - # source://rack//lib/rack/utils.rb#173 - def best_q_match(q_value_header, available_mimes); end - - # source://rack//lib/rack/utils.rb#127 - def build_nested_query(value, prefix = T.unsafe(nil)); end - - # source://rack//lib/rack/utils.rb#117 - def build_query(params); end - - # Parses the "Range:" header, if present, into an array of Range objects. - # Returns nil if the header is missing or syntactically invalid. - # Returns an empty array if none of the ranges are satisfiable. - # - # source://rack//lib/rack/utils.rb#431 - def byte_ranges(env, size); end - - # source://rack//lib/rack/utils.rb#632 - def clean_path_info(path_info); end - - # source://rack//lib/rack/utils.rb#98 - def clock_time; end - - # Returns the value of attribute default_query_parser. - # - # source://rack//lib/rack/utils.rb#28 - def default_query_parser; end - - # Sets the attribute default_query_parser - # - # @param value the value to set the attribute default_query_parser to. - # - # source://rack//lib/rack/utils.rb#28 - def default_query_parser=(_arg0); end - - # source://rack//lib/rack/utils.rb#383 - def delete_cookie_header!(headers, key, value = T.unsafe(nil)); end - - # :call-seq: - # delete_set_cookie_header(key, value = {}) -> encoded string - # - # Generate an encoded string based on the given +key+ and +value+ using - # set_cookie_header for the purpose of causing the specified cookie to be - # deleted. The +value+ may be an instance of +Hash+ and can include - # attributes as outlined by set_cookie_header. The encoded cookie will have - # a +max_age+ of 0 seconds, an +expires+ date in the past and an empty - # +value+. When used with the +set-cookie+ header, it will cause the client - # to *remove* any matching cookie. - # - # delete_set_cookie_header("myname") - # # => "myname=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT" - # - # source://rack//lib/rack/utils.rb#373 - def delete_set_cookie_header(key, value = T.unsafe(nil)); end - - # :call-seq: - # delete_set_cookie_header!(header, key, value = {}) -> header value - # - # Set an expired cookie in the specified headers with the given cookie - # +key+ and +value+ using delete_set_cookie_header. This causes - # the client to immediately delete the specified cookie. - # - # delete_set_cookie_header!(nil, "mycookie") - # # => "mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT" - # - # If the header is non-nil, it will be modified in place. - # - # header = [] - # delete_set_cookie_header!(header, "mycookie") - # # => ["mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT"] - # header - # # => ["mycookie=; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT"] - # - # source://rack//lib/rack/utils.rb#413 - def delete_set_cookie_header!(header, key, value = T.unsafe(nil)); end - - # URI escapes. (CGI style space to +) - # - # source://rack//lib/rack/utils.rb#38 - def escape(s); end - - # Escape ampersands, brackets and quotes to their HTML/XML entities. - # - # source://rack//lib/rack/utils.rb#198 - def escape_html(string); end - - # Like URI escaping, but with %20 instead of +. Strictly speaking this is - # true URI escaping. - # - # source://rack//lib/rack/utils.rb#44 - def escape_path(s); end - - # source://rack//lib/rack/utils.rb#156 - def forwarded_values(forwarded_header); end - - # source://rack//lib/rack/utils.rb#435 - def get_byte_ranges(http_range, size); end - - # source://rack//lib/rack/utils.rb#88 - def key_space_limit; end - - # source://rack//lib/rack/utils.rb#93 - def key_space_limit=(v); end - - # source://rack//lib/rack/utils.rb#377 - def make_delete_cookie_header(header, key, value); end - - # Returns the value of attribute multipart_file_limit. - # - # source://rack//lib/rack/utils.rb#63 - def multipart_file_limit; end - - # Sets the attribute multipart_file_limit - # - # @param value the value to set the attribute multipart_file_limit to. - # - # source://rack//lib/rack/utils.rb#63 - def multipart_file_limit=(_arg0); end - - # Returns the value of attribute multipart_file_limit. - # multipart_part_limit is the original name of multipart_file_limit, but - # the limit only counts parts with filenames. - # - # source://rack//lib/rack/utils.rb#63 - def multipart_part_limit; end - - # Sets the attribute multipart_file_limit - # - # @param value the value to set the attribute multipart_file_limit to. - # - # source://rack//lib/rack/utils.rb#63 - def multipart_part_limit=(_arg0); end - - # Returns the value of attribute multipart_total_part_limit. - # - # source://rack//lib/rack/utils.rb#61 - def multipart_total_part_limit; end - - # Sets the attribute multipart_total_part_limit - # - # @param value the value to set the attribute multipart_total_part_limit to. - # - # source://rack//lib/rack/utils.rb#61 - def multipart_total_part_limit=(_arg0); end - - # source://rack//lib/rack/utils.rb#80 - def param_depth_limit; end - - # source://rack//lib/rack/utils.rb#84 - def param_depth_limit=(v); end - - # :call-seq: - # parse_cookies(env) -> hash - # - # Parse cookies from the provided request environment using - # parse_cookies_header. Returns a map of cookie +key+ to cookie +value+. - # - # parse_cookies({'HTTP_COOKIE' => 'myname=myvalue'}) - # # => {'myname' => 'myvalue'} - # - # source://rack//lib/rack/utils.rb#278 - def parse_cookies(env); end - - # :call-seq: - # parse_cookies_header(value) -> hash - # - # Parse cookies from the provided header +value+ according to RFC6265. The - # syntax for cookie headers only supports semicolons. Returns a map of - # cookie +key+ to cookie +value+. - # - # parse_cookies_header('myname=myvalue; max-age=0') - # # => {"myname"=>"myvalue", "max-age"=>"0"} - # - # source://rack//lib/rack/utils.rb#244 - def parse_cookies_header(value); end - - # source://rack//lib/rack/utils.rb#113 - def parse_nested_query(qs, d = T.unsafe(nil)); end - - # source://rack//lib/rack/utils.rb#109 - def parse_query(qs, d = T.unsafe(nil), &unescaper); end - - # source://rack//lib/rack/utils.rb#145 - def q_values(q_value_header); end - - # source://rack//lib/rack/utils.rb#424 - def rfc2822(time); end - - # source://rack//lib/rack/utils.rb#472 - def secure_compare(a, b); end - - # source://rack//lib/rack/utils.rb#202 - def select_best_encoding(available_encodings, accept_encoding); end - - # :call-seq: - # set_cookie_header(key, value) -> encoded string - # - # Generate an encoded string using the provided +key+ and +value+ suitable - # for the +set-cookie+ header according to RFC6265. The +value+ may be an - # instance of either +String+ or +Hash+. - # - # If the cookie +value+ is an instance of +Hash+, it considers the following - # cookie attribute keys: +domain+, +max_age+, +expires+ (must be instance - # of +Time+), +secure+, +http_only+, +same_site+ and +value+. For more - # details about the interpretation of these fields, consult - # [RFC6265 Section 5.2](https://datatracker.ietf.org/doc/html/rfc6265#section-5.2). - # - # An extra cookie attribute +escape_key+ can be provided to control whether - # or not the cookie key is URL encoded. If explicitly set to +false+, the - # cookie key name will not be url encoded (escaped). The default is +true+. - # - # set_cookie_header("myname", "myvalue") - # # => "myname=myvalue" - # - # set_cookie_header("myname", {value: "myvalue", max_age: 10}) - # # => "myname=myvalue; max-age=10" - # - # source://rack//lib/rack/utils.rb#305 - def set_cookie_header(key, value); end - - # :call-seq: - # set_cookie_header!(headers, key, value) -> header value - # - # Append a cookie in the specified headers with the given cookie +key+ and - # +value+ using set_cookie_header. - # - # If the headers already contains a +set-cookie+ key, it will be converted - # to an +Array+ if not already, and appended to. - # - # source://rack//lib/rack/utils.rb#347 - def set_cookie_header!(headers, key, value); end - - # source://rack//lib/rack/utils.rb#622 - def status_code(status); end - - # Unescapes a URI escaped string with +encoding+. +encoding+ will be the - # target encoding of the string returned, and it defaults to UTF-8 - # - # source://rack//lib/rack/utils.rb#56 - def unescape(s, encoding = T.unsafe(nil)); end - - # Unescapes the **path** component of a URI. See Rack::Utils.unescape for - # unescaping query parameters or form components. - # - # source://rack//lib/rack/utils.rb#50 - def unescape_path(s); end - - # @return [Boolean] - # - # source://rack//lib/rack/utils.rb#649 - def valid_path?(path); end - end -end - -# source://rack//lib/rack/utils.rb#24 -Rack::Utils::COMMON_SEP = T.let(T.unsafe(nil), Hash) - -# Context allows the use of a compatible middleware at different points -# in a request handling stack. A compatible middleware must define -# #context which should take the arguments env and app. The first of which -# would be the request environment. The second of which would be the rack -# application that the request would be forwarded to. -# -# source://rack//lib/rack/utils.rb#495 -class Rack::Utils::Context - # @return [Context] a new instance of Context - # - # source://rack//lib/rack/utils.rb#498 - def initialize(app_f, app_r); end - - # Returns the value of attribute app. - # - # source://rack//lib/rack/utils.rb#496 - def app; end - - # source://rack//lib/rack/utils.rb#503 - def call(env); end - - # source://rack//lib/rack/utils.rb#511 - def context(env, app = T.unsafe(nil)); end - - # Returns the value of attribute for. - # - # source://rack//lib/rack/utils.rb#496 - def for; end - - # source://rack//lib/rack/utils.rb#507 - def recontext(app); end -end - -# source://rack//lib/rack/utils.rb#23 -Rack::Utils::DEFAULT_SEP = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/utils.rb#186 -Rack::Utils::ESCAPE_HTML = T.let(T.unsafe(nil), Hash) - -# source://rack//lib/rack/utils.rb#195 -Rack::Utils::ESCAPE_HTML_PATTERN = T.let(T.unsafe(nil), Regexp) - -# Every standard HTTP code mapped to the appropriate message. -# Generated with: -# curl -s https://www.iana.org/assignments/http-status-codes/http-status-codes-1.csv | \ -# ruby -ne 'm = /^(\d{3}),(?!Unassigned|\(Unused\))([^,]+)/.match($_) and \ -# puts "#{m[1]} => \x27#{m[2].strip}\x27,"' -# -# source://rack//lib/rack/utils.rb#549 -Rack::Utils::HTTP_STATUS_CODES = T.let(T.unsafe(nil), Hash) - -# A wrapper around Headers -# header when set. -# -# @api private -# -# source://rack//lib/rack/utils.rb#520 -class Rack::Utils::HeaderHash < ::Hash - class << self - # @api private - # - # source://rack//lib/rack/utils.rb#521 - def [](headers); end - - # @api private - # @raise [TypeError] - # - # source://rack//lib/rack/utils.rb#539 - def allocate; end - - # @api private - # - # source://rack//lib/rack/utils.rb#532 - def new(hash = T.unsafe(nil)); end - end -end - -# source://rack//lib/rack/utils.rb#21 -Rack::Utils::InvalidParameterError = Rack::QueryParser::InvalidParameterError - -# source://rack//lib/rack/utils.rb#25 -Rack::Utils::KeySpaceConstrainedParams = Rack::QueryParser::Params - -# source://rack//lib/rack/utils.rb#647 -Rack::Utils::NULL_BYTE = T.let(T.unsafe(nil), String) - -# source://rack//lib/rack/utils.rb#630 -Rack::Utils::PATH_SEPS = T.let(T.unsafe(nil), Regexp) - -# source://rack//lib/rack/utils.rb#20 -Rack::Utils::ParameterTypeError = Rack::QueryParser::ParameterTypeError - -# source://rack//lib/rack/utils.rb#22 -Rack::Utils::ParamsTooDeepError = Rack::QueryParser::ParamsTooDeepError - -# Responses with HTTP status codes that should not have an entity body -# -# source://rack//lib/rack/utils.rb#616 -Rack::Utils::STATUS_WITH_NO_ENTITY_BODY = T.let(T.unsafe(nil), Hash) - -# source://rack//lib/rack/utils.rb#618 -Rack::Utils::SYMBOL_TO_STATUS_CODE = T.let(T.unsafe(nil), Hash) - -# The Rack protocol version number implemented. -# -# source://rack//lib/rack/version.rb#16 -Rack::VERSION = T.let(T.unsafe(nil), Array) - -# source://rack//lib/rack/version.rb#19 -Rack::VERSION_STRING = T.let(T.unsafe(nil), String) diff --git a/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.23.1.rbi b/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.23.1.rbi deleted file mode 100644 index 02a1ccd236..0000000000 --- a/Library/Homebrew/sorbet/rbi/gems/rubocop-rails@2.23.1.rbi +++ /dev/null @@ -1,9175 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `rubocop-rails` gem. -# Please instead update this file by running `bin/tapioca gem rubocop-rails`. - -# source://rubocop-rails//lib/rubocop/rails.rb#3 -module RuboCop; end - -# source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#4 -module RuboCop::Cop; end - -# A mixin to extend cops for Active Record features -# -# source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#6 -module RuboCop::Cop::ActiveRecordHelper - extend ::RuboCop::AST::NodePattern::Macros - - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#11 - def active_record?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#30 - def external_dependency_checksum; end - - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#22 - def find_belongs_to(param0); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#18 - def find_set_table_name(param0); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#79 - def foreign_key_of(belongs_to); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#100 - def in_where?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#26 - def inherit_active_record_base?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#91 - def polymorphic?(belongs_to); end - - # Resolve relation into column name. - # It just returns column_name if the column exists. - # Or it tries to resolve column_name as a relation. - # Returns an array of column names if the relation is polymorphic. - # It returns `nil` if it can't resolve. - # - # @param name [String] - # @param class_node [RuboCop::AST::Node] - # @param table [RuboCop::Rails::SchemaLoader::Table] - # @return [Array, String, nil] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#64 - def resolve_relation_into_column(name:, class_node:, table:); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#41 - def schema; end - - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#45 - def table_name(class_node); end -end - -# source://rubocop-rails//lib/rubocop/cop/mixin/active_record_helper.rb#9 -RuboCop::Cop::ActiveRecordHelper::WHERE_METHODS = T.let(T.unsafe(nil), Array) - -# A mixin to extend cops for Active Record features -# -# source://rubocop-rails//lib/rubocop/cop/mixin/active_record_migrations_helper.rb#6 -module RuboCop::Cop::ActiveRecordMigrationsHelper - extend ::RuboCop::AST::NodePattern::Macros - - # source://rubocop-rails//lib/rubocop/cop/mixin/active_record_migrations_helper.rb#24 - def create_table_with_block?(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/mixin/active_record_migrations_helper.rb#19 -RuboCop::Cop::ActiveRecordMigrationsHelper::MYSQL_SCHEMA_DEFINITIONS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/mixin/active_record_migrations_helper.rb#14 -RuboCop::Cop::ActiveRecordMigrationsHelper::POSTGRES_SCHEMA_DEFINITIONS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/mixin/active_record_migrations_helper.rb#9 -RuboCop::Cop::ActiveRecordMigrationsHelper::RAILS_ABSTRACT_SCHEMA_DEFINITIONS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/mixin/active_record_migrations_helper.rb#13 -RuboCop::Cop::ActiveRecordMigrationsHelper::RAILS_ABSTRACT_SCHEMA_DEFINITIONS_HELPERS = T.let(T.unsafe(nil), Array) - -# A mixin to return all of the class send nodes. -# -# source://rubocop-rails//lib/rubocop/cop/mixin/class_send_node_helper.rb#6 -module RuboCop::Cop::ClassSendNodeHelper - # source://rubocop-rails//lib/rubocop/cop/mixin/class_send_node_helper.rb#7 - def class_send_nodes(class_node); end -end - -# A mixin to extend cops in order to determine the database type. -# -# This module automatically detect an adapter from `development` environment -# in `config/database.yml` or the environment variable `DATABASE_URL` -# when the `Database` option is not set. -# -# source://rubocop-rails//lib/rubocop/cop/mixin/database_type_resolvable.rb#10 -module RuboCop::Cop::DatabaseTypeResolvable - # source://rubocop-rails//lib/rubocop/cop/mixin/database_type_resolvable.rb#14 - def database; end - - private - - # source://rubocop-rails//lib/rubocop/cop/mixin/database_type_resolvable.rb#61 - def database_adapter; end - - # source://rubocop-rails//lib/rubocop/cop/mixin/database_type_resolvable.rb#31 - def database_from_env; end - - # source://rubocop-rails//lib/rubocop/cop/mixin/database_type_resolvable.rb#20 - def database_from_yaml; end - - # source://rubocop-rails//lib/rubocop/cop/mixin/database_type_resolvable.rb#43 - def database_yaml; end -end - -# source://rubocop-rails//lib/rubocop/cop/mixin/database_type_resolvable.rb#11 -RuboCop::Cop::DatabaseTypeResolvable::MYSQL = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/mixin/database_type_resolvable.rb#12 -RuboCop::Cop::DatabaseTypeResolvable::POSTGRESQL = T.let(T.unsafe(nil), String) - -# Common functionality for enforcing a specific superclass. -# -# source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#6 -module RuboCop::Cop::EnforceSuperclass - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#19 - def on_class(node); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#25 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#33 - def register_offense(offense_node); end - - class << self - # @private - # - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#7 - def included(base); end - end -end - -# Common functionality for Rails/IndexBy and Rails/IndexWith -# -# source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#6 -module RuboCop::Cop::IndexMethod - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#9 - def on_block(node); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#31 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#21 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#95 - def execute_correction(corrector, node, correction); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#72 - def extract_captures(match); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#59 - def handle_possible_offense(node, match, match_desc); end - - # @raise [NotImplementedError] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#77 - def new_method_name; end - - # @abstract Implemented with `def_node_matcher` - # @raise [NotImplementedError] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#40 - def on_bad_each_with_object(_node); end - - # @abstract Implemented with `def_node_matcher` - # @raise [NotImplementedError] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#55 - def on_bad_hash_brackets_map(_node); end - - # @abstract Implemented with `def_node_matcher` - # @raise [NotImplementedError] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#50 - def on_bad_map_to_h(_node); end - - # @abstract Implemented with `def_node_matcher` - # @raise [NotImplementedError] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#45 - def on_bad_to_h(_node); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#81 - def prepare_correction(node); end -end - -# Internal helper class to hold autocorrect data -# -# source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#115 -class RuboCop::Cop::IndexMethod::Autocorrection < ::Struct - # Returns the value of attribute block_node - # - # @return [Object] the current value of block_node - def block_node; end - - # Sets the attribute block_node - # - # @param value [Object] the value to set the attribute block_node to. - # @return [Object] the newly set value - def block_node=(_); end - - # Returns the value of attribute leading - # - # @return [Object] the current value of leading - def leading; end - - # Sets the attribute leading - # - # @param value [Object] the value to set the attribute leading to. - # @return [Object] the newly set value - def leading=(_); end - - # Returns the value of attribute match - # - # @return [Object] the current value of match - def match; end - - # Sets the attribute match - # - # @param value [Object] the value to set the attribute match to. - # @return [Object] the newly set value - def match=(_); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#155 - def set_new_arg_name(transformed_argname, corrector); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#159 - def set_new_body_expression(transforming_body_expr, corrector); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#146 - def set_new_method_name(new_method_name, corrector); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#140 - def strip_prefix_and_suffix(node, corrector); end - - # Returns the value of attribute trailing - # - # @return [Object] the current value of trailing - def trailing; end - - # Sets the attribute trailing - # - # @param value [Object] the value to set the attribute trailing to. - # @return [Object] the newly set value - def trailing=(_); end - - class << self - def [](*_arg0); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#116 - def from_each_with_object(node, match); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#136 - def from_hash_brackets_map(node, match); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#124 - def from_map_to_h(node, match); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#120 - def from_to_h(node, match); end - - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# Internal helper class to hold match data -# -# source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#105 -class RuboCop::Cop::IndexMethod::Captures < ::Struct - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#109 - def noop_transformation?; end - - # Returns the value of attribute transformed_argname - # - # @return [Object] the current value of transformed_argname - def transformed_argname; end - - # Sets the attribute transformed_argname - # - # @param value [Object] the value to set the attribute transformed_argname to. - # @return [Object] the newly set value - def transformed_argname=(_); end - - # Returns the value of attribute transforming_body_expr - # - # @return [Object] the current value of transforming_body_expr - def transforming_body_expr; end - - # Sets the attribute transforming_body_expr - # - # @param value [Object] the value to set the attribute transforming_body_expr to. - # @return [Object] the newly set value - def transforming_body_expr=(_); end - - class << self - def [](*_arg0); end - def inspect; end - def keyword_init?; end - def members; end - def new(*_arg0); end - end -end - -# source://rubocop-rails//lib/rubocop/cop/mixin/index_method.rb#7 -RuboCop::Cop::IndexMethod::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Common functionality for cops working with migrations -# -# source://rubocop-rails//lib/rubocop/cop/mixin/migrations_helper.rb#6 -module RuboCop::Cop::MigrationsHelper - extend ::RuboCop::AST::NodePattern::Macros - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/migrations_helper.rb#19 - def in_migration?(node); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/migrations_helper.rb#9 - def migration_class?(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#5 -module RuboCop::Cop::Rails; end - -# Using `flash` assignment before `render` in Rails controllers will persist the message for too long. -# Check https://guides.rubyonrails.org/action_controller_overview.html#flash-now -# -# @example -# -# # bad -# class HomeController < ApplicationController -# def create -# flash[:alert] = "msg" -# render :index -# end -# end -# -# # good -# class HomeController < ApplicationController -# def create -# flash.now[:alert] = "msg" -# render :index -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#31 -class RuboCop::Cop::Rails::ActionControllerFlashBeforeRender < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#44 - def action_controller?(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#36 - def flash_assignment?(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#53 - def on_send(flash_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#40 - def render?(param0); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#106 - def find_ancestor(node, type:); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#69 - def followed_by_render?(flash_node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#86 - def inherit_action_controller_base?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#93 - def instance_method_or_block?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#100 - def use_redirect_to?(context); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#34 -RuboCop::Cop::Rails::ActionControllerFlashBeforeRender::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/action_controller_flash_before_render.rb#51 -RuboCop::Cop::Rails::ActionControllerFlashBeforeRender::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Using `ActionController::TestCase` is discouraged and should be replaced by -# `ActionDispatch::IntegrationTest`. Controller tests are too close to the -# internals of a controller whereas integration tests mimic the browser/user. -# -# @example -# # bad -# class MyControllerTest < ActionController::TestCase -# end -# -# # good -# class MyControllerTest < ActionDispatch::IntegrationTest -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/action_controller_test_case.rb#23 -class RuboCop::Cop::Rails::ActionControllerTestCase < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/action_controller_test_case.rb#31 - def action_controller_test_case?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_controller_test_case.rb#37 - def on_class(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/action_controller_test_case.rb#27 -RuboCop::Cop::Rails::ActionControllerTestCase::MSG = T.let(T.unsafe(nil), String) - -# Enforces the consistent use of action filter methods. -# -# The cop is configurable and can enforce the use of the older -# something_filter methods or the newer something_action methods. -# -# IMPORTANT: This cop is deprecated. Because the `*_filter` methods were removed in Rails 4.2, -# and that Rails version is no longer supported by RuboCop Rails. This cop will be removed in RuboCop Rails 3.0. -# -# @example EnforcedStyle: action (default) -# # bad -# after_filter :do_stuff -# append_around_filter :do_stuff -# skip_after_filter :do_stuff -# -# # good -# after_action :do_stuff -# append_around_action :do_stuff -# skip_after_action :do_stuff -# @example EnforcedStyle: filter -# # bad -# after_action :do_stuff -# append_around_action :do_stuff -# skip_after_action :do_stuff -# -# # good -# after_filter :do_stuff -# append_around_filter :do_stuff -# skip_after_filter :do_stuff -# -# source://rubocop-rails//lib/rubocop/cop/rails/action_filter.rb#35 -class RuboCop::Cop::Rails::ActionFilter < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ConfigurableEnforcedStyle - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/action_filter.rb#75 - def on_block(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_filter.rb#79 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/action_filter.rb#96 - def bad_methods; end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_filter.rb#85 - def check_method_node(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_filter.rb#100 - def good_methods; end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_filter.rb#104 - def preferred_method(method); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/action_filter.rb#57 -RuboCop::Cop::Rails::ActionFilter::ACTION_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/action_filter.rb#41 -RuboCop::Cop::Rails::ActionFilter::FILTER_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/action_filter.rb#39 -RuboCop::Cop::Rails::ActionFilter::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/action_filter.rb#73 -RuboCop::Cop::Rails::ActionFilter::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Enforces consistent ordering of the standard Rails RESTful controller actions. -# -# The cop is configurable and can enforce any ordering of the standard actions. -# All other methods are ignored. So, the actions specified in `ExpectedOrder` should be -# defined before actions not specified. -# -# [source,yaml] -# ---- -# Rails/ActionOrder: -# ExpectedOrder: -# - index -# - show -# - new -# - edit -# - create -# - update -# - destroy -# ---- -# -# @example -# # bad -# def index; end -# def destroy; end -# def show; end -# -# # good -# def index; end -# def show; end -# def destroy; end -# -# source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#35 -class RuboCop::Cop::Rails::ActionOrder < ::RuboCop::Cop::Base - include ::RuboCop::Cop::VisibilityHelp - include ::RuboCop::Cop::DefNode - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#43 - def action_declarations(param0, param1); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#45 - def on_class(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#60 - def actions; end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#87 - def add_range(range1, range2); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#83 - def correction_target(def_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#56 - def expected_order; end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#64 - def find_index(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#94 - def range_with_comments(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#105 - def range_with_comments_and_lines(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#68 - def register_offense(previous, current); end - - # source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#109 - def swap_range(corrector, range1, range2); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/action_order.rb#41 -RuboCop::Cop::Rails::ActionOrder::MSG = T.let(T.unsafe(nil), String) - -# Checks that ActiveRecord aliases are not used. The direct method names -# are more clear and easier to read. -# -# @example -# # bad -# book.update_attributes!(author: 'Alice') -# -# # good -# book.update!(author: 'Alice') -# -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_aliases.rb#19 -class RuboCop::Cop::Rails::ActiveRecordAliases < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_aliases.rb#28 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_aliases.rb#28 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_aliases.rb#24 -RuboCop::Cop::Rails::ActiveRecordAliases::ALIASES = T.let(T.unsafe(nil), Hash) - -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_aliases.rb#22 -RuboCop::Cop::Rails::ActiveRecordAliases::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_aliases.rb#26 -RuboCop::Cop::Rails::ActiveRecordAliases::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks that Active Record callbacks are declared -# in the order in which they will be executed. -# -# @example -# # bad -# class Person < ApplicationRecord -# after_commit :after_commit_callback -# before_validation :before_validation_callback -# end -# -# # good -# class Person < ApplicationRecord -# before_validation :before_validation_callback -# after_commit :after_commit_callback -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#22 -class RuboCop::Cop::Rails::ActiveRecordCallbacksOrder < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#51 - def on_class(class_node); end - - private - - # Autocorrect by swapping between two nodes autocorrecting them - # - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#73 - def autocorrect(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#111 - def begin_pos_with_comment(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#137 - def buffer; end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#95 - def callback?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#85 - def defined_callbacks(class_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#106 - def end_position_for(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#125 - def inline_comment?(comment); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#99 - def source_range_with_comment(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#133 - def start_line_position(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#27 -RuboCop::Cop::Rails::ActiveRecordCallbacksOrder::CALLBACKS_IN_ORDER = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#49 -RuboCop::Cop::Rails::ActiveRecordCallbacksOrder::CALLBACKS_ORDER_MAP = T.let(T.unsafe(nil), Hash) - -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_callbacks_order.rb#25 -RuboCop::Cop::Rails::ActiveRecordCallbacksOrder::MSG = T.let(T.unsafe(nil), String) - -# Checks for overriding built-in Active Record methods instead of using -# callbacks. -# -# @example -# # bad -# class Book < ApplicationRecord -# def save -# self.title = title.upcase! -# super -# end -# end -# -# # good -# class Book < ApplicationRecord -# before_save :upcase_title -# -# def upcase_title -# self.title = title.upcase! -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_override.rb#27 -class RuboCop::Cop::Rails::ActiveRecordOverride < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_override.rb#32 - def on_def(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_override.rb#45 - def active_model?(parent_class_name); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_override.rb#49 - def callback_names(method_name); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_override.rb#63 - def find_parent_class_name(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_record_override.rb#59 - def message(method_name); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_override.rb#30 -RuboCop::Cop::Rails::ActiveRecordOverride::ACTIVE_RECORD_CLASSES = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_override.rb#29 -RuboCop::Cop::Rails::ActiveRecordOverride::BAD_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/active_record_override.rb#28 -RuboCop::Cop::Rails::ActiveRecordOverride::MSG = T.let(T.unsafe(nil), String) - -# Checks that ActiveSupport aliases to core ruby methods -# are not used. -# -# @example -# # good -# 'some_string'.start_with?('prefix') -# 'some_string'.end_with?('suffix') -# [1, 2, 'a'] << 'b' -# [1, 2, 'a'].unshift('b') -# -# # bad -# 'some_string'.starts_with?('prefix') -# 'some_string'.ends_with?('suffix') -# [1, 2, 'a'].append('b') -# [1, 2, 'a'].prepend('b') -# -# source://rubocop-rails//lib/rubocop/cop/rails/active_support_aliases.rb#22 -class RuboCop::Cop::Rails::ActiveSupportAliases < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/active_support_aliases.rb#40 - def append(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_support_aliases.rb#40 - def ends_with?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_support_aliases.rb#43 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_support_aliases.rb#43 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_support_aliases.rb#40 - def prepend(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/active_support_aliases.rb#40 - def starts_with?(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/active_support_aliases.rb#28 -RuboCop::Cop::Rails::ActiveSupportAliases::ALIASES = T.let(T.unsafe(nil), Hash) - -# source://rubocop-rails//lib/rubocop/cop/rails/active_support_aliases.rb#25 -RuboCop::Cop::Rails::ActiveSupportAliases::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/active_support_aliases.rb#26 -RuboCop::Cop::Rails::ActiveSupportAliases::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for Rails framework classes that are patched directly instead of using Active Support load hooks. Direct -# patching forcibly loads the framework referenced, using hooks defers loading until it's actually needed. -# -# @example -# -# # bad -# ActiveRecord::Base.include(MyClass) -# -# # good -# ActiveSupport.on_load(:active_record) { include MyClass } -# -# source://rubocop-rails//lib/rubocop/cop/rails/active_support_on_load.rb#20 -class RuboCop::Cop::Rails::ActiveSupportOnLoad < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/active_support_on_load.rb#58 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/active_support_on_load.rb#25 -RuboCop::Cop::Rails::ActiveSupportOnLoad::LOAD_HOOKS = T.let(T.unsafe(nil), Hash) - -# source://rubocop-rails//lib/rubocop/cop/rails/active_support_on_load.rb#23 -RuboCop::Cop::Rails::ActiveSupportOnLoad::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/active_support_on_load.rb#24 -RuboCop::Cop::Rails::ActiveSupportOnLoad::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for migrations using `add_column` that have an `index` -# key. `add_column` does not accept `index`, but also does not raise an -# error for extra keys, so it is possible to mistakenly add the key without -# realizing it will not actually add an index. -# -# @example -# # bad (will not add an index) -# add_column :table, :column, :integer, index: true -# -# # good -# add_column :table, :column, :integer -# add_index :table, :column -# -# source://rubocop-rails//lib/rubocop/cop/rails/add_column_index.rb#19 -class RuboCop::Cop::Rails::AddColumnIndex < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/add_column_index.rb#27 - def add_column_with_index(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/add_column_index.rb#34 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/add_column_index.rb#55 - def index_range(pair_node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/add_column_index.rb#23 -RuboCop::Cop::Rails::AddColumnIndex::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/add_column_index.rb#24 -RuboCop::Cop::Rails::AddColumnIndex::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Enforces that there is only one call to `after_commit` -# (and its aliases - `after_create_commit`, `after_update_commit`, -# and `after_destroy_commit`) with the same callback name per model. -# -# @example -# # bad -# # This won't be triggered. -# after_create_commit :log_action -# -# # This will override the callback added by -# # after_create_commit. -# after_update_commit :log_action -# -# # bad -# # This won't be triggered. -# after_commit :log_action, on: :create -# # This won't be triggered. -# after_update_commit :log_action -# # This will override both previous callbacks. -# after_commit :log_action, on: :destroy -# -# # good -# after_save_commit :log_action -# -# # good -# after_create_commit :log_create_action -# after_update_commit :log_update_action -# -# source://rubocop-rails//lib/rubocop/cop/rails/after_commit_override.rb#34 -class RuboCop::Cop::Rails::AfterCommitOverride < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ClassSendNodeHelper - - # source://rubocop-rails//lib/rubocop/cop/rails/after_commit_override.rb#47 - def on_class(class_node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/after_commit_override.rb#68 - def after_commit_callback?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/after_commit_override.rb#62 - def each_after_commit_callback(class_node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/after_commit_override.rb#72 - def named_callback?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/after_commit_override.rb#39 -RuboCop::Cop::Rails::AfterCommitOverride::AFTER_COMMIT_CALLBACKS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/after_commit_override.rb#37 -RuboCop::Cop::Rails::AfterCommitOverride::MSG = T.let(T.unsafe(nil), String) - -# TODO: In the future, please support only RuboCop 1.52+ and use `RuboCop::Cop::AllowedReceivers`: -# https://github.com/rubocop/rubocop/blob/v1.52.0/lib/rubocop/cop/mixin/allowed_receivers.rb -# At that time, this duplicated module implementation can be removed. -# -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#9 -module RuboCop::Cop::Rails::AllowedReceivers - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#10 - def allowed_receiver?(receiver); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#30 - def allowed_receivers; end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#16 - def receiver_name(receiver); end -end - -# Checks that controllers subclass `ApplicationController`. -# -# @example -# -# # good -# class MyController < ApplicationController -# # ... -# end -# -# # bad -# class MyController < ActionController::Base -# # ... -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/application_controller.rb#23 -class RuboCop::Cop::Rails::ApplicationController < ::RuboCop::Cop::Base - include ::RuboCop::Cop::EnforceSuperclass - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#8 - def class_definition(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#12 - def class_new_definition(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/application_controller.rb#28 -RuboCop::Cop::Rails::ApplicationController::BASE_PATTERN = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/application_controller.rb#26 -RuboCop::Cop::Rails::ApplicationController::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/application_controller.rb#27 -RuboCop::Cop::Rails::ApplicationController::SUPERCLASS = T.let(T.unsafe(nil), String) - -# Checks that jobs subclass `ApplicationJob` with Rails 5.0. -# -# @example -# -# # good -# class Rails5Job < ApplicationJob -# # ... -# end -# -# # bad -# class Rails4Job < ActiveJob::Base -# # ... -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/application_job.rb#23 -class RuboCop::Cop::Rails::ApplicationJob < ::RuboCop::Cop::Base - include ::RuboCop::Cop::EnforceSuperclass - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/application_job.rb#37 - def autocorrect(node); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#8 - def class_definition(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#12 - def class_new_definition(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/application_job.rb#31 -RuboCop::Cop::Rails::ApplicationJob::BASE_PATTERN = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/application_job.rb#29 -RuboCop::Cop::Rails::ApplicationJob::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/application_job.rb#30 -RuboCop::Cop::Rails::ApplicationJob::SUPERCLASS = T.let(T.unsafe(nil), String) - -# Checks that mailers subclass `ApplicationMailer` with Rails 5.0. -# -# @example -# -# # good -# class MyMailer < ApplicationMailer -# # ... -# end -# -# # bad -# class MyMailer < ActionMailer::Base -# # ... -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/application_mailer.rb#23 -class RuboCop::Cop::Rails::ApplicationMailer < ::RuboCop::Cop::Base - include ::RuboCop::Cop::EnforceSuperclass - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#8 - def class_definition(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#12 - def class_new_definition(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/application_mailer.rb#31 -RuboCop::Cop::Rails::ApplicationMailer::BASE_PATTERN = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/application_mailer.rb#29 -RuboCop::Cop::Rails::ApplicationMailer::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/application_mailer.rb#30 -RuboCop::Cop::Rails::ApplicationMailer::SUPERCLASS = T.let(T.unsafe(nil), String) - -# Checks that models subclass `ApplicationRecord` with Rails 5.0. -# -# @example -# -# # good -# class Rails5Model < ApplicationRecord -# # ... -# end -# -# # bad -# class Rails4Model < ActiveRecord::Base -# # ... -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/application_record.rb#24 -class RuboCop::Cop::Rails::ApplicationRecord < ::RuboCop::Cop::Base - include ::RuboCop::Cop::EnforceSuperclass - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#8 - def class_definition(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/mixin/enforce_superclass.rb#12 - def class_new_definition(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/application_record.rb#32 -RuboCop::Cop::Rails::ApplicationRecord::BASE_PATTERN = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/application_record.rb#30 -RuboCop::Cop::Rails::ApplicationRecord::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/application_record.rb#31 -RuboCop::Cop::Rails::ApplicationRecord::SUPERCLASS = T.let(T.unsafe(nil), String) - -# Prevents usage of `"*"` on an Arel::Table column reference. -# -# Using `arel_table["*"]` causes the outputted string to be a literal -# quoted asterisk (e.g. `my_model`.`*`). This causes the -# database to look for a column named `*` (or `"*"`) as opposed -# to expanding the column list as one would likely expect. -# -# @example -# # bad -# MyTable.arel_table["*"] -# -# # good -# MyTable.arel_table[Arel.star] -# -# source://rubocop-rails//lib/rubocop/cop/rails/arel_star.rb#26 -class RuboCop::Cop::Rails::ArelStar < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/arel_star.rb#37 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/arel_star.rb#33 - def star_bracket?(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/arel_star.rb#29 -RuboCop::Cop::Rails::ArelStar::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/arel_star.rb#31 -RuboCop::Cop::Rails::ArelStar::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Use `assert_not` instead of `assert !`. -# -# @example -# # bad -# assert !x -# -# # good -# assert_not x -# -# source://rubocop-rails//lib/rubocop/cop/rails/assert_not.rb#15 -class RuboCop::Cop::Rails::AssertNot < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/assert_not.rb#21 - def offensive?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/assert_not.rb#23 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/assert_not.rb#35 - def corrected_source(source); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/assert_not.rb#18 -RuboCop::Cop::Rails::AssertNot::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/assert_not.rb#19 -RuboCop::Cop::Rails::AssertNot::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Looks for `attribute` class methods that specify a `:default` option -# which value is an array, string literal or method call without a block. -# It will accept all other values, such as string, symbol, integer and float literals -# as well as constants. -# -# @example -# # bad -# class User < ApplicationRecord -# attribute :confirmed_at, :datetime, default: Time.zone.now -# end -# -# # good -# class User < ApplicationRecord -# attribute :confirmed_at, :datetime, default: -> { Time.zone.now } -# end -# -# # bad -# class User < ApplicationRecord -# attribute :roles, :string, array: true, default: [] -# end -# -# # good -# class User < ApplicationRecord -# attribute :roles, :string, array: true, default: -> { [] } -# end -# -# # bad -# class User < ApplicationRecord -# attribute :configuration, default: {} -# end -# -# # good -# class User < ApplicationRecord -# attribute :configuration, default: -> { {} } -# end -# -# # good -# class User < ApplicationRecord -# attribute :role, :string, default: :customer -# end -# -# # good -# class User < ApplicationRecord -# attribute :activated, :boolean, default: false -# end -# -# # good -# class User < ApplicationRecord -# attribute :login_count, :integer, default: 0 -# end -# -# # good -# class User < ApplicationRecord -# FOO = 123 -# attribute :custom_attribute, :integer, default: FOO -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/attribute_default_block_value.rb#62 -class RuboCop::Cop::Rails::AttributeDefaultBlockValue < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/attribute_default_block_value.rb#73 - def attribute(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/attribute_default_block_value.rb#69 - def default_attribute(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/attribute_default_block_value.rb#75 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/attribute_default_block_value.rb#65 -RuboCop::Cop::Rails::AttributeDefaultBlockValue::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/attribute_default_block_value.rb#66 -RuboCop::Cop::Rails::AttributeDefaultBlockValue::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/attribute_default_block_value.rb#67 -RuboCop::Cop::Rails::AttributeDefaultBlockValue::TYPE_OFFENDERS = T.let(T.unsafe(nil), Array) - -# Looks for belongs_to associations where we control whether the -# association is required via the deprecated `required` option instead. -# -# Since Rails 5, belongs_to associations are required by default and this -# can be controlled through the use of `optional: true`. -# -# From the release notes: -# -# belongs_to will now trigger a validation error by default if the -# association is not present. You can turn this off on a -# per-association basis with optional: true. Also deprecate required -# option in favor of optional for belongs_to. (Pull Request) -# -# In the case that the developer is doing `required: false`, we -# definitely want to autocorrect to `optional: true`. -# -# However, without knowing whether they've set overridden the default -# value of `config.active_record.belongs_to_required_by_default`, we -# can't say whether it's safe to remove `required: true` or whether we -# should replace it with `optional: false` (or, similarly, remove a -# superfluous `optional: false`). Therefore, in the cases we're using -# `required: true`, we'll simply invert it to `optional: false` and the -# user can remove depending on their defaults. -# -# @example -# # bad -# class Post < ApplicationRecord -# belongs_to :blog, required: false -# end -# -# # good -# class Post < ApplicationRecord -# belongs_to :blog, optional: true -# end -# -# # bad -# class Post < ApplicationRecord -# belongs_to :blog, required: true -# end -# -# # good -# class Post < ApplicationRecord -# belongs_to :blog, optional: false -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/belongs_to.rb#50 -class RuboCop::Cop::Rails::BelongsTo < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/belongs_to.rb#67 - def match_belongs_to_with_options(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/belongs_to.rb#73 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/belongs_to.rb#65 -RuboCop::Cop::Rails::BelongsTo::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/belongs_to.rb#56 -RuboCop::Cop::Rails::BelongsTo::SUPERFLOUS_REQUIRE_FALSE_MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/belongs_to.rb#60 -RuboCop::Cop::Rails::BelongsTo::SUPERFLOUS_REQUIRE_TRUE_MSG = T.let(T.unsafe(nil), String) - -# Checks for code that can be written with simpler conditionals -# using `Object#blank?` defined by Active Support. -# -# Interaction with `Style/UnlessElse`: -# The configuration of `NotPresent` will not produce an offense in the -# context of `unless else` if `Style/UnlessElse` is enabled. This is -# to prevent interference between the autocorrection of the two cops. -# -# @example NilOrEmpty: true (default) -# # Converts usages of `nil? || empty?` to `blank?` -# -# # bad -# foo.nil? || foo.empty? -# foo == nil || foo.empty? -# -# # good -# foo.blank? -# @example NotPresent: true (default) -# # Converts usages of `!present?` to `blank?` -# -# # bad -# !foo.present? -# -# # good -# foo.blank? -# @example UnlessPresent: true (default) -# # Converts usages of `unless present?` to `if blank?` -# -# # bad -# something unless foo.present? -# -# # good -# something if foo.blank? -# -# # bad -# unless foo.present? -# something -# end -# -# # good -# if foo.blank? -# something -# end -# -# # good -# def blank? -# !present? -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#61 -class RuboCop::Cop::Rails::Blank < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#90 - def defining_blank?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#73 - def nil_or_empty?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#88 - def not_present?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#123 - def on_if(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#110 - def on_or(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#96 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#92 - def unless_present?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#140 - def autocorrect(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#162 - def replacement(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#154 - def unless_condition(node, method_call); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#64 -RuboCop::Cop::Rails::Blank::MSG_NIL_OR_EMPTY = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#65 -RuboCop::Cop::Rails::Blank::MSG_NOT_PRESENT = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#66 -RuboCop::Cop::Rails::Blank::MSG_UNLESS_PRESENT = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/blank.rb#67 -RuboCop::Cop::Rails::Blank::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks whether alter queries are combinable. -# If combinable queries are detected, it suggests to you -# to use `change_table` with `bulk: true` instead. -# This option causes the migration to generate a single -# ALTER TABLE statement combining multiple column alterations. -# -# The `bulk` option is only supported on the MySQL and -# the PostgreSQL (5.2 later) adapter; thus it will -# automatically detect an adapter from `development` environment -# in `config/database.yml` or the environment variable `DATABASE_URL` -# when the `Database` option is not set. -# If the adapter is not `mysql2`, `trilogy`, `postgresql`, or `postgis`, -# this Cop ignores offenses. -# -# @example -# # bad -# def change -# add_column :users, :name, :string, null: false -# add_column :users, :nickname, :string -# -# # ALTER TABLE `users` ADD `name` varchar(255) NOT NULL -# # ALTER TABLE `users` ADD `nickname` varchar(255) -# end -# -# # good -# def change -# change_table :users, bulk: true do |t| -# t.string :name, null: false -# t.string :nickname -# end -# -# # ALTER TABLE `users` ADD `name` varchar(255) NOT NULL, -# # ADD `nickname` varchar(255) -# end -# @example -# # bad -# def change -# change_table :users do |t| -# t.string :name, null: false -# t.string :nickname -# end -# end -# -# # good -# def change -# change_table :users, bulk: true do |t| -# t.string :name, null: false -# t.string :nickname -# end -# end -# -# # good -# # When you don't want to combine alter queries. -# def change -# change_table :users, bulk: false do |t| -# t.string :name, null: false -# t.string :nickname -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#66 -class RuboCop::Cop::Rails::BulkChangeTable < ::RuboCop::Cop::Base - include ::RuboCop::Cop::DatabaseTypeResolvable - - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#119 - def on_def(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#137 - def on_send(node); end - - private - - # @param node [RuboCop::AST::SendNode] - # - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#213 - def add_offense_for_alter_methods(node); end - - # @param node [RuboCop::AST::SendNode] - # - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#223 - def add_offense_for_change_table(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#190 - def call_to_combinable_alter_method?(child_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#194 - def combinable_alter_methods; end - - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#203 - def combinable_transformations; end - - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#158 - def count_transformations(send_nodes); end - - # @param node [RuboCop::AST::SendNode] (send nil? :change_table ...) - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#169 - def include_bulk_options?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#150 - def send_nodes_from_change_table_block(body); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#177 - def support_bulk_alter?; end -end - -# Record combinable alter methods and register offensive nodes. -# -# source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#228 -class RuboCop::Cop::Rails::BulkChangeTable::AlterMethodsRecorder - # @return [AlterMethodsRecorder] a new instance of AlterMethodsRecorder - # - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#229 - def initialize; end - - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#248 - def flush; end - - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#253 - def offensive_nodes; end - - # @param new_node [RuboCop::AST::SendNode] - # - # source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#235 - def process(new_node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#102 -RuboCop::Cop::Rails::BulkChangeTable::COMBINABLE_ALTER_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#78 -RuboCop::Cop::Rails::BulkChangeTable::COMBINABLE_TRANSFORMATIONS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#76 -RuboCop::Cop::Rails::BulkChangeTable::MIGRATION_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#72 -RuboCop::Cop::Rails::BulkChangeTable::MSG_FOR_ALTER_METHODS = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#69 -RuboCop::Cop::Rails::BulkChangeTable::MSG_FOR_CHANGE_TABLE = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#113 -RuboCop::Cop::Rails::BulkChangeTable::MYSQL_COMBINABLE_ALTER_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#111 -RuboCop::Cop::Rails::BulkChangeTable::MYSQL_COMBINABLE_TRANSFORMATIONS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#117 -RuboCop::Cop::Rails::BulkChangeTable::POSTGRESQL_COMBINABLE_ALTER_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/bulk_change_table.rb#115 -RuboCop::Cop::Rails::BulkChangeTable::POSTGRESQL_COMBINABLE_TRANSFORMATIONS = T.let(T.unsafe(nil), Array) - -# Checks if collection can be blank-compacted with `compact_blank`. -# -# @example -# -# # bad -# collection.reject(&:blank?) -# collection.reject { |_k, v| v.blank? } -# -# # good -# collection.compact_blank -# -# # bad -# collection.delete_if(&:blank?) # Same behavior as `Array#compact_blank!` and `Hash#compact_blank!` -# collection.delete_if { |_k, v| v.blank? } # Same behavior as `Array#compact_blank!` and `Hash#compact_blank!` -# collection.reject!(&:blank?) # Same behavior as `ActionController::Parameters#compact_blank!` -# collection.reject! { |_k, v| v.blank? } # Same behavior as `ActionController::Parameters#compact_blank!` -# -# # good -# collection.compact_blank! -# -# source://rubocop-rails//lib/rubocop/cop/rails/compact_blank.rb#40 -class RuboCop::Cop::Rails::CompactBlank < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/compact_blank.rb#64 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/compact_blank.rb#50 - def reject_with_block?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/compact_blank.rb#58 - def reject_with_block_pass?(param0 = T.unsafe(nil)); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/compact_blank.rb#76 - def bad_method?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/compact_blank.rb#95 - def offense_range(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/compact_blank.rb#105 - def preferred_method(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/compact_blank.rb#91 - def use_hash_value_block_argument?(arguments, receiver_in_block); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/compact_blank.rb#87 - def use_single_value_block_argument?(arguments, receiver_in_block); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/compact_blank.rb#45 -RuboCop::Cop::Rails::CompactBlank::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/compact_blank.rb#46 -RuboCop::Cop::Rails::CompactBlank::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks legacy syntax usage of `tag` -# -# NOTE: Allow `tag` when the first argument is a variable because -# `tag(name)` is simpler rather than `tag.public_send(name)`. -# And this cop will be renamed to something like `LegacyTag` in the future. (e.g. RuboCop Rails 3.0) -# -# @example -# # bad -# tag(:p) -# tag(:br, class: 'classname') -# -# # good -# tag.p -# tag.br(class: 'classname') -# tag(name, class: 'classname') -# -# source://rubocop-rails//lib/rubocop/cop/rails/content_tag.rb#21 -class RuboCop::Cop::Rails::ContentTag < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/content_tag.rb#31 - def on_new_investigation; end - - # source://rubocop-rails//lib/rubocop/cop/rails/content_tag.rb#35 - def on_send(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/content_tag.rb#54 - def allowed_argument?(argument); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/content_tag.rb#81 - def allowed_name?(argument); end - - # source://rubocop-rails//lib/rubocop/cop/rails/content_tag.rb#72 - def autocorrect(corrector, node, preferred_method); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/content_tag.rb#50 - def corrected_ancestor?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/content_tag.rb#87 - def correction_range(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/content_tag.rb#63 - def register_offense(node, message, preferred_method); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/content_tag.rb#28 -RuboCop::Cop::Rails::ContentTag::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/content_tag.rb#29 -RuboCop::Cop::Rails::ContentTag::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks the migration for which timestamps are not included when creating a new table. -# In many cases, timestamps are useful information and should be added. -# -# NOTE: Allow `timestamps` not written when `id: false` because this emphasizes respecting -# user's editing intentions. -# -# @example -# # bad -# create_table :users -# -# # bad -# create_table :users do |t| -# t.string :name -# t.string :email -# end -# -# # good -# create_table :users do |t| -# t.string :name -# t.string :email -# -# t.timestamps -# end -# -# # good -# create_table :users do |t| -# t.string :name -# t.string :email -# -# t.datetime :created_at, default: -> { 'CURRENT_TIMESTAMP' } -# end -# -# # good -# create_table :users do |t| -# t.string :name -# t.string :email -# -# t.datetime :updated_at, default: -> { 'CURRENT_TIMESTAMP' } -# end -# -# # good -# create_table :users, articles, id: false do |t| -# t.integer :user_id -# t.integer :article_id -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/create_table_with_timestamps.rb#52 -class RuboCop::Cop::Rails::CreateTableWithTimestamps < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ActiveRecordMigrationsHelper - - # source://rubocop-rails//lib/rubocop/cop/rails/create_table_with_timestamps.rb#62 - def create_table_with_timestamps_proc?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/create_table_with_timestamps.rb#70 - def created_at_or_updated_at_included?(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/create_table_with_timestamps.rb#76 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/create_table_with_timestamps.rb#66 - def timestamps_included?(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/create_table_with_timestamps.rb#58 - def use_id_false_option?(param0); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/create_table_with_timestamps.rb#92 - def time_columns_included?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/create_table_with_timestamps.rb#55 -RuboCop::Cop::Rails::CreateTableWithTimestamps::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/create_table_with_timestamps.rb#56 -RuboCop::Cop::Rails::CreateTableWithTimestamps::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Avoid dangerous column names. -# -# Some column names are considered dangerous because they would overwrite methods already defined. -# -# @example -# # bad -# add_column :users, :save -# -# # good -# add_column :users, :saved -# -# source://rubocop-rails//lib/rubocop/cop/rails/dangerous_column_names.rb#16 -class RuboCop::Cop::Rails::DangerousColumnNames < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/dangerous_column_names.rb#414 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/dangerous_column_names.rb#424 - def column_name_node_from(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/dangerous_column_names.rb#441 - def dangerous_column_name?(column_name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/dangerous_column_names.rb#435 - def dangerous_column_name_node?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/dangerous_column_names.rb#17 -RuboCop::Cop::Rails::DangerousColumnNames::COLUMN_TYPE_METHOD_NAMES = T.let(T.unsafe(nil), Set) - -# Generated from `ActiveRecord::AttributeMethods.dangerous_attribute_methods` on activerecord 7.1.0. -# -# source://rubocop-rails//lib/rubocop/cop/rails/dangerous_column_names.rb#36 -RuboCop::Cop::Rails::DangerousColumnNames::DANGEROUS_COLUMN_NAMES = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/dangerous_column_names.rb#410 -RuboCop::Cop::Rails::DangerousColumnNames::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/dangerous_column_names.rb#412 -RuboCop::Cop::Rails::DangerousColumnNames::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for the correct use of Date methods, -# such as Date.today, Date.current etc. -# -# Using `Date.today` is dangerous, because it doesn't know anything about -# Rails time zone. You must use `Time.zone.today` instead. -# -# The cop also reports warnings when you are using `to_time` method, -# because it doesn't know about Rails time zone either. -# -# Two styles are supported for this cop. When `EnforcedStyle` is 'strict' -# then the Date methods `today`, `current`, `yesterday`, and `tomorrow` -# are prohibited and the usage of both `to_time` -# and 'to_time_in_current_zone' are reported as warning. -# -# When `EnforcedStyle` is `flexible` then only `Date.today` is prohibited. -# -# And you can set a warning for `to_time` with `AllowToTime: false`. -# `AllowToTime` is `true` by default to prevent false positive on `DateTime` object. -# -# @example EnforcedStyle: flexible (default) -# # bad -# Date.today -# -# # good -# Time.zone.today -# Time.zone.today - 1.day -# Date.current -# Date.yesterday -# date.in_time_zone -# @example EnforcedStyle: strict -# # bad -# Date.current -# Date.yesterday -# Date.today -# -# # good -# Time.zone.today -# Time.zone.today - 1.day -# @example AllowToTime: true (default) -# # good -# date.to_time -# @example AllowToTime: false -# # bad -# date.to_time -# -# source://rubocop-rails//lib/rubocop/cop/rails/date.rb#56 -class RuboCop::Cop::Rails::Date < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ConfigurableEnforcedStyle - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#73 - def on_const(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#81 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#81 - def on_send(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#153 - def allow_to_time?; end - - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#161 - def bad_days; end - - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#165 - def bad_methods; end - - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#106 - def check_date_node(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#94 - def check_deprecated_methods(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#123 - def extract_method_chain(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#157 - def good_days; end - - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#169 - def good_methods; end - - # checks that parent node of send_type - # and receiver is the given node - # - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#129 - def method_send?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#135 - def safe_chain?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/date.rb#141 - def safe_to_time?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/date.rb#67 -RuboCop::Cop::Rails::Date::BAD_DAYS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/date.rb#69 -RuboCop::Cop::Rails::Date::DEPRECATED_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/date.rb#71 -RuboCop::Cop::Rails::Date::DEPRECATED_MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/date.rb#61 -RuboCop::Cop::Rails::Date::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/date.rb#63 -RuboCop::Cop::Rails::Date::MSG_SEND = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/date.rb#65 -RuboCop::Cop::Rails::Date::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Looks for uses of `default_scope`. -# -# @example -# # bad -# default_scope -> { where(hidden: false) } -# -# # good -# scope :published, -> { where(hidden: false) } -# -# # bad -# def self.default_scope -# where(hidden: false) -# end -# -# # good -# def self.published -# where(hidden: false) -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/default_scope.rb#25 -class RuboCop::Cop::Rails::DefaultScope < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/default_scope.rb#33 - def class_method_definition?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/default_scope.rb#37 - def eigenclass_method_definition?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/default_scope.rb#29 - def method_call?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/default_scope.rb#47 - def on_defs(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/default_scope.rb#53 - def on_sclass(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/default_scope.rb#41 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/default_scope.rb#26 -RuboCop::Cop::Rails::DefaultScope::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/default_scope.rb#27 -RuboCop::Cop::Rails::DefaultScope::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Looks for delegations that could have been created -# automatically with the `delegate` method. -# -# Safe navigation `&.` is ignored because Rails' `allow_nil` -# option checks not just for nil but also delegates if nil -# responds to the delegated method. -# -# The `EnforceForPrefixed` option (defaulted to `true`) means that -# using the target object as a prefix of the method name -# without using the `delegate` method will be a violation. -# When set to `false`, this case is legal. -# -# @example -# # bad -# def bar -# foo.bar -# end -# -# # good -# delegate :bar, to: :foo -# -# # bad -# def bar -# self.bar -# end -# -# # good -# delegate :bar, to: :self -# -# # good -# def bar -# foo&.bar -# end -# -# # good -# private -# def bar -# foo.bar -# end -# @example EnforceForPrefixed: true (default) -# # bad -# def foo_bar -# foo.bar -# end -# -# # good -# delegate :bar, to: :foo, prefix: true -# @example EnforceForPrefixed: false -# # good -# def foo_bar -# foo.bar -# end -# -# # good -# delegate :bar, to: :foo, prefix: true -# -# source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#63 -class RuboCop::Cop::Rails::Delegate < ::RuboCop::Cop::Base - include ::RuboCop::Cop::VisibilityHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#69 - def delegate?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#74 - def on_def(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#102 - def arguments_match?(arg_array, body); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#116 - def include_prefix_case?; end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#112 - def method_name_matches?(method_name, body); end - - # source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#120 - def prefixed_method_name(body); end - - # source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#126 - def private_or_protected_delegation(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#130 - def private_or_protected_inline(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#83 - def register_offense(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#96 - def trivial_delegate?(def_node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/delegate.rb#67 -RuboCop::Cop::Rails::Delegate::MSG = T.let(T.unsafe(nil), String) - -# Looks for delegations that pass :allow_blank as an option -# instead of :allow_nil. :allow_blank is not a valid option to pass -# to ActiveSupport#delegate. -# -# @example -# # bad -# delegate :foo, to: :bar, allow_blank: true -# -# # good -# delegate :foo, to: :bar, allow_nil: true -# -# source://rubocop-rails//lib/rubocop/cop/rails/delegate_allow_blank.rb#16 -class RuboCop::Cop::Rails::DelegateAllowBlank < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/delegate_allow_blank.rb#22 - def allow_blank_option(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/delegate_allow_blank.rb#26 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/delegate_allow_blank.rb#19 -RuboCop::Cop::Rails::DelegateAllowBlank::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/delegate_allow_blank.rb#20 -RuboCop::Cop::Rails::DelegateAllowBlank::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks direct manipulation of ActiveModel#errors as hash. -# These operations are deprecated in Rails 6.1 and will not work in Rails 7. -# -# @example -# # bad -# user.errors[:name] << 'msg' -# user.errors.messages[:name] << 'msg' -# -# # good -# user.errors.add(:name, 'msg') -# -# # bad -# user.errors[:name].clear -# user.errors.messages[:name].clear -# -# # good -# user.errors.delete(:name) -# -# # bad -# user.errors.keys.include?(:attr) -# -# # good -# user.errors.attribute_names.include?(:attr) -# -# source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#35 -class RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#55 - def any_manipulation?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#81 - def errors_deprecated?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#99 - def messages_details_assignment?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#87 - def messages_details_manipulation?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#108 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#53 - def receiver_matcher_inside_model(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#52 - def receiver_matcher_outside_model(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#74 - def root_assignment?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#65 - def root_manipulation?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#129 - def autocorrect(corrector, node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#162 - def model_file?; end - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#138 - def offense_range(node, receiver); end - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#158 - def receiver_matcher(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#143 - def replacement(node, receiver); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#122 - def skip_autocorrect?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#40 -RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::AUTOCORRECTABLE_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#41 -RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::INCOMPATIBLE_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#43 -RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::MANIPULATIVE_METHODS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/deprecated_active_model_errors_methods.rb#39 -RuboCop::Cop::Rails::DeprecatedActiveModelErrorsMethods::MSG = T.let(T.unsafe(nil), String) - -# Enforces the use of dot-separated locale keys instead of specifying the `:scope` option -# with an array or a single symbol in `I18n` translation methods. -# Dot-separated notation is easier to read and trace the hierarchy. -# -# @example -# # bad -# I18n.t :record_invalid, scope: [:activerecord, :errors, :messages] -# I18n.t :title, scope: :invitation -# -# # good -# I18n.t 'activerecord.errors.messages.record_invalid' -# I18n.t :record_invalid, scope: 'activerecord.errors.messages' -# -# source://rubocop-rails//lib/rubocop/cop/rails/dot_separated_keys.rb#19 -class RuboCop::Cop::Rails::DotSeparatedKeys < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/dot_separated_keys.rb#32 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/dot_separated_keys.rb#26 - def translate_with_scope?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/dot_separated_keys.rb#55 - def new_key(key_node, scope_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/dot_separated_keys.rb#59 - def scopes(scope_node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/dot_separated_keys.rb#51 - def should_convert_scope?(scope_node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/dot_separated_keys.rb#23 -RuboCop::Cop::Rails::DotSeparatedKeys::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/dot_separated_keys.rb#24 -RuboCop::Cop::Rails::DotSeparatedKeys::TRANSLATE_METHODS = T.let(T.unsafe(nil), Array) - -# Looks for associations that have been defined multiple times in the same file. -# -# When an association is defined multiple times on a model, Active Record overrides the -# previously defined association with the new one. Because of this, this cop's autocorrection -# simply keeps the last of any duplicates and discards the rest. -# -# @example -# -# # bad -# belongs_to :foo -# belongs_to :bar -# has_one :foo -# -# # good -# belongs_to :bar -# has_one :foo -# -# # bad -# has_many :foo, class_name: 'Foo' -# has_many :bar, class_name: 'Foo' -# has_one :baz -# -# # good -# has_many :bar, class_name: 'Foo' -# has_one :foo -# -# source://rubocop-rails//lib/rubocop/cop/rails/duplicate_association.rb#32 -class RuboCop::Cop::Rails::DuplicateAssociation < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - include ::RuboCop::Cop::ClassSendNodeHelper - include ::RuboCop::Cop::ActiveRecordHelper - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/duplicate_association.rb#41 - def association(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/duplicate_association.rb#45 - def class_name(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/duplicate_association.rb#49 - def on_class(class_node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/duplicate_association.rb#75 - def association_nodes(class_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/duplicate_association.rb#81 - def duplicated_association_name_nodes(association_nodes); end - - # source://rubocop-rails//lib/rubocop/cop/rails/duplicate_association.rb#89 - def duplicated_class_name_nodes(association_nodes); end - - # source://rubocop-rails//lib/rubocop/cop/rails/duplicate_association.rb#105 - def leave_duplicated_association(grouped_associations); end - - # source://rubocop-rails//lib/rubocop/cop/rails/duplicate_association.rb#65 - def register_offense(name, nodes, message_template); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/duplicate_association.rb#38 -RuboCop::Cop::Rails::DuplicateAssociation::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/duplicate_association.rb#39 -RuboCop::Cop::Rails::DuplicateAssociation::MSG_CLASS_NAME = T.let(T.unsafe(nil), String) - -# Checks for multiple scopes in a model that have the same `where` clause. This -# often means you copy/pasted a scope, updated the name, and forgot to change the condition. -# -# @example -# -# # bad -# scope :visible, -> { where(visible: true) } -# scope :hidden, -> { where(visible: true) } -# -# # good -# scope :visible, -> { where(visible: true) } -# scope :hidden, -> { where(visible: false) } -# -# source://rubocop-rails//lib/rubocop/cop/rails/duplicate_scope.rb#19 -class RuboCop::Cop::Rails::DuplicateScope < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ClassSendNodeHelper - - # source://rubocop-rails//lib/rubocop/cop/rails/duplicate_scope.rb#28 - def on_class(class_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/duplicate_scope.rb#24 - def scope(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/duplicate_scope.rb#36 - def offenses(class_node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/duplicate_scope.rb#22 -RuboCop::Cop::Rails::DuplicateScope::MSG = T.let(T.unsafe(nil), String) - -# Checks if a duration is added to or subtracted from `Time.current`. -# -# @example -# # bad -# Time.current - 1.minute -# Time.current + 2.days -# -# # good - using relative would make it harder to express and read -# Date.yesterday + 3.days -# created_at - 1.minute -# 3.days - 1.hour -# -# # good -# 1.minute.ago -# 2.days.from_now -# -# source://rubocop-rails//lib/rubocop/cop/rails/duration_arithmetic.rb#21 -class RuboCop::Cop::Rails::DurationArithmetic < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # Match a literal Duration - # - # @example source that matches - # 1.hour - # @example source that matches - # 9.5.weeks - # @param node [RuboCop::AST::Node] - # @return [Boolean] true if matches - # - # source://rubocop-rails//lib/rubocop/cop/rails/duration_arithmetic.rb#58 - def duration?(param0 = T.unsafe(nil)); end - - # Match duration subtraction or addition with current time. - # - # @example source that matches - # Time.current - 1.hour - # @example source that matches - # ::Time.zone.now + 1.hour - # @param node [RuboCop::AST::Node] - # @yield operator and duration - # - # source://rubocop-rails//lib/rubocop/cop/rails/duration_arithmetic.rb#43 - def duration_arithmetic_argument?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/duration_arithmetic.rb#78 - def on_send(node); end - - # Match Time.current - # - # @example source that matches - # Time.current - # @example source that matches - # ::Time.zone.now - # @param node [RuboCop::AST::Node] - # @return [Boolean] true if matches - # - # source://rubocop-rails//lib/rubocop/cop/rails/duration_arithmetic.rb#71 - def time_current?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/duration_arithmetic.rb#88 - def corrected_source(operator, duration); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/duration_arithmetic.rb#28 -RuboCop::Cop::Rails::DurationArithmetic::DURATIONS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/duration_arithmetic.rb#24 -RuboCop::Cop::Rails::DurationArithmetic::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/duration_arithmetic.rb#26 -RuboCop::Cop::Rails::DurationArithmetic::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks dynamic `find_by_*` methods. -# Use `find_by` instead of dynamic method. -# See. https://rails.rubystyle.guide#find_by -# -# @example -# # bad -# User.find_by_name(name) -# User.find_by_name_and_email(name) -# User.find_by_email!(name) -# -# # good -# User.find_by(name: name) -# User.find_by(name: name, email: email) -# User.find_by!(email: email) -# @example AllowedMethods: ['find_by_sql', 'find_by_token_for'] (default) -# # bad -# User.find_by_query(users_query) -# User.find_by_token_for(:password_reset, token) -# -# # good -# User.find_by_sql(users_sql) -# User.find_by_token_for(:password_reset, token) -# @example AllowedReceivers: ['Gem::Specification', 'page'] (default) -# # bad -# Specification.find_by_name('backend').gem_dir -# page.find_by_id('a_dom_id').click -# -# # good -# Gem::Specification.find_by_name('backend').gem_dir -# page.find_by_id('a_dom_id').click -# -# source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#42 -class RuboCop::Cop::Rails::DynamicFindBy < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ActiveRecordHelper - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#50 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#50 - def on_send(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#72 - def allowed_invocation?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#76 - def allowed_method?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#82 - def allowed_receiver?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#67 - def autocorrect(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#100 - def autocorrect_argument_keywords(corrector, node, keywords); end - - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#96 - def autocorrect_method_name(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#106 - def column_keywords(method); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#120 - def dynamic_find_by_arguments?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#124 - def dynamic_find_by_arguments_count?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#128 - def dynamic_find_by_arguments_type?(node); end - - # Returns static method name. - # If code isn't wrong, returns nil - # - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#113 - def static_method_name(method_name); end - - # config option `WhiteList` will be deprecated soon - # - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#89 - def whitelisted?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#48 -RuboCop::Cop::Rails::DynamicFindBy::IGNORED_ARGUMENT_TYPES = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#47 -RuboCop::Cop::Rails::DynamicFindBy::METHOD_PATTERN = T.let(T.unsafe(nil), Regexp) - -# source://rubocop-rails//lib/rubocop/cop/rails/dynamic_find_by.rb#46 -RuboCop::Cop::Rails::DynamicFindBy::MSG = T.let(T.unsafe(nil), String) - -# Checks that blocks are used for interpolated strings passed to -# `Rails.logger.debug`. -# -# By default, Rails production environments use the `:info` log level. -# At the `:info` log level, `Rails.logger.debug` statements do not result -# in log output. However, Ruby must eagerly evaluate interpolated string -# arguments passed as method arguments. Passing a block to -# `Rails.logger.debug` prevents costly evaluation of interpolated strings -# when no output would be produced anyway. -# -# @example -# # bad -# Rails.logger.debug "The time is #{Time.zone.now}." -# -# # good -# Rails.logger.debug { "The time is #{Time.zone.now}." } -# -# source://rubocop-rails//lib/rubocop/cop/rails/eager_evaluation_log_message.rb#23 -class RuboCop::Cop::Rails::EagerEvaluationLogMessage < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/eager_evaluation_log_message.rb#29 - def interpolated_string_passed_to_debug(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/eager_evaluation_log_message.rb#44 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/eager_evaluation_log_message.rb#61 - def replacement_range(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/eager_evaluation_log_message.rb#72 - def replacement_source(node, arguments); end - - class << self - # source://rubocop-rails//lib/rubocop/cop/rails/eager_evaluation_log_message.rb#40 - def autocorrect_incompatible_with; end - end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/eager_evaluation_log_message.rb#26 -RuboCop::Cop::Rails::EagerEvaluationLogMessage::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/eager_evaluation_log_message.rb#27 -RuboCop::Cop::Rails::EagerEvaluationLogMessage::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Looks for enums written with array syntax. -# -# When using array syntax, adding an element in a -# position other than the last causes all previous -# definitions to shift. Explicitly specifying the -# value for each key prevents this from happening. -# -# @example -# # bad -# enum status: [:active, :archived] -# -# # good -# enum status: { active: 0, archived: 1 } -# -# source://rubocop-rails//lib/rubocop/cop/rails/enum_hash.rb#20 -class RuboCop::Cop::Rails::EnumHash < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/enum_hash.rb#30 - def array_pair?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/enum_hash.rb#26 - def enum?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/enum_hash.rb#34 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/enum_hash.rb#53 - def enum_name(key); end - - # source://rubocop-rails//lib/rubocop/cop/rails/enum_hash.rb#62 - def source(elem); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/enum_hash.rb#23 -RuboCop::Cop::Rails::EnumHash::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/enum_hash.rb#24 -RuboCop::Cop::Rails::EnumHash::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Looks for duplicate values in enum declarations. -# -# @example -# # bad -# enum status: { active: 0, archived: 0 } -# -# # good -# enum status: { active: 0, archived: 1 } -# -# # bad -# enum status: [:active, :archived, :active] -# -# # good -# enum status: [:active, :archived] -# -# source://rubocop-rails//lib/rubocop/cop/rails/enum_uniqueness.rb#20 -class RuboCop::Cop::Rails::EnumUniqueness < ::RuboCop::Cop::Base - include ::RuboCop::Cop::Duplication - - # source://rubocop-rails//lib/rubocop/cop/rails/enum_uniqueness.rb#26 - def enum?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/enum_uniqueness.rb#30 - def enum_values(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/enum_uniqueness.rb#34 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/enum_uniqueness.rb#52 - def enum_name(key); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/enum_uniqueness.rb#23 -RuboCop::Cop::Rails::EnumUniqueness::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/enum_uniqueness.rb#24 -RuboCop::Cop::Rails::EnumUniqueness::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for usage of `Rails.env.development? || Rails.env.test?` which -# can be replaced with `Rails.env.local?`, introduced in Rails 7.1. -# -# @example -# -# # bad -# Rails.env.development? || Rails.env.test? -# -# # good -# Rails.env.local? -# -# source://rubocop-rails//lib/rubocop/cop/rails/env_local.rb#17 -class RuboCop::Cop::Rails::EnvLocal < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/env_local.rb#34 - def on_or(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/env_local.rb#27 - def rails_env_local_candidate?(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/env_local.rb#22 -RuboCop::Cop::Rails::EnvLocal::LOCAL_ENVIRONMENTS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/env_local.rb#21 -RuboCop::Cop::Rails::EnvLocal::MSG = T.let(T.unsafe(nil), String) - -# Checks that Rails.env is compared using `.production?`-like -# methods instead of equality against a string or symbol. -# -# @example -# # bad -# Rails.env == 'production' -# -# # bad, always returns false -# Rails.env == :test -# -# # good -# Rails.env.production? -# -# source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#18 -class RuboCop::Cop::Rails::EnvironmentComparison < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#27 - def comparing_str_env_with_rails_env_on_lhs?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#35 - def comparing_str_env_with_rails_env_on_rhs?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#43 - def comparing_sym_env_with_rails_env_on_lhs?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#51 - def comparing_sym_env_with_rails_env_on_rhs?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#59 - def content(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#63 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#84 - def autocorrect(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#90 - def build_predicate_method(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#102 - def build_predicate_method_for_rails_env_on_lhs(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#108 - def build_predicate_method_for_rails_env_on_rhs(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#98 - def rails_env_on_lhs?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#21 -RuboCop::Cop::Rails::EnvironmentComparison::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#25 -RuboCop::Cop::Rails::EnvironmentComparison::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/environment_comparison.rb#23 -RuboCop::Cop::Rails::EnvironmentComparison::SYM_MSG = T.let(T.unsafe(nil), String) - -# Looks for direct access to environment variables through the -# `ENV` variable within the application code. This can lead to runtime -# errors due to misconfiguration that could have been discovered at boot -# time if the environment variables were loaded as part of initialization -# and copied into the application's configuration or secrets. The cop can -# be configured to allow either reads or writes if required. -# -# @example -# # good -# Rails.application.config.foo -# Rails.application.config.x.foo.bar -# Rails.application.secrets.foo -# Rails.application.config.foo = "bar" -# @example AllowReads: false (default) -# # bad -# ENV["FOO"] -# ENV.fetch("FOO") -# @example AllowReads: true -# # good -# ENV["FOO"] -# ENV.fetch("FOO") -# @example AllowWrites: false (default) -# # bad -# ENV["FOO"] = "bar" -# @example AllowWrites: true -# # good -# ENV["FOO"] = "bar" -# -# source://rubocop-rails//lib/rubocop/cop/rails/environment_variable_access.rb#37 -class RuboCop::Cop::Rails::EnvironmentVariableAccess < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/environment_variable_access.rb#46 - def env_read?(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_variable_access.rb#50 - def env_write?(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/environment_variable_access.rb#41 - def on_const(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/environment_variable_access.rb#57 - def allow_reads?; end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/environment_variable_access.rb#61 - def allow_writes?; end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/environment_variable_access.rb#38 -RuboCop::Cop::Rails::EnvironmentVariableAccess::READ_MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/environment_variable_access.rb#39 -RuboCop::Cop::Rails::EnvironmentVariableAccess::WRITE_MSG = T.let(T.unsafe(nil), String) - -# Enforces that `exit` calls are not used within a rails app. -# Valid options are instead to raise an error, break, return, or some -# other form of stopping execution of current request. -# -# There are two obvious cases where `exit` is particularly harmful: -# -# * Usage in library code for your application. Even though Rails will -# rescue from a `SystemExit` and continue on, unit testing that library -# code will result in specs exiting (potentially silently if `exit(0)` -# is used.) -# * Usage in application code outside of the web process could result in -# the program exiting, which could result in the code failing to run and -# do its job. -# -# @example -# # bad -# exit(0) -# -# # good -# raise 'a bad error has happened' -# -# source://rubocop-rails//lib/rubocop/cop/rails/exit.rb#26 -class RuboCop::Cop::Rails::Exit < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ConfigurableEnforcedStyle - - # source://rubocop-rails//lib/rubocop/cop/rails/exit.rb#33 - def on_send(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/exit.rb#39 - def offending_node?(node); end - - # More than 1 argument likely means it is a different - # `exit` implementation than the one we are preventing. - # - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/exit.rb#45 - def right_argument_count?(arg_nodes); end - - # Only register if exit is being called explicitly on `Kernel`, - # `Process`, or if receiver node is nil for plain `exit` calls. - # - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/exit.rb#51 - def right_receiver?(receiver_node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/exit.rb#31 -RuboCop::Cop::Rails::Exit::EXPLICIT_RECEIVERS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/exit.rb#29 -RuboCop::Cop::Rails::Exit::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/exit.rb#30 -RuboCop::Cop::Rails::Exit::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for expanded date range. It only compatible `..` range is targeted. -# Incompatible `...` range is ignored. -# -# @example -# # bad -# date.beginning_of_day..date.end_of_day -# date.beginning_of_week..date.end_of_week -# date.beginning_of_month..date.end_of_month -# date.beginning_of_quarter..date.end_of_quarter -# date.beginning_of_year..date.end_of_year -# -# # good -# date.all_day -# date.all_week -# date.all_month -# date.all_quarter -# date.all_year -# -# source://rubocop-rails//lib/rubocop/cop/rails/expanded_date_range.rb#24 -class RuboCop::Cop::Rails::ExpandedDateRange < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/expanded_date_range.rb#48 - def on_irange(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/expanded_date_range.rb#67 - def allow?(begin_node, end_node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/expanded_date_range.rb#88 - def any_arguments?(begin_node, end_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/expanded_date_range.rb#84 - def preferred_method(begin_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/expanded_date_range.rb#74 - def receiver_source(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/expanded_date_range.rb#92 - def register_offense(node, preferred_method); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/expanded_date_range.rb#80 - def same_argument?(begin_node, end_node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/expanded_date_range.rb#40 -RuboCop::Cop::Rails::ExpandedDateRange::MAPPED_DATE_RANGE_METHODS = T.let(T.unsafe(nil), Hash) - -# source://rubocop-rails//lib/rubocop/cop/rails/expanded_date_range.rb#28 -RuboCop::Cop::Rails::ExpandedDateRange::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/expanded_date_range.rb#32 -RuboCop::Cop::Rails::ExpandedDateRange::PREFERRED_METHODS = T.let(T.unsafe(nil), Hash) - -# Identifies usages of file path joining process to use `Rails.root.join` clause. -# It is used to add uniformity when joining paths. -# -# @example EnforcedStyle: slashes (default) -# # bad -# Rails.root.join('app', 'models', 'goober') -# -# # good -# Rails.root.join('app/models/goober') -# -# # bad -# File.join(Rails.root, 'app/models/goober') -# "#{Rails.root}/app/models/goober" -# -# # good -# Rails.root.join('app/models/goober').to_s -# @example EnforcedStyle: arguments -# # bad -# Rails.root.join('app/models/goober') -# -# # good -# Rails.root.join('app', 'models', 'goober') -# -# # bad -# File.join(Rails.root, 'app/models/goober') -# "#{Rails.root}/app/models/goober" -# -# # good -# Rails.root.join('app', 'models', 'goober').to_s -# -# source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#37 -class RuboCop::Cop::Rails::FilePath < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ConfigurableEnforcedStyle - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#47 - def file_join_nodes?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#59 - def on_dstr(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#67 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#55 - def rails_root_join_nodes?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#51 - def rails_root_nodes?(param0); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#223 - def append_argument(corrector, node, argument_source); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#164 - def autocorrect_extension_after_rails_root_join_in_dstr(corrector, node, rails_root_index, extension_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#172 - def autocorrect_file_join(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#204 - def autocorrect_rails_root_join_with_slash_separated_path(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#189 - def autocorrect_rails_root_join_with_string_arguments(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#153 - def autocorrect_slash_after_rails_root_in_dstr(corrector, node, rails_root_index); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#140 - def build_message(require_to_s); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#85 - def check_for_extension_after_rails_root_join_in_dstr(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#95 - def check_for_file_join_with_rails_root(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#116 - def check_for_rails_root_join_with_slash_separated_path(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#104 - def check_for_rails_root_join_with_string_arguments(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#75 - def check_for_slash_after_rails_root_in_dstr(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#147 - def dstr_separated_by_colon?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#235 - def extension_node?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#231 - def extract_rails_root_join_argument_source(node, rails_root_index); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#219 - def find_rails_root_index(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#215 - def inner_range_of(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#131 - def register_offense(node, require_to_s:, &block); end - - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#227 - def replace_with_rails_root_join(corrector, node, argument_source); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#127 - def string_with_slash?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#44 -RuboCop::Cop::Rails::FilePath::MSG_ARGUMENTS = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#43 -RuboCop::Cop::Rails::FilePath::MSG_SLASHES = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/file_path.rb#45 -RuboCop::Cop::Rails::FilePath::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Identifies usages of `where.take` and change them to use `find_by` instead. -# -# And `where(...).first` can return different results from `find_by`. -# (They order records differently, so the "first" record can be different.) -# -# If you also want to detect `where.first`, you can set `IgnoreWhereFirst` to false. -# -# @example -# # bad -# User.where(name: 'Bruce').take -# -# # good -# User.find_by(name: 'Bruce') -# @example IgnoreWhereFirst: true (default) -# # good -# User.where(name: 'Bruce').first -# @example IgnoreWhereFirst: false -# # bad -# User.where(name: 'Bruce').first -# -# source://rubocop-rails//lib/rubocop/cop/rails/find_by.rb#27 -class RuboCop::Cop::Rails::FindBy < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by.rb#34 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by.rb#34 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by.rb#58 - def autocorrect(corrector, node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/find_by.rb#68 - def ignore_where_first?; end - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by.rb#54 - def offense_range(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/find_by.rb#48 - def where_method?(receiver); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/find_by.rb#31 -RuboCop::Cop::Rails::FindBy::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/find_by.rb#32 -RuboCop::Cop::Rails::FindBy::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Enforces that `ActiveRecord#find` is used instead of -# `where.take!`, `find_by!`, and `find_by_id!` to retrieve a single record -# by primary key when you expect it to be found. -# -# @example -# # bad -# User.where(id: id).take! -# User.find_by_id!(id) -# User.find_by!(id: id) -# -# # good -# User.find(id) -# -# source://rubocop-rails//lib/rubocop/cop/rails/find_by_id.rb#19 -class RuboCop::Cop::Rails::FindById < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by_id.rb#33 - def find_by?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by_id.rb#40 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by_id.rb#40 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by_id.rb#26 - def where_take?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by_id.rb#74 - def build_good_method(id_value); end - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by_id.rb#70 - def find_by_offense_range(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by_id.rb#57 - def register_offense(range, id_value); end - - # source://rubocop-rails//lib/rubocop/cop/rails/find_by_id.rb#66 - def where_take_offense_range(node, where); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/find_by_id.rb#23 -RuboCop::Cop::Rails::FindById::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/find_by_id.rb#24 -RuboCop::Cop::Rails::FindById::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Identifies usages of `all.each` and change them to use `all.find_each` instead. -# -# @example -# # bad -# User.all.each -# -# # good -# User.all.find_each -# @example AllowedMethods: ['order'] -# # good -# User.order(:foo).each -# @example AllowedPattern: ['order'] -# # good -# User.order(:foo).each -# -# source://rubocop-rails//lib/rubocop/cop/rails/find_each.rb#27 -class RuboCop::Cop::Rails::FindEach < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ActiveRecordHelper - include ::RuboCop::Cop::AllowedMethods - include ::RuboCop::Cop::AllowedPattern - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/find_each.rb#41 - def on_send(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/find_each.rb#67 - def active_model_error?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/find_each.rb#63 - def active_model_error_where?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/find_each.rb#55 - def ignored?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/find_each.rb#33 -RuboCop::Cop::Rails::FindEach::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/find_each.rb#34 -RuboCop::Cop::Rails::FindEach::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/find_each.rb#36 -RuboCop::Cop::Rails::FindEach::SCOPE_METHODS = T.let(T.unsafe(nil), Array) - -# Identifies usages of `travel_to` with an argument of the current time and -# change them to use `freeze_time` instead. -# -# @example -# # bad -# travel_to(Time.now) -# travel_to(Time.new) -# travel_to(DateTime.now) -# travel_to(Time.current) -# travel_to(Time.zone.now) -# travel_to(Time.now.in_time_zone) -# travel_to(Time.current.to_time) -# -# # good -# freeze_time -# -# source://rubocop-rails//lib/rubocop/cop/rails/freeze_time.rb#27 -class RuboCop::Cop::Rails::FreezeTime < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/freeze_time.rb#48 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/freeze_time.rb#39 - def time_now?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/freeze_time.rb#44 - def zoned_time_now?(param0 = T.unsafe(nil)); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/freeze_time.rb#62 - def current_time?(node, method_name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/freeze_time.rb#68 - def current_time_with_convert?(node, method_name); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/freeze_time.rb#35 -RuboCop::Cop::Rails::FreezeTime::CONVERT_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/freeze_time.rb#33 -RuboCop::Cop::Rails::FreezeTime::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/freeze_time.rb#34 -RuboCop::Cop::Rails::FreezeTime::NOW_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/freeze_time.rb#36 -RuboCop::Cop::Rails::FreezeTime::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for the use of the has_and_belongs_to_many macro. -# -# @example -# # bad -# # has_and_belongs_to_many :ingredients -# -# # good -# # has_many :ingredients, through: :recipe_ingredients -# -# source://rubocop-rails//lib/rubocop/cop/rails/has_and_belongs_to_many.rb#14 -class RuboCop::Cop::Rails::HasAndBelongsToMany < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/has_and_belongs_to_many.rb#18 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/has_and_belongs_to_many.rb#15 -RuboCop::Cop::Rails::HasAndBelongsToMany::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/has_and_belongs_to_many.rb#16 -RuboCop::Cop::Rails::HasAndBelongsToMany::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Looks for `has_many` or `has_one` associations that don't -# specify a `:dependent` option. -# -# It doesn't register an offense if `:through` or `dependent: nil` -# is specified, or if the model is read-only. -# -# @example -# # bad -# class User < ActiveRecord::Base -# has_many :comments -# has_one :avatar -# end -# -# # good -# class User < ActiveRecord::Base -# has_many :comments, dependent: :restrict_with_exception -# has_one :avatar, dependent: :destroy -# has_many :articles, dependent: nil -# has_many :patients, through: :appointments -# end -# -# class User < ActiveRecord::Base -# has_many :comments -# has_one :avatar -# -# def readonly? -# true -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#35 -class RuboCop::Cop::Rails::HasManyOrHasOneDependent < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#39 - def active_resource_class?(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#66 - def association_extension_block?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#47 - def association_with_options?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#43 - def association_without_options?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#51 - def dependent_option?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#78 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#55 - def present_option?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#72 - def readonly?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#59 - def with_options_block(param0 = T.unsafe(nil)); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#135 - def active_resource?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#102 - def contain_valid_options_in_with_options_block?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#127 - def extract_option_if_kwsplat(options); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#88 - def readonly_model?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#114 - def valid_options?(options); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#94 - def valid_options_in_with_options_block?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#36 -RuboCop::Cop::Rails::HasManyOrHasOneDependent::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb#37 -RuboCop::Cop::Rails::HasManyOrHasOneDependent::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for use of the helper methods which reference -# instance variables. -# -# Relying on instance variables makes it difficult to reuse helper -# methods. -# -# If it seems awkward to explicitly pass in each dependent -# variable, consider moving the behavior elsewhere, for -# example to a model, decorator or presenter. -# -# Provided that a class inherits `ActionView::Helpers::FormBuilder`, -# an offense will not be registered. -# -# @example -# # bad -# def welcome_message -# "Hello #{@user.name}" -# end -# -# # good -# def welcome_message(user) -# "Hello #{user.name}" -# end -# -# # good -# class MyFormBuilder < ActionView::Helpers::FormBuilder -# @template.do_something -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/helper_instance_variable.rb#34 -class RuboCop::Cop::Rails::HelperInstanceVariable < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/helper_instance_variable.rb#37 - def form_builder_class?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/helper_instance_variable.rb#43 - def on_ivar(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/helper_instance_variable.rb#49 - def on_ivasgn(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/helper_instance_variable.rb#57 - def inherit_form_builder?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/helper_instance_variable.rb#35 -RuboCop::Cop::Rails::HelperInstanceVariable::MSG = T.let(T.unsafe(nil), String) - -# Identifies usages of http methods like `get`, `post`, -# `put`, `patch` without the usage of keyword arguments in your tests and -# change them to use keyword args. This cop only applies to Rails >= 5. -# If you are running Rails < 5 you should disable the -# Rails/HttpPositionalArguments cop or set your TargetRailsVersion in your -# .rubocop.yml file to 4.2. -# -# NOTE: It does not detect any cases where `include Rack::Test::Methods` is used -# which makes the http methods incompatible behavior. -# -# @example -# # bad -# get :new, { user_id: 1} -# -# # good -# get :new, params: { user_id: 1 } -# get :new, **options -# -# source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#23 -class RuboCop::Cop::Rails::HttpPositionalArguments < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#35 - def http_request?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#43 - def include_rack_test_methods?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#39 - def kwsplat_hash?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#50 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#109 - def convert_hash_data(data, type); end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#123 - def correction(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#136 - def correction_template(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#99 - def format_arg?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#103 - def highlight_range(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#76 - def in_routing_block?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#86 - def needs_conversion?(data); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#95 - def special_keyword_arg?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#80 - def use_rack_test_methods?; end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#29 -RuboCop::Cop::Rails::HttpPositionalArguments::KEYWORD_ARGS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#28 -RuboCop::Cop::Rails::HttpPositionalArguments::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#31 -RuboCop::Cop::Rails::HttpPositionalArguments::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/http_positional_arguments.rb#30 -RuboCop::Cop::Rails::HttpPositionalArguments::ROUTING_METHODS = T.let(T.unsafe(nil), Array) - -# Enforces use of symbolic or numeric value to define HTTP status. -# -# @example EnforcedStyle: symbolic (default) -# # bad -# render :foo, status: 200 -# render :foo, status: '200' -# render json: { foo: 'bar' }, status: 200 -# render plain: 'foo/bar', status: 304 -# redirect_to root_url, status: 301 -# head 200 -# -# # good -# render :foo, status: :ok -# render json: { foo: 'bar' }, status: :ok -# render plain: 'foo/bar', status: :not_modified -# redirect_to root_url, status: :moved_permanently -# head :ok -# @example EnforcedStyle: numeric -# # bad -# render :foo, status: :ok -# render json: { foo: 'bar' }, status: :not_found -# render plain: 'foo/bar', status: :not_modified -# redirect_to root_url, status: :moved_permanently -# head :ok -# -# # good -# render :foo, status: 200 -# render json: { foo: 'bar' }, status: 404 -# render plain: 'foo/bar', status: 304 -# redirect_to root_url, status: 301 -# head 200 -# -# source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#39 -class RuboCop::Cop::Rails::HttpStatus < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ConfigurableEnforcedStyle - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#45 - def http_status(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#57 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#53 - def status_code(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#77 - def checker_class; end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#125 -class RuboCop::Cop::Rails::HttpStatus::NumericStyleChecker - # @return [NumericStyleChecker] a new instance of NumericStyleChecker - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#132 - def initialize(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#140 - def message; end - - # Returns the value of attribute node. - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#130 - def node; end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#136 - def offensive?; end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#144 - def preferred_style; end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#150 - def number; end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#158 - def permitted_symbol?; end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#154 - def symbol; end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#127 -RuboCop::Cop::Rails::HttpStatus::NumericStyleChecker::DEFAULT_MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#126 -RuboCop::Cop::Rails::HttpStatus::NumericStyleChecker::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#128 -RuboCop::Cop::Rails::HttpStatus::NumericStyleChecker::PERMITTED_STATUS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#43 -RuboCop::Cop::Rails::HttpStatus::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#87 -class RuboCop::Cop::Rails::HttpStatus::SymbolicStyleChecker - # @return [SymbolicStyleChecker] a new instance of SymbolicStyleChecker - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#93 - def initialize(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#101 - def message; end - - # Returns the value of attribute node. - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#91 - def node; end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#97 - def offensive?; end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#105 - def preferred_style; end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#119 - def custom_http_status_code?; end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#115 - def number; end - - # source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#111 - def symbol; end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#89 -RuboCop::Cop::Rails::HttpStatus::SymbolicStyleChecker::DEFAULT_MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/http_status.rb#88 -RuboCop::Cop::Rails::HttpStatus::SymbolicStyleChecker::MSG = T.let(T.unsafe(nil), String) - -# Checks for places where I18n "lazy" lookup can be used. -# -# This cop has two different enforcement modes. When the EnforcedStyle -# is `lazy` (the default), explicit lookups are added as offenses. -# -# When the EnforcedStyle is `explicit` then lazy lookups are added as -# offenses. -# -# @example EnforcedStyle: lazy (default) -# # en.yml -# # en: -# # books: -# # create: -# # success: Book created! -# -# # bad -# class BooksController < ApplicationController -# def create -# # ... -# redirect_to books_url, notice: t('books.create.success') -# end -# end -# -# # good -# class BooksController < ApplicationController -# def create -# # ... -# redirect_to books_url, notice: t('.success') -# end -# end -# @example EnforcedStyle: explicit -# # bad -# class BooksController < ApplicationController -# def create -# # ... -# redirect_to books_url, notice: t('.success') -# end -# end -# -# # good -# class BooksController < ApplicationController -# def create -# # ... -# redirect_to books_url, notice: t('books.create.success') -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/i18n_lazy_lookup.rb#54 -class RuboCop::Cop::Rails::I18nLazyLookup < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ConfigurableEnforcedStyle - include ::RuboCop::Cop::VisibilityHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_lazy_lookup.rb#67 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_lazy_lookup.rb#63 - def translate_call?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_lazy_lookup.rb#109 - def controller_and_action(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_lazy_lookup.rb#127 - def controller_path(controller); end - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_lazy_lookup.rb#119 - def get_scoped_key(key_node, controller, action); end - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_lazy_lookup.rb#96 - def handle_explicit_style(node, key_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_lazy_lookup.rb#80 - def handle_lazy_style(node, key_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_lazy_lookup.rb#140 - def message(_range); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/i18n_lazy_lookup.rb#59 -RuboCop::Cop::Rails::I18nLazyLookup::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/i18n_lazy_lookup.rb#61 -RuboCop::Cop::Rails::I18nLazyLookup::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for the use of `I18n.locale=` method. -# -# The `locale` attribute persists for the rest of the Ruby runtime, potentially causing -# unexpected behavior at a later time. -# Using `I18n.with_locale` ensures the code passed in the block is the only place `I18n.locale` is affected. -# It eliminates the possibility of a `locale` sticking around longer than intended. -# -# @example -# # bad -# I18n.locale = :fr -# -# # good -# I18n.with_locale(:fr) do -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_assignment.rb#21 -class RuboCop::Cop::Rails::I18nLocaleAssignment < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_assignment.rb#25 - def i18n_locale_assignment?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_assignment.rb#29 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_assignment.rb#22 -RuboCop::Cop::Rails::I18nLocaleAssignment::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_assignment.rb#23 -RuboCop::Cop::Rails::I18nLocaleAssignment::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Enforces use of I18n and locale files instead of locale specific strings. -# -# @example -# # bad -# class User < ApplicationRecord -# validates :email, presence: { message: "must be present" } -# end -# -# # good -# # config/locales/en.yml -# # en: -# # activerecord: -# # errors: -# # models: -# # user: -# # blank: "must be present" -# -# class User < ApplicationRecord -# validates :email, presence: true -# end -# -# # bad -# class PostsController < ApplicationController -# def create -# # ... -# redirect_to root_path, notice: "Post created!" -# end -# end -# -# # good -# # config/locales/en.yml -# # en: -# # posts: -# # create: -# # success: "Post created!" -# -# class PostsController < ApplicationController -# def create -# # ... -# redirect_to root_path, notice: t(".success") -# end -# end -# -# # bad -# class UserMailer < ApplicationMailer -# def welcome(user) -# mail(to: user.email, subject: "Welcome to My Awesome Site") -# end -# end -# -# # good -# # config/locales/en.yml -# # en: -# # user_mailer: -# # welcome: -# # subject: "Welcome to My Awesome Site" -# -# class UserMailer < ApplicationMailer -# def welcome(user) -# mail(to: user.email) -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_texts.rb#69 -class RuboCop::Cop::Rails::I18nLocaleTexts < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_texts.rb#82 - def flash_assignment?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_texts.rb#90 - def mail_subject(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_texts.rb#94 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_texts.rb#78 - def redirect_to_flash(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_texts.rb#74 - def validation_message(param0); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_texts.rb#70 -RuboCop::Cop::Rails::I18nLocaleTexts::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/i18n_locale_texts.rb#72 -RuboCop::Cop::Rails::I18nLocaleTexts::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Looks for assignments of `ignored_columns` that may override previous -# assignments. -# -# Overwriting previous assignments is usually a mistake, since it will -# un-ignore the first set of columns. Since duplicate column names is not -# a problem, it is better to simply append to the list. -# -# @example -# -# # bad -# class User < ActiveRecord::Base -# self.ignored_columns = [:one] -# end -# -# # bad -# class User < ActiveRecord::Base -# self.ignored_columns = [:one, :two] -# end -# -# # good -# class User < ActiveRecord::Base -# self.ignored_columns += [:one, :two] -# end -# -# # good -# class User < ActiveRecord::Base -# self.ignored_columns += [:one] -# self.ignored_columns += [:two] -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/ignored_columns_assignment.rb#36 -class RuboCop::Cop::Rails::IgnoredColumnsAssignment < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/ignored_columns_assignment.rb#42 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/ignored_columns_assignment.rb#39 -RuboCop::Cop::Rails::IgnoredColumnsAssignment::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/ignored_columns_assignment.rb#40 -RuboCop::Cop::Rails::IgnoredColumnsAssignment::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks that `if` and `only` (or `except`) are not used together -# as options of `skip_*` action filter. -# -# The `if` option will be ignored when `if` and `only` are used together. -# Similarly, the `except` option will be ignored when `if` and `except` -# are used together. -# -# @example -# # bad -# class MyPageController < ApplicationController -# skip_before_action :login_required, -# only: :show, if: :trusted_origin? -# end -# -# # good -# class MyPageController < ApplicationController -# skip_before_action :login_required, -# if: -> { trusted_origin? && action_name == "show" } -# end -# @example -# # bad -# class MyPageController < ApplicationController -# skip_before_action :login_required, -# except: :admin, if: :trusted_origin? -# end -# -# # good -# class MyPageController < ApplicationController -# skip_before_action :login_required, -# if: -> { trusted_origin? && action_name != "admin" } -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb#38 -class RuboCop::Cop::Rails::IgnoredSkipActionFilterOption < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb#51 - def filter_options(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb#59 - def on_send(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb#89 - def if_and_except?(options); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb#85 - def if_and_only?(options); end - - # source://rubocop-rails//lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb#79 - def options_hash(options); end - - # source://rubocop-rails//lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb#93 - def remove_node_with_left_space_and_comma(corrector, node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb#49 -RuboCop::Cop::Rails::IgnoredSkipActionFilterOption::FILTERS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb#43 -RuboCop::Cop::Rails::IgnoredSkipActionFilterOption::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb#47 -RuboCop::Cop::Rails::IgnoredSkipActionFilterOption::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Looks for uses of `each_with_object({}) { ... }`, -# `map { ... }.to_h`, and `Hash[map { ... }]` that are transforming -# an enumerable into a hash where the values are the original elements. -# Rails provides the `index_by` method for this purpose. -# -# @example -# # bad -# [1, 2, 3].each_with_object({}) { |el, h| h[foo(el)] = el } -# [1, 2, 3].to_h { |el| [foo(el), el] } -# [1, 2, 3].map { |el| [foo(el), el] }.to_h -# Hash[[1, 2, 3].collect { |el| [foo(el), el] }] -# -# # good -# [1, 2, 3].index_by { |el| foo(el) } -# -# source://rubocop-rails//lib/rubocop/cop/rails/index_by.rb#20 -class RuboCop::Cop::Rails::IndexBy < ::RuboCop::Cop::Base - include ::RuboCop::Cop::IndexMethod - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/index_by.rb#24 - def on_bad_each_with_object(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/index_by.rb#47 - def on_bad_hash_brackets_map(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/index_by.rb#38 - def on_bad_map_to_h(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/index_by.rb#31 - def on_bad_to_h(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/index_by.rb#59 - def new_method_name; end -end - -# Looks for uses of `each_with_object({}) { ... }`, -# `map { ... }.to_h`, and `Hash[map { ... }]` that are transforming -# an enumerable into a hash where the keys are the original elements. -# Rails provides the `index_with` method for this purpose. -# -# @example -# # bad -# [1, 2, 3].each_with_object({}) { |el, h| h[el] = foo(el) } -# [1, 2, 3].to_h { |el| [el, foo(el)] } -# [1, 2, 3].map { |el| [el, foo(el)] }.to_h -# Hash[[1, 2, 3].collect { |el| [el, foo(el)] }] -# -# # good -# [1, 2, 3].index_with { |el| foo(el) } -# -# source://rubocop-rails//lib/rubocop/cop/rails/index_with.rb#20 -class RuboCop::Cop::Rails::IndexWith < ::RuboCop::Cop::Base - include ::RuboCop::Cop::IndexMethod - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/index_with.rb#27 - def on_bad_each_with_object(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/index_with.rb#50 - def on_bad_hash_brackets_map(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/index_with.rb#41 - def on_bad_map_to_h(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/index_with.rb#34 - def on_bad_to_h(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/index_with.rb#62 - def new_method_name; end -end - -# Checks that Active Support's `inquiry` method is not used. -# -# @example -# # bad - String#inquiry -# ruby = 'two'.inquiry -# ruby.two? -# -# # good -# ruby = 'two' -# ruby == 'two' -# -# # bad - Array#inquiry -# pets = %w(cat dog).inquiry -# pets.gopher? -# -# # good -# pets = %w(cat dog) -# pets.include? 'cat' -# -# source://rubocop-rails//lib/rubocop/cop/rails/inquiry.rb#25 -class RuboCop::Cop::Rails::Inquiry < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/inquiry.rb#29 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/inquiry.rb#29 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/inquiry.rb#26 -RuboCop::Cop::Rails::Inquiry::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/inquiry.rb#27 -RuboCop::Cop::Rails::Inquiry::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Looks for has_(one|many) and belongs_to associations where -# Active Record can't automatically determine the inverse association -# because of a scope or the options used. Using the blog with order scope -# example below, traversing the a Blog's association in both directions -# with `blog.posts.first.blog` would cause the `blog` to be loaded from -# the database twice. -# -# `:inverse_of` must be manually specified for Active Record to use the -# associated object in memory, or set to `false` to opt-out. Note that -# setting `nil` does not stop Active Record from trying to determine the -# inverse automatically, and is not considered a valid value for this. -# -# @example -# # good -# class Blog < ApplicationRecord -# has_many :posts -# end -# -# class Post < ApplicationRecord -# belongs_to :blog -# end -# @example -# # bad -# class Blog < ApplicationRecord -# has_many :posts, -> { order(published_at: :desc) } -# end -# -# class Post < ApplicationRecord -# belongs_to :blog -# end -# -# # good -# class Blog < ApplicationRecord -# has_many(:posts, -# -> { order(published_at: :desc) }, -# inverse_of: :blog) -# end -# -# class Post < ApplicationRecord -# belongs_to :blog -# end -# -# # good -# class Blog < ApplicationRecord -# with_options inverse_of: :blog do -# has_many :posts, -> { order(published_at: :desc) } -# end -# end -# -# class Post < ApplicationRecord -# belongs_to :blog -# end -# -# # good -# # When you don't want to use the inverse association. -# class Blog < ApplicationRecord -# has_many(:posts, -# -> { order(published_at: :desc) }, -# inverse_of: false) -# end -# @example -# # bad -# class Picture < ApplicationRecord -# belongs_to :imageable, polymorphic: true -# end -# -# class Employee < ApplicationRecord -# has_many :pictures, as: :imageable -# end -# -# class Product < ApplicationRecord -# has_many :pictures, as: :imageable -# end -# -# # good -# class Picture < ApplicationRecord -# belongs_to :imageable, polymorphic: true -# end -# -# class Employee < ApplicationRecord -# has_many :pictures, as: :imageable, inverse_of: :imageable -# end -# -# class Product < ApplicationRecord -# has_many :pictures, as: :imageable, inverse_of: :imageable -# end -# @example -# # bad -# # However, RuboCop can not detect this pattern... -# class Physician < ApplicationRecord -# has_many :appointments -# has_many :patients, through: :appointments -# end -# -# class Appointment < ApplicationRecord -# belongs_to :physician -# belongs_to :patient -# end -# -# class Patient < ApplicationRecord -# has_many :appointments -# has_many :physicians, through: :appointments -# end -# -# # good -# class Physician < ApplicationRecord -# has_many :appointments -# has_many :patients, through: :appointments -# end -# -# class Appointment < ApplicationRecord -# belongs_to :physician, inverse_of: :appointments -# belongs_to :patient, inverse_of: :appointments -# end -# -# class Patient < ApplicationRecord -# has_many :appointments -# has_many :physicians, through: :appointments -# end -# @example IgnoreScopes: false (default) -# # bad -# class Blog < ApplicationRecord -# has_many :posts, -> { order(published_at: :desc) } -# end -# @example IgnoreScopes: true -# # good -# class Blog < ApplicationRecord -# has_many :posts, -> { order(published_at: :desc) } -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#140 -class RuboCop::Cop::Rails::InverseOf < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#165 - def as_option?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#145 - def association_recv_arguments(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#153 - def conditions_option?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#169 - def foreign_key_option?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#177 - def inverse_of_nil_option?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#173 - def inverse_of_option?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#181 - def on_send(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#219 - def options_contain_inverse_of?(options); end - - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#149 - def options_from_argument(param0 = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#213 - def options_ignoring_inverse_of?(options); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#203 - def options_requiring_inverse_of?(options); end - - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#161 - def polymorphic_option?(param0 = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#230 - def same_context_in_with_options?(arg, recv); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#199 - def scope?(arguments); end - - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#157 - def through_option?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#223 - def with_options_arguments(recv, node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#246 - def ignore_scopes?; end - - # source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#238 - def message(options); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#142 -RuboCop::Cop::Rails::InverseOf::NIL_MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#143 -RuboCop::Cop::Rails::InverseOf::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/inverse_of.rb#141 -RuboCop::Cop::Rails::InverseOf::SPECIFY_MSG = T.let(T.unsafe(nil), String) - -# Checks that methods specified in the filter's `only` or -# `except` options are defined within the same class or module. -# -# @example -# # bad -# class LoginController < ApplicationController -# before_action :require_login, only: %i[index settings logout] -# -# def index -# end -# end -# -# # good -# class LoginController < ApplicationController -# before_action :require_login, only: %i[index settings logout] -# -# def index -# end -# -# def settings -# end -# -# def logout -# end -# end -# @example -# # bad -# module FooMixin -# extend ActiveSupport::Concern -# -# included do -# before_action proc { authenticate }, only: :foo -# end -# end -# -# # good -# module FooMixin -# extend ActiveSupport::Concern -# -# included do -# before_action proc { authenticate }, only: :foo -# end -# -# def foo -# # something -# end -# end -# @example -# class ContentController < ApplicationController -# def update -# @content.update(content_attributes) -# end -# end -# -# class ArticlesController < ContentController -# before_action :load_article, only: [:update] -# -# # the cop requires this method, but it relies on behavior defined -# # in the superclass, so needs to invoke `super` -# def update -# super -# end -# -# private -# -# def load_article -# @content = Article.find(params[:article_id]) -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/lexically_scoped_action_filter.rb#86 -class RuboCop::Cop::Rails::LexicallyScopedActionFilter < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/lexically_scoped_action_filter.rb#118 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/lexically_scoped_action_filter.rb#107 - def only_or_except_filter_methods(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/lexically_scoped_action_filter.rb#154 - def alias_methods(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/lexically_scoped_action_filter.rb#145 - def aliased_action_methods(node, defined_methods); end - - # @param node [RuboCop::AST::Node] - # @return [Array] - # - # source://rubocop-rails//lib/rubocop/cop/rails/lexically_scoped_action_filter.rb#171 - def array_values(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/lexically_scoped_action_filter.rb#138 - def defined_action_methods(block); end - - # @param methods [Array] - # @param parent [RuboCop::AST::Node] - # @return [String] - # - # source://rubocop-rails//lib/rubocop/cop/rails/lexically_scoped_action_filter.rb#194 - def message(methods, parent); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/lexically_scoped_action_filter.rb#105 -RuboCop::Cop::Rails::LexicallyScopedActionFilter::FILTERS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/lexically_scoped_action_filter.rb#87 -RuboCop::Cop::Rails::LexicallyScopedActionFilter::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/lexically_scoped_action_filter.rb#89 -RuboCop::Cop::Rails::LexicallyScopedActionFilter::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for calls to `link_to` that contain a -# `target: '_blank'` but no `rel: 'noopener'`. This can be a security -# risk as the loaded page will have control over the previous page -# and could change its location for phishing purposes. -# -# The option `rel: 'noreferrer'` also blocks this behavior -# and removes the http-referrer header. -# -# @example -# # bad -# link_to 'Click here', url, target: '_blank' -# -# # good -# link_to 'Click here', url, target: '_blank', rel: 'noopener' -# -# # good -# link_to 'Click here', url, target: '_blank', rel: 'noreferrer' -# -# source://rubocop-rails//lib/rubocop/cop/rails/link_to_blank.rb#23 -class RuboCop::Cop::Rails::LinkToBlank < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/link_to_blank.rb#29 - def blank_target?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/link_to_blank.rb#33 - def includes_noopener?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/link_to_blank.rb#41 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/link_to_blank.rb#37 - def rel_node?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/link_to_blank.rb#75 - def add_rel(send_node, offense_node, corrector); end - - # source://rubocop-rails//lib/rubocop/cop/rails/link_to_blank.rb#69 - def append_to_rel(rel_node, corrector); end - - # source://rubocop-rails//lib/rubocop/cop/rails/link_to_blank.rb#56 - def autocorrect(corrector, send_node, node, option_nodes); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/link_to_blank.rb#88 - def contains_noopener?(value); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/link_to_blank.rb#26 -RuboCop::Cop::Rails::LinkToBlank::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/link_to_blank.rb#27 -RuboCop::Cop::Rails::LinkToBlank::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Enforces that mailer names end with `Mailer` suffix. -# -# Without the `Mailer` suffix it isn't immediately apparent what's a mailer -# and which views are related to the mailer. -# -# @example -# # bad -# class User < ActionMailer::Base -# end -# -# class User < ApplicationMailer -# end -# -# # good -# class UserMailer < ActionMailer::Base -# end -# -# class UserMailer < ApplicationMailer -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/mailer_name.rb#30 -class RuboCop::Cop::Rails::MailerName < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/mailer_name.rb#42 - def class_definition?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/mailer_name.rb#46 - def class_new_definition?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/mailer_name.rb#35 - def mailer_base_class?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/mailer_name.rb#50 - def on_class(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/mailer_name.rb#58 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/mailer_name.rb#74 - def autocorrect(corrector, node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/mailer_name.rb#84 - def mailer_suffix?(mailer_name); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/mailer_name.rb#33 -RuboCop::Cop::Rails::MailerName::MSG = T.let(T.unsafe(nil), String) - -# Identifies places where defining routes with `match` -# can be replaced with a specific HTTP method. -# -# Don't use `match` to define any routes unless there is a need to map multiple request types -# among [:get, :post, :patch, :put, :delete] to a single action using the `:via` option. -# -# @example -# # bad -# match ':controller/:action/:id' -# match 'photos/:id', to: 'photos#show', via: :get -# -# # good -# get ':controller/:action/:id' -# get 'photos/:id', to: 'photos#show' -# match 'photos/:id', to: 'photos#show', via: [:get, :post] -# match 'photos/:id', to: 'photos#show', via: :all -# -# source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#23 -class RuboCop::Cop::Rails::MatchRoute < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#30 - def match_method_call?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#34 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#63 - def routes_draw?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#71 - def extract_via(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#90 - def http_method?(method); end - - # source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#111 - def http_method_and_options(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#53 - def register_offense(node, http_method); end - - # source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#94 - def replacement(path_node, options_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#86 - def via_pair(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#67 - def within_routes?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#28 -RuboCop::Cop::Rails::MatchRoute::HTTP_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#26 -RuboCop::Cop::Rails::MatchRoute::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/match_route.rb#27 -RuboCop::Cop::Rails::MatchRoute::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Makes sure that each migration file defines a migration class -# whose name matches the file name. -# (e.g. `20220224111111_create_users.rb` should define `CreateUsers` class.) -# -# @example -# # db/migrate/20220224111111_create_users.rb -# -# # bad -# class SellBooks < ActiveRecord::Migration[7.0] -# end -# -# # good -# class CreateUsers < ActiveRecord::Migration[7.0] -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/migration_class_name.rb#21 -class RuboCop::Cop::Rails::MigrationClassName < ::RuboCop::Cop::Base - include ::RuboCop::Cop::MigrationsHelper - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/migration_class_name.rb#27 - def on_class(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/migration_class_name.rb#45 - def basename_without_timestamp_and_suffix(filepath); end - - # source://rubocop-rails//lib/rubocop/cop/rails/migration_class_name.rb#57 - def camelize(word); end - - # e.g.: from `add_blobs.active_storage` to `add_blobs`. - # - # source://rubocop-rails//lib/rubocop/cop/rails/migration_class_name.rb#53 - def remove_gem_suffix(file_name); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/migration_class_name.rb#25 -RuboCop::Cop::Rails::MigrationClassName::MSG = T.let(T.unsafe(nil), String) - -# Enforces the use of `collection.exclude?(obj)` -# over `!collection.include?(obj)`. -# -# @example -# # bad -# !array.include?(2) -# !hash.include?(:key) -# -# # good -# array.exclude?(2) -# hash.exclude?(:key) -# -# source://rubocop-rails//lib/rubocop/cop/rails/negate_include.rb#22 -class RuboCop::Cop::Rails::NegateInclude < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/negate_include.rb#28 - def negate_include_call?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/negate_include.rb#32 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/negate_include.rb#25 -RuboCop::Cop::Rails::NegateInclude::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/negate_include.rb#26 -RuboCop::Cop::Rails::NegateInclude::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for add_column call with NOT NULL constraint in migration file. -# -# `TEXT` can have default values in PostgreSQL, but not in MySQL. -# It will automatically detect an adapter from `development` environment -# in `config/database.yml` or the environment variable `DATABASE_URL` -# when the `Database` option is not set. If the database is MySQL, -# this cop ignores offenses for the `TEXT`. -# -# @example -# # bad -# add_column :users, :name, :string, null: false -# add_reference :products, :category, null: false -# -# # good -# add_column :users, :name, :string, null: true -# add_column :users, :name, :string, null: false, default: '' -# add_reference :products, :category -# add_reference :products, :category, null: false, default: 1 -# -# source://rubocop-rails//lib/rubocop/cop/rails/not_null_column.rb#24 -class RuboCop::Cop::Rails::NotNullColumn < ::RuboCop::Cop::Base - include ::RuboCop::Cop::DatabaseTypeResolvable - - # source://rubocop-rails//lib/rubocop/cop/rails/not_null_column.rb#30 - def add_not_null_column?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/not_null_column.rb#34 - def add_not_null_reference?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/not_null_column.rb#42 - def default_option?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/not_null_column.rb#38 - def null_false?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/not_null_column.rb#46 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/not_null_column.rb#53 - def check_add_column(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/not_null_column.rb#64 - def check_add_reference(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/not_null_column.rb#70 - def check_pairs(pairs); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/not_null_column.rb#27 -RuboCop::Cop::Rails::NotNullColumn::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/not_null_column.rb#28 -RuboCop::Cop::Rails::NotNullColumn::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for places where ordering by `id` column is used. -# -# Don't use the `id` column for ordering. The sequence of ids is not guaranteed -# to be in any particular order, despite often (incidentally) being chronological. -# Use a timestamp column to order chronologically. As a bonus the intent is clearer. -# -# NOTE: Make sure the changed order column does not introduce performance -# bottlenecks and appropriate database indexes are added. -# -# @example -# # bad -# scope :chronological, -> { order(id: :asc) } -# scope :chronological, -> { order(primary_key => :asc) } -# -# # good -# scope :chronological, -> { order(created_at: :asc) } -# -# source://rubocop-rails//lib/rubocop/cop/rails/order_by_id.rb#23 -class RuboCop::Cop::Rails::OrderById < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - - # source://rubocop-rails//lib/rubocop/cop/rails/order_by_id.rb#39 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/order_by_id.rb#29 - def order_by_id?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/order_by_id.rb#45 - def offense_range(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/order_by_id.rb#26 -RuboCop::Cop::Rails::OrderById::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/order_by_id.rb#27 -RuboCop::Cop::Rails::OrderById::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for the use of output calls like puts and print -# -# @example -# # bad -# puts 'A debug message' -# pp 'A debug message' -# print 'A debug message' -# -# # good -# Rails.logger.debug 'A debug message' -# -# source://rubocop-rails//lib/rubocop/cop/rails/output.rb#20 -class RuboCop::Cop::Rails::Output < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/output.rb#32 - def io_output?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/output.rb#42 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/output.rb#28 - def output?(param0 = T.unsafe(nil)); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/output.rb#55 - def match_gvar?(sym); end - - # source://rubocop-rails//lib/rubocop/cop/rails/output.rb#59 - def offense_range(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/output.rb#26 -RuboCop::Cop::Rails::Output::ALLOWED_TYPES = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/output.rb#24 -RuboCop::Cop::Rails::Output::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/output.rb#25 -RuboCop::Cop::Rails::Output::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for the use of output safety calls like `html_safe`, -# `raw`, and `safe_concat`. These methods do not escape content. They -# simply return a SafeBuffer containing the content as is. Instead, -# use `safe_join` to join content and escape it and concat to -# concatenate content and escape it, ensuring its safety. -# -# @example -# user_content = "hi" -# -# # bad -# "

#{user_content}

".html_safe -# # => ActiveSupport::SafeBuffer "

hi

" -# -# # good -# content_tag(:p, user_content) -# # => ActiveSupport::SafeBuffer "

<b>hi</b>

" -# -# # bad -# out = "" -# out << "
  • #{user_content}
  • " -# out << "
  • #{user_content}
  • " -# out.html_safe -# # => ActiveSupport::SafeBuffer "
  • hi
  • hi
  • " -# -# # good -# out = [] -# out << content_tag(:li, user_content) -# out << content_tag(:li, user_content) -# safe_join(out) -# # => ActiveSupport::SafeBuffer -# # "
  • <b>hi</b>
  • <b>hi</b>
  • " -# -# # bad -# out = "

    trusted content

    ".html_safe -# out.safe_concat(user_content) -# # => ActiveSupport::SafeBuffer "

    trusted_content

    hi" -# -# # good -# out = "

    trusted content

    ".html_safe -# out.concat(user_content) -# # => ActiveSupport::SafeBuffer -# # "

    trusted_content

    <b>hi</b>" -# -# # safe, though maybe not good style -# out = "trusted content" -# result = out.concat(user_content) -# # => String "trusted contenthi" -# # because when rendered in ERB the String will be escaped: -# # <%= result %> -# # => trusted content<b>hi</b> -# -# # bad -# (user_content + " " + content_tag(:span, user_content)).html_safe -# # => ActiveSupport::SafeBuffer "hi hi" -# -# # good -# safe_join([user_content, " ", content_tag(:span, user_content)]) -# # => ActiveSupport::SafeBuffer -# # "<b>hi</b> <b>hi</b>" -# -# source://rubocop-rails//lib/rubocop/cop/rails/output_safety.rb#65 -class RuboCop::Cop::Rails::OutputSafety < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/output_safety.rb#69 - def i18n_method?(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/output_safety.rb#73 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/output_safety.rb#73 - def on_send(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/output_safety.rb#90 - def looks_like_rails_html_safe?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/output_safety.rb#94 - def looks_like_rails_raw?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/output_safety.rb#98 - def looks_like_rails_safe_concat?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/output_safety.rb#86 - def non_interpolated_string?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/output_safety.rb#66 -RuboCop::Cop::Rails::OutputSafety::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/output_safety.rb#67 -RuboCop::Cop::Rails::OutputSafety::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Enforces the use of `pick` over `pluck(...).first`. -# -# Using `pluck` followed by `first` creates an intermediate array, which -# `pick` avoids. When called on an Active Record relation, `pick` adds a -# limit to the query so that only one value is fetched from the database. -# -# @example -# # bad -# Model.pluck(:a).first -# [{ a: :b, c: :d }].pluck(:a, :b).first -# -# # good -# Model.pick(:a) -# [{ a: :b, c: :d }].pick(:a, :b) -# -# source://rubocop-rails//lib/rubocop/cop/rails/pick.rb#27 -class RuboCop::Cop::Rails::Pick < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/pick.rb#40 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pick.rb#40 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pick.rb#36 - def pick_candidate?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/pick.rb#59 - def message(receiver, current); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/pick.rb#31 -RuboCop::Cop::Rails::Pick::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/pick.rb#32 -RuboCop::Cop::Rails::Pick::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Enforces the use of `pluck` over `map`. -# -# `pluck` can be used instead of `map` to extract a single key from each -# element in an enumerable. When called on an Active Record relation, it -# results in a more efficient query that only selects the necessary key. -# -# @example -# # bad -# Post.published.map { |post| post[:title] } -# [{ a: :b, c: :d }].collect { |el| el[:a] } -# -# # good -# Post.published.pluck(:title) -# [{ a: :b, c: :d }].pluck(:a) -# -# source://rubocop-rails//lib/rubocop/cop/rails/pluck.rb#32 -class RuboCop::Cop::Rails::Pluck < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck.rb#44 - def on_block(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck.rb#44 - def on_numblock(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck.rb#40 - def pluck_candidate?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck.rb#88 - def message(replacement, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck.rb#75 - def offense_range(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck.rb#79 - def register_offense(node, key); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/pluck.rb#69 - def use_block_argument_in_key?(block_argument, key); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/pluck.rb#63 - def use_one_block_argument?(argument); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/pluck.rb#36 -RuboCop::Cop::Rails::Pluck::MSG = T.let(T.unsafe(nil), String) - -# Enforces the use of `ids` over `pluck(:id)` and `pluck(primary_key)`. -# -# @example -# # bad -# User.pluck(:id) -# user.posts.pluck(:id) -# -# def self.user_ids -# pluck(primary_key) -# end -# -# # good -# User.ids -# user.posts.ids -# -# def self.user_ids -# ids -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/pluck_id.rb#28 -class RuboCop::Cop::Rails::PluckId < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - include ::RuboCop::Cop::ActiveRecordHelper - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck_id.rb#40 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck_id.rb#40 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck_id.rb#36 - def pluck_id_call?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck_id.rb#54 - def offense_range(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/pluck_id.rb#33 -RuboCop::Cop::Rails::PluckId::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/pluck_id.rb#34 -RuboCop::Cop::Rails::PluckId::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Identifies places where `pluck` is used in `where` query methods -# and can be replaced with `select`. -# -# Since `pluck` is an eager method and hits the database immediately, -# using `select` helps to avoid additional database queries. -# -# This cop has two different enforcement modes. When the `EnforcedStyle` -# is `conservative` (the default) then only calls to `pluck` on a constant -# (i.e. a model class) in the `where` is used as offenses. -# -# @example -# # bad -# Post.where(user_id: User.active.pluck(:id)) -# Post.where(user_id: User.active.ids) -# Post.where.not(user_id: User.active.pluck(:id)) -# -# # good -# Post.where(user_id: User.active.select(:id)) -# Post.where(user_id: active_users.select(:id)) -# Post.where.not(user_id: active_users.select(:id)) -# @example EnforcedStyle: conservative (default) -# # good -# Post.where(user_id: active_users.pluck(:id)) -# @example EnforcedStyle: aggressive -# # bad -# Post.where(user_id: active_users.pluck(:id)) -# -# source://rubocop-rails//lib/rubocop/cop/rails/pluck_in_where.rb#41 -class RuboCop::Cop::Rails::PluckInWhere < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ActiveRecordHelper - include ::RuboCop::Cop::ConfigurableEnforcedStyle - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck_in_where.rb#50 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck_in_where.rb#50 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/pluck_in_where.rb#72 - def root_receiver(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/pluck_in_where.rb#47 -RuboCop::Cop::Rails::PluckInWhere::MSG_IDS = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/pluck_in_where.rb#46 -RuboCop::Cop::Rails::PluckInWhere::MSG_SELECT = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/pluck_in_where.rb#48 -RuboCop::Cop::Rails::PluckInWhere::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for correct grammar when using ActiveSupport's -# core extensions to the numeric classes. -# -# @example -# # bad -# 3.day.ago -# 1.months.ago -# -# # good -# 3.days.ago -# 1.month.ago -# -# source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#17 -class RuboCop::Cop::Rails::PluralizationGrammar < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#35 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#53 - def correct_method(method_name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#96 - def duration_method?(method_name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#84 - def literal_number?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#49 - def message(number, method_name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#61 - def offense?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#68 - def plural_method?(method_name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#80 - def plural_receiver?(number); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#88 - def pluralize(method_name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#72 - def singular_method?(method_name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#76 - def singular_receiver?(number); end - - # source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#92 - def singularize(method_name); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#33 -RuboCop::Cop::Rails::PluralizationGrammar::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#31 -RuboCop::Cop::Rails::PluralizationGrammar::PLURAL_DURATION_METHODS = T.let(T.unsafe(nil), Hash) - -# source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#29 -RuboCop::Cop::Rails::PluralizationGrammar::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/pluralization_grammar.rb#20 -RuboCop::Cop::Rails::PluralizationGrammar::SINGULAR_DURATION_METHODS = T.let(T.unsafe(nil), Hash) - -# Checks code that can be written more easily using -# `Object#presence` defined by Active Support. -# -# @example -# # bad -# a.present? ? a : nil -# -# # bad -# !a.present? ? nil : a -# -# # bad -# a.blank? ? nil : a -# -# # bad -# !a.blank? ? a : nil -# -# # good -# a.presence -# @example -# # bad -# a.present? ? a : b -# -# # bad -# !a.present? ? b : a -# -# # bad -# a.blank? ? b : a -# -# # bad -# !a.blank? ? a : b -# -# # good -# a.presence || b -# -# source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#40 -class RuboCop::Cop::Rails::Presence < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#76 - def on_if(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#61 - def redundant_negative_receiver_and_other(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#46 - def redundant_receiver_and_other(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#135 - def build_source_for_or_method(other); end - - # source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#114 - def current(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#100 - def ignore_if_node?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#104 - def ignore_other_node?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#108 - def message(node, receiver, other); end - - # source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#146 - def method_range(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#94 - def register_offense(node, receiver, other); end - - # source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#122 - def replacement(receiver, other, left_sibling); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/presence.rb#44 -RuboCop::Cop::Rails::Presence::MSG = T.let(T.unsafe(nil), String) - -# Checks for code that can be written with simpler conditionals -# using `Object#present?` defined by Active Support. -# -# Interaction with `Style/UnlessElse`: -# The configuration of `NotBlank` will not produce an offense in the -# context of `unless else` if `Style/UnlessElse` is enabled. This is -# to prevent interference between the autocorrection of the two cops. -# -# @example NotNilAndNotEmpty: true (default) -# # Converts usages of `!nil? && !empty?` to `present?` -# -# # bad -# !foo.nil? && !foo.empty? -# -# # bad -# foo != nil && !foo.empty? -# -# # good -# foo.present? -# @example NotBlank: true (default) -# # Converts usages of `!blank?` to `present?` -# -# # bad -# !foo.blank? -# -# # bad -# not foo.blank? -# -# # good -# foo.present? -# @example UnlessBlank: true (default) -# # Converts usages of `unless blank?` to `if present?` -# -# # bad -# something unless foo.blank? -# -# # good -# something if foo.present? -# -# source://rubocop-rails//lib/rubocop/cop/rails/present.rb#46 -class RuboCop::Cop::Rails::Present < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/present.rb#126 - def autocorrect(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/present.rb#54 - def exists_and_not_empty?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/present.rb#68 - def not_blank?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/present.rb#86 - def on_and(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/present.rb#112 - def on_if(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/present.rb#100 - def on_or(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/present.rb#74 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/present.rb#70 - def unless_blank?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/present.rb#150 - def replacement(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/present.rb#142 - def unless_condition(node, method_call); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/present.rb#50 -RuboCop::Cop::Rails::Present::MSG_EXISTS_AND_NOT_EMPTY = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/present.rb#49 -RuboCop::Cop::Rails::Present::MSG_NOT_BLANK = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/present.rb#51 -RuboCop::Cop::Rails::Present::MSG_UNLESS_BLANK = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/present.rb#52 -RuboCop::Cop::Rails::Present::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for Rake tasks without the `:environment` task -# dependency. The `:environment` task loads application code for other -# Rake tasks. Without it, tasks cannot make use of application code like -# models. -# -# You can ignore the offense if the task satisfies at least one of the -# following conditions: -# -# * The task does not need application code. -# * The task invokes the `:environment` task. -# -# @example -# # bad -# task :foo do -# do_something -# end -# -# # good -# task foo: :environment do -# do_something -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/rake_environment.rb#33 -class RuboCop::Cop::Rails::RakeEnvironment < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/rake_environment.rb#42 - def on_block(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/rake_environment.rb#38 - def task_definition?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/rake_environment.rb#62 - def correct_task_arguments_dependency(task_method); end - - # source://rubocop-rails//lib/rubocop/cop/rails/rake_environment.rb#66 - def correct_task_dependency(task_name); end - - # source://rubocop-rails//lib/rubocop/cop/rails/rake_environment.rb#91 - def task_arguments(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/rake_environment.rb#74 - def task_name(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/rake_environment.rb#95 - def with_arguments?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/rake_environment.rb#99 - def with_dependencies?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/rake_environment.rb#114 - def with_hash_style_dependencies?(hash_node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/rake_environment.rb#36 -RuboCop::Cop::Rails::RakeEnvironment::MSG = T.let(T.unsafe(nil), String) - -# Checks for the use of the `read_attribute` or `write_attribute` -# methods and recommends square brackets instead. -# -# If an attribute is missing from the instance (for example, when -# initialized by a partial `select`) then `read_attribute` -# will return nil, but square brackets will raise -# an `ActiveModel::MissingAttributeError`. -# -# Explicitly raising an error in this situation is preferable, and that -# is why rubocop recommends using square brackets. -# -# When called from within a method with the same name as the attribute, -# `read_attribute` and `write_attribute` must be used to prevent an -# infinite loop: -# -# @example -# -# # bad -# x = read_attribute(:attr) -# write_attribute(:attr, val) -# -# # good -# x = self[:attr] -# self[:attr] = val -# @example -# -# # good -# def foo -# bar || read_attribute(:foo) -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#37 -class RuboCop::Cop::Rails::ReadWriteAttribute < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#50 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#43 - def read_write_attribute?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#73 - def build_message(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#85 - def multi_line_message(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#93 - def node_replacement(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#102 - def read_attribute_replacement(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#81 - def single_line_message(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#61 - def within_shadowing_method?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#106 - def write_attribute_replacement(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#40 -RuboCop::Cop::Rails::ReadWriteAttribute::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/read_write_attribute.rb#41 -RuboCop::Cop::Rails::ReadWriteAttribute::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Detect redundant `all` used as a receiver for Active Record query methods. -# -# For the methods `delete_all` and `destroy_all`, this cop will only check cases where the receiver is a model. -# It will ignore cases where the receiver is an association (e.g., `user.articles.all.delete_all`). -# This is because omitting `all` from an association changes the methods -# from `ActiveRecord::Relation` to `ActiveRecord::Associations::CollectionProxy`, -# which can affect their behavior. -# -# @example -# # bad -# User.all.find(id) -# User.all.order(:created_at) -# users.all.where(id: ids) -# user.articles.all.order(:created_at) -# -# # good -# User.find(id) -# User.order(:created_at) -# users.where(id: ids) -# user.articles.order(:created_at) -# @example AllowedReceivers: ['ActionMailer::Preview', 'ActiveSupport::TimeZone'] (default) -# # good -# ActionMailer::Preview.all.first -# ActiveSupport::TimeZone.all.first -# -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#63 -class RuboCop::Cop::Rails::RedundantActiveRecordAllMethod < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ActiveRecordHelper - include ::RuboCop::Cop::Rails::AllowedReceivers - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#184 - def followed_by_query_method?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#188 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#213 - def offense_range(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#202 - def possible_enumerable_block_method?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#209 - def sensitive_association_method?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#69 -RuboCop::Cop::Rails::RedundantActiveRecordAllMethod::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#181 -RuboCop::Cop::Rails::RedundantActiveRecordAllMethod::POSSIBLE_ENUMERABLE_BLOCK_METHODS = T.let(T.unsafe(nil), Array) - -# Defined methods in `ActiveRecord::Querying::QUERYING_METHODS` on activerecord 7.1.0. -# -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#74 -RuboCop::Cop::Rails::RedundantActiveRecordAllMethod::QUERYING_METHODS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#71 -RuboCop::Cop::Rails::RedundantActiveRecordAllMethod::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_active_record_all_method.rb#182 -RuboCop::Cop::Rails::RedundantActiveRecordAllMethod::SENSITIVE_METHODS_ON_ASSOCIATION = T.let(T.unsafe(nil), Array) - -# Checks Rails model validations for a redundant `allow_nil` when -# `allow_blank` is present. -# -# @example -# # bad -# validates :x, length: { is: 5 }, allow_nil: true, allow_blank: true -# -# # bad -# validates :x, length: { is: 5 }, allow_nil: false, allow_blank: true -# -# # bad -# validates :x, length: { is: 5 }, allow_nil: false, allow_blank: false -# -# # good -# validates :x, length: { is: 5 }, allow_blank: true -# -# # good -# validates :x, length: { is: 5 }, allow_blank: false -# -# # good -# # Here, `nil` is valid but `''` is not -# validates :x, length: { is: 5 }, allow_nil: true, allow_blank: false -# -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_allow_nil.rb#29 -class RuboCop::Cop::Rails::RedundantAllowNil < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_allow_nil.rb#39 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_allow_nil.rb#70 - def find_allow_nil_and_allow_blank(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_allow_nil.rb#89 - def node_beg(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_allow_nil.rb#93 - def node_end(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_allow_nil.rb#55 - def register_offense(allow_nil, message); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_allow_nil.rb#35 -RuboCop::Cop::Rails::RedundantAllowNil::MSG_ALLOW_NIL_FALSE = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_allow_nil.rb#33 -RuboCop::Cop::Rails::RedundantAllowNil::MSG_SAME = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_allow_nil.rb#37 -RuboCop::Cop::Rails::RedundantAllowNil::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Detects cases where the `:foreign_key` option on associations -# is redundant. -# -# @example -# # bad -# class Post -# has_many :comments, foreign_key: 'post_id' -# end -# -# class Comment -# belongs_to :post, foreign_key: 'post_id' -# end -# -# # good -# class Post -# has_many :comments -# end -# -# class Comment -# belongs_to :author, foreign_key: 'user_id' -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_foreign_key.rb#27 -class RuboCop::Cop::Rails::RedundantForeignKey < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_foreign_key.rb#34 - def association_with_foreign_key(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_foreign_key.rb#40 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_foreign_key.rb#59 - def default_foreign_key(node, association_type, association_name, options); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_foreign_key.rb#69 - def find_as_option(options); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_foreign_key.rb#55 - def redundant?(node, association_type, association_name, options, foreign_key); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_foreign_key.rb#31 -RuboCop::Cop::Rails::RedundantForeignKey::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_foreign_key.rb#32 -RuboCop::Cop::Rails::RedundantForeignKey::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Since Rails 5.0 the default for `belongs_to` is `optional: false` -# unless `config.active_record.belongs_to_required_by_default` is -# explicitly set to `false`. The presence validator is added -# automatically, and explicit presence validation is redundant. -# -# @example -# # bad -# belongs_to :user -# validates :user, presence: true -# -# # bad -# belongs_to :user -# validates :user_id, presence: true -# -# # bad -# belongs_to :author, foreign_key: :user_id -# validates :user_id, presence: true -# -# # good -# belongs_to :user -# -# # good -# belongs_to :author, foreign_key: :user_id -# -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#34 -class RuboCop::Cop::Rails::RedundantPresenceValidationOnBelongsTo < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # Match a class with `belongs_to` with no regard to `foreign_key` option - # - # @example source that matches - # belongs_to :user - # @example source that matches - regardless of `foreign_key` - # belongs_to :author, foreign_key: :user_id - # @param node [RuboCop::AST::Node] - # @param association [Symbol] - # @return [Array, nil] matching node - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#106 - def any_belongs_to?(param0 = T.unsafe(nil), association:); end - - # Match a class with a matching association, either by name or an explicit - # `foreign_key` option - # - # @example source that matches - fk matches `foreign_key` option - # belongs_to :author, foreign_key: :user_id - # @example source that matches - key matches association name - # belongs_to :user - # @example source that does not match - explicit `foreign_key` does not match - # belongs_to :user, foreign_key: :account_id - # @param node [RuboCop::AST::Node] - # @param key [Symbol] e.g. `:user` - # @param fk [Symbol] e.g. `:user_id` - # @return [Array] matching nodes - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#132 - def belongs_to?(param0 = T.unsafe(nil), key:, fk:); end - - # Match a matching `belongs_to` association with a matching explicit `foreign_key` option - # - # @example source that matches - # belongs_to :author, foreign_key: :user_id - # @param node [RuboCop::AST::Node] - # @param fk [Symbol] e.g. `:user_id` - # @return [Array] matching nodes - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#167 - def belongs_to_with_a_matching_fk?(param0 = T.unsafe(nil), param1); end - - # Match a matching `belongs_to` association, without an explicit `foreign_key` option - # - # @param node [RuboCop::AST::Node] - # @param key [Symbol] e.g. `:user` - # @return [Array] matching nodes - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#150 - def belongs_to_without_fk?(param0 = T.unsafe(nil), param1); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#171 - def on_send(node); end - - # Match a `belongs_to` association with an optional option in a hash - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#81 - def optional?(param0 = T.unsafe(nil)); end - - # Match an optional option in a hash - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#87 - def optional_option?(param0 = T.unsafe(nil)); end - - # Match a `validates` statement with a presence check - # - # @example source that matches - by association - # validates :user, presence: true - # @example source that matches - by association - # validates :name, :user, presence: true - # @example source that matches - by a foreign key - # validates :user_id, presence: true - # @example source that DOES NOT match - if condition - # validates :user_id, presence: true, if: condition - # @example source that DOES NOT match - unless condition - # validates :user_id, presence: true, unless: condition - # @example source that DOES NOT match - strict validation - # validates :user_id, presence: true, strict: true - # @example source that DOES NOT match - custom strict validation - # validates :user_id, presence: true, strict: MissingUserError - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#67 - def presence_validation?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#182 - def add_offense_and_correct(node, all_keys, keys, options, presence); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#210 - def belongs_to_for(model_class_node, key); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#242 - def extract_validation_for_keys(corrector, node, keys, options); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#198 - def message_for(keys); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#203 - def non_optional_belongs_to(node, keys); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#223 - def remove_keys_from_validation(corrector, node, keys); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#234 - def remove_presence_option(corrector, presence); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#219 - def remove_validation(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#258 - def validation_range(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#39 -RuboCop::Cop::Rails::RedundantPresenceValidationOnBelongsTo::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb#40 -RuboCop::Cop::Rails::RedundantPresenceValidationOnBelongsTo::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for redundant receiver in `with_options`. -# Receiver is implicit from Rails 4.2 or higher. -# -# @example -# # bad -# class Account < ApplicationRecord -# with_options dependent: :destroy do |assoc| -# assoc.has_many :customers -# assoc.has_many :products -# assoc.has_many :invoices -# assoc.has_many :expenses -# end -# end -# -# # good -# class Account < ApplicationRecord -# with_options dependent: :destroy do -# has_many :customers -# has_many :products -# has_many :invoices -# has_many :expenses -# end -# end -# @example -# # bad -# with_options options: false do |merger| -# merger.invoke(merger.something) -# end -# -# # good -# with_options options: false do -# invoke(something) -# end -# -# # good -# client = Client.new -# with_options options: false do |merger| -# client.invoke(merger.something, something) -# end -# -# # ok -# # When `with_options` includes a block, all scoping scenarios -# # cannot be evaluated. Thus, it is ok to include the explicit -# # receiver. -# with_options options: false do |merger| -# merger.invoke -# with_another_method do |another_receiver| -# merger.invoke(another_receiver) -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb#57 -class RuboCop::Cop::Rails::RedundantReceiverInWithOptions < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb#63 - def all_block_nodes_in(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb#67 - def all_send_nodes_in(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb#71 - def on_block(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb#71 - def on_numblock(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb#91 - def autocorrect(corrector, send_node, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb#110 - def block_argument_range(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb#97 - def redundant_receiver?(send_nodes, node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb#132 - def same_value?(arg_node, recv_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb#122 - def search_begin_pos_of_space_before_block_argument(begin_pos); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb#61 -RuboCop::Cop::Rails::RedundantReceiverInWithOptions::MSG = T.let(T.unsafe(nil), String) - -# Checks for redundant `travel_back` calls. -# Since Rails 5.2, `travel_back` is automatically called at the end of the test. -# -# @example -# -# # bad -# def teardown -# do_something -# travel_back -# end -# -# # good -# def teardown -# do_something -# end -# -# # bad -# after do -# do_something -# travel_back -# end -# -# # good -# after do -# do_something -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_travel_back.rb#33 -class RuboCop::Cop::Rails::RedundantTravelBack < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/redundant_travel_back.rb#43 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_travel_back.rb#40 -RuboCop::Cop::Rails::RedundantTravelBack::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/redundant_travel_back.rb#41 -RuboCop::Cop::Rails::RedundantTravelBack::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks if the value of the option `class_name`, in -# the definition of a reflection is a string. -# -# @example -# # bad -# has_many :accounts, class_name: Account -# has_many :accounts, class_name: Account.name -# -# # good -# has_many :accounts, class_name: 'Account' -# -# source://rubocop-rails//lib/rubocop/cop/rails/reflection_class_name.rb#20 -class RuboCop::Cop::Rails::ReflectionClassName < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/reflection_class_name.rb#27 - def association_with_reflection(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reflection_class_name.rb#37 - def const_or_string(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reflection_class_name.rb#41 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reflection_class_name.rb#33 - def reflection_class_name(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/reflection_class_name.rb#76 - def autocorrect(corrector, class_config); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/reflection_class_name.rb#68 - def reflection_class_value?(class_value); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/reflection_class_name.rb#54 - def str_assigned?(reflection_class_name); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/reflection_class_name.rb#25 -RuboCop::Cop::Rails::ReflectionClassName::ALLOWED_REFLECTION_CLASS_TYPES = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/reflection_class_name.rb#23 -RuboCop::Cop::Rails::ReflectionClassName::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/reflection_class_name.rb#24 -RuboCop::Cop::Rails::ReflectionClassName::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Use `assert_not` methods instead of `refute` methods. -# -# @example EnforcedStyle: assert_not (default) -# # bad -# refute false -# refute_empty [1, 2, 3] -# refute_equal true, false -# -# # good -# assert_not false -# assert_not_empty [1, 2, 3] -# assert_not_equal true, false -# @example EnforcedStyle: refute -# # bad -# assert_not false -# assert_not_empty [1, 2, 3] -# assert_not_equal true, false -# -# # good -# refute false -# refute_empty [1, 2, 3] -# refute_equal true, false -# -# source://rubocop-rails//lib/rubocop/cop/rails/refute_methods.rb#30 -class RuboCop::Cop::Rails::RefuteMethods < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ConfigurableEnforcedStyle - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/refute_methods.rb#58 - def offensive?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/refute_methods.rb#60 - def on_send(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/refute_methods.rb#74 - def bad_method?(method_name); end - - # source://rubocop-rails//lib/rubocop/cop/rails/refute_methods.rb#86 - def convert_good_method(bad_method); end - - # source://rubocop-rails//lib/rubocop/cop/rails/refute_methods.rb#82 - def offense_message(method_name); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/refute_methods.rb#54 -RuboCop::Cop::Rails::RefuteMethods::ASSERT_NOT_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/refute_methods.rb#36 -RuboCop::Cop::Rails::RefuteMethods::CORRECTIONS = T.let(T.unsafe(nil), Hash) - -# source://rubocop-rails//lib/rubocop/cop/rails/refute_methods.rb#34 -RuboCop::Cop::Rails::RefuteMethods::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/refute_methods.rb#53 -RuboCop::Cop::Rails::RefuteMethods::REFUTE_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/refute_methods.rb#56 -RuboCop::Cop::Rails::RefuteMethods::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks whether constant value isn't relative date. -# Because the relative date will be evaluated only once. -# -# @example -# # bad -# class SomeClass -# EXPIRED_AT = 1.week.since -# end -# -# # good -# class SomeClass -# EXPIRES = 1.week -# -# def self.expired_at -# EXPIRES.since -# end -# end -# -# # good -# class SomeClass -# def self.expired_at -# 1.week.since -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#33 -class RuboCop::Cop::Rails::RelativeDateConstant < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#40 - def on_casgn(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#48 - def on_masgn(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#64 - def on_or_asgn(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#106 - def relative_date(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#102 - def relative_date_or_assignment(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#72 - def autocorrect(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#84 - def message(method_name); end - - # source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#92 - def nested_relative_date(node, &callback); end - - # source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#88 - def offense_range(name, value); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#37 -RuboCop::Cop::Rails::RelativeDateConstant::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/relative_date_constant.rb#38 -RuboCop::Cop::Rails::RelativeDateConstant::RELATIVE_DATE_METHODS = T.let(T.unsafe(nil), Set) - -# Looks for inline rendering within controller actions. -# -# @example -# # bad -# class ProductsController < ApplicationController -# def index -# render inline: "<% products.each do |p| %>

    <%= p.name %>

    <% end %>", type: :erb -# end -# end -# -# # good -# # app/views/products/index.html.erb -# # <% products.each do |p| %> -# #

    <%= p.name %>

    -# # <% end %> -# -# class ProductsController < ApplicationController -# def index -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/render_inline.rb#27 -class RuboCop::Cop::Rails::RenderInline < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/render_inline.rb#35 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/render_inline.rb#31 - def render_with_inline_option?(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/render_inline.rb#28 -RuboCop::Cop::Rails::RenderInline::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/render_inline.rb#29 -RuboCop::Cop::Rails::RenderInline::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Identifies places where `render text:` can be -# replaced with `render plain:`. -# -# @example -# # bad - explicit MIME type to `text/plain` -# render text: 'Ruby!', content_type: 'text/plain' -# -# # good - short and precise -# render plain: 'Ruby!' -# -# # good - explicit MIME type not to `text/plain` -# render text: 'Ruby!', content_type: 'text/html' -# @example ContentTypeCompatibility: true (default) -# # good - sets MIME type to `text/html` -# render text: 'Ruby!' -# @example ContentTypeCompatibility: false -# # bad - sets MIME type to `text/html` -# render text: 'Ruby!' -# -# source://rubocop-rails//lib/rubocop/cop/rails/render_plain_text.rb#27 -class RuboCop::Cop::Rails::RenderPlainText < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/render_plain_text.rb#37 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/render_plain_text.rb#33 - def render_plain_text?(param0 = T.unsafe(nil)); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/render_plain_text.rb#56 - def compatible_content_type?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/render_plain_text.rb#52 - def find_content_type(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/render_plain_text.rb#61 - def replacement(rest_options, option_value); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/render_plain_text.rb#30 -RuboCop::Cop::Rails::RenderPlainText::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/render_plain_text.rb#31 -RuboCop::Cop::Rails::RenderPlainText::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for consistent uses of `request.referer` or -# `request.referrer`, depending on the cop's configuration. -# -# @example EnforcedStyle: referer (default) -# # bad -# request.referrer -# -# # good -# request.referer -# @example EnforcedStyle: referrer -# # bad -# request.referer -# -# # good -# request.referrer -# -# source://rubocop-rails//lib/rubocop/cop/rails/request_referer.rb#22 -class RuboCop::Cop::Rails::RequestReferer < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ConfigurableEnforcedStyle - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/request_referer.rb#33 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/request_referer.rb#29 - def referer?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/request_referer.rb#45 - def message(_range); end - - # source://rubocop-rails//lib/rubocop/cop/rails/request_referer.rb#49 - def wrong_method_name; end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/request_referer.rb#26 -RuboCop::Cop::Rails::RequestReferer::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/request_referer.rb#27 -RuboCop::Cop::Rails::RequestReferer::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for the usage of `require_dependency`. -# -# `require_dependency` is an obsolete method for Rails applications running in Zeitwerk mode. -# In Zeitwerk mode, the semantics should match Ruby's and no need to be defensive with load order, -# just refer to classes and modules normally. -# If the constant name is dynamic, camelize if needed, and constantize. -# -# Applications running in Zeitwerk mode should not use `require_dependency`. -# -# NOTE: This cop is disabled by default. Please enable it if you are using Zeitwerk mode. -# -# @example -# # bad -# require_dependency 'some_lib' -# -# source://rubocop-rails//lib/rubocop/cop/rails/require_dependency.rb#20 -class RuboCop::Cop::Rails::RequireDependency < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/require_dependency.rb#32 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/require_dependency.rb#28 - def require_dependency_call?(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/require_dependency.rb#25 -RuboCop::Cop::Rails::RequireDependency::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/require_dependency.rb#26 -RuboCop::Cop::Rails::RequireDependency::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Prefer `response.parsed_body` to custom parsing logic for `response.body`. -# -# @example -# # bad -# JSON.parse(response.body) -# -# # bad -# Nokogiri::HTML.parse(response.body) -# -# # bad -# Nokogiri::HTML5.parse(response.body) -# -# # good -# response.parsed_body -# -# source://rubocop-rails//lib/rubocop/cop/rails/response_parsed_body.rb#26 -class RuboCop::Cop::Rails::ResponseParsedBody < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/response_parsed_body.rb#35 - def json_parse_response_body?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/response_parsed_body.rb#47 - def nokogiri_html_parse_response_body(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/response_parsed_body.rb#61 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/response_parsed_body.rb#71 - def autocorrect(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/response_parsed_body.rb#75 - def check_json_parse_response_body(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/response_parsed_body.rb#86 - def check_nokogiri_html_parse_response_body(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/response_parsed_body.rb#30 -RuboCop::Cop::Rails::ResponseParsedBody::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks whether the change method of the migration file is -# reversible. -# -# @example -# # remove_index -# -# # bad -# def change -# remove_index :users, name: :index_users_on_email -# end -# -# # good -# def change -# remove_index :users, :email -# end -# -# # good -# def change -# remove_index :users, column: :email -# end -# @example -# # drop_table -# -# # bad -# def change -# drop_table :users -# end -# -# # good -# def change -# drop_table :users do |t| -# t.string :name -# end -# end -# @example -# # change_column_default -# -# # bad -# def change -# change_column_default(:suppliers, :qualification, 'new') -# end -# -# # good -# def change -# change_column_default(:posts, :state, from: nil, to: "draft") -# end -# @example -# # remove_column -# -# # bad -# def change -# remove_column(:suppliers, :qualification) -# end -# -# # good -# def change -# remove_column(:suppliers, :qualification, :string) -# end -# @example -# # remove_foreign_key -# -# # bad -# def change -# remove_foreign_key :accounts, column: :owner_id -# end -# -# # good -# def change -# remove_foreign_key :accounts, :branches -# end -# -# # good -# def change -# remove_foreign_key :accounts, to_table: :branches -# end -# @example -# # change_table -# -# # bad -# def change -# change_table :users do |t| -# t.remove :name -# t.change_default :authorized, 1 -# t.change :price, :string -# end -# end -# -# # good -# def change -# change_table :users do |t| -# t.string :name -# end -# end -# @example -# # remove_columns -# -# # bad -# def change -# remove_columns :users, :name, :email -# end -# -# # good -# def change -# reversible do |dir| -# dir.up do -# remove_columns :users, :name, :email -# end -# -# dir.down do -# add_column :users, :name, :string -# add_column :users, :email, :string -# end -# end -# end -# -# # good (Rails >= 6.1, see https://github.com/rails/rails/pull/36589) -# def change -# remove_columns :users, :name, :email, type: :string -# end -# @example -# # bad -# def change -# change_table :users do |t| -# t.remove :name -# end -# end -# -# # good -# def change -# change_table :users do |t| -# t.remove :name, :string -# end -# end -# -# # good -# def change -# create_table :users do |t| -# t.string :name -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#153 -class RuboCop::Cop::Rails::ReversibleMigration < ::RuboCop::Cop::Base - include ::RuboCop::Cop::MigrationsHelper - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#174 - def change_table_call(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#162 - def drop_table_call(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#158 - def irreversible_schema_statement_call(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#199 - def on_block(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#199 - def on_numblock(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#186 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#166 - def remove_column_call(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#178 - def remove_columns_call(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#170 - def remove_foreign_key_call(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#182 - def remove_index_call(param0 = T.unsafe(nil)); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#314 - def all_hash_key?(args, *keys); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#245 - def check_change_table_node(node, block); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#275 - def check_change_table_offense(receiver, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#217 - def check_drop_table_node(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#211 - def check_irreversible_schema_statement_node(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#231 - def check_remove_column_node(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#257 - def check_remove_columns_node(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#237 - def check_remove_foreign_key_node(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#267 - def check_remove_index_node(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#225 - def check_reversible_hash_node(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#288 - def reversible_change_table_call?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#302 - def within_change_method?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#308 - def within_reversible_or_up_only_block?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration.rb#156 -RuboCop::Cop::Rails::ReversibleMigration::MSG = T.let(T.unsafe(nil), String) - -# Checks whether the migration implements -# either a `change` method or both an `up` and a `down` -# method. -# -# @example -# # bad -# class SomeMigration < ActiveRecord::Migration[6.0] -# def up -# # up migration -# end -# -# # <----- missing down method -# end -# -# class SomeMigration < ActiveRecord::Migration[6.0] -# # <----- missing up method -# -# def down -# # down migration -# end -# end -# -# # good -# class SomeMigration < ActiveRecord::Migration[6.0] -# def change -# # reversible migration -# end -# end -# -# # good -# class SomeMigration < ActiveRecord::Migration[6.0] -# def up -# # up migration -# end -# -# def down -# # down migration -# end -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration_method_definition.rb#45 -class RuboCop::Cop::Rails::ReversibleMigrationMethodDefinition < ::RuboCop::Cop::Base - include ::RuboCop::Cop::MigrationsHelper - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration_method_definition.rb#50 - def change_method?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration_method_definition.rb#58 - def on_class(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration_method_definition.rb#54 - def up_and_down_methods?(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/reversible_migration_method_definition.rb#48 -RuboCop::Cop::Rails::ReversibleMigrationMethodDefinition::MSG = T.let(T.unsafe(nil), String) - -# Use a single `#join` instead of chaining on `Rails.root` or `Rails.public_path`. -# -# @example -# # bad -# Rails.root.join('db').join('schema.rb') -# Rails.root.join('db').join(migrate).join('migration.rb') -# Rails.public_path.join('path').join('file.pdf') -# Rails.public_path.join('path').join(to).join('file.pdf') -# -# # good -# Rails.root.join('db', 'schema.rb') -# Rails.root.join('db', migrate, 'migration.rb') -# Rails.public_path.join('path', 'file.pdf') -# Rails.public_path.join('path', to, 'file.pdf') -# -# source://rubocop-rails//lib/rubocop/cop/rails/root_join_chain.rb#21 -class RuboCop::Cop::Rails::RootJoinChain < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/root_join_chain.rb#35 - def join?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_join_chain.rb#39 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_join_chain.rb#30 - def rails_root?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/root_join_chain.rb#52 - def evidence(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/root_join_chain.rb#25 -RuboCop::Cop::Rails::RootJoinChain::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/root_join_chain.rb#27 -RuboCop::Cop::Rails::RootJoinChain::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) - -# Use `Rails.root` IO methods instead of passing it to `File`. -# -# `Rails.root` is an instance of `Pathname` -# so we can apply many IO methods directly. -# -# This cop works best when used together with -# `Style/FileRead`, `Style/FileWrite` and `Rails/RootJoinChain`. -# -# @example -# # bad -# File.open(Rails.root.join('db', 'schema.rb')) -# File.open(Rails.root.join('db', 'schema.rb'), 'w') -# File.read(Rails.root.join('db', 'schema.rb')) -# File.binread(Rails.root.join('db', 'schema.rb')) -# File.write(Rails.root.join('db', 'schema.rb'), content) -# File.binwrite(Rails.root.join('db', 'schema.rb'), content) -# -# # good -# Rails.root.join('db', 'schema.rb').open -# Rails.root.join('db', 'schema.rb').open('w') -# Rails.root.join('db', 'schema.rb').read -# Rails.root.join('db', 'schema.rb').binread -# Rails.root.join('db', 'schema.rb').write(content) -# Rails.root.join('db', 'schema.rb').binwrite(content) -# -# source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#35 -class RuboCop::Cop::Rails::RootPathnameMethods < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#172 - def dir_glob?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#189 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#163 - def pathname_method_for_ruby_2_4_or_lower(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#153 - def pathname_method_for_ruby_2_5_or_higher(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#185 - def rails_root?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#177 - def rails_root_pathname?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#220 - def build_path_glob_replacement(path, method); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#228 - def build_path_replacement(path, method, args); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#262 - def enforce_double_quotes?; end - - # @yield [method, path, args, rails_root] - # - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#205 - def evidence(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#240 - def include_interpolation?(arguments); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#246 - def join_arguments(arguments); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#212 - def pathname_method(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#266 - def string_literals_config; end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#41 -RuboCop::Cop::Rails::RootPathnameMethods::DIR_GLOB_METHODS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#56 -RuboCop::Cop::Rails::RootPathnameMethods::DIR_METHODS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#43 -RuboCop::Cop::Rails::RootPathnameMethods::DIR_NON_GLOB_METHODS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#58 -RuboCop::Cop::Rails::RootPathnameMethods::FILE_METHODS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#120 -RuboCop::Cop::Rails::RootPathnameMethods::FILE_TEST_METHODS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#148 -RuboCop::Cop::Rails::RootPathnameMethods::FILE_UTILS_METHODS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#39 -RuboCop::Cop::Rails::RootPathnameMethods::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/root_pathname_methods.rb#150 -RuboCop::Cop::Rails::RootPathnameMethods::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) - -# Favor `Rails.public_path` over `Rails.root` with `'public'` -# -# @example -# # bad -# Rails.root.join('public') -# Rails.root.join('public/file.pdf') -# Rails.root.join('public', 'file.pdf') -# -# # good -# Rails.public_path -# Rails.public_path.join('file.pdf') -# Rails.public_path.join('file.pdf') -# -# source://rubocop-rails//lib/rubocop/cop/rails/root_public_path.rb#19 -class RuboCop::Cop::Rails::RootPublicPath < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/root_public_path.rb#35 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/root_public_path.rb#28 - def rails_root_public(param0 = T.unsafe(nil)); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/root_public_path.rb#53 - def public_path?(string); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/root_public_path.rb#22 -RuboCop::Cop::Rails::RootPublicPath::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/root_public_path.rb#26 -RuboCop::Cop::Rails::RootPublicPath::PATTERN = T.let(T.unsafe(nil), Regexp) - -# source://rubocop-rails//lib/rubocop/cop/rails/root_public_path.rb#24 -RuboCop::Cop::Rails::RootPublicPath::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Set) - -# Converts usages of `try!` to `&.`. It can also be configured -# to convert `try`. It will convert code to use safe navigation -# if the target Ruby version is set to 2.3+ -# -# @example ConvertTry: false (default) -# # bad -# foo.try!(:bar) -# foo.try!(:bar, baz) -# foo.try!(:bar) { |e| e.baz } -# -# foo.try!(:[], 0) -# -# # good -# foo.try(:bar) -# foo.try(:bar, baz) -# foo.try(:bar) { |e| e.baz } -# -# foo&.bar -# foo&.bar(baz) -# foo&.bar { |e| e.baz } -# @example ConvertTry: true -# # bad -# foo.try!(:bar) -# foo.try!(:bar, baz) -# foo.try!(:bar) { |e| e.baz } -# foo.try(:bar) -# foo.try(:bar, baz) -# foo.try(:bar) { |e| e.baz } -# -# # good -# foo&.bar -# foo&.bar(baz) -# foo&.bar { |e| e.baz } -# -# source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation.rb#40 -class RuboCop::Cop::Rails::SafeNavigation < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRubyVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation.rb#58 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation.rb#50 - def try_call(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation.rb#71 - def autocorrect(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation.rb#85 - def replacement(method, params); end - - class << self - # source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation.rb#54 - def autocorrect_incompatible_with; end - end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation.rb#47 -RuboCop::Cop::Rails::SafeNavigation::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation.rb#48 -RuboCop::Cop::Rails::SafeNavigation::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks to make sure safe navigation isn't used with `blank?` in -# a conditional. -# -# @example -# # bad -# do_something if foo&.blank? -# do_something unless foo&.blank? -# -# # good -# do_something if foo.blank? -# do_something unless foo.blank? -# -# source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation_with_blank.rb#31 -class RuboCop::Cop::Rails::SafeNavigationWithBlank < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation_with_blank.rb#40 - def on_if(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation_with_blank.rb#36 - def safe_navigation_blank_in_conditional?(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/safe_navigation_with_blank.rb#34 -RuboCop::Cop::Rails::SafeNavigationWithBlank::MSG = T.let(T.unsafe(nil), String) - -# Identifies possible cases where Active Record save! or related -# should be used instead of save because the model might have failed to -# save and an exception is better than unhandled failure. -# -# This will allow: -# -# * update or save calls, assigned to a variable, -# or used as a condition in an if/unless/case statement. -# * create calls, assigned to a variable that then has a -# call to `persisted?`, or whose return value is checked by -# `persisted?` immediately -# * calls if the result is explicitly returned from methods and blocks, -# or provided as arguments. -# * calls whose signature doesn't look like an ActiveRecord -# persistence method. -# -# By default it will also allow implicit returns from methods and blocks. -# that behavior can be turned off with `AllowImplicitReturn: false`. -# -# You can permit receivers that are giving false positives with -# `AllowedReceivers: []` -# -# @example -# -# # bad -# user.save -# user.update(name: 'Joe') -# user.find_or_create_by(name: 'Joe') -# user.destroy -# -# # good -# unless user.save -# # ... -# end -# user.save! -# user.update!(name: 'Joe') -# user.find_or_create_by!(name: 'Joe') -# user.destroy! -# -# user = User.find_or_create_by(name: 'Joe') -# unless user.persisted? -# # ... -# end -# -# def save_user -# return user.save -# end -# @example AllowImplicitReturn: true (default) -# -# # good -# users.each { |u| u.save } -# -# def save_user -# user.save -# end -# @example AllowImplicitReturn: false -# -# # bad -# users.each { |u| u.save } -# def save_user -# user.save -# end -# -# # good -# users.each { |u| u.save! } -# -# def save_user -# user.save! -# end -# -# def save_user -# return user.save -# end -# @example AllowedReceivers: ['merchant.customers', 'Service::Mailer'] -# -# # bad -# merchant.create -# customers.builder.save -# Mailer.create -# -# module Service::Mailer -# self.create -# end -# -# # good -# merchant.customers.create -# MerchantService.merchant.customers.destroy -# Service::Mailer.update(message: 'Message') -# ::Service::Mailer.update -# Services::Service::Mailer.update(message: 'Message') -# Service::Mailer::update -# -# source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#120 -class RuboCop::Cop::Rails::SaveBang < ::RuboCop::Cop::Base - include ::RuboCop::Cop::NegativeConditional - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#136 - def after_leaving_scope(scope, _variable_table); end - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#144 - def check_assignment(assignment); end - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#155 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#155 - def on_send(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#261 - def allowed_receiver?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#319 - def argument?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#221 - def array_parent(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#202 - def assignable_node(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#198 - def call_to_persisted?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#228 - def check_used_in_condition_or_compound_boolean(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#257 - def checked_immediately?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#248 - def conditional?(parent); end - - # Const == Const - # ::Const == ::Const - # ::Const == Const - # Const == ::Const - # NameSpace::Const == Const - # NameSpace::Const == NameSpace::Const - # NameSpace::Const != ::Const - # Const != NameSpace::Const - # - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#294 - def const_matches?(const, allowed_const); end - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#252 - def deparenthesize(node); end - - # Check argument signature as no arguments or one hash - # - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#338 - def expected_signature?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#323 - def explicit_return?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#311 - def find_method_with_sibling_index(node, sibling_index = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#211 - def hash_parent(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#301 - def implicit_return?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#236 - def in_condition_or_compound_boolean?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#244 - def operator_or_single_negative?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#333 - def persist_method?(node, methods = T.unsafe(nil)); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#190 - def persisted_referenced?(assignment); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#271 - def receiver_chain_matches?(node, allowed_receiver); end - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#171 - def register_offense(node, msg); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#328 - def return_value_assigned?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#182 - def right_assignment_node(assignment); end - - class << self - # source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#132 - def joining_forces; end - end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#126 -RuboCop::Cop::Rails::SaveBang::CREATE_CONDITIONAL_MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#125 -RuboCop::Cop::Rails::SaveBang::CREATE_MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#128 -RuboCop::Cop::Rails::SaveBang::CREATE_PERSIST_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#129 -RuboCop::Cop::Rails::SaveBang::MODIFY_PERSIST_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#124 -RuboCop::Cop::Rails::SaveBang::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/save_bang.rb#130 -RuboCop::Cop::Rails::SaveBang::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Enforces the use of the `comment` option when adding a new table or column -# to the database during a migration. -# -# @example -# # bad (no comment for a new column or table) -# add_column :table, :column, :integer -# -# create_table :table do |t| -# t.type :column -# end -# -# # good -# add_column :table, :column, :integer, comment: 'Number of offenses' -# -# create_table :table, comment: 'Table of offenses data' do |t| -# t.type :column, comment: 'Number of offenses' -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#24 -class RuboCop::Cop::Rails::SchemaComment < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ActiveRecordMigrationsHelper - - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#45 - def add_column?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#50 - def add_column_with_comment?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#40 - def comment_present?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#55 - def create_table?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#60 - def create_table_with_comment?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#74 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#65 - def t_column?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#70 - def t_column_with_comment?(param0 = T.unsafe(nil)); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#96 - def add_column_without_comment?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#86 - def check_column_within_create_table_block(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#100 - def create_table_without_comment?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#104 - def t_column_without_comment?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#27 -RuboCop::Cop::Rails::SchemaComment::COLUMN_MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#30 -RuboCop::Cop::Rails::SchemaComment::CREATE_TABLE_COLUMN_METHODS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#29 -RuboCop::Cop::Rails::SchemaComment::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/schema_comment.rb#28 -RuboCop::Cop::Rails::SchemaComment::TABLE_MSG = T.let(T.unsafe(nil), String) - -# Checks for scope calls where it was passed -# a method (usually a scope) instead of a lambda/proc. -# -# @example -# -# # bad -# scope :something, where(something: true) -# -# # good -# scope :something, -> { where(something: true) } -# -# source://rubocop-rails//lib/rubocop/cop/rails/scope_args.rb#16 -class RuboCop::Cop::Rails::ScopeArgs < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/scope_args.rb#24 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/scope_args.rb#22 - def scope?(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/scope_args.rb#19 -RuboCop::Cop::Rails::ScopeArgs::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/scope_args.rb#20 -RuboCop::Cop::Rails::ScopeArgs::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for uses of `select(:column_name)` with `map(&:column_name)`. -# These can be replaced with `pluck(:column_name)`. -# -# There also should be some performance improvement since it skips instantiating the model class for matches. -# -# @example -# # bad -# Model.select(:column_name).map(&:column_name) -# -# # good -# Model.pluck(:column_name) -# -# source://rubocop-rails//lib/rubocop/cop/rails/select_map.rb#22 -class RuboCop::Cop::Rails::SelectMap < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/select_map.rb#29 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/select_map.rb#55 - def autocorrect(corrector, select_node, node, preferred_method); end - - # source://rubocop-rails//lib/rubocop/cop/rails/select_map.rb#46 - def find_select_node(node, column_name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/select_map.rb#62 - def match_column_name?(select_candidate, column_name); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/select_map.rb#25 -RuboCop::Cop::Rails::SelectMap::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/select_map.rb#27 -RuboCop::Cop::Rails::SelectMap::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Enforces that short forms of `I18n` methods are used: -# `t` instead of `translate` and `l` instead of `localize`. -# -# This cop has two different enforcement modes. When the EnforcedStyle -# is conservative (the default) then only `I18n.translate` and `I18n.localize` -# calls are added as offenses. -# -# When the EnforcedStyle is aggressive then all `translate` and `localize` calls -# without a receiver are added as offenses. -# -# @example -# # bad -# I18n.translate :key -# I18n.localize Time.now -# -# # good -# I18n.t :key -# I18n.l Time.now -# @example EnforcedStyle: conservative (default) -# # good -# translate :key -# localize Time.now -# t :key -# l Time.now -# @example EnforcedStyle: aggressive -# # bad -# translate :key -# localize Time.now -# -# # good -# t :key -# l Time.now -# -# source://rubocop-rails//lib/rubocop/cop/rails/short_i18n.rb#41 -class RuboCop::Cop::Rails::ShortI18n < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ConfigurableEnforcedStyle - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/short_i18n.rb#51 - def long_i18n?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/short_i18n.rb#55 - def on_send(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/short_i18n.rb#45 -RuboCop::Cop::Rails::ShortI18n::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/short_i18n.rb#47 -RuboCop::Cop::Rails::ShortI18n::PREFERRED_METHODS = T.let(T.unsafe(nil), Hash) - -# source://rubocop-rails//lib/rubocop/cop/rails/short_i18n.rb#49 -RuboCop::Cop::Rails::ShortI18n::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for the use of methods which skip -# validations which are listed in -# https://guides.rubyonrails.org/active_record_validations.html#skipping-validations -# -# Methods may be ignored from this rule by configuring a `AllowedMethods`. -# -# @example -# # bad -# Article.first.decrement!(:view_count) -# DiscussionBoard.decrement_counter(:post_count, 5) -# Article.first.increment!(:view_count) -# DiscussionBoard.increment_counter(:post_count, 5) -# person.toggle :active -# product.touch -# Billing.update_all("category = 'authorized', author = 'David'") -# user.update_attribute(:website, 'example.com') -# user.update_columns(last_request_at: Time.current) -# Post.update_counters 5, comment_count: -1, action_count: 1 -# -# # good -# user.update(website: 'example.com') -# FileUtils.touch('file') -# @example AllowedMethods: ["touch"] -# # bad -# DiscussionBoard.decrement_counter(:post_count, 5) -# DiscussionBoard.increment_counter(:post_count, 5) -# person.toggle :active -# -# # good -# user.touch -# -# source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#38 -class RuboCop::Cop::Rails::SkipsModelValidations < ::RuboCop::Cop::Base - # @return [SkipsModelValidations] a new instance of SkipsModelValidations - # - # source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#83 - def initialize(*_arg0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#65 - def good_insert?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#58 - def good_touch?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#72 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#72 - def on_send(node); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#95 - def allowed_method?(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#110 - def allowed_methods; end - - # source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#99 - def forbidden_methods; end - - # source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#91 - def message(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#41 -RuboCop::Cop::Rails::SkipsModelValidations::METHODS_WITH_ARGUMENTS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/skips_model_validations.rb#39 -RuboCop::Cop::Rails::SkipsModelValidations::MSG = T.let(T.unsafe(nil), String) - -# Checks SQL heredocs to use `.squish`. -# -# @example -# # bad -# <<-SQL -# SELECT * FROM posts; -# SQL -# -# <<-SQL -# SELECT * FROM posts -# WHERE id = 1 -# SQL -# -# execute(<<~SQL, "Post Load") -# SELECT * FROM posts -# WHERE post_id = 1 -# SQL -# -# # good -# <<-SQL.squish -# SELECT * FROM posts; -# SQL -# -# <<~SQL.squish -# SELECT * FROM table -# WHERE id = 1 -# SQL -# -# execute(<<~SQL.squish, "Post Load") -# SELECT * FROM posts -# WHERE post_id = 1 -# SQL -# -# source://rubocop-rails//lib/rubocop/cop/rails/squished_sql_heredocs.rb#43 -class RuboCop::Cop::Rails::SquishedSQLHeredocs < ::RuboCop::Cop::Base - include ::RuboCop::Cop::Heredoc - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/squished_sql_heredocs.rb#52 - def on_heredoc(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/squished_sql_heredocs.rb#80 - def message(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/squished_sql_heredocs.rb#62 - def offense_detected?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/squished_sql_heredocs.rb#74 - def singleline_comments_present?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/squished_sql_heredocs.rb#66 - def sql_heredoc?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/squished_sql_heredocs.rb#70 - def using_squish?(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/squished_sql_heredocs.rb#49 -RuboCop::Cop::Rails::SquishedSQLHeredocs::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/squished_sql_heredocs.rb#47 -RuboCop::Cop::Rails::SquishedSQLHeredocs::SQL = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/squished_sql_heredocs.rb#50 -RuboCop::Cop::Rails::SquishedSQLHeredocs::SQL_IDENTIFIER_MARKERS = T.let(T.unsafe(nil), Regexp) - -# source://rubocop-rails//lib/rubocop/cop/rails/squished_sql_heredocs.rb#48 -RuboCop::Cop::Rails::SquishedSQLHeredocs::SQUISH = T.let(T.unsafe(nil), String) - -# Enforces the use of squiggly heredoc over `strip_heredoc`. -# -# @example -# -# # bad -# <= 7, where transactions -# exited using these statements are being rollbacked rather than -# committed (pre ActiveRecord 7 behavior). -# -# As alternatives, it would be more intuitive to explicitly raise an -# error when rollback is desired, and to use `next` when commit is -# desired. -# -# If you are defining custom transaction methods, you can configure it with `TransactionMethods`. -# -# @example -# # bad -# ApplicationRecord.transaction do -# return if user.active? -# end -# -# # bad -# ApplicationRecord.transaction do -# break if user.active? -# end -# -# # bad -# ApplicationRecord.transaction do -# throw if user.active? -# end -# -# # bad, as `with_lock` implicitly opens a transaction too -# user.with_lock do -# throw if user.active? -# end -# -# # bad, as `with_lock` implicitly opens a transaction too -# ApplicationRecord.with_lock do -# break if user.active? -# end -# -# # good -# ApplicationRecord.transaction do -# # Rollback -# raise "User is active" if user.active? -# end -# -# # good -# ApplicationRecord.transaction do -# # Commit -# next if user.active? -# end -# @example TransactionMethods: ["custom_transaction"] -# # bad -# CustomModel.custom_transaction do -# return if user.active? -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/transaction_exit_statement.rb#62 -class RuboCop::Cop::Rails::TransactionExitStatement < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/transaction_exit_statement.rb#66 - def exit_statements(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/transaction_exit_statement.rb#78 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/transaction_exit_statement.rb#70 - def rescue_body_return_node?(param0 = T.unsafe(nil)); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/transaction_exit_statement.rb#93 - def in_transaction_block?(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/transaction_exit_statement.rb#110 - def nested_block?(statement_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/transaction_exit_statement.rb#100 - def statement(statement_node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/transaction_exit_statement.rb#119 - def transaction_method?(method_name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/transaction_exit_statement.rb#115 - def transaction_method_name?(method_name); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/transaction_exit_statement.rb#64 -RuboCop::Cop::Rails::TransactionExitStatement::BUILT_IN_TRANSACTION_METHODS = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/transaction_exit_statement.rb#63 -RuboCop::Cop::Rails::TransactionExitStatement::MSG = T.let(T.unsafe(nil), String) - -# Prefer using `distinct` before `pluck` instead of `uniq` after `pluck`. -# -# The use of distinct before pluck is preferred because it executes by -# the database. -# -# This cop has two different enforcement modes. When the EnforcedStyle -# is `conservative` (the default), then only calls to `pluck` on a constant -# (i.e. a model class) before `uniq` are added as offenses. -# -# When the EnforcedStyle is `aggressive` then all calls to `pluck` before -# distinct are added as offenses. This may lead to false positives -# as the cop cannot distinguish between calls to `pluck` on an -# ActiveRecord::Relation vs a call to pluck on an -# ActiveRecord::Associations::CollectionProxy. -# -# @example EnforcedStyle: conservative (default) -# # bad - redundantly fetches duplicate values -# Album.pluck(:band_name).uniq -# -# # good -# Album.distinct.pluck(:band_name) -# @example EnforcedStyle: aggressive -# # bad - redundantly fetches duplicate values -# Album.pluck(:band_name).uniq -# -# # bad - redundantly fetches duplicate values -# Album.where(year: 1985).pluck(:band_name).uniq -# -# # bad - redundantly fetches duplicate values -# customer.favourites.pluck(:color).uniq -# -# # good -# Album.distinct.pluck(:band_name) -# Album.distinct.where(year: 1985).pluck(:band_name) -# customer.favourites.distinct.pluck(:color) -# -# source://rubocop-rails//lib/rubocop/cop/rails/uniq_before_pluck.rb#47 -class RuboCop::Cop::Rails::UniqBeforePluck < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ConfigurableEnforcedStyle - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/uniq_before_pluck.rb#59 - def aggressive_node_match(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/uniq_before_pluck.rb#57 - def conservative_node_match(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/uniq_before_pluck.rb#61 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/uniq_before_pluck.rb#84 - def dot_method_begin_pos(method, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/uniq_before_pluck.rb#80 - def dot_method_with_whitespace(method, node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/uniq_before_pluck.rb#52 -RuboCop::Cop::Rails::UniqBeforePluck::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/uniq_before_pluck.rb#54 -RuboCop::Cop::Rails::UniqBeforePluck::NEWLINE = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/uniq_before_pluck.rb#55 -RuboCop::Cop::Rails::UniqBeforePluck::PATTERN = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/uniq_before_pluck.rb#53 -RuboCop::Cop::Rails::UniqBeforePluck::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# When you define a uniqueness validation in Active Record model, -# you also should add a unique index for the column. There are two reasons. -# First, duplicated records may occur even if Active Record's validation -# is defined. -# Second, it will cause slow queries. The validation executes a `SELECT` -# statement with the target column when inserting/updating a record. -# If the column does not have an index and the table is large, -# the query will be heavy. -# -# Note that the cop does nothing if db/schema.rb does not exist. -# -# @example -# # bad - if the schema does not have a unique index -# validates :account, uniqueness: true -# -# # good - if the schema has a unique index -# validates :account, uniqueness: true -# -# # good - even if the schema does not have a unique index -# validates :account, length: { minimum: MIN_LENGTH } -# -# source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#27 -class RuboCop::Cop::Rails::UniqueValidationWithoutIndex < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ActiveRecordHelper - - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#33 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#155 - def array_node_to_array(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#122 - def class_node(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#74 - def column_names(node, uniqueness_part); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#93 - def column_names_from_scope(uniqueness_part); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#146 - def condition_hash_part?(pairs, keys:); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#137 - def condition_part?(node, uniqueness_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#47 - def find_schema_information(node, uniqueness_part); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#109 - def find_scope(pairs); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#66 - def include_column_names_in_expression_index?(index, column_names); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#118 - def unfreeze_scope(scope); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#126 - def uniqueness_part(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#57 - def with_index?(klass, table, names); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#30 -RuboCop::Cop::Rails::UniqueValidationWithoutIndex::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/unique_validation_without_index.rb#31 -RuboCop::Cop::Rails::UniqueValidationWithoutIndex::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks that environments called with `Rails.env` predicates -# exist. -# By default the cop allows three environments which Rails ships with: -# `development`, `test`, and `production`. -# More can be added to the `Environments` config parameter. -# -# @example -# # bad -# Rails.env.proudction? -# Rails.env == 'proudction' -# -# # good -# Rails.env.production? -# Rails.env == 'production' -# -# source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#20 -class RuboCop::Cop::Rails::UnknownEnv < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#41 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#24 - def rails_env?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#34 - def unknown_environment_equal?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#30 - def unknown_environment_predicate?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#54 - def collect_variable_like_names(_scope); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#88 - def environments; end - - # source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#58 - def message(name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#84 - def unknown_env_name?(name); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#79 - def unknown_env_predicate?(name); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#21 -RuboCop::Cop::Rails::UnknownEnv::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/unknown_env.rb#22 -RuboCop::Cop::Rails::UnknownEnv::MSG_SIMILAR = T.let(T.unsafe(nil), String) - -# Suggests you remove a column that does not exist in the schema from `ignored_columns`. -# `ignored_columns` is necessary to drop a column from RDBMS, but you don't need it after the migration -# to drop the column. You avoid forgetting to remove `ignored_columns` by this cop. -# -# @example -# # bad -# class User < ApplicationRecord -# self.ignored_columns = [:already_removed_column] -# end -# -# # good -# class User < ApplicationRecord -# self.ignored_columns = [:still_existing_column] -# end -# -# source://rubocop-rails//lib/rubocop/cop/rails/unused_ignored_columns.rb#21 -class RuboCop::Cop::Rails::UnusedIgnoredColumns < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ActiveRecordHelper - - # source://rubocop-rails//lib/rubocop/cop/rails/unused_ignored_columns.rb#31 - def appended_ignored_columns(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unused_ignored_columns.rb#35 - def column_name(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unused_ignored_columns.rb#27 - def ignored_columns(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unused_ignored_columns.rb#39 - def on_op_asgn(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unused_ignored_columns.rb#39 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/unused_ignored_columns.rb#54 - def check_column_existence(column_node, table); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unused_ignored_columns.rb#63 - def class_node(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unused_ignored_columns.rb#67 - def table(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/unused_ignored_columns.rb#24 -RuboCop::Cop::Rails::UnusedIgnoredColumns::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/unused_ignored_columns.rb#25 -RuboCop::Cop::Rails::UnusedIgnoredColumns::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# If you try to render content along with a non-content status code (100-199, 204, 205, or 304), -# it will be dropped from the response. -# -# This cop checks for uses of `render` which specify both body content and a non-content status. -# -# @example -# # bad -# render 'foo', status: :continue -# render status: 100, plain: 'Ruby!' -# -# # good -# head :continue -# head 100 -# -# source://rubocop-rails//lib/rubocop/cop/rails/unused_render_content.rb#19 -class RuboCop::Cop::Rails::UnusedRenderContent < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - - # source://rubocop-rails//lib/rubocop/cop/rails/unused_render_content.rb#45 - def non_content_status?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unused_render_content.rb#59 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/unused_render_content.rb#52 - def unused_render_content?(param0 = T.unsafe(nil)); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/unused_render_content.rb#28 -RuboCop::Cop::Rails::UnusedRenderContent::BODY_OPTIONS = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/unused_render_content.rb#22 -RuboCop::Cop::Rails::UnusedRenderContent::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/unused_render_content.rb#25 -RuboCop::Cop::Rails::UnusedRenderContent::NON_CONTENT_STATUSES = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/unused_render_content.rb#24 -RuboCop::Cop::Rails::UnusedRenderContent::NON_CONTENT_STATUS_CODES = T.let(T.unsafe(nil), Set) - -# source://rubocop-rails//lib/rubocop/cop/rails/unused_render_content.rb#23 -RuboCop::Cop::Rails::UnusedRenderContent::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Checks for the use of old-style attribute validation macros. -# -# @example -# # bad -# validates_acceptance_of :foo -# validates_confirmation_of :foo -# validates_exclusion_of :foo -# validates_format_of :foo -# validates_inclusion_of :foo -# validates_length_of :foo -# validates_numericality_of :foo -# validates_presence_of :foo -# validates_absence_of :foo -# validates_size_of :foo -# validates_uniqueness_of :foo -# -# # good -# validates :foo, acceptance: true -# validates :foo, confirmation: true -# validates :foo, exclusion: true -# validates :foo, format: true -# validates :foo, inclusion: true -# validates :foo, length: true -# validates :foo, numericality: true -# validates :foo, presence: true -# validates :foo, absence: true -# validates :foo, size: true -# validates :foo, uniqueness: true -# -# source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#35 -class RuboCop::Cop::Rails::Validation < ::RuboCop::Cop::Base - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#57 - def on_send(node); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#130 - def braced_options(options); end - - # source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#83 - def correct_validate_type(corrector, node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#108 - def correct_validate_type_for_array(corrector, node, arguments, loc); end - - # source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#104 - def correct_validate_type_for_hash(corrector, node, arguments); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#126 - def frozen_array_argument?(argument); end - - # source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#73 - def message(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#79 - def preferred_method(method); end - - # source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#122 - def validate_type(node); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#55 -RuboCop::Cop::Rails::Validation::ALLOWLIST = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#38 -RuboCop::Cop::Rails::Validation::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#54 -RuboCop::Cop::Rails::Validation::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# source://rubocop-rails//lib/rubocop/cop/rails/validation.rb#40 -RuboCop::Cop::Rails::Validation::TYPES = T.let(T.unsafe(nil), Array) - -# Identifies places where manually constructed SQL -# in `where` can be replaced with `where(attribute: value)`. -# -# @example -# # bad -# User.where('name = ?', 'Gabe') -# User.where('name = :name', name: 'Gabe') -# User.where('name IS NULL') -# User.where('name IN (?)', ['john', 'jane']) -# User.where('name IN (:names)', names: ['john', 'jane']) -# User.where('users.name = :name', name: 'Gabe') -# -# # good -# User.where(name: 'Gabe') -# User.where(name: nil) -# User.where(name: ['john', 'jane']) -# User.where(users: { name: 'Gabe' }) -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#27 -class RuboCop::Cop::Rails::WhereEquals < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#41 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#41 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#34 - def where_method_call?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#91 - def build_good_method(column, value); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#72 - def extract_column_and_value(template_node, value_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#68 - def offense_range(node); end -end - -# column = ? -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#60 -RuboCop::Cop::Rails::WhereEquals::EQ_ANONYMOUS_RE = T.let(T.unsafe(nil), Regexp) - -# column = :column -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#62 -RuboCop::Cop::Rails::WhereEquals::EQ_NAMED_RE = T.let(T.unsafe(nil), Regexp) - -# column IN (?) -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#61 -RuboCop::Cop::Rails::WhereEquals::IN_ANONYMOUS_RE = T.let(T.unsafe(nil), Regexp) - -# column IN (:column) -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#63 -RuboCop::Cop::Rails::WhereEquals::IN_NAMED_RE = T.let(T.unsafe(nil), Regexp) - -# column IS NULL -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#64 -RuboCop::Cop::Rails::WhereEquals::IS_NULL_RE = T.let(T.unsafe(nil), Regexp) - -# source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#31 -RuboCop::Cop::Rails::WhereEquals::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/where_equals.rb#32 -RuboCop::Cop::Rails::WhereEquals::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Enforces consistent style when using `exists?`. -# -# Two styles are supported for this cop. When EnforcedStyle is 'exists' -# then the cop enforces `exists?(...)` over `where(...).exists?`. -# -# When EnforcedStyle is 'where' then the cop enforces -# `where(...).exists?` over `exists?(...)`. -# -# @example EnforcedStyle: exists (default) -# # bad -# User.where(name: 'john').exists? -# User.where(['name = ?', 'john']).exists? -# User.where('name = ?', 'john').exists? -# user.posts.where(published: true).exists? -# -# # good -# User.exists?(name: 'john') -# User.where('length(name) > 10').exists? -# user.posts.exists?(published: true) -# @example EnforcedStyle: where -# # bad -# User.exists?(name: 'john') -# User.exists?(['name = ?', 'john']) -# user.posts.exists?(published: true) -# -# # good -# User.where(name: 'john').exists? -# User.where(['name = ?', 'john']).exists? -# User.where('name = ?', 'john').exists? -# user.posts.where(published: true).exists? -# User.where('length(name) > 10').exists? -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#50 -class RuboCop::Cop::Rails::WhereExists < ::RuboCop::Cop::Base - include ::RuboCop::Cop::ConfigurableEnforcedStyle - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#61 - def exists_with_args?(param0 = T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#65 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#65 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#57 - def where_exists_call?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#112 - def build_good_method(args, dot_source: T.unsafe(nil)); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#120 - def build_good_method_exists(args); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#128 - def build_good_method_where(args, dot_source); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#98 - def convertable_args?(args); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#104 - def correction_range(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#86 - def exists_style?; end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#90 - def find_offenses(node, &block); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#82 - def where_style?; end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#54 -RuboCop::Cop::Rails::WhereExists::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/where_exists.rb#55 -RuboCop::Cop::Rails::WhereExists::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Use `where.missing(...)` to find missing relationship records. -# -# This cop is enabled in Rails 6.1 or higher. -# -# @example -# # bad -# Post.left_joins(:author).where(authors: { id: nil }) -# -# # good -# Post.where.missing(:author) -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#17 -class RuboCop::Cop::Rails::WhereMissing < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - extend ::RuboCop::Cop::TargetRailsVersion - - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#34 - def missing_relationship(param0); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#38 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#29 - def where_node_and_argument(param0); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#111 - def message(node, where_argument); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#107 - def multi_condition?(where_arg); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#67 - def register_offense(node, where_node, where_argument, range); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#92 - def remove_where_method(corrector, node, where_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#84 - def replace_range(child); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#78 - def replace_where_method(corrector, where_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#54 - def root_receiver(node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#103 - def same_line?(left_joins_node, where_node); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#63 - def same_relationship?(where, left_joins); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#22 -RuboCop::Cop::Rails::WhereMissing::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/where_missing.rb#24 -RuboCop::Cop::Rails::WhereMissing::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Identifies places where manually constructed SQL -# in `where` can be replaced with `where.not(...)`. -# -# @example -# # bad -# User.where('name != ?', 'Gabe') -# User.where('name != :name', name: 'Gabe') -# User.where('name <> ?', 'Gabe') -# User.where('name <> :name', name: 'Gabe') -# User.where('name IS NOT NULL') -# User.where('name NOT IN (?)', ['john', 'jane']) -# User.where('name NOT IN (:names)', names: ['john', 'jane']) -# User.where('users.name != :name', name: 'Gabe') -# -# # good -# User.where.not(name: 'Gabe') -# User.where.not(name: nil) -# User.where.not(name: ['john', 'jane']) -# User.where.not(users: { name: 'Gabe' }) -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#26 -class RuboCop::Cop::Rails::WhereNot < ::RuboCop::Cop::Base - include ::RuboCop::Cop::RangeHelp - extend ::RuboCop::Cop::AutoCorrector - - # source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#40 - def on_csend(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#40 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#33 - def where_method_call?(param0 = T.unsafe(nil)); end - - private - - # source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#90 - def build_good_method(dot, column, value); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#71 - def extract_column_and_value(template_node, value_node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#67 - def offense_range(node); end -end - -# column IS NOT NULL -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#63 -RuboCop::Cop::Rails::WhereNot::IS_NOT_NULL_RE = T.let(T.unsafe(nil), Regexp) - -# source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#30 -RuboCop::Cop::Rails::WhereNot::MSG = T.let(T.unsafe(nil), String) - -# column != ?, column <> ? -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#59 -RuboCop::Cop::Rails::WhereNot::NOT_EQ_ANONYMOUS_RE = T.let(T.unsafe(nil), Regexp) - -# column != :column, column <> :column -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#61 -RuboCop::Cop::Rails::WhereNot::NOT_EQ_NAMED_RE = T.let(T.unsafe(nil), Regexp) - -# column NOT IN (?) -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#60 -RuboCop::Cop::Rails::WhereNot::NOT_IN_ANONYMOUS_RE = T.let(T.unsafe(nil), Regexp) - -# column NOT IN (:column) -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#62 -RuboCop::Cop::Rails::WhereNot::NOT_IN_NAMED_RE = T.let(T.unsafe(nil), Regexp) - -# source://rubocop-rails//lib/rubocop/cop/rails/where_not.rb#31 -RuboCop::Cop::Rails::WhereNot::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -# Identifies calls to `where.not` with multiple hash arguments. -# -# The behavior of `where.not` changed in Rails 6.1. Prior to the change, -# `.where.not(trashed: true, role: 'admin')` evaluated to -# `WHERE trashed != TRUE AND role != 'admin'`. -# From Rails 6.1 onwards, this executes the query -# `WHERE NOT (trashed == TRUE AND roles == 'admin')`. -# -# @example -# # bad -# User.where.not(trashed: true, role: 'admin') -# User.where.not(trashed: true, role: ['moderator', 'admin']) -# User.joins(:posts).where.not(posts: { trashed: true, title: 'Rails' }) -# -# # good -# User.where.not(trashed: true) -# User.where.not(role: ['moderator', 'admin']) -# User.where.not(trashed: true).where.not(role: ['moderator', 'admin']) -# User.where.not('trashed = ? OR role = ?', true, 'admin') -# -# source://rubocop-rails//lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb#25 -class RuboCop::Cop::Rails::WhereNotWithMultipleConditions < ::RuboCop::Cop::Base - # source://rubocop-rails//lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb#33 - def on_send(node); end - - # source://rubocop-rails//lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb#29 - def where_not_call?(param0 = T.unsafe(nil)); end - - private - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb#46 - def multiple_arguments_hash?(hash); end -end - -# source://rubocop-rails//lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb#26 -RuboCop::Cop::Rails::WhereNotWithMultipleConditions::MSG = T.let(T.unsafe(nil), String) - -# source://rubocop-rails//lib/rubocop/cop/rails/where_not_with_multiple_conditions.rb#27 -RuboCop::Cop::Rails::WhereNotWithMultipleConditions::RESTRICT_ON_SEND = T.let(T.unsafe(nil), Array) - -module RuboCop::Cop::Style; end - -class RuboCop::Cop::Style::InverseMethods < ::RuboCop::Cop::Base - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#70 - def inverse_block?(param0 = T.unsafe(nil)); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#61 - def inverse_candidate?(param0 = T.unsafe(nil)); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#92 - def on_block(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#78 - def on_csend(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#92 - def on_numblock(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#78 - def on_send(node); end - - private - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#177 - def camel_case_constant?(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#121 - def correct_inverse_block(corrector, node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#112 - def correct_inverse_method(corrector, node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#128 - def correct_inverse_selector(block, corrector); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#181 - def dot_range(loc); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#164 - def end_parentheses(node, method_call); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#150 - def inverse_blocks; end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#145 - def inverse_methods; end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#191 - def message(method, inverse); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#154 - def negated?(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#158 - def not_to_receiver(node, method_call); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#172 - def possible_class_hierarchy_check?(lhs, rhs, method); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/inverse_methods.rb#185 - def remove_end_parenthesis(corrector, node, method, method_call); end - - class << self - # source://rubocop-rails//lib/rubocop-rails.rb#22 - def autocorrect_incompatible_with; end - end -end - -class RuboCop::Cop::Style::MethodCallWithArgsParentheses < ::RuboCop::Cop::Base - # source://rubocop/1.59.0/lib/rubocop/cop/style/method_call_with_args_parentheses.rb#217 - def on_csend(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/method_call_with_args_parentheses.rb#217 - def on_send(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/method_call_with_args_parentheses.rb#217 - def on_super(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/method_call_with_args_parentheses.rb#217 - def on_yield(node); end - - private - - # source://rubocop/1.59.0/lib/rubocop/cop/style/method_call_with_args_parentheses.rb#226 - def args_begin(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/method_call_with_args_parentheses.rb#235 - def args_end(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/method_call_with_args_parentheses.rb#239 - def args_parenthesized?(node); end - - class << self - # source://rubocop-rails//lib/rubocop-rails.rb#30 - def autocorrect_incompatible_with; end - end -end - -class RuboCop::Cop::Style::RedundantSelf < ::RuboCop::Cop::Base - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#60 - def initialize(config = T.unsafe(nil), options = T.unsafe(nil)); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#68 - def on_and_asgn(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#86 - def on_args(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#120 - def on_block(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#90 - def on_blockarg(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#81 - def on_def(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#81 - def on_defs(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#126 - def on_if(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#104 - def on_in_pattern(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#99 - def on_lvasgn(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#94 - def on_masgn(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#120 - def on_numblock(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#74 - def on_op_asgn(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#68 - def on_or_asgn(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#108 - def on_send(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#126 - def on_until(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#126 - def on_while(node); end - - private - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#196 - def add_lhs_to_local_variables_scopes(rhs, lhs); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#204 - def add_masgn_lhs_variables(rhs, lhs); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#210 - def add_match_var_scopes(in_pattern_node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#144 - def add_scope(node, local_variables = T.unsafe(nil)); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#190 - def allow_self(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#150 - def allowed_send_node?(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#165 - def it_method_in_block?(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#181 - def on_argument(node); end - - # source://rubocop/1.59.0/lib/rubocop/cop/style/redundant_self.rb#173 - def regular_method_call?(node); end - - class << self - # source://rubocop-rails//lib/rubocop-rails.rb#38 - def autocorrect_incompatible_with; end - end -end - -# Common functionality for checking target rails version. -# -# source://rubocop-rails//lib/rubocop/cop/mixin/target_rails_version.rb#6 -module RuboCop::Cop::TargetRailsVersion - # source://rubocop-rails//lib/rubocop/cop/mixin/target_rails_version.rb#7 - def minimum_target_rails_version(version); end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/cop/mixin/target_rails_version.rb#11 - def support_target_rails_version?(version); end -end - -# RuboCop Rails project namespace -# -# source://rubocop-rails//lib/rubocop/rails.rb#5 -module RuboCop::Rails; end - -# source://rubocop-rails//lib/rubocop/rails.rb#8 -RuboCop::Rails::CONFIG = T.let(T.unsafe(nil), Hash) - -# source://rubocop-rails//lib/rubocop/rails.rb#7 -RuboCop::Rails::CONFIG_DEFAULT = T.let(T.unsafe(nil), Pathname) - -# Because RuboCop doesn't yet support plugins, we have to monkey patch in a -# bit of our configuration. -# -# source://rubocop-rails//lib/rubocop/rails/inject.rb#7 -module RuboCop::Rails::Inject - class << self - # source://rubocop-rails//lib/rubocop/rails/inject.rb#8 - def defaults!; end - end -end - -# source://rubocop-rails//lib/rubocop/rails.rb#6 -RuboCop::Rails::PROJECT_ROOT = T.let(T.unsafe(nil), Pathname) - -# It loads db/schema.rb and return Schema object. -# Cops refers database schema information with this module. -# -# source://rubocop-rails//lib/rubocop/rails/schema_loader.rb#7 -module RuboCop::Rails::SchemaLoader - extend ::RuboCop::Rails::SchemaLoader - - # source://rubocop-rails//lib/rubocop/rails/schema_loader.rb#27 - def db_schema_path; end - - # It parses `db/schema.rb` and return it. - # It returns `nil` if it can't find `db/schema.rb`. - # So a cop that uses the loader should handle `nil` properly. - # - # @return [Schema, nil] - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader.rb#15 - def load(target_ruby_version); end - - # source://rubocop-rails//lib/rubocop/rails/schema_loader.rb#21 - def reset!; end - - private - - # source://rubocop-rails//lib/rubocop/rails/schema_loader.rb#41 - def load!(target_ruby_version); end - - # source://rubocop-rails//lib/rubocop/rails/schema_loader.rb#49 - def parse(path, target_ruby_version); end -end - -# Represent an `add_index` -# -# source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#176 -class RuboCop::Rails::SchemaLoader::AddIndex < ::RuboCop::Rails::SchemaLoader::Index - # @return [AddIndex] a new instance of AddIndex - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#179 - def initialize(node); end - - # Returns the value of attribute table_name. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#177 - def table_name; end -end - -# Represent a column -# -# source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#116 -class RuboCop::Rails::SchemaLoader::Column - # @return [Column] a new instance of Column - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#119 - def initialize(node); end - - # Returns the value of attribute name. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#117 - def name; end - - # Returns the value of attribute not_null. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#117 - def not_null; end - - # Returns the value of attribute type. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#117 - def type; end - - private - - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#129 - def analyze_keywords!(node); end -end - -# Represent an index -# -# source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#140 -class RuboCop::Rails::SchemaLoader::Index - # @return [Index] a new instance of Index - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#143 - def initialize(node); end - - # Returns the value of attribute columns. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#141 - def columns; end - - # Returns the value of attribute expression. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#141 - def expression; end - - # Returns the value of attribute name. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#141 - def name; end - - # Returns the value of attribute unique. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#141 - def unique; end - - private - - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#160 - def analyze_keywords!(node); end - - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#152 - def build_columns_or_expr(columns); end -end - -# Represent db/schema.rb -# -# source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#7 -class RuboCop::Rails::SchemaLoader::Schema - # @return [Schema] a new instance of Schema - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#10 - def initialize(ast); end - - # Returns the value of attribute add_indices. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#8 - def add_indices; end - - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#23 - def add_indices_by(table_name:); end - - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#17 - def table_by(name:); end - - # Returns the value of attribute tables. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#8 - def tables; end - - private - - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#31 - def build!(ast); end - - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#59 - def each_add_index(ast); end - - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#46 - def each_table(ast); end -end - -# Represent a table -# -# source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#70 -class RuboCop::Rails::SchemaLoader::Table - # @return [Table] a new instance of Table - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#73 - def initialize(node); end - - # Returns the value of attribute columns. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#71 - def columns; end - - # Returns the value of attribute indices. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#71 - def indices; end - - # Returns the value of attribute name. - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#71 - def name; end - - # @return [Boolean] - # - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#79 - def with_column?(name:); end - - private - - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#85 - def build_columns(node); end - - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#94 - def build_indices(node); end - - # source://rubocop-rails//lib/rubocop/rails/schema_loader/schema.rb#103 - def each_content(node, &block); end -end - -# This module holds the RuboCop Rails version information. -# -# source://rubocop-rails//lib/rubocop/rails/version.rb#6 -module RuboCop::Rails::Version - class << self - # source://rubocop-rails//lib/rubocop/rails/version.rb#9 - def document_version; end - end -end - -# source://rubocop-rails//lib/rubocop/rails/version.rb#7 -RuboCop::Rails::Version::STRING = T.let(T.unsafe(nil), String) diff --git a/Library/Homebrew/sorbet/rbi/gems/tzinfo@2.0.6.rbi b/Library/Homebrew/sorbet/rbi/gems/tzinfo@2.0.6.rbi deleted file mode 100644 index dd1e432fda..0000000000 --- a/Library/Homebrew/sorbet/rbi/gems/tzinfo@2.0.6.rbi +++ /dev/null @@ -1,5917 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `tzinfo` gem. -# Please instead update this file by running `bin/tapioca gem tzinfo`. - -# The top level module for TZInfo. -# -# source://tzinfo//lib/tzinfo.rb#5 -module TZInfo - class << self - # Instructs the current {DataSource} to load all timezone and country data - # into memory (initializing the {DataSource} first if not previously - # accessed or set). - # - # This may be desirable in production environments to improve copy-on-write - # performance and to avoid flushing the constant cache every time a new - # timezone or country is loaded from {DataSources::RubyDataSource}. - # - # source://tzinfo//lib/tzinfo.rb#14 - def eager_load!; end - end -end - -# Defines transitions that occur on the zero-based nth day of the year. -# -# Day 0 is 1 January. -# -# Leap days are counted. Day 59 will be 29 February on a leap year and 1 March -# on a non-leap year. Day 365 will be 31 December on a leap year and 1 January -# the following year on a non-leap year. -# -# @private -# -# source://tzinfo//lib/tzinfo/transition_rule.rb#129 -class TZInfo::AbsoluteDayOfYearTransitionRule < ::TZInfo::DayOfYearTransitionRule - # Initializes a new {AbsoluteDayOfYearTransitionRule}. - # - # @param day [Integer] the zero-based day of the year on which the - # transition occurs (0 to 365 inclusive). - # @param transition_at [Integer] the time in seconds after midnight local - # time at which the transition occurs. - # @raise [ArgumentError] if `transition_at` is not an `Integer`. - # @raise [ArgumentError] if `day` is not an `Integer`. - # @raise [ArgumentError] if `day` is less than 0 or greater than 365. - # @return [AbsoluteDayOfYearTransitionRule] a new instance of AbsoluteDayOfYearTransitionRule - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#130 - def initialize(day, transition_at = T.unsafe(nil)); end - - # Determines if this {AbsoluteDayOfYearTransitionRule} is equal to another - # instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {AbsoluteDayOfYearTransitionRule} - # with the same {transition_at} and day as this - # {AbsoluteDayOfYearTransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#153 - def ==(r); end - - # Determines if this {AbsoluteDayOfYearTransitionRule} is equal to another - # instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {AbsoluteDayOfYearTransitionRule} - # with the same {transition_at} and day as this - # {AbsoluteDayOfYearTransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#153 - def eql?(r); end - - # @return [Boolean] `true` if the day specified by this transition is the - # first in the year (a day number of 0), otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#137 - def is_always_first_day_of_year?; end - - # @return [Boolean] `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#142 - def is_always_last_day_of_year?; end - - protected - - # Returns a `Time` representing midnight local time on the day specified by - # the rule for the given offset and year. - # - # @param offset [TimezoneOffset] the current offset at the time of the - # transition. - # @param year [Integer] the year in which the transition occurs. - # @return [Time] midnight local time on the day specified by the rule for - # the given offset and year. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#168 - def get_day(offset, year); end - - # @return [Array] an `Array` of parameters that will influence the output of - # {hash}. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#173 - def hash_args; end -end - -# {AmbiguousTime} is raised to indicate that a specified local time has more -# than one possible equivalent UTC time. Such ambiguities arise when the -# clocks are set back in a time zone, most commonly during the repeated hour -# when transitioning from daylight savings time to standard time. -# -# {AmbiguousTime} is raised by {Timezone#local_datetime}, -# {Timezone#local_time}, {Timezone#local_timestamp}, {Timezone#local_to_utc} -# and {Timezone#period_for_local} when using an ambiguous time and not -# specifying how to resolve the ambiguity. -# -# source://tzinfo//lib/tzinfo/timezone.rb#16 -class TZInfo::AmbiguousTime < ::StandardError; end - -# A set of rules that define when transitions occur in time zones with -# annually occurring daylight savings time. -# -# @private -# -# source://tzinfo//lib/tzinfo/annual_rules.rb#9 -class TZInfo::AnnualRules - # Initializes a new {AnnualRules} instance. - # - # @param std_offset [TimezoneOffset] the standard offset that applies when - # daylight savings time is not in force. - # @param dst_offset [TimezoneOffset] the offset that applies when daylight - # savings time is in force. - # @param dst_start_rule [TransitionRule] the rule that determines when - # daylight savings time starts. - # @param dst_end_rule [TransitionRule] the rule that determines when daylight - # savings time ends. - # @return [AnnualRules] a new instance of AnnualRules - # - # source://tzinfo//lib/tzinfo/annual_rules.rb#36 - def initialize(std_offset, dst_offset, dst_start_rule, dst_end_rule); end - - # @return [TransitionRule] the rule that determines when daylight savings - # time ends. - # - # source://tzinfo//lib/tzinfo/annual_rules.rb#24 - def dst_end_rule; end - - # @return [TimezoneOffset] the offset that applies when daylight savings - # time is in force. - # - # source://tzinfo//lib/tzinfo/annual_rules.rb#16 - def dst_offset; end - - # @return [TransitionRule] the rule that determines when daylight savings - # time starts. - # - # source://tzinfo//lib/tzinfo/annual_rules.rb#20 - def dst_start_rule; end - - # @return [TimezoneOffset] the standard offset that applies when daylight - # savings time is not in force. - # - # source://tzinfo//lib/tzinfo/annual_rules.rb#12 - def std_offset; end - - # Returns the transitions between standard and daylight savings time for a - # given year. The results are ordered by time of occurrence (earliest to - # latest). - # - # @param year [Integer] the year to calculate transitions for. - # @return [Array] the transitions for the year. - # - # source://tzinfo//lib/tzinfo/annual_rules.rb#49 - def transitions(year); end - - private - - # Applies a given rule between offsets on a year. - # - # @param rule [TransitionRule] the rule to apply. - # @param from_offset [TimezoneOffset] the offset the rule transitions from. - # @param to_offset [TimezoneOffset] the offset the rule transitions to. - # @param year [Integer] the year when the transition occurs. - # @return [TimezoneTransition] the transition determined by the rule. - # - # source://tzinfo//lib/tzinfo/annual_rules.rb#65 - def apply_rule(rule, from_offset, to_offset, year); end -end - -# A thread-safe version of {StringDeduper}. -# -# @private -# -# source://tzinfo//lib/tzinfo/string_deduper.rb#50 -class TZInfo::ConcurrentStringDeduper < ::TZInfo::StringDeduper - protected - - # source://tzinfo//lib/tzinfo/string_deduper.rb#53 - def create_hash(&block); end -end - -# The {Country} class represents an ISO 3166-1 country. It can be used to -# obtain a list of time zones observed by a country. For example: -# -# united_states = Country.get('US') -# united_states.zone_identifiers -# united_states.zones -# united_states.zone_info -# -# The {Country} class is thread-safe. It is safe to use class and instance -# methods of {Country} in concurrently executing threads. Instances of -# {Country} can be shared across thread boundaries. -# -# Country information available through TZInfo is intended as an aid for -# users, to help them select time zone data appropriate for their practical -# needs. It is not intended to take or endorse any position on legal or -# territorial claims. -# -# source://tzinfo//lib/tzinfo/country.rb#26 -class TZInfo::Country - include ::Comparable - - # Initializes a new {Country} based upon a {DataSources::CountryInfo} - # instance. - # - # {Country} instances should not normally be constructed directly. Use - # the {Country.get} method to obtain instances instead. - # - # @param info [DataSources::CountryInfo] the data to base the new {Country} - # instance upon. - # @return [Country] a new instance of Country - # - # source://tzinfo//lib/tzinfo/country.rb#72 - def initialize(info); end - - # Compares this {Country} with another based on their {code}. - # - # @param c [Object] an `Object` to compare this {Country} with. - # @return [Integer] -1 if `c` is less than `self`, 0 if `c` is equal to - # `self` and +1 if `c` is greater than `self`, or `nil` if `c` is not an - # instance of {Country}. - # - # source://tzinfo//lib/tzinfo/country.rb#162 - def <=>(c); end - - # Matches `regexp` against the {code} of this {Country}. - # - # @param regexp [Regexp] a `Regexp` to match against the {code} of - # this {Country}. - # @return [Integer] the position the match starts, or `nil` if there is no - # match. - # - # source://tzinfo//lib/tzinfo/country.rb#185 - def =~(regexp); end - - # Returns a serialized representation of this {Country}. This method is - # called when using `Marshal.dump` with an instance of {Country}. - # - # @param limit [Integer] the maximum depth to dump - ignored. - # @return [String] a serialized representation of this {Country}. - # - # source://tzinfo//lib/tzinfo/country.rb#194 - def _dump(limit); end - - # @return [String] the ISO 3166-1 alpha-2 country code. - # - # source://tzinfo//lib/tzinfo/country.rb#77 - def code; end - - # @param c [Object] an `Object` to compare this {Country} with. - # @return [Boolean] `true` if `c` is an instance of {Country} and has the - # same code as `self`, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/country.rb#170 - def eql?(c); end - - # @return [Integer] a hash based on the {code}. - # - # source://tzinfo//lib/tzinfo/country.rb#175 - def hash; end - - # @return [String] the internal object state as a programmer-readable - # `String`. - # - # source://tzinfo//lib/tzinfo/country.rb#94 - def inspect; end - - # @return [String] the name of the country. - # - # source://tzinfo//lib/tzinfo/country.rb#82 - def name; end - - # @return [String] a `String` representation of this {Country} (the name of - # the country). - # - # source://tzinfo//lib/tzinfo/country.rb#88 - def to_s; end - - # Returns an `Array` containing the identifier for each time zone observed - # by the country. These are in an order that - # - # 1. makes some geographical sense, and - # 2. puts the most populous zones first, where that does not contradict 1. - # - # Returned zone identifiers may refer to cities and regions outside of the - # country. This will occur if the zone covers multiple countries. Any zones - # referring to a city or region in a different country will be listed after - # those relating to this country. - # - # @return [Array] an `Array` containing the identifier for each time - # zone observed by the country - # - # source://tzinfo//lib/tzinfo/country.rb#111 - def zone_identifiers; end - - # Returns a frozen `Array` containing a {CountryTimezone} instance for each - # time zone observed by the country. These are in an order that - # - # 1. makes some geographical sense, and - # 2. puts the most populous zones first, where that does not contradict 1. - # - # The {CountryTimezone} instances can be used to obtain the location and - # descriptions of the observed time zones. - # - # Identifiers and descriptions of the time zones returned may refer to - # cities and regions outside of the country. This will occur if the time - # zone covers multiple countries. Any zones referring to a city or region in - # a different country will be listed after those relating to this country. - # - # @return [Array] a frozen `Array` containing a - # {CountryTimezone} instance for each time zone observed by the country. - # - # source://tzinfo//lib/tzinfo/country.rb#152 - def zone_info; end - - # Returns an `Array` containing the identifier for each time zone observed - # by the country. These are in an order that - # - # 1. makes some geographical sense, and - # 2. puts the most populous zones first, where that does not contradict 1. - # - # Returned zone identifiers may refer to cities and regions outside of the - # country. This will occur if the zone covers multiple countries. Any zones - # referring to a city or region in a different country will be listed after - # those relating to this country. - # - # @return [Array] an `Array` containing the identifier for each time - # zone observed by the country - # - # source://tzinfo//lib/tzinfo/country.rb#111 - def zone_names; end - - # Returns An `Array` containing a {Timezone} instance for each time zone - # observed by the country. These are in an order that - # - # 1. makes some geographical sense, and - # 2. puts the most populous zones first, where that does not contradict 1. - # - # The identifiers of the time zones returned may refer to cities and regions - # outside of the country. This will occur if the time zone covers multiple - # countries. Any zones referring to a city or region in a different country - # will be listed after those relating to this country. - # - # The results are actually instances of {TimezoneProxy} in order to defer - # loading of the time zone transition data until it is first needed. - # - # @return [Array] an `Array` containing a {Timezone} instance for - # each time zone observed by the country. - # - # source://tzinfo//lib/tzinfo/country.rb#132 - def zones; end - - class << self - # Loads a {Country} from the serialized representation returned by {_dump}. - # This is method is called when using `Marshal.load` or `Marshal.restore` - # to restore a serialized {Country}. - # - # @param data [String] a serialized representation of a {Country}. - # @return [Country] the result of converting `data` back into a {Country}. - # - # source://tzinfo//lib/tzinfo/country.rb#204 - def _load(data); end - - # @return [Array] an `Array` containing one {Country} instance - # for each defined country. - # - # source://tzinfo//lib/tzinfo/country.rb#52 - def all; end - - # @return [Array] an `Array` containing all the valid ISO 3166-1 - # alpha-2 country codes. - # - # source://tzinfo//lib/tzinfo/country.rb#46 - def all_codes; end - - # Gets a {Country} by its ISO 3166-1 alpha-2 code. - # - # The {Country.all_codes} method can be used to obtain a list of valid ISO - # 3166-1 alpha-2 codes. - # - # @param code [String] An ISO 3166-1 alpha-2 code. - # @raise [InvalidCountryCode] If {code} is not a valid ISO 3166-1 alpha-2 - # code it couldn't be found. - # @return [Country] a {Country} instance representing the ISO-3166-1 - # country identified by the `code` parameter. - # - # source://tzinfo//lib/tzinfo/country.rb#40 - def get(code); end - - private - - # @return [DataSource] the current DataSource. - # - # source://tzinfo//lib/tzinfo/country.rb#59 - def data_source; end - end -end - -# Alias used by TZInfo::Data format1 releases. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1/country_index_definition.rb#62 -TZInfo::CountryIndexDefinition = TZInfo::Format1::CountryIndexDefinition - -# Information about a time zone used by a {Country}. -# -# source://tzinfo//lib/tzinfo/country_timezone.rb#5 -class TZInfo::CountryTimezone - # Creates a new {CountryTimezone}. - # - # The passed in identifier and description instances will be frozen. - # - # {CountryTimezone} instances should normally only be constructed - # by implementations of {DataSource}. - # - # @param identifier [String] the {Timezone} identifier. - # @param latitude [Rational] the latitude of the time zone. - # @param longitude [Rational] the longitude of the time zone. - # @param description [String] an optional description of the time zone. - # @return [CountryTimezone] a new instance of CountryTimezone - # - # source://tzinfo//lib/tzinfo/country_timezone.rb#44 - def initialize(identifier, latitude, longitude, description = T.unsafe(nil)); end - - # Tests if the given object is equal to the current instance (has the same - # identifier, latitude, longitude and description). - # - # @param ct [Object] the object to be compared. - # @return [TrueClass] `true` if `ct` is equal to the current instance. - # - # source://tzinfo//lib/tzinfo/country_timezone.rb#72 - def ==(ct); end - - # A description of this time zone in relation to the country, e.g. "Eastern - # Time". This is usually `nil` for countries that have a single time zone. - # - # @return [String] an optional description of the time zone. - # - # source://tzinfo//lib/tzinfo/country_timezone.rb#31 - def description; end - - # @return [String] the {description} if present, otherwise a human-readable - # representation of the identifier (using {Timezone#friendly_identifier}). - # - # source://tzinfo//lib/tzinfo/country_timezone.rb#63 - def description_or_friendly_identifier; end - - # Tests if the given object is equal to the current instance (has the same - # identifier, latitude, longitude and description). - # - # @param ct [Object] the object to be compared. - # @return [Boolean] `true` if `ct` is equal to the current instance. - # - # source://tzinfo//lib/tzinfo/country_timezone.rb#83 - def eql?(ct); end - - # {longitude} and {description}. - # - # @return [Integer] a hash based on the {identifier}, {latitude}, - # - # source://tzinfo//lib/tzinfo/country_timezone.rb#89 - def hash; end - - # @return [String] the identifier of the {Timezone} being described. - # - # source://tzinfo//lib/tzinfo/country_timezone.rb#7 - def identifier; end - - # The latitude of this time zone in degrees. Positive numbers are degrees - # north and negative numbers are degrees south. - # - # Note that depending on the data source, the position given by {#latitude} - # and {#longitude} may not be within the country. - # - # @return [Rational] the latitude in degrees. - # - # source://tzinfo//lib/tzinfo/country_timezone.rb#16 - def latitude; end - - # The longitude of this time zone in degrees. Positive numbers are degrees - # east and negative numbers are degrees west. - # - # Note that depending on the data source, the position given by {#latitude} - # and {#longitude} may not be within the country. - # - # @return [Rational] the longitude in degrees. - # - # source://tzinfo//lib/tzinfo/country_timezone.rb#25 - def longitude; end - - # Returns the associated {Timezone}. - # - # The result is actually an instance of {TimezoneProxy} in order to defer - # loading of the time zone transition data until it is first needed. - # - # @return [Timezone] the associated {Timezone}. - # - # source://tzinfo//lib/tzinfo/country_timezone.rb#57 - def timezone; end -end - -# TZInfo can be used with different data sources for time zone and country -# data. Each source of data is implemented as a subclass of {DataSource}. -# -# To choose a data source and override the default selection, use the -# {DataSource.set} method. -# -# @abstract To create a custom data source, create a subclass of {DataSource} -# and implement the {load_timezone_info}, {data_timezone_identifiers}, -# {linked_timezone_identifiers}, {load_country_info} and {country_codes} -# methods. -# -# source://tzinfo//lib/tzinfo/data_source.rb#29 -class TZInfo::DataSource - # Initializes a new {DataSource} instance. Typically only called via - # subclasses of {DataSource}. - # - # @return [DataSource] a new instance of DataSource - # - # source://tzinfo//lib/tzinfo/data_source.rb#166 - def initialize; end - - # Returns a frozen `Array` of all the available ISO 3166-1 alpha-2 country - # codes. The identifiers are sorted according to `String#<=>`. - # - # @return [Array] a frozen `Array` of all the available ISO 3166-1 - # alpha-2 country codes. - # - # source://tzinfo//lib/tzinfo/data_source.rb#246 - def country_codes; end - - # Returns a frozen `Array` of all the available time zone identifiers for - # data time zones (i.e. those that actually contain definitions). The - # identifiers are sorted according to `String#<=>`. - # - # @return [Array] a frozen `Array` of all the available time zone - # identifiers for data time zones. - # - # source://tzinfo//lib/tzinfo/data_source.rb#218 - def data_timezone_identifiers; end - - # Loads all timezone and country data into memory. - # - # This may be desirable in production environments to improve copy-on-write - # performance and to avoid flushing the constant cache every time a new - # timezone or country is loaded from {DataSources::RubyDataSource}. - # - # source://tzinfo//lib/tzinfo/data_source.rb#255 - def eager_load!; end - - # @param code [String] an ISO 3166-1 alpha-2 country code. - # @raise [InvalidCountryCode] if the country could not be found or the code - # is invalid. - # @return [DataSources::CountryInfo] a {DataSources::CountryInfo} instance - # for the given ISO 3166-1 alpha-2 country code. - # - # source://tzinfo//lib/tzinfo/data_source.rb#237 - def get_country_info(code); end - - # Returns a {DataSources::TimezoneInfo} instance for the given identifier. - # The result will derive from either {DataSources::DataTimezoneInfo} for - # time zones that define their own data or {DataSources::LinkedTimezoneInfo} - # for links or aliases to other time zones. - # - # {get_timezone_info} calls {load_timezone_info} to create the - # {DataSources::TimezoneInfo} instance. The returned instance is cached and - # returned in subsequent calls to {get_timezone_info} for the identifier. - # - # @param identifier [String] A time zone identifier. - # @raise [InvalidTimezoneIdentifier] if the time zone is not found or the - # identifier is invalid. - # @return [DataSources::TimezoneInfo] a {DataSources::TimezoneInfo} instance - # for a given identifier. - # - # source://tzinfo//lib/tzinfo/data_source.rb#184 - def get_timezone_info(identifier); end - - # @return [String] the internal object state as a programmer-readable - # `String`. - # - # source://tzinfo//lib/tzinfo/data_source.rb#268 - def inspect; end - - # Returns a frozen `Array` of all the available time zone identifiers that - # are links to other time zones. The identifiers are sorted according to - # `String#<=>`. - # - # @return [Array] a frozen `Array` of all the available time zone - # identifiers that are links to other time zones. - # - # source://tzinfo//lib/tzinfo/data_source.rb#228 - def linked_timezone_identifiers; end - - # @return [Array] a frozen `Array`` of all the available time zone - # identifiers. The identifiers are sorted according to `String#<=>`. - # - # source://tzinfo//lib/tzinfo/data_source.rb#204 - def timezone_identifiers; end - - # @return [String] a description of the {DataSource}. - # - # source://tzinfo//lib/tzinfo/data_source.rb#262 - def to_s; end - - protected - - # @param code [String] an ISO 3166-1 alpha-2 country code. - # @raise [InvalidCountryCode] if the country could not be found or the code - # is invalid. - # @return [DataSources::CountryInfo] a {DataSources::CountryInfo} instance - # for the given ISO 3166-1 alpha-2 country code. - # - # source://tzinfo//lib/tzinfo/data_source.rb#294 - def load_country_info(code); end - - # Returns a {DataSources::TimezoneInfo} instance for the given time zone - # identifier. The result should derive from either - # {DataSources::DataTimezoneInfo} for time zones that define their own data - # or {DataSources::LinkedTimezoneInfo} for links to or aliases for other - # time zones. - # - # @param identifier [String] A time zone identifier. - # @raise [InvalidTimezoneIdentifier] if the time zone is not found or the - # identifier is invalid. - # @return [DataSources::TimezoneInfo] a {DataSources::TimezoneInfo} instance - # for the given time zone identifier. - # - # source://tzinfo//lib/tzinfo/data_source.rb#285 - def load_timezone_info(identifier); end - - # Looks up a given code in the given hash of code to - # {DataSources::CountryInfo} mappings. If the code is found the - # {DataSources::CountryInfo} is returned. Otherwise an {InvalidCountryCode} - # exception is raised. - # - # @param hash [String, DataSources::CountryInfo] a mapping from ISO 3166-1 - # alpha-2 country codes to {DataSources::CountryInfo} instances. - # @param code [String] a country code to lookup. - # @param encoding [Encoding] the encoding used for the country codes in - # `hash`. - # @raise [InvalidCountryCode] if `code` was not found in `hash`. - # @return [DataSources::CountryInfo] the {DataSources::CountryInfo} instance - # corresponding to `code`. - # - # source://tzinfo//lib/tzinfo/data_source.rb#337 - def lookup_country_info(hash, code, encoding = T.unsafe(nil)); end - - # @return [Encoding] the `Encoding` used by the `String` instances returned - # by {data_timezone_identifiers} and {linked_timezone_identifiers}. - # - # source://tzinfo//lib/tzinfo/data_source.rb#300 - def timezone_identifier_encoding; end - - # Checks that the given identifier is a valid time zone identifier (can be - # found in the {timezone_identifiers} `Array`). If the identifier is valid, - # the `String` instance representing that identifier from - # `timezone_identifiers` is returned. Otherwise an - # {InvalidTimezoneIdentifier} exception is raised. - # - # @param identifier [String] a time zone identifier to be validated. - # @raise [InvalidTimezoneIdentifier] if `identifier` was not found in - # {timezone_identifiers}. - # @return [String] the `String` instance equivalent to `identifier` from - # {timezone_identifiers}. - # - # source://tzinfo//lib/tzinfo/data_source.rb#315 - def validate_timezone_identifier(identifier); end - - private - - # Combines {data_timezone_identifiers} and {linked_timezone_identifiers} - # to create an `Array` containing all valid time zone identifiers. If - # {linked_timezone_identifiers} is empty, the {data_timezone_identifiers} - # instance is returned. - # - # The returned `Array` is frozen. The identifiers are sorted according to - # `String#<=>`. - # - # @return [Array] an `Array` containing all valid time zone - # identifiers. - # - # source://tzinfo//lib/tzinfo/data_source.rb#366 - def build_timezone_identifiers; end - - # If the given `identifier` is contained within the {timezone_identifiers} - # `Array`, the `String` instance representing that identifier from - # {timezone_identifiers} is returned. Otherwise, `nil` is returned. - # - # :nocov_array_bsearch: - # - # @param identifier [String] A time zone identifier to search for. - # @return [String] the `String` instance representing `identifier` from - # {timezone_identifiers} if found, or `nil` if not found. - # - # source://tzinfo//lib/tzinfo/data_source.rb#382 - def find_timezone_identifier(identifier); end - - # Raises {InvalidDataSource} to indicate that a method has not been - # overridden by a particular data source implementation. - # - # @raise [InvalidDataSource] always. - # - # source://tzinfo//lib/tzinfo/data_source.rb#352 - def raise_invalid_data_source(method_name); end - - # Tries an operation using `string` directly. If the operation fails, the - # string is copied and encoded with `encoding` and the operation is tried - # again. - # - # fails and `string` is already encoded with `encoding`. - # - # @param string [String] The `String` to perform the operation on. - # @param encoding [Encoding] The `Encoding` to use if the initial attempt - # fails. - # @return [Object] the result of the operation or `nil` if the first attempt - # @yield [s] the caller will be yielded to once or twice to attempt the - # operation. - # @yieldparam s [String] either `string` or an encoded copy of `string`. - # @yieldreturn [Object] The result of the operation. Must be truthy if - # successful. - # - # source://tzinfo//lib/tzinfo/data_source.rb#436 - def try_with_encoding(string, encoding); end - - class << self - # @return [DataSource] the currently selected source of data. - # - # source://tzinfo//lib/tzinfo/data_source.rb#42 - def get; end - - # Sets the currently selected data source for time zone and country data. - # - # This should usually be set to one of the two standard data source types: - # - # * `:ruby` - read data from the Ruby modules included in the TZInfo::Data - # library (tzinfo-data gem). - # * `:zoneinfo` - read data from the zoneinfo files included with most - # Unix-like operating systems (e.g. in /usr/share/zoneinfo). - # - # To set TZInfo to use one of the standard data source types, call - # `TZInfo::DataSource.set`` in one of the following ways: - # - # TZInfo::DataSource.set(:ruby) - # TZInfo::DataSource.set(:zoneinfo) - # TZInfo::DataSource.set(:zoneinfo, zoneinfo_dir) - # TZInfo::DataSource.set(:zoneinfo, zoneinfo_dir, iso3166_tab_file) - # - # `DataSource.set(:zoneinfo)` will automatically search for the zoneinfo - # directory by checking the paths specified in - # {DataSources::ZoneinfoDataSource.search_path}. - # {DataSources::ZoneinfoDirectoryNotFound} will be raised if no valid - # zoneinfo directory could be found. - # - # `DataSource.set(:zoneinfo, zoneinfo_dir)` uses the specified - # `zoneinfo_dir` directory as the data source. If the directory is not a - # valid zoneinfo directory, a {DataSources::InvalidZoneinfoDirectory} - # exception will be raised. - # - # `DataSource.set(:zoneinfo, zoneinfo_dir, iso3166_tab_file)` uses the - # specified `zoneinfo_dir` directory as the data source, but loads the - # `iso3166.tab` file from the path given by `iso3166_tab_file`. If the - # directory is not a valid zoneinfo directory, a - # {DataSources::InvalidZoneinfoDirectory} exception will be raised. - # - # Custom data sources can be created by subclassing TZInfo::DataSource and - # implementing the following methods: - # - # * {load_timezone_info} - # * {data_timezone_identifiers} - # * {linked_timezone_identifiers} - # * {load_country_info} - # * {country_codes} - # - # To have TZInfo use the custom data source, call {DataSource.set}, - # passing an instance of the custom data source implementation as follows: - # - # TZInfo::DataSource.set(CustomDataSource.new) - # - # Calling {DataSource.set} will only affect instances of {Timezone} and - # {Country} obtained with {Timezone.get} and {Country.get} subsequent to - # the {DataSource.set} call. Existing {Timezone} and {Country} instances - # will be unaffected. - # - # If {DataSource.set} is not called, TZInfo will by default attempt to use - # TZInfo::Data as the data source. If TZInfo::Data is not available (i.e. - # if `require 'tzinfo/data'` fails), then TZInfo will search for a - # zoneinfo directory instead (using the search path specified by - # {DataSources::ZoneinfoDataSource.search_path}). - # - # @param data_source_or_type [Object] either `:ruby`, `:zoneinfo` or an - # instance of a {DataSource}. - # @param args [Array] when `data_source_or_type` is a symbol, - # optional arguments to use when initializing the data source. - # @raise [ArgumentError] if `data_source_or_type` is not `:ruby`, - # `:zoneinfo` or an instance of {DataSource}. - # - # source://tzinfo//lib/tzinfo/data_source.rb#127 - def set(data_source_or_type, *args); end - - private - - # Creates a {DataSource} instance for use as the default. Used if no - # preference has been specified manually. - # - # @return [DataSource] the newly created default {DataSource} instance. - # - # source://tzinfo//lib/tzinfo/data_source.rb#145 - def create_default_data_source; end - end -end - -# {DataSourceNotFound} is raised if no data source could be found (i.e. if -# `'tzinfo/data'` cannot be found on the load path and no valid zoneinfo -# directory can be found on the system). -# -# source://tzinfo//lib/tzinfo/data_source.rb#16 -class TZInfo::DataSourceNotFound < ::StandardError; end - -# {DataSource} implementations and classes used by {DataSource} -# implementations. -# -# source://tzinfo//lib/tzinfo/data_sources.rb#6 -module TZInfo::DataSources; end - -# Represents a data time zone defined by a constantly observed offset. -# -# source://tzinfo//lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb#8 -class TZInfo::DataSources::ConstantOffsetDataTimezoneInfo < ::TZInfo::DataSources::DataTimezoneInfo - # Initializes a new {ConstantOffsetDataTimezoneInfo}. - # - # The passed in `identifier` instance will be frozen. A reference to the - # passed in {TimezoneOffset} will be retained. - # - # @param identifier [String] the identifier of the time zone. - # @param constant_offset [TimezoneOffset] the constantly observed offset. - # @raise [ArgumentError] if `identifier` or `constant_offset` is `nil`. - # @return [ConstantOffsetDataTimezoneInfo] a new instance of ConstantOffsetDataTimezoneInfo - # - # source://tzinfo//lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb#19 - def initialize(identifier, constant_offset); end - - # @return [TimezoneOffset] the offset that is constantly observed. - # - # source://tzinfo//lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb#9 - def constant_offset; end - - # @param timestamp [Timestamp] ignored. - # @return [TimezonePeriod] an unbounded {TimezonePeriod} for the time - # zone's constantly observed offset. - # - # source://tzinfo//lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb#28 - def period_for(timestamp); end - - # @param local_timestamp [Timestamp] ignored. - # @return [Array] an `Array` containing a single unbounded - # {TimezonePeriod} for the time zone's constantly observed offset. - # - # source://tzinfo//lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb#35 - def periods_for_local(local_timestamp); end - - # @param to_timestamp [Timestamp] ignored. - # @param from_timestamp [Timestamp] ignored. - # @return [Array] an empty `Array`, since there are no transitions in time - # zones that observe a constant offset. - # - # source://tzinfo//lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb#43 - def transitions_up_to(to_timestamp, from_timestamp = T.unsafe(nil)); end - - private - - # @return [TimezonePeriod] an unbounded {TimezonePeriod} with the constant - # offset of this timezone. - # - # source://tzinfo//lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb#51 - def constant_period; end -end - -# Represents a country and references to its time zones as returned by a -# {DataSource}. -# -# source://tzinfo//lib/tzinfo/data_sources/country_info.rb#8 -class TZInfo::DataSources::CountryInfo - # Initializes a new {CountryInfo}. The passed in `code`, `name` and - # `zones` instances will be frozen. - # - # @param code [String] an ISO 3166-1 alpha-2 country code. - # @param name [String] the name of the country. - # @param zones [Array] the time zones observed in the - # country. - # @raise [ArgumentError] if `code`, `name` or `zones` is `nil`. - # @return [CountryInfo] a new instance of CountryInfo - # - # source://tzinfo//lib/tzinfo/data_sources/country_info.rb#26 - def initialize(code, name, zones); end - - # @return [String] the ISO 3166-1 alpha-2 country code. - # - # source://tzinfo//lib/tzinfo/data_sources/country_info.rb#10 - def code; end - - # @return [String] the internal object state as a programmer-readable - # `String`. - # - # source://tzinfo//lib/tzinfo/data_sources/country_info.rb#37 - def inspect; end - - # @return [String] the name of the country. - # - # source://tzinfo//lib/tzinfo/data_sources/country_info.rb#13 - def name; end - - # @return [Array] the time zones observed in the country. - # - # source://tzinfo//lib/tzinfo/data_sources/country_info.rb#16 - def zones; end -end - -# The base class for time zones defined as either a series of transitions -# ({TransitionsDataTimezoneInfo}) or a constantly observed offset -# ({ConstantOffsetDataTimezoneInfo}). -# -# @abstract Data sources return instances of {DataTimezoneInfo} subclasses. -# -# source://tzinfo//lib/tzinfo/data_sources/data_timezone_info.rb#17 -class TZInfo::DataSources::DataTimezoneInfo < ::TZInfo::DataSources::TimezoneInfo - # @return [DataTimezone] a new {DataTimezone} instance for the time zone - # represented by this {DataTimezoneInfo}. - # - # source://tzinfo//lib/tzinfo/data_sources/data_timezone_info.rb#76 - def create_timezone; end - - # @param timestamp [Timestamp] a {Timestamp} with a specified - # {Timestamp#utc_offset utc_offset}. - # @raise [ArgumentError] may be raised if `timestamp` is `nil` or does not - # have a specified {Timestamp#utc_offset utc_offset}. - # @return [TimezonePeriod] the {TimezonePeriod} observed at the time - # specified by `timestamp`. - # - # source://tzinfo//lib/tzinfo/data_sources/data_timezone_info.rb#18 - def period_for(timestamp); end - - # Returns an `Array` containing the {TimezonePeriod TimezonePeriods} that - # could be observed at the local time specified by `local_timestamp`. The - # results are are ordered by increasing UTC start date. An empty `Array` - # is returned if no periods are found for the given local time. - # - # @param local_timestamp [Timestamp] a {Timestamp} representing a local - # time - must have an unspecified {Timestamp#utc_offset utc_offset}. - # @raise [ArgumentError] may be raised if `local_timestamp` is `nil`, or - # has a specified {Timestamp#utc_offset utc_offset}. - # @return [Array] an `Array` containing the - # {TimezonePeriod TimezonePeriods} that could be observed at the local - # time specified by `local_timestamp`. - # - # source://tzinfo//lib/tzinfo/data_sources/data_timezone_info.rb#34 - def periods_for_local(local_timestamp); end - - # Returns an `Array` of {TimezoneTransition} instances representing the - # times where the UTC offset of the time zone changes. - # - # Transitions are returned up to a given {Timestamp} (`to_timestamp`). - # - # A from {Timestamp} may also be supplied using the `from_timestamp` - # parameter. If `from_timestamp` is specified, only transitions from that - # time onwards will be returned. - # - # Comparisons with `to_timestamp` are exclusive. Comparisons with - # `from_timestamp` are inclusive. If a transition falls precisely on - # `to_timestamp`, it will be excluded. If a transition falls on - # `from_timestamp`, it will be included. - # - # Transitions returned are ordered by when they occur, from earliest to - # latest. - # - # @param to_timestamp [Timestamp] a {Timestamp} with a specified - # {Timestamp#utc_offset utc_offset}. Transitions are returned if they - # occur before this time. - # @param from_timestamp [Timestamp] an optional {Timestamp} with a - # specified {Timestamp#utc_offset utc_offset}. If specified, transitions - # are returned if they occur at or after this time. - # @raise [ArgumentError] may be raised if `to_timestamp` is `nil` or does - # not have a specified {Timestamp#utc_offset utc_offset}. - # @raise [ArgumentError] may be raised if `from_timestamp` is specified - # but does not have a specified {Timestamp#utc_offset utc_offset}. - # @raise [ArgumentError] may be raised if `from_timestamp` is specified - # but is not earlier than or at the same time as `to_timestamp`. - # @return [Array] an `Array` of {TimezoneTransition} - # instances representing the times where the UTC offset of the time zone - # changes. - # - # source://tzinfo//lib/tzinfo/data_sources/data_timezone_info.rb#70 - def transitions_up_to(to_timestamp, from_timestamp = T.unsafe(nil)); end - - private - - # Raises a {NotImplementedError} to indicate that the base class is - # incorrectly being used directly. - # - # raise [NotImplementedError] always. - # - # @raise [NotImplementedError] - # - # source://tzinfo//lib/tzinfo/data_sources/data_timezone_info.rb#86 - def raise_not_implemented(method_name); end -end - -# An {InvalidPosixTimeZone} exception is raised if an invalid POSIX-style -# time zone string is encountered. -# -# @private -# -# source://tzinfo//lib/tzinfo/data_sources/posix_time_zone_parser.rb#12 -class TZInfo::DataSources::InvalidPosixTimeZone < ::StandardError; end - -# An {InvalidZoneinfoDirectory} exception is raised if {ZoneinfoDataSource} -# is initialized with a specific zoneinfo path that is not a valid zoneinfo -# directory. A valid zoneinfo directory is one that contains time zone -# files, a country code index file named iso3166.tab and a time zone index -# file named zone1970.tab or zone.tab. -# -# source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#11 -class TZInfo::DataSources::InvalidZoneinfoDirectory < ::StandardError; end - -# An {InvalidZoneinfoFile} exception is raised if an attempt is made to load -# an invalid zoneinfo file. -# -# source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#8 -class TZInfo::DataSources::InvalidZoneinfoFile < ::StandardError; end - -# Represents a time zone that is defined as a link to or alias of another -# zone. -# -# source://tzinfo//lib/tzinfo/data_sources/linked_timezone_info.rb#9 -class TZInfo::DataSources::LinkedTimezoneInfo < ::TZInfo::DataSources::TimezoneInfo - # Initializes a new {LinkedTimezoneInfo}. The passed in `identifier` and - # `link_to_identifier` instances will be frozen. - # - # `nil`. - # - # @param identifier [String] the identifier of the time zone. - # @param link_to_identifier [String] the identifier of the time zone that - # this zone link to. - # @raise [ArgumentError] if `identifier` or `link_to_identifier` are - # @return [LinkedTimezoneInfo] a new instance of LinkedTimezoneInfo - # - # source://tzinfo//lib/tzinfo/data_sources/linked_timezone_info.rb#20 - def initialize(identifier, link_to_identifier); end - - # @return [LinkedTimezone] a new {LinkedTimezone} instance for the time - # zone represented by this {LinkedTimezoneInfo}. - # - # source://tzinfo//lib/tzinfo/data_sources/linked_timezone_info.rb#28 - def create_timezone; end - - # (that this zone links to or is an alias for). - # - # @return [String] the identifier of the time zone that provides the data - # - # source://tzinfo//lib/tzinfo/data_sources/linked_timezone_info.rb#10 - def link_to_identifier; end -end - -# A parser for POSIX-style TZ strings used in zoneinfo files and specified -# by tzfile.5 and tzset.3. -# -# @private -# -# source://tzinfo//lib/tzinfo/data_sources/posix_time_zone_parser.rb#20 -class TZInfo::DataSources::PosixTimeZoneParser - # Initializes a new {PosixTimeZoneParser}. - # - # @param string_deduper [StringDeduper] a {StringDeduper} instance to use - # to dedupe abbreviations. - # @return [PosixTimeZoneParser] a new instance of PosixTimeZoneParser - # - # source://tzinfo//lib/tzinfo/data_sources/posix_time_zone_parser.rb#25 - def initialize(string_deduper); end - - # Parses a POSIX-style TZ string. - # - # @param tz_string [String] the string to parse. - # @raise [InvalidPosixTimeZone] if `tz_string` is not a `String`. - # @raise [InvalidPosixTimeZone] if `tz_string` is is not valid. - # @return [Object] either a {TimezoneOffset} for a constantly applied - # offset or an {AnnualRules} instance representing the rules. - # - # source://tzinfo//lib/tzinfo/data_sources/posix_time_zone_parser.rb#36 - def parse(tz_string); end - - private - - # Scans for a pattern and raises an exception if the pattern does not - # match the input. - # - # @param s [StringScanner] the `StringScanner` to scan. - # @param pattern [Regexp] the pattern to match. - # @raise [InvalidPosixTimeZone] if the pattern does not match the input. - # @return [String] the result of the scan. - # - # source://tzinfo//lib/tzinfo/data_sources/posix_time_zone_parser.rb#169 - def check_scan(s, pattern); end - - # Returns an offset in seconds from hh:mm:ss values. The value can be - # negative. -02:33:12 would represent 2 hours, 33 minutes and 12 seconds - # ahead of UTC. - # - # @param h [String] the hours. - # @param m [String] the minutes. - # @param s [String] the seconds. - # @raise [InvalidPosixTimeZone] if the mm and ss values are greater than - # 59. - # @return [Integer] the offset. - # - # source://tzinfo//lib/tzinfo/data_sources/posix_time_zone_parser.rb#132 - def get_offset_from_hms(h, m, s); end - - # Returns the seconds from midnight from hh:mm:ss values. Hours can exceed - # 24 for a time on the following day. Hours can be negative to subtract - # hours from midnight on the given day. -02:33:12 represents 22:33:12 on - # the prior day. - # - # @param h [String] the hour. - # @param m [String] the minutes past the hour. - # @param s [String] the seconds past the minute. - # @raise [InvalidPosixTimeZone] if the mm and ss values are greater than - # 59. - # @return [Integer] the number of seconds after midnight. - # - # source://tzinfo//lib/tzinfo/data_sources/posix_time_zone_parser.rb#153 - def get_seconds_after_midnight_from_hms(h, m, s); end - - # Parses a rule. - # - # @param s [StringScanner] the `StringScanner` to read the rule from. - # @param type [String] the type of rule (either `'start'` or `'end'`). - # @raise [InvalidPosixTimeZone] if the rule is not valid. - # @return [TransitionRule] the parsed rule. - # - # source://tzinfo//lib/tzinfo/data_sources/posix_time_zone_parser.rb#92 - def parse_rule(s, type); end -end - -# A DataSource implementation that loads data from the set of Ruby modules -# included in the tzinfo-data gem. -# -# TZInfo will use {RubyDataSource} by default if the tzinfo-data gem -# is available on the load path. It can also be selected by calling -# {DataSource.set} as follows: -# -# TZInfo::DataSource.set(:ruby) -# -# source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#21 -class TZInfo::DataSources::RubyDataSource < ::TZInfo::DataSource - # Initializes a new {RubyDataSource} instance. - # - # @raise [TZInfoDataNotFound] if the tzinfo-data gem could not be found - # (i.e. `require 'tzinfo/data'` failed). - # @return [RubyDataSource] a new instance of RubyDataSource - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#34 - def initialize; end - - # Returns a frozen `Array` of all the available ISO 3166-1 alpha-2 country - # codes. The identifiers are sorted according to `String#<=>`. - # - # @return [Array] a frozen `Array` of all the available ISO 3166-1 - # alpha-2 country codes. - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#28 - def country_codes; end - - # Returns a frozen `Array` of all the available time zone identifiers for - # data time zones (i.e. those that actually contain definitions). The - # identifiers are sorted according to `String#<=>`. - # - # @return [Array] a frozen `Array` of all the available time zone - # identifiers for data time zones. - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#22 - def data_timezone_identifiers; end - - # @return [String] the internal object state as a programmer-readable - # `String`. - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#72 - def inspect; end - - # Returns a frozen `Array` of all the available time zone identifiers that - # are links to other time zones. The identifiers are sorted according to - # `String#<=>`. - # - # @return [Array] a frozen `Array` of all the available time zone - # identifiers that are links to other time zones. - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#25 - def linked_timezone_identifiers; end - - # @return [String] a description of the {DataSource}. - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#67 - def to_s; end - - protected - - # @param code [String] an ISO 3166-1 alpha-2 country code. - # @raise [InvalidCountryCode] if the country could not be found or the code - # is invalid. - # @return [DataSources::CountryInfo] a {DataSources::CountryInfo} instance - # for the given ISO 3166-1 alpha-2 country code. - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#104 - def load_country_info(code); end - - # Returns a {TimezoneInfo} instance for the given time zone identifier. - # The result will either be a {ConstantOffsetDataTimezoneInfo}, a - # {TransitionsDataTimezoneInfo} or a {LinkedTimezoneInfo} depending on the - # type of time zone. - # - # @param identifier [String] A time zone identifier. - # @raise [InvalidTimezoneIdentifier] if the time zone is not found or the - # identifier is invalid. - # @return [TimezoneInfo] a {TimezoneInfo} instance for the given time zone - # identifier. - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#88 - def load_timezone_info(identifier); end - - private - - # Requires a file from tzinfo/data. - # - # @param file [Array] a relative path to a file to be required. - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#128 - def require_data(*file); end - - # Requires a zone definition by its identifier (split on /). - # - # @param identifier [Array] the component parts of a time zone - # identifier (split on /). This must have already been validated. - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#114 - def require_definition(identifier); end - - # Requires an index by its name. - # - # @param name [String] an index name. - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#121 - def require_index(name); end - - # @return [String] a `String` containing TZInfo::Data version infomation - # for inclusion in the #to_s and #inspect output. - # - # source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#134 - def version_info; end -end - -# A {TZInfoDataNotFound} exception is raised if the tzinfo-data gem could -# not be found (i.e. `require 'tzinfo/data'` failed) when selecting the Ruby -# data source. -# -# source://tzinfo//lib/tzinfo/data_sources/ruby_data_source.rb#9 -class TZInfo::DataSources::TZInfoDataNotFound < ::StandardError; end - -# Represents a time zone defined by a data source. -# -# @abstract Data sources return instances of {TimezoneInfo} subclasses. -# -# source://tzinfo//lib/tzinfo/data_sources/timezone_info.rb#9 -class TZInfo::DataSources::TimezoneInfo - # Initializes a new TimezoneInfo. The passed in `identifier` instance will - # be frozen. - # - # @param identifier [String] the identifier of the time zone. - # @raise [ArgumentError] if `identifier` is `nil`. - # @return [TimezoneInfo] a new instance of TimezoneInfo - # - # source://tzinfo//lib/tzinfo/data_sources/timezone_info.rb#18 - def initialize(identifier); end - - # @return [Timezone] a new {Timezone} instance for the time zone - # represented by this {TimezoneInfo}. - # - # source://tzinfo//lib/tzinfo/data_sources/timezone_info.rb#31 - def create_timezone; end - - # @return [String] the identifier of the time zone. - # - # source://tzinfo//lib/tzinfo/data_sources/timezone_info.rb#11 - def identifier; end - - # @return [String] the internal object state as a programmer-readable - # `String`. - # - # source://tzinfo//lib/tzinfo/data_sources/timezone_info.rb#25 - def inspect; end - - private - - # Raises a {NotImplementedError}. - # - # @param method_name [String] the name of the method that must be - # overridden. - # @raise NotImplementedError always. - # - # source://tzinfo//lib/tzinfo/data_sources/timezone_info.rb#42 - def raise_not_implemented(method_name); end -end - -# Represents a data time zone defined by a list of transitions that change -# the locally observed time. -# -# source://tzinfo//lib/tzinfo/data_sources/transitions_data_timezone_info.rb#10 -class TZInfo::DataSources::TransitionsDataTimezoneInfo < ::TZInfo::DataSources::DataTimezoneInfo - # Initializes a new {TransitionsDataTimezoneInfo}. - # - # The passed in `identifier` instance will be frozen. A reference to the - # passed in `Array` will be retained. - # - # The `transitions` `Array` must be sorted in order of ascending - # timestamp. Each transition must have a - # {TimezoneTransition#timestamp_value timestamp_value} that is greater - # than the {TimezoneTransition#timestamp_value timestamp_value} of the - # prior transition. - # - # @param identifier [String] the identifier of the time zone. - # @param transitions [Array] an `Array` of - # transitions that each indicate when a change occurs in the locally - # observed time. - # @raise [ArgumentError] if `identifier` is `nil`. - # @raise [ArgumentError] if `transitions` is `nil`. - # @raise [ArgumentError] if `transitions` is an empty `Array`. - # @return [TransitionsDataTimezoneInfo] a new instance of TransitionsDataTimezoneInfo - # - # source://tzinfo//lib/tzinfo/data_sources/transitions_data_timezone_info.rb#31 - def initialize(identifier, transitions); end - - # @param timestamp [Timestamp] a {Timestamp} with a specified - # {Timestamp#utc_offset utc_offset}. - # @raise [ArgumentError] may be raised if `timestamp` is `nil` or does not - # have a specified {Timestamp#utc_offset utc_offset}. - # @return [TimezonePeriod] the {TimezonePeriod} observed at the time - # specified by `timestamp`. - # - # source://tzinfo//lib/tzinfo/data_sources/transitions_data_timezone_info.rb#39 - def period_for(timestamp); end - - # Returns an `Array` containing the {TimezonePeriod TimezonePeriods} that - # could be observed at the local time specified by `local_timestamp`. The - # results are are ordered by increasing UTC start date. An empty `Array` - # is returned if no periods are found for the given local time. - # - # @param local_timestamp [Timestamp] a {Timestamp} representing a local - # time - must have an unspecified {Timestamp#utc_offset utc_offset}. - # @raise [ArgumentError] may be raised if `local_timestamp` is `nil`, or - # has a specified {Timestamp#utc_offset utc_offset}. - # @return [Array] an `Array` containing the - # {TimezonePeriod TimezonePeriods} that could be observed at the local - # time specified by `local_timestamp`. - # - # source://tzinfo//lib/tzinfo/data_sources/transitions_data_timezone_info.rb#70 - def periods_for_local(local_timestamp); end - - # @return [Array] the transitions that define this - # time zone in order of ascending timestamp. - # - # source://tzinfo//lib/tzinfo/data_sources/transitions_data_timezone_info.rb#11 - def transitions; end - - # Returns an `Array` of {TimezoneTransition} instances representing the - # times where the UTC offset of the time zone changes. - # - # Transitions are returned up to a given {Timestamp} (`to_timestamp`). - # - # A from {Timestamp} may also be supplied using the `from_timestamp` - # parameter. If `from_timestamp` is specified, only transitions from that - # time onwards will be returned. - # - # Comparisons with `to_timestamp` are exclusive. Comparisons with - # `from_timestamp` are inclusive. If a transition falls precisely on - # `to_timestamp`, it will be excluded. If a transition falls on - # `from_timestamp`, it will be included. - # - # Transitions returned are ordered by when they occur, from earliest to - # latest. - # - # @param to_timestamp [Timestamp] a {Timestamp} with a specified - # {Timestamp#utc_offset utc_offset}. Transitions are returned if they - # occur before this time. - # @param from_timestamp [Timestamp] an optional {Timestamp} with a - # specified {Timestamp#utc_offset utc_offset}. If specified, transitions - # are returned if they occur at or after this time. - # @raise [ArgumentError] may be raised if `to_timestamp` is `nil` or does - # not have a specified {Timestamp#utc_offset utc_offset}. - # @raise [ArgumentError] may be raised if `from_timestamp` is specified - # but does not have a specified {Timestamp#utc_offset utc_offset}. - # @raise [ArgumentError] may be raised if `from_timestamp` is specified - # but is not earlier than or at the same time as `to_timestamp`. - # @return [Array] an `Array` of {TimezoneTransition} - # instances representing the times where the UTC offset of the time zone - # changes. - # - # source://tzinfo//lib/tzinfo/data_sources/transitions_data_timezone_info.rb#111 - def transitions_up_to(to_timestamp, from_timestamp = T.unsafe(nil)); end - - private - - # Performs a binary search on {transitions} to find the index of the - # earliest transition satisfying a condition. - # - # :nocov_array_bsearch_index: - # - # @return [Integer] the index of the earliest transition safisfying - # the condition or `nil` if there are no such transitions. - # @yield [transition] the caller will be yielded to to test the search - # condition. - # @yieldparam transition [TimezoneTransition] a {TimezoneTransition} - # instance from {transitions}. - # @yieldreturn [Boolean] `true` for the earliest transition that - # satisfies the condition and return `true` for all subsequent - # transitions. In all other cases, the result of the block must be - # `false`. - # - # source://tzinfo//lib/tzinfo/data_sources/transitions_data_timezone_info.rb#159 - def find_minimum_transition(&block); end - - # Determines if a transition occurs at or after a given {Timestamp}, - # taking the {Timestamp#sub_second sub_second} into consideration. - # - # @param transition [TimezoneTransition] the transition to compare. - # @param timestamp [Timestamp] the timestamp to compare. - # @return [Boolean] `true` if `transition` occurs at or after `timestamp`, - # otherwise `false`. - # - # source://tzinfo//lib/tzinfo/data_sources/transitions_data_timezone_info.rb#207 - def transition_on_or_after_timestamp?(transition, timestamp); end -end - -# A DataSource implementation that loads data from a 'zoneinfo' directory -# containing compiled "TZif" version 3 (or earlier) files in addition to -# iso3166.tab and zone1970.tab or zone.tab index files. -# -# To have TZInfo load the system zoneinfo files, call -# {TZInfo::DataSource.set} as follows: -# -# TZInfo::DataSource.set(:zoneinfo) -# -# To load zoneinfo files from a particular directory, pass the directory to -# {TZInfo::DataSource.set}: -# -# TZInfo::DataSource.set(:zoneinfo, directory) -# -# To load zoneinfo files from a particular directory, but load the -# iso3166.tab index file from a separate location, pass the directory and -# path to the iso3166.tab file to {TZInfo::DataSource.set}: -# -# TZInfo::DataSource.set(:zoneinfo, directory, iso3166_path) -# -# Please note that versions of the 'zic' tool (used to build zoneinfo files) -# that were released prior to February 2006 created zoneinfo files that used -# 32-bit integers for transition timestamps. Later versions of zic produce -# zoneinfo files that use 64-bit integers. If you have 32-bit zoneinfo files -# on your system, then any queries falling outside of the range 1901-12-13 -# 20:45:52 to 2038-01-19 03:14:07 may be inaccurate. -# -# Most modern platforms include 64-bit zoneinfo files. However, Mac OS X (up -# to at least 10.8.4) still uses 32-bit zoneinfo files. -# -# To check whether your zoneinfo files contain 32-bit or 64-bit transition -# data, you can run the following code (substituting the identifier of the -# zone you want to test for `zone_identifier`): -# -# TZInfo::DataSource.set(:zoneinfo) -# dir = TZInfo::DataSource.get.zoneinfo_dir -# File.open(File.join(dir, zone_identifier), 'r') {|f| f.read(5) } -# -# If the last line returns `"TZif\\x00"`, then you have a 32-bit zoneinfo -# file. If it returns `"TZif2"` or `"TZif3"` then you have a 64-bit zoneinfo -# file. -# -# It is also worth noting that as of the 2017c release of the IANA Time Zone -# Database, 64-bit zoneinfo files only include future transitions up to -# 2038-01-19 03:14:07. Any queries falling after this time may be -# inaccurate. -# -# source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#69 -class TZInfo::DataSources::ZoneinfoDataSource < ::TZInfo::DataSource - # Initializes a new {ZoneinfoDataSource}. - # - # If `zoneinfo_dir` is specified, it will be checked and used as the - # source of zoneinfo files. - # - # The directory must contain a file named iso3166.tab and a file named - # either zone1970.tab or zone.tab. These may either be included in the - # root of the directory or in a 'tab' sub-directory and named country.tab - # and zone_sun.tab respectively (as is the case on Solaris). - # - # Additionally, the path to iso3166.tab can be overridden using the - # `alternate_iso3166_tab_path` parameter. - # - # If `zoneinfo_dir` is not specified or `nil`, the paths referenced in - # {search_path} are searched in order to find a valid zoneinfo directory - # (one that contains zone1970.tab or zone.tab and iso3166.tab files as - # above). - # - # The paths referenced in {alternate_iso3166_tab_search_path} are also - # searched to find an iso3166.tab file if one of the searched zoneinfo - # directories doesn't contain an iso3166.tab file. - # - # @param zoneinfo_dir [String] an optional path to a directory to use as - # the source of zoneinfo files. - # @param alternate_iso3166_tab_path [String] an optional path to the - # iso3166.tab file. - # @raise [InvalidZoneinfoDirectory] if the iso3166.tab and zone1970.tab or - # zone.tab files cannot be found using the `zoneinfo_dir` and - # `alternate_iso3166_tab_path` parameters. - # @raise [ZoneinfoDirectoryNotFound] if no valid directory can be found - # by searching. - # @return [ZoneinfoDataSource] a new instance of ZoneinfoDataSource - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#237 - def initialize(zoneinfo_dir = T.unsafe(nil), alternate_iso3166_tab_path = T.unsafe(nil)); end - - # Returns a frozen `Array` of all the available ISO 3166-1 alpha-2 country - # codes. The identifiers are sorted according to `String#<=>`. - # - # @return [Array] a frozen `Array` of all the available ISO 3166-1 - # alpha-2 country codes. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#204 - def country_codes; end - - # Returns a frozen `Array` of all the available time zone identifiers. The - # identifiers are sorted according to `String#<=>`. - # - # @return [Array] a frozen `Array` of all the available time zone - # identifiers. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#271 - def data_timezone_identifiers; end - - # @return [String] the internal object state as a programmer-readable - # `String`. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#290 - def inspect; end - - # Returns an empty `Array`. There is no information about linked/aliased - # time zones in the zoneinfo files. When using {ZoneinfoDataSource}, every - # time zone will be returned as a {DataTimezone}. - # - # @return [Array] an empty `Array`. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#280 - def linked_timezone_identifiers; end - - # @return [String] a description of the {DataSource}. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#285 - def to_s; end - - # @return [String] the zoneinfo directory being used. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#201 - def zoneinfo_dir; end - - protected - - # @param code [String] an ISO 3166-1 alpha-2 country code. - # @raise [InvalidCountryCode] if the country could not be found or the code - # is invalid. - # @return [DataSources::CountryInfo] a {DataSources::CountryInfo} instance - # for the given ISO 3166-1 alpha-2 country code. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#326 - def load_country_info(code); end - - # Returns a {TimezoneInfo} instance for the given time zone identifier. - # The result will either be a {ConstantOffsetDataTimezoneInfo} or a - # {TransitionsDataTimezoneInfo}. - # - # @param identifier [String] A time zone identifier. - # @raise [InvalidTimezoneIdentifier] if the time zone is not found, the - # identifier is invalid, the zoneinfo file cannot be opened or the - # zoneinfo file is not valid. - # @return [TimezoneInfo] a {TimezoneInfo} instance for the given time zone - # identifier. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#306 - def load_timezone_info(identifier); end - - private - - # Converts degrees, minutes and seconds to a Rational. - # - # @param sign [String] `'-'` or `'+'`. - # @param degrees [String] the number of degrees. - # @param minutes [String] the number of minutes. - # @param seconds [String] the number of seconds (optional). - # @return [Rational] the result of converting from degrees, minutes and - # seconds to a `Rational`. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#579 - def dms_to_rational(sign, degrees, minutes, seconds = T.unsafe(nil)); end - - # Recursively enumerate a directory of time zones. - # - # @param dir [Array] the directory to enumerate as an `Array` of - # path components. - # @param exclude [Array] file names to exclude when scanning - # `dir`. - # @yield [path] the path of each time zone file found is passed to - # the block. - # @yieldparam path [Array] the path of a time zone file as an - # `Array` of path components. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#434 - def enum_timezones(dir, exclude = T.unsafe(nil), &block); end - - # Finds a zoneinfo directory using {search_path} and - # {alternate_iso3166_tab_search_path}. - # - # @return [Array] an `Array` containing the iso3166.tab and - # zone.tab paths if a zoneinfo directory was found, otherwise `nil`. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#389 - def find_zoneinfo_dir; end - - # Uses the iso3166.tab and zone1970.tab or zone.tab files to return a Hash - # mapping country codes to CountryInfo instances. - # - # @param iso3166_tab_path [String] the path to the iso3166.tab file. - # @param zone_tab_path [String] the path to the zone.tab file. - # @return [Hash] a mapping from ISO 3166-1 alpha-2 - # country codes to {CountryInfo} instances. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#463 - def load_countries(iso3166_tab_path, zone_tab_path); end - - # Scans @zoneinfo_dir and returns an `Array` of available time zone - # identifiers. The result is sorted according to `String#<=>`. - # - # @return [Array] an `Array` containing all the time zone - # identifiers found. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#414 - def load_timezone_identifiers; end - - # Attempts to resolve the path to a tab file given its standard names and - # tab sub-directory name (as used on Solaris). - # - # @param zoneinfo_path [String] the path to a zoneinfo directory. - # @param standard_names [Array] the standard names for the tab - # file. - # @param tab_name [String] the alternate name for the tab file to check in - # the tab sub-directory. - # @return [String] the path to the tab file. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#372 - def resolve_tab_path(zoneinfo_path, standard_names, tab_name); end - - # Validates a zoneinfo directory and returns the paths to the iso3166.tab - # and zone1970.tab or zone.tab files if valid. If the directory is not - # valid, returns `nil`. - # - # The path to the iso3166.tab file may be overridden by passing in a path. - # This is treated as either absolute or relative to the current working - # directory. - # - # @param path [String] the path to a possible zoneinfo directory. - # @param iso3166_tab_path [String] an optional path to an external - # iso3166.tab file. - # @return [Array] an `Array` containing the iso3166.tab and - # zone.tab paths if the directory is valid, otherwise `nil`. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#345 - def validate_zoneinfo_dir(path, iso3166_tab_path = T.unsafe(nil)); end - - class << self - # An `Array` of paths that will be checked to find an alternate - # iso3166.tab file if one was not included in the zoneinfo directory - # (for example, on FreeBSD and OpenBSD systems). - # - # Paths are checked in the order they appear in the `Array`. - # - # The default value is `['/usr/share/misc/iso3166.tab', - # '/usr/share/misc/iso3166']`. - # - # @return [Array] an `Array` of paths to check in order to - # locate an iso3166.tab file. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#156 - def alternate_iso3166_tab_search_path; end - - # Sets the paths to check to locate an alternate iso3166.tab file if one - # was not included in the zoneinfo directory. - # - # Can be set to an `Array` of paths or a `String` containing paths - # separated with `File::PATH_SEPARATOR`. - # - # Paths are checked in the order they appear in the array. - # - # Set to `nil` to revert to the default paths. - # - # @param alternate_iso3166_tab_search_path [Object] either `nil` or a - # list of paths to check as either an `Array` of `String` or a - # `File::PATH_SEPARATOR` separated `String`. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#173 - def alternate_iso3166_tab_search_path=(alternate_iso3166_tab_search_path); end - - # An `Array` of directories that will be checked to find the system - # zoneinfo directory. - # - # Directories are checked in the order they appear in the `Array`. - # - # The default value is `['/usr/share/zoneinfo', - # '/usr/share/lib/zoneinfo', '/etc/zoneinfo']`. - # - # @return [Array] an `Array` of directories to check in order to - # find the system zoneinfo directory. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#123 - def search_path; end - - # Sets the directories to be checked when locating the system zoneinfo - # directory. - # - # Can be set to an `Array` of directories or a `String` containing - # directories separated with `File::PATH_SEPARATOR`. - # - # Directories are checked in the order they appear in the `Array` or - # `String`. - # - # Set to `nil` to revert to the default paths. - # - # @param search_path [Object] either `nil` or a list of directories to - # check as either an `Array` of `String` or a `File::PATH_SEPARATOR` - # separated `String`. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#141 - def search_path=(search_path); end - - private - - # Processes a path for use as the {search_path} or - # {alternate_iso3166_tab_search_path}. - # - # @param path [Object] either `nil` or a list of paths to check as - # either an `Array` of `String` or a `File::PATH_SEPARATOR` separated - # `String`. - # @param default [Array] the default value. - # @return [Array] the processed path. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#187 - def process_search_path(path, default); end - end -end - -# The default value of {ZoneinfoDataSource.alternate_iso3166_tab_search_path}. -# -# source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#74 -TZInfo::DataSources::ZoneinfoDataSource::DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH = T.let(T.unsafe(nil), Array) - -# The default value of {ZoneinfoDataSource.search_path}. -# -# source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#70 -TZInfo::DataSources::ZoneinfoDataSource::DEFAULT_SEARCH_PATH = T.let(T.unsafe(nil), Array) - -# Files and directories in the top level zoneinfo directory that will be -# excluded from the list of available time zones: -# -# - +VERSION is included on Mac OS X. -# - leapseconds is a list of leap seconds. -# - localtime is the current local timezone (may be a link). -# - posix, posixrules and right are directories containing other -# versions of the zoneinfo files. -# - SECURITY is included in the Arch Linux tzdata package. -# - src is a directory containing the tzdata source included on Solaris. -# - timeconfig is a symlink included on Slackware. -# -# source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#88 -TZInfo::DataSources::ZoneinfoDataSource::EXCLUDED_FILENAMES = T.let(T.unsafe(nil), Array) - -# A {ZoneinfoDirectoryNotFound} exception is raised if no valid zoneinfo -# directory could be found when checking the paths listed in -# {ZoneinfoDataSource.search_path}. A valid zoneinfo directory is one that -# contains time zone files, a country code index file named iso3166.tab and -# a time zone index file named zone1970.tab or zone.tab. -# -# source://tzinfo//lib/tzinfo/data_sources/zoneinfo_data_source.rb#19 -class TZInfo::DataSources::ZoneinfoDirectoryNotFound < ::StandardError; end - -# Reads compiled zoneinfo TZif (\0, 2 or 3) files. -# -# source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#12 -class TZInfo::DataSources::ZoneinfoReader - # Initializes a new {ZoneinfoReader}. - # - # @param posix_tz_parser [PosixTimeZoneParser] a {PosixTimeZoneParser} - # instance to use to parse POSIX-style TZ strings. - # @param string_deduper [StringDeduper] a {StringDeduper} instance to use - # to dedupe abbreviations. - # @return [ZoneinfoReader] a new instance of ZoneinfoReader - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#25 - def initialize(posix_tz_parser, string_deduper); end - - # Reads a zoneinfo structure from the given path. Returns either a - # {TimezoneOffset} that is constantly observed or an `Array` - # {TimezoneTransition}s. - # - # @param file_path [String] the path of a zoneinfo file. - # @raise [SecurityError] if safe mode is enabled and `file_path` is - # tainted. - # @raise [InvalidZoneinfoFile] if `file_path`` does not refer to a valid - # zoneinfo file. - # @return [Object] either a {TimezoneOffset} or an `Array` of - # {TimezoneTransition}s. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#41 - def read(file_path); end - - private - - # Apply the rules from the TZ string when there were defined - # transitions. Checks for a matching offset with the last transition. - # Redefines the last transition if required and if the rules don't - # specific a constant offset, generates transitions until 100 years into - # the future (at the time of loading zoneinfo_reader.rb). - # - # @param file [IO] the file being processed. - # @param transitions [Array] the defined transitions. - # @param offsets [Array] the offsets used by the defined - # transitions. - # @param rules [Object] a {TimezoneOffset} specifying a constant offset or - # {AnnualRules} instance specfying transitions. - # @raise [InvalidZoneinfoFile] if the first offset does not match the - # rules. - # @raise [InvalidZoneinfoFile] if the previous offset of the first - # generated transition does not match the offset of the last defined - # transition. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#311 - def apply_rules_with_transitions(file, transitions, offsets, rules); end - - # Apply the rules from the TZ string when there were no defined - # transitions. Checks for a matching offset. Returns the rules-based - # constant offset or generates transitions from 1970 until 100 years into - # the future (at the time of loading zoneinfo_reader.rb). - # - # @param file [IO] the file being processed. - # @param first_offset [TimezoneOffset] the first offset included in the - # file that would normally apply without the rules. - # @param rules [Object] a {TimezoneOffset} specifying a constant offset or - # {AnnualRules} instance specfying transitions. - # @raise [InvalidZoneinfoFile] if the first offset does not match the - # rules. - # @return [Object] either a {TimezoneOffset} or an `Array` of - # {TimezoneTransition}s. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#199 - def apply_rules_without_transitions(file, first_offset, rules); end - - # Reads the given number of bytes from the given file and checks that the - # correct number of bytes could be read. - # - # @param file [IO] the file to read from. - # @param bytes [Integer] the number of bytes to read. - # @raise [InvalidZoneinfoFile] if the number of bytes available didn't - # match the number requested. - # @return [String] the bytes that were read. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#76 - def check_read(file, bytes); end - - # Zoneinfo files don't include the offset from standard time (std_offset) - # for DST periods. Derive the base offset (base_utc_offset) where DST is - # observed from either the previous or next non-DST period. - # - # @param transitions [Array] an `Array` of transition hashes. - # @param offsets [Array] an `Array` of offset hashes. - # @return [Integer] the index of the offset to be used prior to the first - # transition. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#94 - def derive_offsets(transitions, offsets); end - - # Finds an offset that is equivalent to the one specified in the given - # `Array`. Matching is performed with {TimezoneOffset#==}. - # - # @param offsets [Array] an `Array` to search. - # @param offset [TimezoneOffset] the offset to search for. - # @return [TimezoneOffset] the matching offset from `offsets` or `nil` - # if not found. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#233 - def find_existing_offset(offsets, offset); end - - # Translates an unsigned 32-bit integer (as returned by unpack) to signed - # 32-bit. - # - # @param long [Integer] an unsigned 32-bit integer. - # @return [Integer] {long} translated to signed 32-bit. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#52 - def make_signed_int32(long); end - - # Translates a pair of unsigned 32-bit integers (as returned by unpack, - # most significant first) to a signed 64-bit integer. - # - # @param high [Integer] the most significant 32-bits. - # @param low [Integer] the least significant 32-bits. - # @return [Integer] {high} and {low} combined and translated to signed - # 64-bit. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#63 - def make_signed_int64(high, low); end - - # Determines if the offset from a transition matches the offset from a - # rule. This is a looser match than equality, not requiring that the - # base_utc_offset and std_offset both match (which have to be derived for - # transitions, but are known for rules. - # - # @param offset [TimezoneOffset] an offset from a transition. - # @param rule_offset [TimezoneOffset] an offset from a rule. - # @return [Boolean] whether the offsets match. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#179 - def offset_matches_rule?(offset, rule_offset); end - - # Parses a zoneinfo file and returns either a {TimezoneOffset} that is - # constantly observed or an `Array` of {TimezoneTransition}s. - # - # @param file [IO] the file to be read. - # @raise [InvalidZoneinfoFile] if the file is not a valid zoneinfo file. - # @return [Object] either a {TimezoneOffset} or an `Array` of - # {TimezoneTransition}s. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#343 - def parse(file); end - - # Returns a new AnnualRules instance with standard and daylight savings - # offsets replaced with equivalents from an array. This reduces the memory - # requirement for loaded time zones by reusing offsets for rule-generated - # transitions. - # - # @param offsets [Array] an `Array` to search for - # equivalent offsets. - # @param annual_rules [AnnualRules] the {AnnualRules} instance to check. - # @return [AnnualRules] either a new {AnnualRules} instance with either - # the {AnnualRules#std_offset std_offset} or {AnnualRules#dst_offset - # dst_offset} replaced, or the original instance if no equivalent for - # either {AnnualRules#std_offset std_offset} or {AnnualRules#dst_offset - # dst_offset} could be found. - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#250 - def replace_with_existing_offsets(offsets, annual_rules); end - - # Validates the offset indicated to be observed by the rules before the - # first generated transition against the offset of the last defined - # transition. - # - # Fix the last defined transition if it differ on just base/std offsets - # (which are derived). Raise an error if the observed UTC offset or - # abbreviations differ. - # - # @param file [IO] the file being processed. - # @param last_defined [TimezoneTransition] the last defined transition in - # the file. - # @param first_rule_offset [TimezoneOffset] the offset the rules indicate - # is observed prior to the first rules generated transition. - # @raise [InvalidZoneinfoFile] if the offset of {last_defined} and - # {first_rule_offset} do not match. - # @return [TimezoneTransition] the last defined transition (either the - # original instance or a replacement). - # - # source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#278 - def validate_and_fix_last_defined_transition_offset(file, last_defined, first_rule_offset); end -end - -# The year to generate transitions up to. -# -# @private -# -# source://tzinfo//lib/tzinfo/data_sources/zoneinfo_reader.rb#16 -TZInfo::DataSources::ZoneinfoReader::GENERATE_UP_TO = T.let(T.unsafe(nil), Integer) - -# Represents time zones that are defined by rules that set out when -# transitions occur. -# -# source://tzinfo//lib/tzinfo/data_timezone.rb#8 -class TZInfo::DataTimezone < ::TZInfo::InfoTimezone - # Returns the canonical {Timezone} instance for this {DataTimezone}. - # - # For a {DataTimezone}, this is always `self`. - # - # @return [Timezone] `self`. - # - # source://tzinfo//lib/tzinfo/data_timezone.rb#40 - def canonical_zone; end - - # Returns the {TimezonePeriod} that is valid at a given time. - # - # Unlike {period_for_local} and {period_for_utc}, the UTC offset of the - # `time` parameter is taken into consideration. - # - # @param time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [ArgumentError] if `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified - # offset. - # @return [TimezonePeriod] the {TimezonePeriod} that is valid at `time`. - # - # source://tzinfo//lib/tzinfo/data_timezone.rb#9 - def period_for(time); end - - # Returns the set of {TimezonePeriod}s that are valid for the given - # local time as an `Array`. - # - # The UTC offset of the `local_time` parameter is ignored (it is treated as - # a time in the time zone represented by `self`). - # - # This will typically return an `Array` containing a single - # {TimezonePeriod}. More than one {TimezonePeriod} will be returned when the - # local time is ambiguous (for example, when daylight savings time ends). An - # empty `Array` will be returned when the local time is not valid (for - # example, when daylight savings time begins). - # - # To obtain just a single {TimezonePeriod} in all cases, use - # {period_for_local} instead and specify how ambiguities should be resolved. - # - # @param local_time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [ArgumentError] if `local_time` is `nil`. - # @return [Array] the set of {TimezonePeriod}s that are - # valid at `local_time`. - # - # source://tzinfo//lib/tzinfo/data_timezone.rb#17 - def periods_for_local(local_time); end - - # Returns an `Array` of {TimezoneTransition} instances representing the - # times where the UTC offset of the timezone changes. - # - # Transitions are returned up to a given time (`to`). - # - # A from time may also be supplied using the `from` parameter. If from is - # not `nil`, only transitions from that time onwards will be returned. - # - # Comparisons with `to` are exclusive. Comparisons with `from` are - # inclusive. If a transition falls precisely on `to`, it will be excluded. - # If a transition falls on `from`, it will be included. - # - # @param to [Object] a `Time`, `DateTime` or {Timestamp} specifying the - # latest (exclusive) transition to return. - # @param from [Object] an optional `Time`, `DateTime` or {Timestamp} - # specifying the earliest (inclusive) transition to return. - # @raise [ArgumentError] if `from` is specified and `to` is not greater than - # `from`. - # @raise [ArgumentError] is raised if `to` is `nil`. - # @raise [ArgumentError] if either `to` or `from` is a {Timestamp} with an - # unspecified offset. - # @return [Array] the transitions that are earlier than - # `to` and, if specified, at or later than `from`. Transitions are ordered - # by when they occur, from earliest to latest. - # - # source://tzinfo//lib/tzinfo/data_timezone.rb#23 - def transitions_up_to(to, from = T.unsafe(nil)); end -end - -# A subclass of `DateTime` used to represent local times. {DateTimeWithOffset} -# holds a reference to the related {TimezoneOffset} and overrides various -# methods to return results appropriate for the {TimezoneOffset}. Certain -# operations will clear the associated {TimezoneOffset} (if the -# {TimezoneOffset} would not necessarily be valid for the result). Once the -# {TimezoneOffset} has been cleared, {DateTimeWithOffset} behaves identically -# to `DateTime`. -# -# Arithmetic performed on {DateTimeWithOffset} instances is _not_ time -# zone-aware. Regardless of whether transitions in the time zone are crossed, -# results of arithmetic operations will always maintain the same offset from -# UTC (`offset`). The associated {TimezoneOffset} will aways be cleared. -# -# source://tzinfo//lib/tzinfo/datetime_with_offset.rb#19 -class TZInfo::DateTimeWithOffset < ::DateTime - include ::TZInfo::WithOffset - - # An overridden version of `DateTime#downto` that clears the associated - # {TimezoneOffset} of the returned or yielded instances. - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#61 - def downto(min); end - - # An overridden version of `DateTime#england` that preserves the associated - # {TimezoneOffset}. - # - # @return [DateTime] - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#75 - def england; end - - # An overridden version of `DateTime#gregorian` that preserves the - # associated {TimezoneOffset}. - # - # @return [DateTime] - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#85 - def gregorian; end - - # An overridden version of `DateTime#italy` that preserves the associated - # {TimezoneOffset}. - # - # @return [DateTime] - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#95 - def italy; end - - # An overridden version of `DateTime#julian` that preserves the associated - # {TimezoneOffset}. - # - # @return [DateTime] - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#105 - def julian; end - - # An overridden version of `DateTime#new_start` that preserves the - # associated {TimezoneOffset}. - # - # @return [DateTime] - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#115 - def new_start(start = T.unsafe(nil)); end - - # Sets the associated {TimezoneOffset}. - # - # @param timezone_offset [TimezoneOffset] a {TimezoneOffset} valid at the - # time and for the offset of this {DateTimeWithOffset}. - # @raise [ArgumentError] if `timezone_offset` is `nil`. - # @raise [ArgumentError] if `timezone_offset.observed_utc_offset` does not - # equal `self.offset * 86400`. - # @return [DateTimeWithOffset] `self`. - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#34 - def set_timezone_offset(timezone_offset); end - - # An overridden version of `DateTime#step` that clears the associated - # {TimezoneOffset} of the returned or yielded instances. - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#121 - def step(limit, step = T.unsafe(nil)); end - - # @return [TimezoneOffset] the {TimezoneOffset} associated with this - # instance. - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#24 - def timezone_offset; end - - # An overridden version of `DateTime#to_time` that, if there is an - # associated {TimezoneOffset}, returns a {DateTimeWithOffset} with that - # offset. - # - # @return [Time] if there is an associated {TimezoneOffset}, a - # {TimeWithOffset} representation of this {DateTimeWithOffset}, otherwise - # a `Time` representation. - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#48 - def to_time; end - - # An overridden version of `DateTime#upto` that clears the associated - # {TimezoneOffset} of the returned or yielded instances. - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#133 - def upto(max); end - - protected - - # Clears the associated {TimezoneOffset}. - # - # @return [DateTimeWithOffset] `self`. - # - # source://tzinfo//lib/tzinfo/datetime_with_offset.rb#148 - def clear_timezone_offset; end -end - -# A rule that transitions on the nth occurrence of a particular day of week -# of a calendar month. -# -# @private -# -# source://tzinfo//lib/tzinfo/transition_rule.rb#339 -class TZInfo::DayOfMonthTransitionRule < ::TZInfo::DayOfWeekTransitionRule - # Initializes a new {DayOfMonthTransitionRule}. - # - # @param transition_at [Integer] the time in seconds after midnight local - # time at which the transition occurs. - # @param week [Integer] the week of the month when the transition occurs (1 - # to 4). - # @param day_of_week [Integer] the day of the week when the transition - # occurs. 0 is Sunday, 6 is Saturday. - # @param month [Integer] the month of the year when the transition occurs. - # @raise [ArgumentError] if `week` is less than 1 or greater than 4. - # @raise [ArgumentError] if `day_of_week` is not an `Integer`. - # @raise [ArgumentError] if `day_of_week` is less than 0 or greater than 6. - # @raise [ArgumentError] if `month` is less than 1 or greater than 12. - # @raise [ArgumentError] if `transition_at` is not an `Integer`. - # @raise [ArgumentError] if `month` is not an `Integer`. - # @raise [ArgumentError] if `week` is not an `Integer`. - # @return [DayOfMonthTransitionRule] a new instance of DayOfMonthTransitionRule - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#340 - def initialize(month, week, day_of_week, transition_at = T.unsafe(nil)); end - - # Determines if this {DayOfMonthTransitionRule} is equal to another - # instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {DayOfMonthTransitionRule} with the - # same {transition_at}, month, week and day of week as this - # {DayOfMonthTransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#353 - def ==(r); end - - # Determines if this {DayOfMonthTransitionRule} is equal to another - # instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {DayOfMonthTransitionRule} with the - # same {transition_at}, month, week and day of week as this - # {DayOfMonthTransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#353 - def eql?(r); end - - protected - - # Returns a `Time` representing midnight local time on the day specified by - # the rule for the given offset and year. - # - # @param offset [TimezoneOffset] the current offset at the time of the - # transition. - # @param year [Integer] the year in which the transition occurs. - # @return [Time] midnight local time on the day specified by the rule for - # the given offset and year. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#372 - def get_day(offset, year); end - - # @return [Array] an `Array` of parameters that will influence the output of - # {hash}. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#386 - def hash_args; end - - # @return [Integer] the day the week starts on for a month starting on a - # Sunday. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#362 - def offset_start; end -end - -# A base class for rules that transition on a particular day of week of a -# given week (subclasses specify which week of the month). -# -# @abstract -# @private -# -# source://tzinfo//lib/tzinfo/transition_rule.rb#273 -class TZInfo::DayOfWeekTransitionRule < ::TZInfo::TransitionRule - # Initializes a new {DayOfWeekTransitionRule}. - # - # @param transition_at [Integer] the time in seconds after midnight local - # time at which the transition occurs. - # @param day_of_week [Integer] the day of the week when the transition - # occurs. 0 is Sunday, 6 is Saturday. - # @param month [Integer] the month of the year when the transition occurs. - # @raise [ArgumentError] if `day_of_week` is not an `Integer`. - # @raise [ArgumentError] if `day_of_week` is less than 0 or greater than 6. - # @raise [ArgumentError] if `month` is not an `Integer`. - # @raise [ArgumentError] if `transition_at` is not an `Integer`. - # @raise [ArgumentError] if `month` is less than 1 or greater than 12. - # @return [DayOfWeekTransitionRule] a new instance of DayOfWeekTransitionRule - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#274 - def initialize(month, day_of_week, transition_at); end - - # Determines if this {DayOfWeekTransitionRule} is equal to another - # instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {DayOfWeekTransitionRule} with the - # same {transition_at}, month and day of week as this - # {DayOfWeekTransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#299 - def ==(r); end - - # Determines if this {DayOfWeekTransitionRule} is equal to another - # instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {DayOfWeekTransitionRule} with the - # same {transition_at}, month and day of week as this - # {DayOfWeekTransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#299 - def eql?(r); end - - # @return [Boolean] `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#283 - def is_always_first_day_of_year?; end - - # @return [Boolean] `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#288 - def is_always_last_day_of_year?; end - - protected - - # @return [Integer] the day of the week (0 to 6 for Sunday to Monday). - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#310 - def day_of_week; end - - # @return [Array] an `Array` of parameters that will influence the output of - # {hash}. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#313 - def hash_args; end - - # @return [Integer] the month of the year (1 to 12). - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#307 - def month; end -end - -# A base class for transition rules that activate based on an integer day of -# the year. -# -# @abstract -# @private -# -# source://tzinfo//lib/tzinfo/transition_rule.rb#81 -class TZInfo::DayOfYearTransitionRule < ::TZInfo::TransitionRule - # Initializes a new {DayOfYearTransitionRule}. - # - # @param day [Integer] the day of the year on which the transition occurs. - # The precise meaning is defined by subclasses. - # @param transition_at [Integer] the time in seconds after midnight local - # time at which the transition occurs. - # @raise [ArgumentError] if `transition_at` is not an `Integer`. - # @raise [ArgumentError] if `day` is not an `Integer`. - # @return [DayOfYearTransitionRule] a new instance of DayOfYearTransitionRule - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#82 - def initialize(day, transition_at); end - - # Determines if this {DayOfYearTransitionRule} is equal to another instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {DayOfYearTransitionRule} with the - # same {transition_at} and day as this {DayOfYearTransitionRule}, - # otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#94 - def ==(r); end - - # Determines if this {DayOfYearTransitionRule} is equal to another instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {DayOfYearTransitionRule} with the - # same {transition_at} and day as this {DayOfYearTransitionRule}, - # otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#94 - def eql?(r); end - - protected - - # @return [Array] an `Array` of parameters that will influence the output of - # {hash}. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#105 - def hash_args; end - - # @return [Integer] the day multipled by the number of seconds in a day. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#102 - def seconds; end -end - -# Modules and classes used by the format 1 version of TZInfo::Data. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1.rb#7 -module TZInfo::Format1; end - -# Instances of {Format1::CountryDefiner} are yielded to the format 1 version -# of `TZInfo::Data::Indexes::Countries` by {CountryIndexDefinition} to allow -# the zones of a country to be specified. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1/country_definer.rb#11 -class TZInfo::Format1::CountryDefiner < ::TZInfo::Format2::CountryDefiner - # Initializes a new {CountryDefiner}. - # - # @return [CountryDefiner] a new instance of CountryDefiner - # - # source://tzinfo//lib/tzinfo/format1/country_definer.rb#12 - def initialize(identifier_deduper, description_deduper); end -end - -# The format 1 TZInfo::Data country index file includes -# {Format1::CountryIndexDefinition}, which provides a -# {CountryIndexDefinition::ClassMethods#country country} method used to -# define each country in the index. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1/country_index_definition.rb#11 -module TZInfo::Format1::CountryIndexDefinition - mixes_in_class_methods ::TZInfo::Format1::CountryIndexDefinition::ClassMethods - - class << self - # Adds class methods to the includee and initializes class instance - # variables. - # - # @param base [Module] the includee. - # - # source://tzinfo//lib/tzinfo/format1/country_index_definition.rb#16 - def append_features(base); end - end -end - -# Class methods for inclusion. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1/country_index_definition.rb#25 -module TZInfo::Format1::CountryIndexDefinition::ClassMethods - # @return [Hash] a frozen `Hash` - # of all the countries that have been defined in the index keyed by - # their codes. - # - # source://tzinfo//lib/tzinfo/format1/country_index_definition.rb#29 - def countries; end - - private - - # Defines a country with an ISO 3166-1 alpha-2 country code and name. - # - # @param code [String] the ISO 3166-1 alpha-2 country code. - # @param name [String] the name of the country. - # @yield [definer] (optional) to obtain the time zones for the country. - # @yieldparam definer [CountryDefiner] a {CountryDefiner} instance. - # - # source://tzinfo//lib/tzinfo/format1/country_index_definition.rb#42 - def country(code, name); end -end - -# Instances of {Format1::TimezoneDefiner} are yielded to TZInfo::Data -# format 1 modules by {TimezoneDefinition} to allow the offsets and -# transitions of the time zone to be specified. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1/timezone_definer.rb#11 -class TZInfo::Format1::TimezoneDefiner < ::TZInfo::Format2::TimezoneDefiner - # Defines an offset. - # - # @param id [Symbol] an arbitrary value used identify the offset in - # subsequent calls to transition. It must be unique. - # @param utc_offset [Integer] the base offset from UTC of the zone in - # seconds. This does not include daylight savings time. - # @param std_offset [Integer] the daylight savings offset from the base - # offset in seconds. Typically either 0 or 3600. - # @param abbreviation [Symbol] an abbreviation for the offset, for - # example, `:EST` or `:EDT`. - # @raise [ArgumentError] if another offset has already been defined with - # the given id. - # - # source://tzinfo//lib/tzinfo/format1/timezone_definer.rb#26 - def offset(id, utc_offset, std_offset, abbreviation); end - - # Defines a transition to a given offset. - # - # Transitions must be defined in increasing time order. - # - # @param year [Integer] the UTC year in which the transition occurs. Used - # in earlier versions of TZInfo, but now ignored. - # @param month [Integer] the UTC month in which the transition occurs. - # Used in earlier versions of TZInfo, but now ignored. - # @param offset_id [Symbol] references the id of a previously defined - # offset (see #offset). - # @param timestamp_value [Integer] the time the transition occurs as an - # Integer number of seconds since 1970-01-01 00:00:00 UTC ignoring leap - # seconds (i.e. each day is treated as if it were 86,400 seconds long). - # @param datetime_numerator [Integer] the time of the transition as the - # numerator of the `Rational` returned by `DateTime#ajd`. Used in - # earlier versions of TZInfo, but now ignored. - # @param datetime_denominator [Integer] the time of the transition as the - # denominator of the `Rational` returned by `DateTime#ajd`. Used in - # earlier versions of TZInfo, but now ignored. - # @raise [ArgumentError] if `offset_id` does not reference a defined - # offset. - # @raise [ArgumentError] if `timestamp_value` is not greater than the - # `timestamp_value` of the previously defined transition. - # @raise [ArgumentError] if `datetime_numerator` is specified, but - # `datetime_denominator` is not. In older versions of TZInfo, it was - # possible to define a transition with the `DateTime` numerator as the - # 4th parameter and the denominator as the 5th parameter. This style of - # definition is not used in released versions of TZInfo::Data. - # - # source://tzinfo//lib/tzinfo/format1/timezone_definer.rb#58 - def transition(year, month, offset_id, timestamp_value, datetime_numerator = T.unsafe(nil), datetime_denominator = T.unsafe(nil)); end -end - -# {Format1::TimezoneDefinition} is included into format 1 time zone -# definition modules and provides the methods for defining time zones. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1/timezone_definition.rb#9 -module TZInfo::Format1::TimezoneDefinition - mixes_in_class_methods ::TZInfo::Format2::TimezoneDefinition::ClassMethods - mixes_in_class_methods ::TZInfo::Format1::TimezoneDefinition::ClassMethods - - class << self - # Adds class methods to the includee. - # - # @param base [Module] the includee. - # - # source://tzinfo//lib/tzinfo/format1/timezone_definition.rb#13 - def append_features(base); end - end -end - -# Class methods for inclusion. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1/timezone_definition.rb#22 -module TZInfo::Format1::TimezoneDefinition::ClassMethods - private - - # {Format2::TimezoneDefinition::ClassMethods#timezone}. - # - # @return the class to be instantiated and yielded by - # - # source://tzinfo//lib/tzinfo/format1/timezone_definition.rb#27 - def timezone_definer_class; end -end - -# The format 1 TZInfo::Data time zone index file includes -# {Format1::TimezoneIndexDefinition}, which provides methods used to define -# time zones in the index. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1/timezone_index_definition.rb#10 -module TZInfo::Format1::TimezoneIndexDefinition - mixes_in_class_methods ::TZInfo::Format1::TimezoneIndexDefinition::ClassMethods - - class << self - # Adds class methods to the includee and initializes class instance - # variables. - # - # @param base [Module] the includee. - # - # source://tzinfo//lib/tzinfo/format1/timezone_index_definition.rb#15 - def append_features(base); end - end -end - -# Class methods for inclusion. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1/timezone_index_definition.rb#28 -module TZInfo::Format1::TimezoneIndexDefinition::ClassMethods - # @return [Array] a frozen `Array` containing the identifiers of - # all data time zones. Identifiers are sorted according to - # `String#<=>`. - # - # source://tzinfo//lib/tzinfo/format1/timezone_index_definition.rb#32 - def data_timezones; end - - # @return [Array] a frozen `Array` containing the identifiers of - # all linked time zones. Identifiers are sorted according to - # `String#<=>`. - # - # source://tzinfo//lib/tzinfo/format1/timezone_index_definition.rb#42 - def linked_timezones; end - - private - - # Adds a linked time zone to the index. - # - # @param identifier [String] the time zone identifier. - # - # source://tzinfo//lib/tzinfo/format1/timezone_index_definition.rb#63 - def linked_timezone(identifier); end - - # Adds a data time zone to the index. - # - # @param identifier [String] the time zone identifier. - # - # source://tzinfo//lib/tzinfo/format1/timezone_index_definition.rb#54 - def timezone(identifier); end -end - -# Modules and classes used by the format 2 version of TZInfo::Data. -# -# @private -# -# source://tzinfo//lib/tzinfo/format2.rb#7 -module TZInfo::Format2; end - -# Instances of {Format2::CountryDefiner} are yielded to the format 2 version -# of `TZInfo::Data::Indexes::Countries` by {CountryIndexDefiner} to allow -# the zones of a country to be specified. -# -# @private -# -# source://tzinfo//lib/tzinfo/format2/country_definer.rb#11 -class TZInfo::Format2::CountryDefiner - # Initializes a new {CountryDefiner}. - # - # @param shared_timezones [Hash] a `Hash` - # containing time zones shared by more than one country, keyed by a - # unique reference. - # @param identifier_deduper [StringDeduper] a {StringDeduper} instance to - # use when deduping time zone identifiers. - # @param description_deduper [StringDeduper] a {StringDeduper} instance to - # use when deduping time zone descriptions. - # @return [CountryDefiner] a new instance of CountryDefiner - # - # source://tzinfo//lib/tzinfo/format2/country_definer.rb#24 - def initialize(shared_timezones, identifier_deduper, description_deduper); end - - # @overload timezone - # @overload timezone - # - # source://tzinfo//lib/tzinfo/format2/country_definer.rb#46 - def timezone(identifier_or_reference, latitude_numerator = T.unsafe(nil), latitude_denominator = T.unsafe(nil), longitude_numerator = T.unsafe(nil), longitude_denominator = T.unsafe(nil), description = T.unsafe(nil)); end - - # @return [Array] the time zones observed in the country. - # - # source://tzinfo//lib/tzinfo/format2/country_definer.rb#13 - def timezones; end -end - -# Instances of {Format2::CountryIndexDefiner} are yielded to the format 2 -# version of `TZInfo::Data::Indexes::Countries` by {CountryIndexDefinition} -# to allow countries and their time zones to be specified. -# -# @private -# -# source://tzinfo//lib/tzinfo/format2/country_index_definer.rb#10 -class TZInfo::Format2::CountryIndexDefiner - # Initializes a new {CountryIndexDefiner}. - # - # @param identifier_deduper [StringDeduper] a {StringDeduper} instance to - # use when deduping time zone identifiers. - # @param description_deduper [StringDeduper] a {StringDeduper} instance to - # use when deduping time zone descriptions. - # @return [CountryIndexDefiner] a new instance of CountryIndexDefiner - # - # source://tzinfo//lib/tzinfo/format2/country_index_definer.rb#21 - def initialize(identifier_deduper, description_deduper); end - - # @return [Hash] a `Hash` of all the countries that - # have been defined in the index keyed by their codes. - # - # source://tzinfo//lib/tzinfo/format2/country_index_definer.rb#13 - def countries; end - - # Defines a country. - # - # @param code [String] The ISO 3166-1 alpha-2 code of the country. - # @param name [String] Then name of the country. - # @yield [definer] yields (optional) to obtain the time zones for the - # country. - # @yieldparam definer [CountryDefiner] a {CountryDefiner} - # instance that should be used to specify the time zones of the country. - # - # source://tzinfo//lib/tzinfo/format2/country_index_definer.rb#56 - def country(code, name); end - - # Defines a time zone shared by many countries with an reference for - # subsequent use in country definitions. The latitude and longitude are - # given as the numerator and denominator of a `Rational`. - # - # @param reference [Symbol] a unique reference for the time zone. - # @param identifier [String] the time zone identifier. - # @param latitude_numerator [Integer] the numerator of the latitude. - # @param latitude_denominator [Integer] the denominator of the latitude. - # @param longitude_numerator [Integer] the numerator of the longitude. - # @param longitude_denominator [Integer] the denominator of the longitude. - # @param description [String] an optional description for the time zone. - # - # source://tzinfo//lib/tzinfo/format2/country_index_definer.rb#39 - def timezone(reference, identifier, latitude_numerator, latitude_denominator, longitude_numerator, longitude_denominator, description = T.unsafe(nil)); end -end - -# The format 2 country index file includes -# {Format2::CountryIndexDefinition}, which provides a -# {CountryIndexDefinition::ClassMethods#country_index country_index} method -# used to define the country index. -# -# @private -# -# source://tzinfo//lib/tzinfo/format2/country_index_definition.rb#11 -module TZInfo::Format2::CountryIndexDefinition - mixes_in_class_methods ::TZInfo::Format2::CountryIndexDefinition::ClassMethods - - class << self - # Adds class methods to the includee and initializes class instance - # variables. - # - # @param base [Module] the includee. - # - # source://tzinfo//lib/tzinfo/format2/country_index_definition.rb#16 - def append_features(base); end - end -end - -# Class methods for inclusion. -# -# @private -# -# source://tzinfo//lib/tzinfo/format2/country_index_definition.rb#25 -module TZInfo::Format2::CountryIndexDefinition::ClassMethods - # @return [Hash] a frozen `Hash` - # of all the countries that have been defined in the index keyed by - # their codes. - # - # source://tzinfo//lib/tzinfo/format2/country_index_definition.rb#29 - def countries; end - - private - - # Defines the index. - # - # @yield [definer] yields to allow the index to be defined. - # @yieldparam definer [CountryIndexDefiner] a {CountryIndexDefiner} - # instance that should be used to define the index. - # - # source://tzinfo//lib/tzinfo/format2/country_index_definition.rb#38 - def country_index; end -end - -# Instances of {TimezoneDefiner} are yielded to TZInfo::Data modules by -# {TimezoneDefinition} to allow the offsets and transitions of the time zone -# to be specified. -# -# @private -# -# source://tzinfo//lib/tzinfo/format2/timezone_definer.rb#11 -class TZInfo::Format2::TimezoneDefiner - # Initializes a new TimezoneDefiner. - # - # @param string_deduper [StringDeduper] a {StringDeduper} instance to use - # when deduping abbreviations. - # @return [TimezoneDefiner] a new instance of TimezoneDefiner - # - # source://tzinfo//lib/tzinfo/format2/timezone_definer.rb#20 - def initialize(string_deduper); end - - # Returns the first offset to be defined or `nil` if no offsets have been - # defined. The first offset is observed before the time of the first - # transition. - # - # @return [TimezoneOffset] the first offset to be defined or `nil` if no - # offsets have been defined. - # - # source://tzinfo//lib/tzinfo/format2/timezone_definer.rb#32 - def first_offset; end - - # Defines an offset. - # - # @param id [Symbol] an arbitrary value used identify the offset in - # subsequent calls to transition. It must be unique. - # @param base_utc_offset [Integer] the base offset from UTC of the zone in - # seconds. This does not include daylight savings time. - # @param std_offset [Integer] the daylight savings offset from the base - # offset in seconds. Typically either 0 or 3600. - # @param abbreviation [String] an abbreviation for the offset, for - # example, EST or EDT. - # @raise [ArgumentError] if another offset has already been defined with - # the given id. - # - # source://tzinfo//lib/tzinfo/format2/timezone_definer.rb#49 - def offset(id, base_utc_offset, std_offset, abbreviation); end - - # Defines the rules that will be used for handling instants after the last - # transition. - # - # This method is currently just a placeholder for forward compatibility - # that accepts and ignores any arguments passed. - # - # Support for subsequent rules will be added in a future version of TZInfo - # and the rules will be included in format 2 releases of TZInfo::Data. - # - # source://tzinfo//lib/tzinfo/format2/timezone_definer.rb#90 - def subsequent_rules(*args); end - - # Defines a transition to a given offset. - # - # Transitions must be defined in increasing time order. - # - # @param offset_id [Symbol] references the id of a previously defined - # offset. - # @param timestamp_value [Integer] the time the transition occurs as a - # number of seconds since 1970-01-01 00:00:00 UTC ignoring leap seconds - # (i.e. each day is treated as if it were 86,400 seconds long). - # @raise [ArgumentError] if `offset_id` does not reference a defined - # offset. - # @raise [ArgumentError] if `timestamp_value` is not greater than the - # `timestamp_value` of the previously defined transition. - # - # source://tzinfo//lib/tzinfo/format2/timezone_definer.rb#74 - def transition(offset_id, timestamp_value); end - - # @return [Array] the defined transitions of the time - # zone. - # - # source://tzinfo//lib/tzinfo/format2/timezone_definer.rb#14 - def transitions; end -end - -# {Format2::TimezoneDefinition} is included into format 2 time zone -# definition modules and provides methods for defining time zones. -# -# @private -# -# source://tzinfo//lib/tzinfo/format2/timezone_definition.rb#9 -module TZInfo::Format2::TimezoneDefinition - mixes_in_class_methods ::TZInfo::Format2::TimezoneDefinition::ClassMethods - - class << self - # Adds class methods to the includee. - # - # @param base [Module] the includee. - # - # source://tzinfo//lib/tzinfo/format2/timezone_definition.rb#13 - def append_features(base); end - end -end - -# Class methods for inclusion. -# -# @private -# -# source://tzinfo//lib/tzinfo/format2/timezone_definition.rb#21 -module TZInfo::Format2::TimezoneDefinition::ClassMethods - # @return [TimezoneInfo] the last time zone to be defined. - # - # source://tzinfo//lib/tzinfo/format2/timezone_definition.rb#23 - def get; end - - private - - # Defines a linked time zone. - # - # @param identifier [String] the identifier of the time zone being - # defined. - # @param link_to_identifier [String] the identifier the new time zone - # links to (is an alias for). - # - # source://tzinfo//lib/tzinfo/format2/timezone_definition.rb#64 - def linked_timezone(identifier, link_to_identifier); end - - # Defines a data time zone. - # - # @param identifier [String] the identifier of the time zone. - # @yield [definer] yields to the caller to define the time zone. - # @yieldparam definer [Object] an instance of the class returned by - # {#timezone_definer_class}, typically {TimezoneDefiner}. - # - # source://tzinfo//lib/tzinfo/format2/timezone_definition.rb#41 - def timezone(identifier); end - - # @return [Class] the class to be instantiated and yielded by - # {#timezone}. - # - # source://tzinfo//lib/tzinfo/format2/timezone_definition.rb#31 - def timezone_definer_class; end -end - -# Instances of {TimezoneIndexDefiner} are yielded by -# {TimezoneIndexDefinition} to allow the time zone index to be defined. -# -# @private -# -# source://tzinfo//lib/tzinfo/format2/timezone_index_definer.rb#9 -class TZInfo::Format2::TimezoneIndexDefiner - # Initializes a new TimezoneDefiner. - # - # @param string_deduper [StringDeduper] a {StringDeduper} instance to use - # when deduping identifiers. - # @return [TimezoneIndexDefiner] a new instance of TimezoneIndexDefiner - # - # source://tzinfo//lib/tzinfo/format2/timezone_index_definer.rb#20 - def initialize(string_deduper); end - - # Adds a data time zone to the index. - # - # @param identifier [String] the time zone identifier. - # - # source://tzinfo//lib/tzinfo/format2/timezone_index_definer.rb#29 - def data_timezone(identifier); end - - # @return [Array] the identifiers of all data time zones. - # - # source://tzinfo//lib/tzinfo/format2/timezone_index_definer.rb#11 - def data_timezones; end - - # Adds a linked time zone to the index. - # - # @param identifier [String] the time zone identifier. - # - # source://tzinfo//lib/tzinfo/format2/timezone_index_definer.rb#38 - def linked_timezone(identifier); end - - # @return [Array] the identifiers of all linked time zones. - # - # source://tzinfo//lib/tzinfo/format2/timezone_index_definer.rb#14 - def linked_timezones; end -end - -# The format 2 time zone index file includes {TimezoneIndexDefinition}, -# which provides the {TimezoneIndexDefinition::ClassMethods#timezone_index -# timezone_index} method used to define the index. -# -# @private -# -# source://tzinfo//lib/tzinfo/format2/timezone_index_definition.rb#10 -module TZInfo::Format2::TimezoneIndexDefinition - mixes_in_class_methods ::TZInfo::Format2::TimezoneIndexDefinition::ClassMethods - - class << self - # Adds class methods to the includee and initializes class instance - # variables. - # - # @param base [Module] the includee. - # - # source://tzinfo//lib/tzinfo/format2/timezone_index_definition.rb#15 - def append_features(base); end - end -end - -# Class methods for inclusion. -# -# @private -# -# source://tzinfo//lib/tzinfo/format2/timezone_index_definition.rb#29 -module TZInfo::Format2::TimezoneIndexDefinition::ClassMethods - # @return [Array] a frozen `Array` containing the identifiers of - # all data time zones. Identifiers are sorted according to - # `String#<=>`. - # - # source://tzinfo//lib/tzinfo/format2/timezone_index_definition.rb#33 - def data_timezones; end - - # @return [Array] a frozen `Array` containing the identifiers of - # all linked time zones. Identifiers are sorted according to - # `String#<=>`. - # - # source://tzinfo//lib/tzinfo/format2/timezone_index_definition.rb#38 - def linked_timezones; end - - # Defines the index. - # - # @yield [definer] yields to the caller to allow the index to be - # defined. - # @yieldparam definer [TimezoneIndexDefiner] a {TimezoneIndexDefiner} - # instance that should be used to define the index. - # - # source://tzinfo//lib/tzinfo/format2/timezone_index_definition.rb#46 - def timezone_index; end -end - -# A {Timezone} based on a {DataSources::TimezoneInfo}. -# -# @abstract -# -# source://tzinfo//lib/tzinfo/info_timezone.rb#16 -class TZInfo::InfoTimezone < ::TZInfo::Timezone - # Initializes a new {InfoTimezone}. - # - # {InfoTimezone} instances should not normally be created directly. Use - # the {Timezone.get} method to obtain {Timezone} instances. - # - # @param info [DataSources::TimezoneInfo] a {DataSources::TimezoneInfo} - # instance supplied by a {DataSource} that will be used as the source of - # data for this {InfoTimezone}. - # @return [InfoTimezone] a new instance of InfoTimezone - # - # source://tzinfo//lib/tzinfo/info_timezone.rb#17 - def initialize(info); end - - # @return [String] the identifier of the time zone, for example, - # `"Europe/Paris"`. - # - # source://tzinfo//lib/tzinfo/info_timezone.rb#23 - def identifier; end - - protected - - # @return [DataSources::TimezoneInfo] the {DataSources::TimezoneInfo} this - # {InfoTimezone} is based on. - # - # source://tzinfo//lib/tzinfo/info_timezone.rb#31 - def info; end -end - -# {InvalidCountryCode} is raised by {Country#get} if the code given is not a -# valid ISO 3166-1 alpha-2 code. -# -# source://tzinfo//lib/tzinfo/country.rb#7 -class TZInfo::InvalidCountryCode < ::StandardError; end - -# {InvalidDataSource} is raised if the selected {DataSource} doesn't implement -# one of the required methods. -# -# source://tzinfo//lib/tzinfo/data_source.rb#10 -class TZInfo::InvalidDataSource < ::StandardError; end - -# {InvalidTimezoneIdentifier} is raised by {Timezone.get} if the identifier -# given is not valid. -# -# source://tzinfo//lib/tzinfo/timezone.rb#26 -class TZInfo::InvalidTimezoneIdentifier < ::StandardError; end - -# Defines transitions that occur on the one-based nth Julian day of the year. -# -# Leap days are not counted. Day 1 is 1 January. Day 60 is always 1 March. -# Day 365 is always 31 December. -# -# @private -# -# source://tzinfo//lib/tzinfo/transition_rule.rb#185 -class TZInfo::JulianDayOfYearTransitionRule < ::TZInfo::DayOfYearTransitionRule - # Initializes a new {JulianDayOfYearTransitionRule}. - # - # @param day [Integer] the one-based Julian day of the year on which the - # transition occurs (1 to 365 inclusive). - # @param transition_at [Integer] the time in seconds after midnight local - # time at which the transition occurs. - # @raise [ArgumentError] if `transition_at` is not an `Integer`. - # @raise [ArgumentError] if `day` is not an `Integer`. - # @raise [ArgumentError] if `day` is less than 1 or greater than 365. - # @return [JulianDayOfYearTransitionRule] a new instance of JulianDayOfYearTransitionRule - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#202 - def initialize(day, transition_at = T.unsafe(nil)); end - - # Determines if this {JulianDayOfYearTransitionRule} is equal to another - # instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {JulianDayOfYearTransitionRule} with - # the same {transition_at} and day as this - # {JulianDayOfYearTransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#226 - def ==(r); end - - # Determines if this {JulianDayOfYearTransitionRule} is equal to another - # instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {JulianDayOfYearTransitionRule} with - # the same {transition_at} and day as this - # {JulianDayOfYearTransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#226 - def eql?(r); end - - # @return [Boolean] `true` if the day specified by this transition is the - # first in the year (a day number of 1), otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#209 - def is_always_first_day_of_year?; end - - # @return [Boolean] `true` if the day specified by this transition is the - # last in the year (a day number of 365), otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#215 - def is_always_last_day_of_year?; end - - protected - - # Returns a `Time` representing midnight local time on the day specified by - # the rule for the given offset and year. - # - # @param offset [TimezoneOffset] the current offset at the time of the - # transition. - # @param year [Integer] the year in which the transition occurs. - # @return [Time] midnight local time on the day specified by the rule for - # the given offset and year. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#241 - def get_day(offset, year); end - - # @return [Array] an `Array` of parameters that will influence the output of - # {hash}. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#250 - def hash_args; end -end - -# The 60 days in seconds. -# -# source://tzinfo//lib/tzinfo/transition_rule.rb#186 -TZInfo::JulianDayOfYearTransitionRule::LEAP = T.let(T.unsafe(nil), Integer) - -# The length of a non-leap year in seconds. -# -# source://tzinfo//lib/tzinfo/transition_rule.rb#190 -TZInfo::JulianDayOfYearTransitionRule::YEAR = T.let(T.unsafe(nil), Integer) - -# A rule that transitions on the last occurrence of a particular day of week -# of a calendar month. -# -# @private -# -# source://tzinfo//lib/tzinfo/transition_rule.rb#408 -class TZInfo::LastDayOfMonthTransitionRule < ::TZInfo::DayOfWeekTransitionRule - # Initializes a new {LastDayOfMonthTransitionRule}. - # - # @param transition_at [Integer] the time in seconds after midnight local - # time at which the transition occurs. - # @param day_of_week [Integer] the day of the week when the transition - # occurs. 0 is Sunday, 6 is Saturday. - # @param month [Integer] the month of the year when the transition occurs. - # @raise [ArgumentError] if `day_of_week` is not an `Integer`. - # @raise [ArgumentError] if `day_of_week` is less than 0 or greater than 6. - # @raise [ArgumentError] if `month` is not an `Integer`. - # @raise [ArgumentError] if `transition_at` is not an `Integer`. - # @raise [ArgumentError] if `month` is less than 1 or greater than 12. - # @return [LastDayOfMonthTransitionRule] a new instance of LastDayOfMonthTransitionRule - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#409 - def initialize(month, day_of_week, transition_at = T.unsafe(nil)); end - - # Determines if this {LastDayOfMonthTransitionRule} is equal to another - # instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {LastDayOfMonthTransitionRule} with - # the same {transition_at}, month and day of week as this - # {LastDayOfMonthTransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#420 - def ==(r); end - - # Determines if this {LastDayOfMonthTransitionRule} is equal to another - # instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {LastDayOfMonthTransitionRule} with - # the same {transition_at}, month and day of week as this - # {LastDayOfMonthTransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#420 - def eql?(r); end - - protected - - # Returns a `Time` representing midnight local time on the day specified by - # the rule for the given offset and year. - # - # @param offset [TimezoneOffset] the current offset at the time of the - # transition. - # @param year [Integer] the year in which the transition occurs. - # @return [Time] midnight local time on the day specified by the rule for - # the given offset and year. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#435 - def get_day(offset, year); end -end - -# Represents time zones that are defined as a link to or alias for another -# time zone. -# -# source://tzinfo//lib/tzinfo/linked_timezone.rb#14 -class TZInfo::LinkedTimezone < ::TZInfo::InfoTimezone - # Initializes a new {LinkedTimezone}. - # - # {LinkedTimezone} instances should not normally be created directly. Use - # the {Timezone.get} method to obtain {Timezone} instances. - # - # @param info [DataSources::LinkedTimezoneInfo] a - # {DataSources::LinkedTimezoneInfo} instance supplied by a {DataSource} - # that will be used as the source of data for this {LinkedTimezone}. - # @return [LinkedTimezone] a new instance of LinkedTimezone - # - # source://tzinfo//lib/tzinfo/linked_timezone.rb#15 - def initialize(info); end - - # Returns the canonical {Timezone} instance for this {LinkedTimezone}. - # - # For a {LinkedTimezone}, this is the canonical zone of the link target. - # - # @return [Timezone] the canonical {Timezone} instance for this {Timezone}. - # - # source://tzinfo//lib/tzinfo/linked_timezone.rb#40 - def canonical_zone; end - - # Returns the {TimezonePeriod} that is valid at a given time. - # - # Unlike {period_for_local} and {period_for_utc}, the UTC offset of the - # `time` parameter is taken into consideration. - # - # @param time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [ArgumentError] if `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified - # offset. - # @return [TimezonePeriod] the {TimezonePeriod} that is valid at `time`. - # - # source://tzinfo//lib/tzinfo/linked_timezone.rb#21 - def period_for(time); end - - # Returns the set of {TimezonePeriod}s that are valid for the given - # local time as an `Array`. - # - # The UTC offset of the `local_time` parameter is ignored (it is treated as - # a time in the time zone represented by `self`). - # - # This will typically return an `Array` containing a single - # {TimezonePeriod}. More than one {TimezonePeriod} will be returned when the - # local time is ambiguous (for example, when daylight savings time ends). An - # empty `Array` will be returned when the local time is not valid (for - # example, when daylight savings time begins). - # - # To obtain just a single {TimezonePeriod} in all cases, use - # {period_for_local} instead and specify how ambiguities should be resolved. - # - # @param local_time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [ArgumentError] if `local_time` is `nil`. - # @return [Array] the set of {TimezonePeriod}s that are - # valid at `local_time`. - # - # source://tzinfo//lib/tzinfo/linked_timezone.rb#26 - def periods_for_local(local_time); end - - # Returns an `Array` of {TimezoneTransition} instances representing the - # times where the UTC offset of the timezone changes. - # - # Transitions are returned up to a given time (`to`). - # - # A from time may also be supplied using the `from` parameter. If from is - # not `nil`, only transitions from that time onwards will be returned. - # - # Comparisons with `to` are exclusive. Comparisons with `from` are - # inclusive. If a transition falls precisely on `to`, it will be excluded. - # If a transition falls on `from`, it will be included. - # - # @param to [Object] a `Time`, `DateTime` or {Timestamp} specifying the - # latest (exclusive) transition to return. - # @param from [Object] an optional `Time`, `DateTime` or {Timestamp} - # specifying the earliest (inclusive) transition to return. - # @raise [ArgumentError] if `from` is specified and `to` is not greater than - # `from`. - # @raise [ArgumentError] is raised if `to` is `nil`. - # @raise [ArgumentError] if either `to` or `from` is a {Timestamp} with an - # unspecified offset. - # @return [Array] the transitions that are earlier than - # `to` and, if specified, at or later than `from`. Transitions are ordered - # by when they occur, from earliest to latest. - # - # source://tzinfo//lib/tzinfo/linked_timezone.rb#31 - def transitions_up_to(to, from = T.unsafe(nil)); end -end - -# Represents the infinite period of time in a time zone that constantly -# observes the same offset from UTC (has an unbounded start and end). -# -# source://tzinfo//lib/tzinfo/offset_timezone_period.rb#10 -class TZInfo::OffsetTimezonePeriod < ::TZInfo::TimezonePeriod - # Initializes an {OffsetTimezonePeriod}. - # - # @param offset [TimezoneOffset] the offset that is constantly observed. - # @raise [ArgumentError] if `offset` is `nil`. - # @return [OffsetTimezonePeriod] a new instance of OffsetTimezonePeriod - # - # source://tzinfo//lib/tzinfo/offset_timezone_period.rb#11 - def initialize(offset); end - - # Determines if this {OffsetTimezonePeriod} is equal to another instance. - # - # @param p [Object] the instance to test for equality. - # @return [Boolean] `true` if `p` is a {OffsetTimezonePeriod} with the same - # {offset}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/offset_timezone_period.rb#32 - def ==(p); end - - # @return [TimezoneTransition] the transition that defines the end of this - # {TimezonePeriod}, always `nil` for {OffsetTimezonePeriod}. - # - # source://tzinfo//lib/tzinfo/offset_timezone_period.rb#23 - def end_transition; end - - # Determines if this {OffsetTimezonePeriod} is equal to another instance. - # - # @param p [Object] the instance to test for equality. - # @return [Boolean] `true` if `p` is a {OffsetTimezonePeriod} with the same - # {offset}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/offset_timezone_period.rb#32 - def eql?(p); end - - # @return [Integer] a hash based on {offset}. - # - # source://tzinfo//lib/tzinfo/offset_timezone_period.rb#38 - def hash; end - - # @return [TimezoneTransition] the transition that defines the start of this - # {TimezonePeriod}, always `nil` for {OffsetTimezonePeriod}. - # - # source://tzinfo//lib/tzinfo/offset_timezone_period.rb#17 - def start_transition; end -end - -# {PeriodNotFound} is raised to indicate that no {TimezonePeriod} matching a -# given time could be found. -# -# source://tzinfo//lib/tzinfo/timezone.rb#21 -class TZInfo::PeriodNotFound < ::StandardError; end - -# Methods to support different versions of Ruby. -# -# @private -# -# source://tzinfo//lib/tzinfo/ruby_core_support.rb#6 -module TZInfo::RubyCoreSupport - class << self - # source://tzinfo//lib/tzinfo/ruby_core_support.rb#17 - def untaint(o); end - end -end - -# Maintains a pool of `String` instances. The {#dedupe} method will return -# either a pooled copy of a given `String` or add the instance to the pool. -# -# @private -# -# source://tzinfo//lib/tzinfo/string_deduper.rb#11 -class TZInfo::StringDeduper - # Initializes a new {StringDeduper}. - # - # @return [StringDeduper] a new instance of StringDeduper - # - # source://tzinfo//lib/tzinfo/string_deduper.rb#20 - def initialize; end - - # @param string [String] the string to deduplicate. - # @return [bool] `string` if it is frozen, otherwise a frozen, possibly - # pre-existing copy of `string`. - # - # source://tzinfo//lib/tzinfo/string_deduper.rb#30 - def dedupe(string); end - - protected - - # Creates a `Hash` to store pooled `String` instances. - # - # @param block [Proc] Default value block to be passed to `Hash.new`. - # @return [Hash] a `Hash` to store pooled `String` instances. - # - # source://tzinfo//lib/tzinfo/string_deduper.rb#41 - def create_hash(&block); end - - class << self - # @return [StringDeduper] a globally available singleton instance of - # {StringDeduper}. This instance is safe for use in concurrently - # executing threads. - # - # source://tzinfo//lib/tzinfo/string_deduper.rb#16 - def global; end - end -end - -# A subclass of `Time` used to represent local times. {TimeWithOffset} holds a -# reference to the related {TimezoneOffset} and overrides various methods to -# return results appropriate for the {TimezoneOffset}. Certain operations will -# clear the associated {TimezoneOffset} (if the {TimezoneOffset} would not -# necessarily be valid for the result). Once the {TimezoneOffset} has been -# cleared, {TimeWithOffset} behaves identically to `Time`. -# -# Arithmetic performed on {TimeWithOffset} instances is _not_ time zone-aware. -# Regardless of whether transitions in the time zone are crossed, results of -# arithmetic operations will always maintain the same offset from UTC -# (`utc_offset`). The associated {TimezoneOffset} will aways be cleared. -# -# source://tzinfo//lib/tzinfo/time_with_offset.rb#16 -class TZInfo::TimeWithOffset < ::Time - include ::TZInfo::WithOffset - - # An overridden version of `Time#dst?` that, if there is an associated - # {TimezoneOffset}, returns the result of calling {TimezoneOffset#dst? dst?} - # on that offset. - # - # @return [Boolean] `true` if daylight savings time is being observed, - # otherwise `false`. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#43 - def dst?; end - - # An overridden version of `Time#getlocal` that clears the associated - # {TimezoneOffset} if the base implementation of `getlocal` returns a - # {TimeWithOffset}. - # - # @return [Time] a representation of the {TimeWithOffset} using either the - # local time zone or the given offset. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#55 - def getlocal(*args); end - - # An overridden version of `Time#gmtime` that clears the associated - # {TimezoneOffset}. - # - # @return [TimeWithOffset] `self`. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#69 - def gmtime; end - - # An overridden version of `Time#dst?` that, if there is an associated - # {TimezoneOffset}, returns the result of calling {TimezoneOffset#dst? dst?} - # on that offset. - # - # @return [Boolean] `true` if daylight savings time is being observed, - # otherwise `false`. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#43 - def isdst; end - - # An overridden version of `Time#localtime` that clears the associated - # {TimezoneOffset}. - # - # @return [TimeWithOffset] `self`. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#79 - def localtime(*args); end - - # An overridden version of `Time#round` that, if there is an associated - # {TimezoneOffset}, returns a {TimeWithOffset} preserving that offset. - # - # @return [Time] the rounded time. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#89 - def round(ndigits = T.unsafe(nil)); end - - # Marks this {TimeWithOffset} as a local time with the UTC offset of a given - # {TimezoneOffset} and sets the associated {TimezoneOffset}. - # - # @param timezone_offset [TimezoneOffset] the {TimezoneOffset} to use to set - # the offset of this {TimeWithOffset}. - # @raise [ArgumentError] if `timezone_offset` is `nil`. - # @return [TimeWithOffset] `self`. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#30 - def set_timezone_offset(timezone_offset); end - - # @return [TimezoneOffset] the {TimezoneOffset} associated with this - # instance. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#21 - def timezone_offset; end - - # An overridden version of `Time#to_a`. The `isdst` (index 8) and `zone` - # (index 9) elements of the array are set according to the associated - # {TimezoneOffset}. - # - # @return [Array] an `Array` representation of the {TimeWithOffset}. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#98 - def to_a; end - - # An overridden version of `Time#to_datetime` that, if there is an - # associated {TimezoneOffset}, returns a {DateTimeWithOffset} with that - # offset. - # - # @return [DateTime] if there is an associated {TimezoneOffset}, a - # {DateTimeWithOffset} representation of this {TimeWithOffset}, otherwise - # a `Time` representation. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#135 - def to_datetime; end - - # An overridden version of `Time#utc` that clears the associated - # {TimezoneOffset}. - # - # @return [TimeWithOffset] `self`. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#110 - def utc; end - - # An overridden version of `Time#zone` that, if there is an associated - # {TimezoneOffset}, returns the {TimezoneOffset#abbreviation abbreviation} - # of that offset. - # - # @return [String] the {TimezoneOffset#abbreviation abbreviation} of the - # associated {TimezoneOffset}, or the result from `Time#zone` if there is - # no such offset. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#123 - def zone; end - - protected - - # Clears the associated {TimezoneOffset}. - # - # @return [TimeWithOffset] `self`. - # - # source://tzinfo//lib/tzinfo/time_with_offset.rb#149 - def clear_timezone_offset; end -end - -# A time represented as an `Integer` number of seconds since 1970-01-01 -# 00:00:00 UTC (ignoring leap seconds and using the proleptic Gregorian -# calendar), the fraction through the second (sub_second as a `Rational`) and -# an optional UTC offset. Like Ruby's `Time` class, {Timestamp} can -# distinguish between a local time with a zero offset and a time specified -# explicitly as UTC. -# -# source://tzinfo//lib/tzinfo/timestamp.rb#11 -class TZInfo::Timestamp - include ::Comparable - - # Initializes a new {Timestamp}. - # - # @param value [Integer] the number of seconds since 1970-01-01 00:00:00 UTC - # ignoring leap seconds. - # @param utc_offset [Object] either `nil` for a {Timestamp} without a - # specified offset, an offset from UTC specified as an `Integer` number of - # seconds or the `Symbol` `:utc`). - # @param sub_second [Numeric] the fractional part of the second as either a - # `Rational` that is greater than or equal to 0 and less than 1, or - # the `Integer` 0. - # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` and - # not the `Symbol` `:utc`. - # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the - # `Integer` 0. - # @raise [ArgumentError] if `value` is not an `Integer`. - # @raise [RangeError] if `sub_second` is a `Rational` but that is less - # than 0 or greater than or equal to 1. - # @return [Timestamp] a new instance of Timestamp - # - # source://tzinfo//lib/tzinfo/timestamp.rb#344 - def initialize(value, sub_second = T.unsafe(nil), utc_offset = T.unsafe(nil)); end - - # Compares this {Timestamp} with another. - # - # {Timestamp} instances without a defined UTC offset are not comparable with - # {Timestamp} instances that have a defined UTC offset. - # - # @param t [Timestamp] the {Timestamp} to compare this instance with. - # @return [Integer] -1, 0 or 1 depending if this instance is earlier, equal - # or later than `t` respectively. Returns `nil` when comparing a - # {Timestamp} that does not have a defined UTC offset with a {Timestamp} - # that does have a defined UTC offset. Returns `nil` if `t` is not a - # {Timestamp}. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#454 - def <=>(t); end - - # Adds a number of seconds to the {Timestamp} value, setting the UTC offset - # of the result. - # - # @param seconds [Integer] the number of seconds to be added. - # @param utc_offset [Object] either `nil` for a {Timestamp} without a - # specified offset, an offset from UTC specified as an `Integer` number of - # seconds or the `Symbol` `:utc`). - # @raise [ArgumentError] if `seconds` is not an `Integer`. - # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` and - # not the `Symbol` `:utc`. - # @return [Timestamp] the result of adding `seconds` to the - # {Timestamp} value as a new {Timestamp} instance with the chosen - # `utc_offset`. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#372 - def add_and_set_utc_offset(seconds, utc_offset); end - - def eql?(_arg0); end - - # @return [Integer] a hash based on the value, sub-second and whether there - # is a defined UTC offset. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#468 - def hash; end - - # @return [String] the internal object state as a programmer-readable - # `String`. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#474 - def inspect; end - - # Formats this {Timestamp} according to the directives in the given format - # string. - # - # @param format [String] the format string. Please refer to `Time#strftime` - # for a list of supported format directives. - # @raise [ArgumentError] if `format` is not specified. - # @return [String] the formatted {Timestamp}. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#426 - def strftime(format); end - - # @return [Numeric] the fraction of a second elapsed since timestamp as - # either a `Rational` or the `Integer` 0. Always greater than or equal to - # 0 and less than 1. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#321 - def sub_second; end - - # Converts this {Timestamp} to a Gregorian `DateTime`. - # - # @return [DateTime] a Gregorian `DateTime` representation of this - # {Timestamp}. If the UTC offset of this {Timestamp} is not specified, a - # UTC `DateTime` will be returned. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#406 - def to_datetime; end - - # Converts this {Timestamp} to an `Integer` number of seconds since - # 1970-01-01 00:00:00 UTC (ignoring leap seconds). - # - # @return [Integer] an `Integer` representation of this {Timestamp} (the - # number of seconds since 1970-01-01 00:00:00 UTC ignoring leap seconds). - # - # source://tzinfo//lib/tzinfo/timestamp.rb#415 - def to_i; end - - # @return [String] a `String` representation of this {Timestamp}. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#432 - def to_s; end - - # Converts this {Timestamp} to a `Time`. - # - # @return [Time] a `Time` representation of this {Timestamp}. If the UTC - # offset of this {Timestamp} is not specified, a UTC `Time` will be - # returned. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#391 - def to_time; end - - # @return [Timestamp] a UTC {Timestamp} equivalent to this instance. Returns - # `self` if {#utc? self.utc?} is `true`. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#381 - def utc; end - - # @return [Boolean] `true` if this {Timestamp} represents UTC, `false` if - # the {Timestamp} wasn't specified as UTC or `nil` if the {Timestamp} has - # no specified offset. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#355 - def utc?; end - - # @return [Integer] the offset from UTC in seconds or `nil` if the - # {Timestamp} doesn't have a specified offset. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#325 - def utc_offset; end - - # @return [Integer] the number of seconds since 1970-01-01 00:00:00 UTC - # ignoring leap seconds (i.e. each day is treated as if it were 86,400 - # seconds long). - # - # source://tzinfo//lib/tzinfo/timestamp.rb#316 - def value; end - - protected - - # Constructs a new instance of a `DateTime` or `DateTime`-like class with - # the same {value}, {sub_second} and {utc_offset} as this {Timestamp}. - # - # @param klass [Class] the class to instantiate. - # @private - # - # source://tzinfo//lib/tzinfo/timestamp.rb#496 - def new_datetime(klass = T.unsafe(nil)); end - - # Creates a new instance of a `Time` or `Time`-like class matching the - # {value} and {sub_second} of this {Timestamp}, but not setting the offset. - # - # @param klass [Class] the class to instantiate. - # @private - # - # source://tzinfo//lib/tzinfo/timestamp.rb#486 - def new_time(klass = T.unsafe(nil)); end - - private - - # Initializes a new {Timestamp} without validating the parameters. This - # method is used internally within {Timestamp} to avoid the overhead of - # checking parameters. - # - # @param value [Integer] the number of seconds since 1970-01-01 00:00:00 UTC - # ignoring leap seconds. - # @param sub_second [Numeric] the fractional part of the second as either a - # `Rational` that is greater than or equal to 0 and less than 1, or the - # `Integer` 0. - # @param utc_offset [Object] either `nil` for a {Timestamp} without a - # specified offset, an offset from UTC specified as an `Integer` number of - # seconds or the `Symbol` `:utc`). - # - # source://tzinfo//lib/tzinfo/timestamp.rb#538 - def initialize!(value, sub_second = T.unsafe(nil), utc_offset = T.unsafe(nil)); end - - # Converts the {sub_second} value to a `String` suitable for appending to - # the `String` representation of a {Timestamp}. - # - # @return [String] a `String` representation of {sub_second}. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#518 - def sub_second_to_s; end - - # Converts the value and sub-seconds to a `String`, adding on the given - # offset. - # - # @param offset [Integer] the offset to add to the value. - # @return [String] the value and sub-seconds. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#510 - def value_and_sub_second_to_s(offset = T.unsafe(nil)); end - - class << self - # Returns a new {Timestamp} representing the (proleptic Gregorian - # calendar) date and time specified by the supplied parameters. - # - # If `utc_offset` is `nil`, `:utc` or 0, the date and time parameters will - # be interpreted as representing a UTC date and time. Otherwise the date - # and time parameters will be interpreted as a local date and time with - # the given offset. - # - # @param month [Integer] the month (1-12). - # @param day [Integer] the day of the month (1-31). - # @param hour [Integer] the hour (0-23). - # @param minute [Integer] the minute (0-59). - # @param second [Integer] the second (0-59). - # @param sub_second [Numeric] the fractional part of the second as either - # a `Rational` that is greater than or equal to 0 and less than 1, or - # the `Integer` 0. - # @param utc_offset [Object] either `nil` for a {Timestamp} without a - # specified offset, an offset from UTC specified as an `Integer` number - # of seconds or the `Symbol` `:utc`). - # @param year [Integer] the year. - # @raise [RangeError] if `sub_second` is a `Rational` but that is less - # than 0 or greater than or equal to 1. - # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the - # `Integer` 0. - # @raise [ArgumentError] if either of `year`, `month`, `day`, `hour`, - # `minute`, or `second` is not an `Integer`. - # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` - # and not the `Symbol` `:utc`. - # @raise [RangeError] if `month` is not between 1 and 12. - # @raise [RangeError] if `day` is not between 1 and 31. - # @raise [RangeError] if `hour` is not between 0 and 23. - # @raise [RangeError] if `minute` is not between 0 and 59. - # @raise [RangeError] if `second` is not between 0 and 59. - # @return [Timestamp] a new {Timestamp} representing the specified - # (proleptic Gregorian calendar) date and time. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#55 - def create(year, month = T.unsafe(nil), day = T.unsafe(nil), hour = T.unsafe(nil), minute = T.unsafe(nil), second = T.unsafe(nil), sub_second = T.unsafe(nil), utc_offset = T.unsafe(nil)); end - - # When used without a block, returns a {Timestamp} representation of a - # given `Time`, `DateTime` or {Timestamp}. - # - # When called with a block, the {Timestamp} representation of `value` is - # passed to the block. The block must then return a {Timestamp}, which - # will be converted back to the type of the initial value. If the initial - # value was a {Timestamp}, the block result will be returned. If the - # initial value was a `DateTime`, a Gregorian `DateTime` will be returned. - # - # The UTC offset of `value` can either be preserved (the {Timestamp} - # representation will have the same UTC offset as `value`), ignored (the - # {Timestamp} representation will have no defined UTC offset), or treated - # as though it were UTC (the {Timestamp} representation will have a - # {utc_offset} of 0 and {utc?} will return `true`). - # - # @param value [Object] a `Time`, `DateTime` or {Timestamp}. - # @param offset [Symbol] either `:preserve` to preserve the offset of - # `value`, `:ignore` to ignore the offset of `value` and create a - # {Timestamp} with an unspecified offset, or `:treat_as_utc` to treat - # the offset of `value` as though it were UTC and create a UTC - # {Timestamp}. - # @raise [ArgumentError] - # @return [Object] if called without a block, the {Timestamp} - # representation of `value`, otherwise the result of the block, - # converted back to the type of `value`. - # @yield [timestamp] if a block is provided, the {Timestamp} - # representation is passed to the block. - # @yieldparam timestamp [Timestamp] the {Timestamp} representation of - # `value`. - # @yieldreturn [Timestamp] a {Timestamp} to be converted back to the type - # of `value`. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#112 - def for(value, offset = T.unsafe(nil)); end - - # Creates a new UTC {Timestamp}. - # - # @param value [Integer] the number of seconds since 1970-01-01 00:00:00 - # UTC ignoring leap seconds. - # @param sub_second [Numeric] the fractional part of the second as either - # a `Rational` that is greater than or equal to 0 and less than 1, or - # the `Integer` 0. - # @raise [ArgumentError] if `value` is not an `Integer`. - # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the - # `Integer` 0. - # @raise [RangeError] if `sub_second` is a `Rational` but that is less - # than 0 or greater than or equal to 1. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#172 - def utc(value, sub_second = T.unsafe(nil)); end - - private - - # Creates a {Timestamp} that represents a given `DateTime`, optionally - # ignoring the offset. - # - # @param datetime [DateTime] a `DateTime`. - # @param ignore_offset [Boolean] whether to ignore the offset of - # `datetime`. - # @param target_utc_offset [Object] if `ignore_offset` is `true`, the UTC - # offset of the result (`:utc`, `nil` or an `Integer`). - # @return [Timestamp] the {Timestamp} representation of `datetime`. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#231 - def for_datetime(datetime, ignore_offset, target_utc_offset); end - - # Creates a {Timestamp} that represents a given `Time`, optionally - # ignoring the offset. - # - # @param time [Time] a `Time`. - # @param ignore_offset [Boolean] whether to ignore the offset of `time`. - # @param target_utc_offset [Object] if `ignore_offset` is `true`, the UTC - # offset of the result (`:utc`, `nil` or an `Integer`). - # @return [Timestamp] the {Timestamp} representation of `time`. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#206 - def for_time(time, ignore_offset, target_utc_offset); end - - # Creates a {Timestamp} that represents a given `Time`-like object, - # optionally ignoring the offset (if the `time_like` responds to - # `utc_offset`). - # - # @param time_like [Object] a `Time`-like object. - # @param ignore_offset [Boolean] whether to ignore the offset of `time`. - # @param target_utc_offset [Object] if `ignore_offset` is `true`, the UTC - # offset of the result (`:utc`, `nil` or an `Integer`). - # @return [Timestamp] the {Timestamp} representation of `time_like`. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#296 - def for_time_like(time_like, ignore_offset, target_utc_offset); end - - # Returns a {Timestamp} that represents another {Timestamp}, optionally - # ignoring the offset. If the result would be identical to `value`, the - # same instance is returned. If the passed in value is an instance of a - # subclass of {Timestamp}, then a new {Timestamp} will always be returned. - # - # @param timestamp [Timestamp] a {Timestamp}. - # @param ignore_offset [Boolean] whether to ignore the offset of - # `timestamp`. - # @param target_utc_offset [Object] if `ignore_offset` is `true`, the UTC - # offset of the result (`:utc`, `nil` or an `Integer`). - # @return [Timestamp] a [Timestamp] representation of `timestamp`. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#256 - def for_timestamp(timestamp, ignore_offset, target_utc_offset); end - - # Determines if an object is like a `Time` (for the purposes of converting - # to a {Timestamp} with {for}), responding to `to_i` and `subsec`. - # - # @param value [Object] an object to test. - # @return [Boolean] `true` if the object is `Time`-like, otherwise - # `false`. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#283 - def is_time_like?(value); end - - # Constructs a new instance of `self` (i.e. {Timestamp} or a subclass of - # {Timestamp}) without validating the parameters. This method is used - # internally within {Timestamp} to avoid the overhead of checking - # parameters. - # - # @param value [Integer] the number of seconds since 1970-01-01 00:00:00 - # UTC ignoring leap seconds. - # @param sub_second [Numeric] the fractional part of the second as either - # a `Rational` that is greater than or equal to 0 and less than 1, or - # the `Integer` 0. - # @param utc_offset [Object] either `nil` for a {Timestamp} without a - # specified offset, an offset from UTC specified as an `Integer` number - # of seconds or the `Symbol` `:utc`). - # @return [Timestamp] a new instance of `self`. - # - # source://tzinfo//lib/tzinfo/timestamp.rb#192 - def new!(value, sub_second = T.unsafe(nil), utc_offset = T.unsafe(nil)); end - end -end - -# The Unix epoch (1970-01-01 00:00:00 UTC) as a chronological Julian day -# number. -# -# source://tzinfo//lib/tzinfo/timestamp.rb#16 -TZInfo::Timestamp::JD_EPOCH = T.let(T.unsafe(nil), Integer) - -# A subclass of {Timestamp} used to represent local times. -# {TimestampWithOffset} holds a reference to the related {TimezoneOffset} and -# overrides various methods to return results appropriate for the -# {TimezoneOffset}. Certain operations will clear the associated -# {TimezoneOffset} (if the {TimezoneOffset} would not necessarily be valid for -# the result). Once the {TimezoneOffset} has been cleared, -# {TimestampWithOffset} behaves identically to {Timestamp}. -# -# source://tzinfo//lib/tzinfo/timestamp_with_offset.rb#12 -class TZInfo::TimestampWithOffset < ::TZInfo::Timestamp - include ::TZInfo::WithOffset - - # Sets the associated {TimezoneOffset} of this {TimestampWithOffset}. - # - # @param timezone_offset [TimezoneOffset] a {TimezoneOffset} valid at the time - # and for the offset of this {TimestampWithOffset}. - # @raise [ArgumentError] if `timezone_offset` is `nil`. - # @raise [ArgumentError] if {utc? self.utc?} is `true`. - # @raise [ArgumentError] if `timezone_offset.observed_utc_offset` does not equal - # `self.utc_offset`. - # @return [TimestampWithOffset] `self`. - # - # source://tzinfo//lib/tzinfo/timestamp_with_offset.rb#47 - def set_timezone_offset(timezone_offset); end - - # @return [TimezoneOffset] the {TimezoneOffset} associated with this - # instance. - # - # source://tzinfo//lib/tzinfo/timestamp_with_offset.rb#17 - def timezone_offset; end - - # An overridden version of {Timestamp#to_datetime}, if there is an - # associated {TimezoneOffset}, returns a {DateTimeWithOffset} with that - # offset. - # - # @return [DateTime] if there is an associated {TimezoneOffset}, a - # {DateTimeWithOffset} representation of this {TimestampWithOffset}, - # otherwise a `DateTime` representation. - # - # source://tzinfo//lib/tzinfo/timestamp_with_offset.rb#76 - def to_datetime; end - - # An overridden version of {Timestamp#to_time} that, if there is an - # associated {TimezoneOffset}, returns a {TimeWithOffset} with that offset. - # - # @return [Time] if there is an associated {TimezoneOffset}, a - # {TimeWithOffset} representation of this {TimestampWithOffset}, otherwise - # a `Time` representation. - # - # source://tzinfo//lib/tzinfo/timestamp_with_offset.rb#60 - def to_time; end - - class << self - # Creates a new {TimestampWithOffset} from a given {Timestamp} and - # {TimezoneOffset}. - # - # time of `timestamp`. - # - # @param timestamp [Timestamp] a {Timestamp}. - # @param timezone_offset [TimezoneOffset] a {TimezoneOffset} valid at the - # @raise [ArgumentError] if `timestamp` or `timezone_offset` is `nil`. - # @return [TimestampWithOffset] a {TimestampWithOffset} that has the same - # {value value} and {sub_second sub_second} as the `timestamp` parameter, - # a {utc_offset utc_offset} equal to the - # {TimezoneOffset#observed_utc_offset observed_utc_offset} of the - # `timezone_offset` parameter and {timezone_offset timezone_offset} set to - # the `timezone_offset` parameter. - # - # source://tzinfo//lib/tzinfo/timestamp_with_offset.rb#32 - def set_timezone_offset(timestamp, timezone_offset); end - end -end - -# The {Timezone} class represents a time zone. It provides a factory method, -# {get}, to retrieve {Timezone} instances by their identifier. -# -# The {Timezone#to_local} method can be used to convert `Time` and `DateTime` -# instances to the local time for the zone. For example: -# -# tz = TZInfo::Timezone.get('America/New_York') -# local_time = tz.to_local(Time.utc(2005,8,29,15,35,0)) -# local_datetime = tz.to_local(DateTime.new(2005,8,29,15,35,0)) -# -# Local `Time` and `DateTime` instances returned by `Timezone` have the -# correct local offset. -# -# The {Timezone#local_to_utc} method can by used to convert local `Time` and -# `DateTime` instances to UTC. {Timezone#local_to_utc} ignores the UTC offset -# of the supplied value and treats if it is a local time for the zone. For -# example: -# -# tz = TZInfo::Timezone.get('America/New_York') -# utc_time = tz.local_to_utc(Time.new(2005,8,29,11,35,0)) -# utc_datetime = tz.local_to_utc(DateTime.new(2005,8,29,11,35,0)) -# -# Each time zone is treated as sequence of periods of time ({TimezonePeriod}) -# that observe the same offset ({TimezoneOffset}). Transitions -# ({TimezoneTransition}) denote the end of one period and the start of the -# next. The {Timezone} class has methods that allow the periods, offsets and -# transitions of a time zone to be interrogated. -# -# All methods that take `Time` objects as parameters can be used with -# arbitrary `Time`-like objects that respond to both `to_i` and `subsec` and -# optionally `utc_offset`. -# -# The {Timezone} class is thread-safe. It is safe to use class and instance -# methods of {Timezone} in concurrently executing threads. Instances of -# {Timezone} can be shared across thread boundaries. -# -# The IANA Time Zone Database maintainers recommend that time zone identifiers -# are not made visible to end-users (see [Names of -# timezones](https://data.iana.org/time-zones/theory.html#naming)). The -# {Country} class can be used to obtain lists of time zones by country, -# including user-friendly descriptions and approximate locations. -# -# @abstract The {get} method returns an instance of either {DataTimezone} or -# {LinkedTimezone}. The {get_proxy} method and other methods returning -# collections of time zones return instances of {TimezoneProxy}. -# -# source://tzinfo//lib/tzinfo/timezone.rb#80 -class TZInfo::Timezone - include ::Comparable - - # Compares this {Timezone} with another based on the {identifier}. - # - # @param tz [Object] an `Object` to compare this {Timezone} with. - # @return [Integer] -1 if `tz` is less than `self`, 0 if `tz` is equal to - # `self` and +1 if `tz` is greater than `self`, or `nil` if `tz` is not an - # instance of {Timezone}. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1105 - def <=>(tz); end - - # Matches `regexp` against the {identifier} of this {Timezone}. - # - # @param regexp [Regexp] a `Regexp` to match against the {identifier} of - # this {Timezone}. - # @return [Integer] the position the match starts, or `nil` if there is no - # match. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1128 - def =~(regexp); end - - # Returns a serialized representation of this {Timezone}. This method is - # called when using `Marshal.dump` with an instance of {Timezone}. - # - # @param limit [Integer] the maximum depth to dump - ignored. - # @return [String] a serialized representation of this {Timezone}. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1137 - def _dump(limit); end - - # @param time [Object] a `Time`, `DateTime` or `Timestamp`. - # @raise [ArgumentError] if `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC - # offset. - # @return [String] the abbreviation of this {Timezone} at the given time. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1048 - def abbr(time = T.unsafe(nil)); end - - # @param time [Object] a `Time`, `DateTime` or `Timestamp`. - # @raise [ArgumentError] if `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC - # offset. - # @return [String] the abbreviation of this {Timezone} at the given time. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1048 - def abbreviation(time = T.unsafe(nil)); end - - # Returns the base offset from UTC in seconds at the given time. This does - # not include any adjustment made for daylight savings time and will - # typically remain constant throughout the year. - # - # To obtain the observed offset from UTC, including the effect of daylight - # savings time, use {observed_utc_offset} instead. - # - # If you require accurate {base_utc_offset} values, you should install the - # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. - # When using {DataSources::ZoneinfoDataSource}, the value of - # {base_utc_offset} has to be derived from changes to the observed UTC - # offset and DST status since it is not included in zoneinfo files. - # - # @param time [Object] a `Time`, `DateTime` or `Timestamp`. - # @raise [ArgumentError] if `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC - # offset. - # @return [Integer] the base offset from UTC in seconds at the given time. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1081 - def base_utc_offset(time = T.unsafe(nil)); end - - # Returns the canonical identifier of this time zone. - # - # This is a shortcut for calling `canonical_zone.identifier`. Please refer - # to the {canonical_zone} documentation for further information. - # - # @return [String] the canonical identifier of this time zone. - # - # source://tzinfo//lib/tzinfo/timezone.rb#987 - def canonical_identifier; end - - # Returns the canonical {Timezone} instance for this {Timezone}. - # - # The IANA Time Zone database contains two types of definition: Zones and - # Links. Zones are defined by rules that set out when transitions occur. - # Links are just references to fully defined Zone, creating an alias for - # that Zone. - # - # Links are commonly used where a time zone has been renamed in a release of - # the Time Zone database. For example, the US/Eastern Zone was renamed as - # America/New_York. A US/Eastern Link was added in its place, linking to - # (and creating an alias for) America/New_York. - # - # Links are also used for time zones that are currently identical to a full - # Zone, but that are administered separately. For example, Europe/Vatican is - # a Link to (and alias for) Europe/Rome. - # - # For a full Zone (implemented by {DataTimezone}), {canonical_zone} returns - # self. - # - # For a Link (implemented by {LinkedTimezone}), {canonical_zone} returns a - # {Timezone} instance representing the full Zone that the link targets. - # - # TZInfo can be used with different data sources (see the documentation for - # {TZInfo::DataSource}). Some DataSource implementations may not support - # distinguishing between full Zones and Links and will treat all time zones - # as full Zones. In this case, {canonical_zone} will always return `self`. - # - # There are two built-in DataSource implementations. - # {DataSources::RubyDataSource} (which will be used if the tzinfo-data gem - # is available) supports Link zones. {DataSources::ZoneinfoDataSource} - # returns Link zones as if they were full Zones. If the {canonical_zone} or - # {canonical_identifier} methods are needed, the tzinfo-data gem should be - # installed. - # - # The {TZInfo::DataSource.get} method can be used to check which DataSource - # implementation is being used. - # - # @return [Timezone] the canonical {Timezone} instance for this {Timezone}. - # - # source://tzinfo//lib/tzinfo/timezone.rb#412 - def canonical_zone; end - - # @return [TimezonePeriod] the current {TimezonePeriod} for the time zone. - # - # source://tzinfo//lib/tzinfo/timezone.rb#997 - def current_period; end - - # Returns the current local time and {TimezonePeriod} for the time zone as - # an `Array`. The first element is the time as a {TimeWithOffset}. The - # second element is the period. - # - # @return [Array] an `Array` containing the current {TimeWithOffset} for the - # time zone as the first element and the current {TimezonePeriod} for the - # time zone as the second element. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1008 - def current_period_and_time; end - - # Returns the current local time and {TimezonePeriod} for the time zone as - # an `Array`. The first element is the time as a {TimeWithOffset}. The - # second element is the period. - # - # @return [Array] an `Array` containing the current {TimeWithOffset} for the - # time zone as the first element and the current {TimezonePeriod} for the - # time zone as the second element. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1008 - def current_time_and_period; end - - # @param time [Object] a `Time`, `DateTime` or `Timestamp`. - # @raise [ArgumentError] if `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC - # offset. - # @return [Boolean] whether daylight savings time is in effect at the given - # time. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1059 - def dst?(time = T.unsafe(nil)); end - - # @param tz [Object] an `Object` to compare this {Timezone} with. - # @return [Boolean] `true` if `tz` is an instance of {Timezone} and has the - # same {identifier} as `self`, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1113 - def eql?(tz); end - - # Returns {identifier}, modified to make it more readable. Set - # `skip_first_part` to omit the first part of the identifier (typically a - # region name) where there is more than one part. - # - # For example: - # - # TZInfo::Timezone.get('Europe/Paris').friendly_identifier(false) #=> "Europe - Paris" - # TZInfo::Timezone.get('Europe/Paris').friendly_identifier(true) #=> "Paris" - # TZInfo::Timezone.get('America/Indiana/Knox').friendly_identifier(false) #=> "America - Knox, Indiana" - # TZInfo::Timezone.get('America/Indiana/Knox').friendly_identifier(true) #=> "Knox, Indiana" - # - # @param skip_first_part [Boolean] whether the first part of the identifier - # (typically a region name) should be omitted. - # @return [String] the modified identifier. - # - # source://tzinfo//lib/tzinfo/timezone.rb#277 - def friendly_identifier(skip_first_part = T.unsafe(nil)); end - - # @return [Integer] a hash based on the {identifier}. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1118 - def hash; end - - # @return [String] the identifier of the time zone, for example, - # `"Europe/Paris"`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#241 - def identifier; end - - # @return [String] the internal object state as a programmer-readable - # `String`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#259 - def inspect; end - - # Creates a `DateTime` object based on the given (Gregorian calendar) date - # and time parameters. The parameters are interpreted as a local time in the - # time zone. The result has the appropriate `offset` and - # {DateTimeWithOffset#timezone_offset timezone_offset}. - # - # _Warning:_ There are time values that are not valid as local times in a - # time zone (for example, during the transition from standard time to - # daylight savings time). There are also time values that are ambiguous, - # occurring more than once with different offsets to UTC (for example, - # during the transition from daylight savings time to standard time). - # - # In the first case (an invalid local time), a {PeriodNotFound} exception - # will be raised. - # - # In the second case (more than one occurrence), an {AmbiguousTime} - # exception will be raised unless the optional `dst` parameter or block - # handles the ambiguity. - # - # If the ambiguity is due to a transition from daylight savings time to - # standard time, the `dst` parameter can be used to select whether the - # daylight savings time or local time is used. For example, the following - # code would raise an {AmbiguousTime} exception: - # - # tz = TZInfo::Timezone.get('America/New_York') - # tz.local_datetime(2004,10,31,1,30,0,0) - # - # Specifying `dst = true` would return a `Time` with a UTC offset of -4 - # hours and abbreviation EDT (Eastern Daylight Time). Specifying `dst = - # false` would return a `Time` with a UTC offset of -5 hours and - # abbreviation EST (Eastern Standard Time). - # - # The `dst` parameter will not be able to resolve an ambiguity resulting - # from the clocks being set back without changing from daylight savings time - # to standard time. In this case, if a block is specified, it will be called - # to resolve the ambiguity. The block must take a single parameter - an - # `Array` of {TimezonePeriod}s that need to be resolved. The block can - # select and return a single {TimezonePeriod} or return `nil` or an empty - # `Array` to cause an {AmbiguousTime} exception to be raised. - # - # The default value of the `dst` parameter can be specified using - # {Timezone.default_dst=}. - # - # values, interpreted as a local time in the time zone. - # - # @param hour [Integer] the hour (0-23). - # @param minute [Integer] the minute (0-59). - # @param second [Integer] the second (0-59). - # @param sub_second [Numeric] the fractional part of the second as either - # a `Rational` that is greater than or equal to 0 and less than 1, or - # the `Integer` 0. - # @param dst [Boolean] whether to resolve ambiguous local times by always - # selecting the period observing daylight savings time (`true`), always - # selecting the period observing standard time (`false`), or leaving the - # ambiguity unresolved (`nil`). - # @param month [Integer] the month (1-12). - # @param day [Integer] the day of the month (1-31). - # @param year [Integer] the year. - # @raise [RangeError] if `sub_second` is a `Rational` but that is less - # than 0 or greater than or equal to 1. - # @raise [PeriodNotFound] if the date and time parameters do not specify a - # valid local time in the time zone. - # @raise [AmbiguousTime] if the date and time parameters are ambiguous for - # the time zone and the `dst` parameter or block did not resolve the - # ambiguity. - # @raise [RangeError] if `month` is not between 1 and 12. - # @raise [ArgumentError] if either of `year`, `month`, `day`, `hour`, - # `minute`, or `second` is not an `Integer`. - # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the - # `Integer` 0. - # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` - # and not the `Symbol` `:utc`. - # @raise [RangeError] if `day` is not between 1 and 31. - # @raise [RangeError] if `hour` is not between 0 and 23. - # @raise [RangeError] if `minute` is not between 0 and 59. - # @raise [RangeError] if `second` is not between 0 and 59. - # @return [DateTimeWithOffset] a new `DateTime` object based on the given - # @yield [periods] if the `dst` parameter did not resolve an ambiguity, an - # optional block is yielded to. - # @yieldparam periods [Array] an `Array` containing all - # the {TimezonePeriod}s that still match `local_time` after applying the - # `dst` parameter. - # @yieldreturn [Object] to resolve the ambiguity: a chosen {TimezonePeriod} - # or an `Array` containing a chosen {TimezonePeriod}; to leave the - # ambiguity unresolved: an empty `Array`, an `Array` containing more than - # one {TimezonePeriod}, or `nil`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#831 - def local_datetime(year, month = T.unsafe(nil), day = T.unsafe(nil), hour = T.unsafe(nil), minute = T.unsafe(nil), second = T.unsafe(nil), sub_second = T.unsafe(nil), dst = T.unsafe(nil), &block); end - - # Creates a `Time` object based on the given (Gregorian calendar) date and - # time parameters. The parameters are interpreted as a local time in the - # time zone. The result has the appropriate `utc_offset`, `zone` and - # {TimeWithOffset#timezone_offset timezone_offset}. - # - # _Warning:_ There are time values that are not valid as local times in a - # time zone (for example, during the transition from standard time to - # daylight savings time). There are also time values that are ambiguous, - # occurring more than once with different offsets to UTC (for example, - # during the transition from daylight savings time to standard time). - # - # In the first case (an invalid local time), a {PeriodNotFound} exception - # will be raised. - # - # In the second case (more than one occurrence), an {AmbiguousTime} - # exception will be raised unless the optional `dst` parameter or block - # handles the ambiguity. - # - # If the ambiguity is due to a transition from daylight savings time to - # standard time, the `dst` parameter can be used to select whether the - # daylight savings time or local time is used. For example, the following - # code would raise an {AmbiguousTime} exception: - # - # tz = TZInfo::Timezone.get('America/New_York') - # tz.local_time(2004,10,31,1,30,0,0) - # - # Specifying `dst = true` would return a `Time` with a UTC offset of -4 - # hours and abbreviation EDT (Eastern Daylight Time). Specifying `dst = - # false` would return a `Time` with a UTC offset of -5 hours and - # abbreviation EST (Eastern Standard Time). - # - # The `dst` parameter will not be able to resolve an ambiguity resulting - # from the clocks being set back without changing from daylight savings time - # to standard time. In this case, if a block is specified, it will be called - # to resolve the ambiguity. The block must take a single parameter - an - # `Array` of {TimezonePeriod}s that need to be resolved. The block can - # select and return a single {TimezonePeriod} or return `nil` or an empty - # `Array` to cause an {AmbiguousTime} exception to be raised. - # - # The default value of the `dst` parameter can be specified using - # {Timezone.default_dst=}. - # - # @param hour [Integer] the hour (0-23). - # @param minute [Integer] the minute (0-59). - # @param second [Integer] the second (0-59). - # @param sub_second [Numeric] the fractional part of the second as either - # a `Rational` that is greater than or equal to 0 and less than 1, or - # the `Integer` 0. - # @param dst [Boolean] whether to resolve ambiguous local times by always - # selecting the period observing daylight savings time (`true`), always - # selecting the period observing standard time (`false`), or leaving the - # ambiguity unresolved (`nil`). - # @param month [Integer] the month (1-12). - # @param day [Integer] the day of the month (1-31). - # @param year [Integer] the year. - # @raise [RangeError] if `sub_second` is a `Rational` but that is less - # than 0 or greater than or equal to 1. - # @raise [PeriodNotFound] if the date and time parameters do not specify a - # valid local time in the time zone. - # @raise [AmbiguousTime] if the date and time parameters are ambiguous for - # the time zone and the `dst` parameter or block did not resolve the - # ambiguity. - # @raise [RangeError] if `month` is not between 1 and 12. - # @raise [ArgumentError] if either of `year`, `month`, `day`, `hour`, - # `minute`, or `second` is not an `Integer`. - # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the - # `Integer` 0. - # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` - # and not the `Symbol` `:utc`. - # @raise [RangeError] if `day` is not between 1 and 31. - # @raise [RangeError] if `hour` is not between 0 and 23. - # @raise [RangeError] if `minute` is not between 0 and 59. - # @raise [RangeError] if `second` is not between 0 and 59. - # @return [TimeWithOffset] a new `Time` object based on the given values, - # interpreted as a local time in the time zone. - # @yield [periods] if the `dst` parameter did not resolve an ambiguity, an - # optional block is yielded to. - # @yieldparam periods [Array] an `Array` containing all - # the {TimezonePeriod}s that still match `local_time` after applying the - # `dst` parameter. - # @yieldreturn [Object] to resolve the ambiguity: a chosen {TimezonePeriod} - # or an `Array` containing a chosen {TimezonePeriod}; to leave the - # ambiguity unresolved: an empty `Array`, an `Array` containing more than - # one {TimezonePeriod}, or `nil`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#743 - def local_time(year, month = T.unsafe(nil), day = T.unsafe(nil), hour = T.unsafe(nil), minute = T.unsafe(nil), second = T.unsafe(nil), sub_second = T.unsafe(nil), dst = T.unsafe(nil), &block); end - - # Creates a {Timestamp} object based on the given (Gregorian calendar) date - # and time parameters. The parameters are interpreted as a local time in the - # time zone. The result has the appropriate {Timestamp#utc_offset - # utc_offset} and {TimestampWithOffset#timezone_offset timezone_offset}. - # - # _Warning:_ There are time values that are not valid as local times in a - # time zone (for example, during the transition from standard time to - # daylight savings time). There are also time values that are ambiguous, - # occurring more than once with different offsets to UTC (for example, - # during the transition from daylight savings time to standard time). - # - # In the first case (an invalid local time), a {PeriodNotFound} exception - # will be raised. - # - # In the second case (more than one occurrence), an {AmbiguousTime} - # exception will be raised unless the optional `dst` parameter or block - # handles the ambiguity. - # - # If the ambiguity is due to a transition from daylight savings time to - # standard time, the `dst` parameter can be used to select whether the - # daylight savings time or local time is used. For example, the following - # code would raise an {AmbiguousTime} exception: - # - # tz = TZInfo::Timezone.get('America/New_York') - # tz.local_timestamp(2004,10,31,1,30,0,0) - # - # Specifying `dst = true` would return a `Time` with a UTC offset of -4 - # hours and abbreviation EDT (Eastern Daylight Time). Specifying `dst = - # false` would return a `Time` with a UTC offset of -5 hours and - # abbreviation EST (Eastern Standard Time). - # - # The `dst` parameter will not be able to resolve an ambiguity resulting - # from the clocks being set back without changing from daylight savings time - # to standard time. In this case, if a block is specified, it will be called - # to resolve the ambiguity. The block must take a single parameter - an - # `Array` of {TimezonePeriod}s that need to be resolved. The block can - # select and return a single {TimezonePeriod} or return `nil` or an empty - # `Array` to cause an {AmbiguousTime} exception to be raised. - # - # The default value of the `dst` parameter can be specified using - # {Timezone.default_dst=}. - # - # @param hour [Integer] the hour (0-23). - # @param minute [Integer] the minute (0-59). - # @param second [Integer] the second (0-59). - # @param sub_second [Numeric] the fractional part of the second as either - # a `Rational` that is greater than or equal to 0 and less than 1, or - # the `Integer` 0. - # @param dst [Boolean] whether to resolve ambiguous local times by always - # selecting the period observing daylight savings time (`true`), always - # selecting the period observing standard time (`false`), or leaving the - # ambiguity unresolved (`nil`). - # @param month [Integer] the month (1-12). - # @param day [Integer] the day of the month (1-31). - # @param year [Integer] the year. - # @raise [RangeError] if `sub_second` is a `Rational` but that is less - # than 0 or greater than or equal to 1. - # @raise [PeriodNotFound] if the date and time parameters do not specify a - # valid local time in the time zone. - # @raise [AmbiguousTime] if the date and time parameters are ambiguous for - # the time zone and the `dst` parameter or block did not resolve the - # ambiguity. - # @raise [RangeError] if `month` is not between 1 and 12. - # @raise [ArgumentError] if either of `year`, `month`, `day`, `hour`, - # `minute`, or `second` is not an `Integer`. - # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the - # `Integer` 0. - # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` - # and not the `Symbol` `:utc`. - # @raise [RangeError] if `day` is not between 1 and 31. - # @raise [RangeError] if `hour` is not between 0 and 23. - # @raise [RangeError] if `minute` is not between 0 and 59. - # @raise [RangeError] if `second` is not between 0 and 59. - # @return [TimestampWithOffset] a new {Timestamp} object based on the given - # values, interpreted as a local time in the time zone. - # @yield [periods] if the `dst` parameter did not resolve an ambiguity, an - # optional block is yielded to. - # @yieldparam periods [Array] an `Array` containing all - # the {TimezonePeriod}s that still match `local_time` after applying the - # `dst` parameter. - # @yieldreturn [Object] to resolve the ambiguity: a chosen {TimezonePeriod} - # or an `Array` containing a chosen {TimezonePeriod}; to leave the - # ambiguity unresolved: an empty `Array`, an `Array` containing more than - # one {TimezonePeriod}, or `nil`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#919 - def local_timestamp(year, month = T.unsafe(nil), day = T.unsafe(nil), hour = T.unsafe(nil), minute = T.unsafe(nil), second = T.unsafe(nil), sub_second = T.unsafe(nil), dst = T.unsafe(nil), &block); end - - # Converts a local time for the time zone to UTC. - # - # The result will either be a `Time`, `DateTime` or {Timestamp} according to - # the type of the `local_time` parameter. - # - # The UTC offset of the `local_time` parameter is ignored (it is treated as - # a time in the time zone represented by `self`). - # - # _Warning:_ There are local times that have no equivalent UTC times (for - # example, during the transition from standard time to daylight savings - # time). There are also local times that have more than one UTC equivalent - # (for example, during the transition from daylight savings time to standard - # time). - # - # In the first case (no equivalent UTC time), a {PeriodNotFound} exception - # will be raised. - # - # In the second case (more than one equivalent UTC time), an {AmbiguousTime} - # exception will be raised unless the optional `dst` parameter or block - # handles the ambiguity. - # - # If the ambiguity is due to a transition from daylight savings time to - # standard time, the `dst` parameter can be used to select whether the - # daylight savings time or local time is used. For example, the following - # code would raise an {AmbiguousTime} exception: - # - # tz = TZInfo::Timezone.get('America/New_York') - # tz.period_for_local(Time.new(2004,10,31,1,30,0)) - # - # Specifying `dst = true` would select the daylight savings period from - # April to October 2004. Specifying `dst = false` would return the - # standard time period from October 2004 to April 2005. - # - # The `dst` parameter will not be able to resolve an ambiguity resulting - # from the clocks being set back without changing from daylight savings time - # to standard time. In this case, if a block is specified, it will be called - # to resolve the ambiguity. The block must take a single parameter - an - # `Array` of {TimezonePeriod}s that need to be resolved. The block can - # select and return a single {TimezonePeriod} or return `nil` or an empty - # `Array` to cause an {AmbiguousTime} exception to be raised. - # - # The default value of the `dst` parameter can be specified using - # {Timezone.default_dst=}. - # - # @param dst [Boolean] whether to resolve ambiguous local times by always - # selecting the period observing daylight savings time (`true`), always - # selecting the period observing standard time (`false`), or leaving the - # ambiguity unresolved (`nil`). - # @param local_time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [PeriodNotFound] if `local_time` is not valid for the time zone - # (there is no equivalent UTC time). - # @raise [AmbiguousTime] if `local_time` was ambiguous for the time zone and - # the `dst` parameter or block did not resolve the ambiguity. - # @raise [ArgumentError] if `local_time` is `nil`. - # @return [Object] the UTC equivalent of `local_time` as a `Time`, - # `DateTime` or {Timestamp}. - # @yield [periods] if the `dst` parameter did not resolve an ambiguity, an - # optional block is yielded to. - # @yieldparam periods [Array] an `Array` containing all - # the {TimezonePeriod}s that still match `local_time` after applying the - # `dst` parameter. - # @yieldreturn [Object] to resolve the ambiguity: a chosen {TimezonePeriod} - # or an `Array` containing a chosen {TimezonePeriod}; to leave the - # ambiguity unresolved: an empty `Array`, an `Array` containing more than - # one {TimezonePeriod}, or `nil`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#645 - def local_to_utc(local_time, dst = T.unsafe(nil)); end - - # @return [String] the identifier of the time zone, for example, - # `"Europe/Paris"`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#247 - def name; end - - # @return [TimeWithOffset] the current local time in the time zone. - # - # source://tzinfo//lib/tzinfo/timezone.rb#992 - def now; end - - # Returns the observed offset from UTC in seconds at the given time. This - # includes adjustments made for daylight savings time. - # - # @param time [Object] a `Time`, `DateTime` or `Timestamp`. - # @raise [ArgumentError] if `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC - # offset. - # @return [Integer] the observed offset from UTC in seconds at the given - # time. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1094 - def observed_utc_offset(time = T.unsafe(nil)); end - - # Returns the unique offsets used by the time zone up to a given time (`to`) - # as an `Array` of {TimezoneOffset} instances. - # - # A from time may also be supplied using the `from` parameter. If from is - # not `nil`, only offsets used from that time onwards will be returned. - # - # Comparisons with `to` are exclusive. Comparisons with `from` are - # inclusive. - # - # @param to [Object] a `Time`, `DateTime` or {Timestamp} specifying the - # latest (exclusive) offset to return. - # @param from [Object] an optional `Time`, `DateTime` or {Timestamp} - # specifying the earliest (inclusive) offset to return. - # @raise [ArgumentError] if `from` is specified and `to` is not greater than - # `from`. - # @raise [ArgumentError] is raised if `to` is `nil`. - # @raise [ArgumentError] if either `to` or `from` is a {Timestamp} with an - # unspecified offset. - # @return [Array] the offsets that are used earlier than - # `to` and, if specified, at or later than `from`. Offsets may be returned - # in any order. - # - # source://tzinfo//lib/tzinfo/timezone.rb#947 - def offsets_up_to(to, from = T.unsafe(nil)); end - - # Returns the {TimezonePeriod} that is valid at a given time. - # - # Unlike {period_for_local} and {period_for_utc}, the UTC offset of the - # `time` parameter is taken into consideration. - # - # @param time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [ArgumentError] if `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified - # offset. - # @return [TimezonePeriod] the {TimezonePeriod} that is valid at `time`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#319 - def period_for(time); end - - # Returns the {TimezonePeriod} that is valid at the given local time. - # - # The UTC offset of the `local_time` parameter is ignored (it is treated as - # a time in the time zone represented by `self`). Use the {period_for} - # method instead if the the UTC offset of the time needs to be taken into - # consideration. - # - # _Warning:_ There are local times that have no equivalent UTC times (for - # example, during the transition from standard time to daylight savings - # time). There are also local times that have more than one UTC equivalent - # (for example, during the transition from daylight savings time to standard - # time). - # - # In the first case (no equivalent UTC time), a {PeriodNotFound} exception - # will be raised. - # - # In the second case (more than one equivalent UTC time), an {AmbiguousTime} - # exception will be raised unless the optional `dst` parameter or block - # handles the ambiguity. - # - # If the ambiguity is due to a transition from daylight savings time to - # standard time, the `dst` parameter can be used to select whether the - # daylight savings time or local time is used. For example, the following - # code would raise an {AmbiguousTime} exception: - # - # tz = TZInfo::Timezone.get('America/New_York') - # tz.period_for_local(Time.new(2004,10,31,1,30,0)) - # - # Specifying `dst = true` would select the daylight savings period from - # April to October 2004. Specifying `dst = false` would return the - # standard time period from October 2004 to April 2005. - # - # The `dst` parameter will not be able to resolve an ambiguity resulting - # from the clocks being set back without changing from daylight savings time - # to standard time. In this case, if a block is specified, it will be called - # to resolve the ambiguity. The block must take a single parameter - an - # `Array` of {TimezonePeriod}s that need to be resolved. The block can - # select and return a single {TimezonePeriod} or return `nil` or an empty - # `Array` to cause an {AmbiguousTime} exception to be raised. - # - # The default value of the `dst` parameter can be specified using - # {Timezone.default_dst=}. - # - # @param dst [Boolean] whether to resolve ambiguous local times by always - # selecting the period observing daylight savings time (`true`), always - # selecting the period observing standard time (`false`), or leaving the - # ambiguity unresolved (`nil`). - # @param local_time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [PeriodNotFound] if `local_time` is not valid for the time zone - # (there is no equivalent UTC time). - # @raise [AmbiguousTime] if `local_time` was ambiguous for the time zone and - # the `dst` parameter or block did not resolve the ambiguity. - # @raise [ArgumentError] if `local_time` is `nil`. - # @return [TimezonePeriod] the {TimezonePeriod} that is valid at - # `local_time`. - # @yield [periods] if the `dst` parameter did not resolve an ambiguity, an - # optional block is yielded to. - # @yieldparam periods [Array] an `Array` containing all - # the {TimezonePeriod}s that still match `local_time` after applying the - # `dst` parameter. - # @yieldreturn [Object] to resolve the ambiguity: a chosen {TimezonePeriod} - # or an `Array` containing a chosen {TimezonePeriod}; to leave the - # ambiguity unresolved: an empty `Array`, an `Array` containing more than - # one {TimezonePeriod}, or `nil`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#494 - def period_for_local(local_time, dst = T.unsafe(nil)); end - - # Returns the {TimezonePeriod} that is valid at a given time. - # - # The UTC offset of the `utc_time` parameter is ignored (it is treated as a - # UTC time). Use the {period_for} method instead if the UTC offset of the - # time needs to be taken into consideration. - # - # @param utc_time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [ArgumentError] if `utc_time` is `nil`. - # @return [TimezonePeriod] the {TimezonePeriod} that is valid at `utc_time`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#425 - def period_for_utc(utc_time); end - - # Returns the set of {TimezonePeriod}s that are valid for the given - # local time as an `Array`. - # - # The UTC offset of the `local_time` parameter is ignored (it is treated as - # a time in the time zone represented by `self`). - # - # This will typically return an `Array` containing a single - # {TimezonePeriod}. More than one {TimezonePeriod} will be returned when the - # local time is ambiguous (for example, when daylight savings time ends). An - # empty `Array` will be returned when the local time is not valid (for - # example, when daylight savings time begins). - # - # To obtain just a single {TimezonePeriod} in all cases, use - # {period_for_local} instead and specify how ambiguities should be resolved. - # - # @param local_time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [ArgumentError] if `local_time` is `nil`. - # @return [Array] the set of {TimezonePeriod}s that are - # valid at `local_time`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#342 - def periods_for_local(local_time); end - - # Converts a time to local time for the time zone and returns a `String` - # representation of the local time according to the given format. - # - # `Timezone#strftime` first expands any occurrences of `%Z` in the format - # string to the time zone abbreviation for the local time (for example, EST - # or EDT). Depending on the type of `time` parameter, the result of the - # expansion is then passed to either `Time#strftime`, `DateTime#strftime` or - # `Timestamp#strftime` to handle any other format directives. - # - # This method is equivalent to the following: - # - # time_zone.to_local(time).strftime(format) - # - # @param format [String] the format string. - # @param time [Object] a `Time`, `DateTime` or `Timestamp`. - # @raise [ArgumentError] if `format` or `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC - # offset. - # @return [String] the formatted local time. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1039 - def strftime(format, time = T.unsafe(nil)); end - - # Converts a time to the local time for the time zone. - # - # The result will be of type {TimeWithOffset} (if passed a `Time`), - # {DateTimeWithOffset} (if passed a `DateTime`) or {TimestampWithOffset} (if - # passed a {Timestamp}). {TimeWithOffset}, {DateTimeWithOffset} and - # {TimestampWithOffset} are subclasses of `Time`, `DateTime` and {Timestamp} - # that provide additional information about the local result. - # - # Unlike {utc_to_local}, {to_local} takes the UTC offset of the given time - # into consideration. - # - # @param time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [ArgumentError] if `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} that does not have a - # specified UTC offset. - # @return [Object] the local equivalent of `time` as a {TimeWithOffset}, - # {DateTimeWithOffset} or {TimestampWithOffset}. - # - # source://tzinfo//lib/tzinfo/timezone.rb#548 - def to_local(time); end - - # @return [String] {identifier}, modified to make it more readable. - # - # source://tzinfo//lib/tzinfo/timezone.rb#253 - def to_s; end - - # Returns an `Array` of {TimezoneTransition} instances representing the - # times where the UTC offset of the timezone changes. - # - # Transitions are returned up to a given time (`to`). - # - # A from time may also be supplied using the `from` parameter. If from is - # not `nil`, only transitions from that time onwards will be returned. - # - # Comparisons with `to` are exclusive. Comparisons with `from` are - # inclusive. If a transition falls precisely on `to`, it will be excluded. - # If a transition falls on `from`, it will be included. - # - # @param to [Object] a `Time`, `DateTime` or {Timestamp} specifying the - # latest (exclusive) transition to return. - # @param from [Object] an optional `Time`, `DateTime` or {Timestamp} - # specifying the earliest (inclusive) transition to return. - # @raise [ArgumentError] if `from` is specified and `to` is not greater than - # `from`. - # @raise [ArgumentError] is raised if `to` is `nil`. - # @raise [ArgumentError] if either `to` or `from` is a {Timestamp} with an - # unspecified offset. - # @return [Array] the transitions that are earlier than - # `to` and, if specified, at or later than `from`. Transitions are ordered - # by when they occur, from earliest to latest. - # - # source://tzinfo//lib/tzinfo/timezone.rb#370 - def transitions_up_to(to, from = T.unsafe(nil)); end - - # Returns the observed offset from UTC in seconds at the given time. This - # includes adjustments made for daylight savings time. - # - # @param time [Object] a `Time`, `DateTime` or `Timestamp`. - # @raise [ArgumentError] if `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC - # offset. - # @return [Integer] the observed offset from UTC in seconds at the given - # time. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1094 - def utc_offset(time = T.unsafe(nil)); end - - # Converts a time in UTC to the local time for the time zone. - # - # The result will be of type {TimeWithOffset} (if passed a `Time`), - # {DateTimeWithOffset} (if passed a `DateTime`) or {TimestampWithOffset} (if - # passed a {Timestamp}). {TimeWithOffset}, {DateTimeWithOffset} and - # {TimestampWithOffset} are subclasses of `Time`, `DateTime` and {Timestamp} - # that provide additional information about the local result. - # - # The UTC offset of the `utc_time` parameter is ignored (it is treated as a - # UTC time). Use the {to_local} method instead if the the UTC offset of the - # time needs to be taken into consideration. - # - # @param utc_time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [ArgumentError] if `utc_time` is `nil`. - # @return [Object] the local equivalent of `utc_time` as a {TimeWithOffset}, - # {DateTimeWithOffset} or {TimestampWithOffset}. - # - # source://tzinfo//lib/tzinfo/timezone.rb#572 - def utc_to_local(utc_time); end - - private - - # Raises an {UnknownTimezone} exception. - # - # @raise [UnknownTimezone] always. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1156 - def raise_unknown_timezone; end - - class << self - # Loads a {Timezone} from the serialized representation returned by {_dump}. - # This is method is called when using `Marshal.load` or `Marshal.restore` - # to restore a serialized {Timezone}. - # - # @param data [String] a serialized representation of a {Timezone}. - # @return [Timezone] the result of converting `data` back into a {Timezone}. - # - # source://tzinfo//lib/tzinfo/timezone.rb#1147 - def _load(data); end - - # Returns an `Array` of all the available time zones. - # - # {TimezoneProxy} instances are returned to avoid the overhead of loading - # time zone data until it is first needed. - # - # @return [Array] all available time zones. - # - # source://tzinfo//lib/tzinfo/timezone.rb#151 - def all; end - - # Returns an `Array` of the identifiers of all the time zones that are - # observed by at least one {Country}. This is not the complete set of time - # zone identifiers as some are not country specific (e.g. `'Etc/GMT'`). - # - # {TimezoneProxy} instances are returned to avoid the overhead of loading - # time zone data until it is first needed. - # - # zones that are observed by at least one {Country}. - # - # @return [Array] an `Array` of the identifiers of all the time - # - # source://tzinfo//lib/tzinfo/timezone.rb#219 - def all_country_zone_identifiers; end - - # Returns an `Array` of all the time zones that are observed by at least - # one {Country}. This is not the complete set of time zones as some are - # not country specific (e.g. `'Etc/GMT'`). - # - # {TimezoneProxy} instances are returned to avoid the overhead of loading - # time zone data until it is first needed. - # - # @return [Array] an `Array` of all the time zones that are - # observed by at least one {Country}. - # - # source://tzinfo//lib/tzinfo/timezone.rb#206 - def all_country_zones; end - - # time zones that are defined by offsets and transitions. - # - # @return [Array] an `Array` of the identifiers of all available - # - # source://tzinfo//lib/tzinfo/timezone.rb#175 - def all_data_zone_identifiers; end - - # Returns an `Array` of all the available time zones that are - # defined by offsets and transitions. - # - # {TimezoneProxy} instances are returned to avoid the overhead of loading - # time zone data until it is first needed. - # - # @return [Array] an `Array` of all the available time zones - # that are defined by offsets and transitions. - # - # source://tzinfo//lib/tzinfo/timezone.rb#169 - def all_data_zones; end - - # @return [Array] an `Array` containing the identifiers of all the - # available time zones. - # - # source://tzinfo//lib/tzinfo/timezone.rb#157 - def all_identifiers; end - - # time zones that are defined as links to / aliases for other time zones. - # - # @return [Array] an `Array` of the identifiers of all available - # - # source://tzinfo//lib/tzinfo/timezone.rb#193 - def all_linked_zone_identifiers; end - - # Returns an `Array` of all the available time zones that are - # defined as links to / aliases for other time zones. - # - # {TimezoneProxy} instances are returned to avoid the overhead of loading - # time zone data until it is first needed. - # - # @return [Array] an `Array` of all the available time zones - # that are defined as links to / aliases for other time zones. - # - # source://tzinfo//lib/tzinfo/timezone.rb#187 - def all_linked_zones; end - - # Returns the default value of the optional `dst` parameter of the - # {local_time}, {local_datetime} and {local_timestamp}, {local_to_utc} - # and {period_for_local} methods (`nil`, `true` or `false`). - # - # {default_dst} defaults to `nil` unless changed with {default_dst=}. - # - # @return [Boolean] the default value of the optional `dst` parameter of - # the {local_time}, {local_datetime} and {local_timestamp}, - # {local_to_utc} and {period_for_local} methods (`nil`, `true` or - # `false`). - # - # source://tzinfo//lib/tzinfo/timezone.rb#110 - def default_dst; end - - # Sets the default value of the optional `dst` parameter of the - # {local_datetime}, {local_time}, {local_timestamp}, {local_to_utc} and - # {period_for_local} methods. Can be set to `nil`, `true` or `false`. - # - # @param value [Boolean] `nil`, `true` or `false`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#96 - def default_dst=(value); end - - # Returns a time zone by its IANA Time Zone Database identifier (e.g. - # `"Europe/London"` or `"America/Chicago"`). Call {all_identifiers} for a - # list of all the valid identifiers. - # - # The {get} method will return a subclass of {Timezone}, either a - # {DataTimezone} (for a time zone defined by rules that set out when - # transitions occur) or a {LinkedTimezone} (for a time zone that is just a - # link to or alias for a another time zone). - # - # @param identifier [String] an IANA Time Zone Database time zone - # identifier. - # @raise [InvalidTimezoneIdentifier] if the `identifier` is not valid. - # @return [Timezone] the {Timezone} with the given `identifier`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#127 - def get(identifier); end - - # Returns a proxy for the time zone with the given identifier. This allows - # loading of the time zone data to be deferred until it is first needed. - # - # The identifier will not be validated. If an invalid identifier is - # specified, no exception will be raised until the proxy is used. - # - # @param identifier [String] an IANA Time Zone Database time zone - # identifier. - # @return [TimezoneProxy] a proxy for the time zone with the given - # `identifier`. - # - # source://tzinfo//lib/tzinfo/timezone.rb#141 - def get_proxy(identifier); end - - private - - # @return [DataSource] the current DataSource. - # - # source://tzinfo//lib/tzinfo/timezone.rb#234 - def data_source; end - - # @param identifiers [Enumerable] an `Enumerable` of time zone - # identifiers. - # @return [Array] an `Array` of {TimezoneProxy} - # instances corresponding to the given identifiers. - # - # source://tzinfo//lib/tzinfo/timezone.rb#229 - def get_proxies(identifiers); end - end -end - -# Alias used by TZInfo::Data format1 releases. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1/timezone_definition.rb#37 -TZInfo::TimezoneDefinition = TZInfo::Format1::TimezoneDefinition - -# Alias used by TZInfo::Data format 1 releases. -# -# @private -# -# source://tzinfo//lib/tzinfo/format1/timezone_index_definition.rb#75 -TZInfo::TimezoneIndexDefinition = TZInfo::Format1::TimezoneIndexDefinition - -# Represents an offset from UTC observed by a time zone. -# -# source://tzinfo//lib/tzinfo/timezone_offset.rb#6 -class TZInfo::TimezoneOffset - # Initializes a new {TimezoneOffset}. - # - # {TimezoneOffset} instances should not normally be constructed manually. - # - # The passed in `abbreviation` instance will be frozen. - # - # @param base_utc_offset [Integer] the base offset from UTC in seconds. - # @param std_offset [Integer] the offset from standard time in seconds. - # @param abbreviation [String] the abbreviation identifying the offset. - # @return [TimezoneOffset] a new instance of TimezoneOffset - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#62 - def initialize(base_utc_offset, std_offset, abbreviation); end - - # Determines if this {TimezoneOffset} is equal to another instance. - # - # @param toi [Object] the instance to test for equality. - # @return [Boolean] `true` if `toi` is a {TimezoneOffset} with the same - # {utc_offset}, {std_offset} and {abbreviation} as this {TimezoneOffset}, - # otherwise `false`. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#84 - def ==(toi); end - - # The abbreviation that identifies this offset. For example GMT - # (Greenwich Mean Time) or BST (British Summer Time) for Europe/London. - # - # @return [String] the abbreviation that identifies this offset. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#50 - def abbr; end - - # The abbreviation that identifies this offset. For example GMT - # (Greenwich Mean Time) or BST (British Summer Time) for Europe/London. - # - # @return [String] the abbreviation that identifies this offset. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#50 - def abbreviation; end - - # Returns the base offset from UTC in seconds (`observed_utc_offset - - # std_offset`). This does not include any adjustment made for daylight - # savings time and will typically remain constant throughout the year. - # - # To obtain the currently observed offset from UTC, including the effect of - # daylight savings time, use {observed_utc_offset} instead. - # - # If you require accurate {base_utc_offset} values, you should install the - # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. - # When using {DataSources::ZoneinfoDataSource}, the value of - # {base_utc_offset} has to be derived from changes to the observed UTC - # offset and DST status since it is not included in zoneinfo files. - # - # @return [Integer] the base offset from UTC in seconds. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#21 - def base_utc_offset; end - - # Determines if daylight savings is in effect (i.e. if {std_offset} is - # non-zero). - # - # @return [Boolean] `true` if {std_offset} is non-zero, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#74 - def dst?; end - - # Determines if this {TimezoneOffset} is equal to another instance. - # - # @param toi [Object] the instance to test for equality. - # @return [Boolean] `true` if `toi` is a {TimezoneOffset} with the same - # {utc_offset}, {std_offset} and {abbreviation} as this {TimezoneOffset}, - # otherwise `false`. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#95 - def eql?(toi); end - - # @return [Integer] a hash based on {utc_offset}, {std_offset} and - # {abbreviation}. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#101 - def hash; end - - # @return [String] the internal object state as a programmer-readable - # `String`. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#107 - def inspect; end - - # Returns the observed offset from UTC in seconds (`base_utc_offset + - # std_offset`). This includes adjustments made for daylight savings time. - # - # @return [Integer] the observed offset from UTC in seconds. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#43 - def observed_utc_offset; end - - # Returns the offset from the time zone's standard time in seconds - # (`observed_utc_offset - base_utc_offset`). Zero when daylight savings time - # is not in effect. Non-zero (usually 3600 = 1 hour) if daylight savings is - # being observed. - # - # If you require accurate {std_offset} values, you should install the - # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. - # When using {DataSources::ZoneinfoDataSource}, the value of {std_offset} - # has to be derived from changes to the observed UTC offset and DST status - # since it is not included in zoneinfo files. - # - # @return [Integer] the offset from the time zone's standard time in - # seconds. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#37 - def std_offset; end - - # Returns the base offset from UTC in seconds (`observed_utc_offset - - # std_offset`). This does not include any adjustment made for daylight - # savings time and will typically remain constant throughout the year. - # - # To obtain the currently observed offset from UTC, including the effect of - # daylight savings time, use {observed_utc_offset} instead. - # - # If you require accurate {base_utc_offset} values, you should install the - # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. - # When using {DataSources::ZoneinfoDataSource}, the value of - # {base_utc_offset} has to be derived from changes to the observed UTC - # offset and DST status since it is not included in zoneinfo files. - # - # @return [Integer] the base offset from UTC in seconds. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#21 - def utc_offset; end - - # Returns the observed offset from UTC in seconds (`base_utc_offset + - # std_offset`). This includes adjustments made for daylight savings time. - # - # @return [Integer] the observed offset from UTC in seconds. - # - # source://tzinfo//lib/tzinfo/timezone_offset.rb#43 - def utc_total_offset; end -end - -# {TimezonePeriod} represents a period of time for a time zone where the same -# offset from UTC applies. It provides access to the observed offset, time -# zone abbreviation, start time and end time. -# -# The period of time can be unbounded at the start, end, or both the start -# and end. -# -# @abstract Time zone period data will returned as an instance of one of the -# subclasses of {TimezonePeriod}. -# -# source://tzinfo//lib/tzinfo/timezone_period.rb#14 -class TZInfo::TimezonePeriod - # Initializes a {TimezonePeriod}. - # - # @param offset [TimezoneOffset] the offset that is observed for the period - # of time. - # @raise [ArgumentError] if `offset` is `nil`. - # @return [TimezonePeriod] a new instance of TimezonePeriod - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#23 - def initialize(offset); end - - # The abbreviation that identifies this offset. For example GMT - # (Greenwich Mean Time) or BST (British Summer Time) for Europe/London. - # - # @return [String] the abbreviation that identifies this offset. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#80 - def abbr; end - - # The abbreviation that identifies this offset. For example GMT - # (Greenwich Mean Time) or BST (British Summer Time) for Europe/London. - # - # @return [String] the abbreviation that identifies this offset. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#80 - def abbreviation; end - - # Returns the base offset from UTC in seconds (`observed_utc_offset - - # std_offset`). This does not include any adjustment made for daylight - # savings time and will typically remain constant throughout the year. - # - # To obtain the currently observed offset from UTC, including the effect of - # daylight savings time, use {observed_utc_offset} instead. - # - # If you require accurate {base_utc_offset} values, you should install the - # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. - # When using {DataSources::ZoneinfoDataSource}, the value of - # {base_utc_offset} has to be derived from changes to the observed UTC - # offset and DST status since it is not included in zoneinfo files. - # - # @return [Integer] the base offset from UTC in seconds. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#54 - def base_utc_offset; end - - # Determines if daylight savings is in effect (i.e. if {std_offset} is - # non-zero). - # - # @return [Boolean] `true` if {std_offset} is non-zero, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#99 - def dst?; end - - # @return [TimezoneTransition] the transition that defines the end of this - # {TimezonePeriod} (`nil` if the end is unbounded). - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#36 - def end_transition; end - - # Returns the UTC end time of the period or `nil` if the end of the period - # is unbounded. - # - # The result is returned as a {Timestamp}. To obtain the end time as a - # `Time` or `DateTime`, call either {Timestamp#to_time to_time} or - # {Timestamp#to_datetime to_datetime} on the result. - # - # @return [Timestamp] the UTC end time of the period or `nil` if the end of - # the period is unbounded. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#125 - def ends_at; end - - # Returns the local end time of the period or `nil` if the end of the period - # is unbounded. - # - # The result is returned as a {TimestampWithOffset}. To obtain the end time - # as a `Time` or `DateTime`, call either {TimestampWithOffset#to_time - # to_time} or {TimestampWithOffset#to_datetime to_datetime} on the result. - # - # @return [TimestampWithOffset] the local end time of the period or `nil` if - # the end of the period is unbounded. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#151 - def local_ends_at; end - - # Returns the local start time of the period or `nil` if the start of the - # period is unbounded. - # - # The result is returned as a {TimestampWithOffset}. To obtain the start - # time as a `Time` or `DateTime`, call either {TimestampWithOffset#to_time - # to_time} or {TimestampWithOffset#to_datetime to_datetime} on the result. - # - # @return [TimestampWithOffset] the local start time of the period or `nil` - # if the start of the period is unbounded. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#138 - def local_starts_at; end - - # Returns the observed offset from UTC in seconds (`base_utc_offset + - # std_offset`). This includes adjustments made for daylight savings time. - # - # @return [Integer] the observed offset from UTC in seconds. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#90 - def observed_utc_offset; end - - # @return [TimezoneOffset] the offset that applies in the period of time. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#16 - def offset; end - - # @return [TimezoneTransition] the transition that defines the start of this - # {TimezonePeriod} (`nil` if the start is unbounded). - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#30 - def start_transition; end - - # Returns the UTC start time of the period or `nil` if the start of the - # period is unbounded. - # - # The result is returned as a {Timestamp}. To obtain the start time as a - # `Time` or `DateTime`, call either {Timestamp#to_time to_time} or - # {Timestamp#to_datetime to_datetime} on the result. - # - # @return [Timestamp] the UTC start time of the period or `nil` if the start - # of the period is unbounded. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#112 - def starts_at; end - - # Returns the offset from the time zone's standard time in seconds - # (`observed_utc_offset - base_utc_offset`). Zero when daylight savings time - # is not in effect. Non-zero (usually 3600 = 1 hour) if daylight savings is - # being observed. - # - # If you require accurate {std_offset} values, you should install the - # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. - # When using {DataSources::ZoneinfoDataSource}, the value of {std_offset} - # has to be derived from changes to the observed UTC offset and DST status - # since it is not included in zoneinfo files. - # - # @return [Integer] the offset from the time zone's standard time in - # seconds. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#72 - def std_offset; end - - # Returns the base offset from UTC in seconds (`observed_utc_offset - - # std_offset`). This does not include any adjustment made for daylight - # savings time and will typically remain constant throughout the year. - # - # To obtain the currently observed offset from UTC, including the effect of - # daylight savings time, use {observed_utc_offset} instead. - # - # If you require accurate {base_utc_offset} values, you should install the - # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. - # When using {DataSources::ZoneinfoDataSource}, the value of - # {base_utc_offset} has to be derived from changes to the observed UTC - # offset and DST status since it is not included in zoneinfo files. - # - # @return [Integer] the base offset from UTC in seconds. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#54 - def utc_offset; end - - # Returns the observed offset from UTC in seconds (`base_utc_offset + - # std_offset`). This includes adjustments made for daylight savings time. - # - # @return [Integer] the observed offset from UTC in seconds. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#90 - def utc_total_offset; end - - # The abbreviation that identifies this offset. For example GMT - # (Greenwich Mean Time) or BST (British Summer Time) for Europe/London. - # - # @return [String] the abbreviation that identifies this offset. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#80 - def zone_identifier; end - - private - - # Raises a {NotImplementedError} to indicate that subclasses should override - # a method. - # - # @raise [NotImplementedError] always. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#161 - def raise_not_implemented(method_name); end - - # @param transition [TimezoneTransition] a transition or `nil`. - # @return [Timestamp] the {Timestamp} representing when a transition occurs, - # or `nil` if `transition` is `nil`. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#168 - def timestamp(transition); end - - # @param transition [TimezoneTransition] a transition or `nil`. - # @return [TimestampWithOffset] a {Timestamp} representing when a transition - # occurs with offset set to {#offset}, or `nil` if `transition` is `nil`. - # - # source://tzinfo//lib/tzinfo/timezone_period.rb#175 - def timestamp_with_offset(transition); end -end - -# A proxy class standing in for a {Timezone} with a given identifier. -# {TimezoneProxy} inherits from {Timezone} and can be treated identically to -# {Timezone} instances loaded with {Timezone.get}. -# -# {TimezoneProxy} instances are used to avoid the performance overhead of -# loading time zone data into memory, for example, by {Timezone.all}. -# -# The first time an attempt is made to access the data for the time zone, the -# real {Timezone} will be loaded is loaded. If the proxy's identifier was not -# valid, then an exception will be raised at this point. -# -# source://tzinfo//lib/tzinfo/timezone_proxy.rb#22 -class TZInfo::TimezoneProxy < ::TZInfo::Timezone - # Initializes a new {TimezoneProxy}. - # - # The `identifier` parameter is not checked when initializing the proxy. It - # will be validated when the real {Timezone} instance is loaded. - # - # @param identifier [String] an IANA Time Zone Database time zone - # identifier. - # @return [TimezoneProxy] a new instance of TimezoneProxy - # - # source://tzinfo//lib/tzinfo/timezone_proxy.rb#23 - def initialize(identifier); end - - # Returns a serialized representation of this {TimezoneProxy}. This method - # is called when using `Marshal.dump` with an instance of {TimezoneProxy}. - # - # @param limit [Integer] the maximum depth to dump - ignored. @return - # [String] a serialized representation of this {TimezoneProxy}. - # @return [String] a serialized representation of this {TimezoneProxy}. - # - # source://tzinfo//lib/tzinfo/timezone_proxy.rb#60 - def _dump(limit); end - - # Returns the canonical {Timezone} instance for this {Timezone}. - # - # The IANA Time Zone database contains two types of definition: Zones and - # Links. Zones are defined by rules that set out when transitions occur. - # Links are just references to fully defined Zone, creating an alias for - # that Zone. - # - # Links are commonly used where a time zone has been renamed in a release of - # the Time Zone database. For example, the US/Eastern Zone was renamed as - # America/New_York. A US/Eastern Link was added in its place, linking to - # (and creating an alias for) America/New_York. - # - # Links are also used for time zones that are currently identical to a full - # Zone, but that are administered separately. For example, Europe/Vatican is - # a Link to (and alias for) Europe/Rome. - # - # For a full Zone (implemented by {DataTimezone}), {canonical_zone} returns - # self. - # - # For a Link (implemented by {LinkedTimezone}), {canonical_zone} returns a - # {Timezone} instance representing the full Zone that the link targets. - # - # TZInfo can be used with different data sources (see the documentation for - # {TZInfo::DataSource}). Some DataSource implementations may not support - # distinguishing between full Zones and Links and will treat all time zones - # as full Zones. In this case, {canonical_zone} will always return `self`. - # - # There are two built-in DataSource implementations. - # {DataSources::RubyDataSource} (which will be used if the tzinfo-data gem - # is available) supports Link zones. {DataSources::ZoneinfoDataSource} - # returns Link zones as if they were full Zones. If the {canonical_zone} or - # {canonical_identifier} methods are needed, the tzinfo-data gem should be - # installed. - # - # The {TZInfo::DataSource.get} method can be used to check which DataSource - # implementation is being used. - # - # @return [Timezone] the canonical {Timezone} instance for this {Timezone}. - # - # source://tzinfo//lib/tzinfo/timezone_proxy.rb#50 - def canonical_zone; end - - # @return [String] the identifier of the time zone, for example, - # `"Europe/Paris"`. - # - # source://tzinfo//lib/tzinfo/timezone_proxy.rb#30 - def identifier; end - - # Returns the {TimezonePeriod} that is valid at a given time. - # - # Unlike {period_for_local} and {period_for_utc}, the UTC offset of the - # `time` parameter is taken into consideration. - # - # @param time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [ArgumentError] if `time` is `nil`. - # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified - # offset. - # @return [TimezonePeriod] the {TimezonePeriod} that is valid at `time`. - # - # source://tzinfo//lib/tzinfo/timezone_proxy.rb#35 - def period_for(time); end - - # Returns the set of {TimezonePeriod}s that are valid for the given - # local time as an `Array`. - # - # The UTC offset of the `local_time` parameter is ignored (it is treated as - # a time in the time zone represented by `self`). - # - # This will typically return an `Array` containing a single - # {TimezonePeriod}. More than one {TimezonePeriod} will be returned when the - # local time is ambiguous (for example, when daylight savings time ends). An - # empty `Array` will be returned when the local time is not valid (for - # example, when daylight savings time begins). - # - # To obtain just a single {TimezonePeriod} in all cases, use - # {period_for_local} instead and specify how ambiguities should be resolved. - # - # @param local_time [Object] a `Time`, `DateTime` or {Timestamp}. - # @raise [ArgumentError] if `local_time` is `nil`. - # @return [Array] the set of {TimezonePeriod}s that are - # valid at `local_time`. - # - # source://tzinfo//lib/tzinfo/timezone_proxy.rb#40 - def periods_for_local(local_time); end - - # Returns an `Array` of {TimezoneTransition} instances representing the - # times where the UTC offset of the timezone changes. - # - # Transitions are returned up to a given time (`to`). - # - # A from time may also be supplied using the `from` parameter. If from is - # not `nil`, only transitions from that time onwards will be returned. - # - # Comparisons with `to` are exclusive. Comparisons with `from` are - # inclusive. If a transition falls precisely on `to`, it will be excluded. - # If a transition falls on `from`, it will be included. - # - # @param to [Object] a `Time`, `DateTime` or {Timestamp} specifying the - # latest (exclusive) transition to return. - # @param from [Object] an optional `Time`, `DateTime` or {Timestamp} - # specifying the earliest (inclusive) transition to return. - # @raise [ArgumentError] if `from` is specified and `to` is not greater than - # `from`. - # @raise [ArgumentError] is raised if `to` is `nil`. - # @raise [ArgumentError] if either `to` or `from` is a {Timestamp} with an - # unspecified offset. - # @return [Array] the transitions that are earlier than - # `to` and, if specified, at or later than `from`. Transitions are ordered - # by when they occur, from earliest to latest. - # - # source://tzinfo//lib/tzinfo/timezone_proxy.rb#45 - def transitions_up_to(to, from = T.unsafe(nil)); end - - private - - # Returns the real {Timezone} instance being proxied. - # - # The real {Timezone} is loaded using {Timezone.get} on the first access. - # - # @return [Timezone] the real {Timezone} instance being proxied. - # - # source://tzinfo//lib/tzinfo/timezone_proxy.rb#82 - def real_timezone; end - - class << self - # Loads a {TimezoneProxy} from the serialized representation returned by - # {_dump}. This is method is called when using `Marshal.load` or - # `Marshal.restore` to restore a serialized {Timezone}. - # - # @param data [String] a serialized representation of a {TimezoneProxy}. - # @return [TimezoneProxy] the result of converting `data` back into a - # {TimezoneProxy}. - # - # source://tzinfo//lib/tzinfo/timezone_proxy.rb#71 - def _load(data); end - end -end - -# Represents a transition from one observed UTC offset ({TimezoneOffset} to -# another for a time zone. -# -# source://tzinfo//lib/tzinfo/timezone_transition.rb#7 -class TZInfo::TimezoneTransition - # Initializes a new {TimezoneTransition}. - # - # {TimezoneTransition} instances should not normally be constructed - # manually. - # - # @param offset [TimezoneOffset] the offset the transition changes to. - # @param previous_offset [TimezoneOffset] the offset the transition changes - # from. - # @param timestamp_value [Integer] when the transition occurs as a - # number of seconds since 1970-01-01 00:00:00 UTC ignoring leap seconds - # (i.e. each day is treated as if it were 86,400 seconds long). - # @return [TimezoneTransition] a new instance of TimezoneTransition - # - # source://tzinfo//lib/tzinfo/timezone_transition.rb#34 - def initialize(offset, previous_offset, timestamp_value); end - - # Determines if this {TimezoneTransition} is equal to another instance. - # - # @param tti [Object] the instance to test for equality. - # @return [Boolean] `true` if `tti` is a {TimezoneTransition} with the same - # {offset}, {previous_offset} and {timestamp_value} as this - # {TimezoneTransition}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/timezone_transition.rb#86 - def ==(tti); end - - # Returns a {Timestamp} instance representing the UTC time when this - # transition occurs. - # - # To obtain the result as a `Time` or `DateTime`, call either - # {Timestamp#to_time to_time} or {Timestamp#to_datetime to_datetime} on the - # {Timestamp} instance that is returned. - # - # @return [Timestamp] the UTC time when this transition occurs. - # - # source://tzinfo//lib/tzinfo/timezone_transition.rb#48 - def at; end - - # Determines if this {TimezoneTransition} is equal to another instance. - # - # @param tti [Object] the instance to test for equality. - # @return [Boolean] `true` if `tti` is a {TimezoneTransition} with the same - # {offset}, {previous_offset} and {timestamp_value} as this - # {TimezoneTransition}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/timezone_transition.rb#86 - def eql?(tti); end - - # @return [Integer] a hash based on {offset}, {previous_offset} and - # {timestamp_value}. - # - # source://tzinfo//lib/tzinfo/timezone_transition.rb#94 - def hash; end - - # Returns a {TimestampWithOffset} instance representing the local time when - # this transition causes the previous observance to end (calculated from - # {at} using {previous_offset}). - # - # To obtain the result as a `Time` or `DateTime`, call either - # {TimestampWithOffset#to_time to_time} or {TimestampWithOffset#to_datetime - # to_datetime} on the {TimestampWithOffset} instance that is returned. - # - # @return [TimestampWithOffset] the local time when this transition causes - # the previous observance to end. - # - # source://tzinfo//lib/tzinfo/timezone_transition.rb#62 - def local_end_at; end - - # Returns a {TimestampWithOffset} instance representing the local time when - # this transition causes the next observance to start (calculated from {at} - # using {offset}). - # - # To obtain the result as a `Time` or `DateTime`, call either - # {TimestampWithOffset#to_time to_time} or {TimestampWithOffset#to_datetime - # to_datetime} on the {TimestampWithOffset} instance that is returned. - # - # @return [TimestampWithOffset] the local time when this transition causes - # the next observance to start. - # - # source://tzinfo//lib/tzinfo/timezone_transition.rb#76 - def local_start_at; end - - # @return [TimezoneOffset] the offset this transition changes to. - # - # source://tzinfo//lib/tzinfo/timezone_transition.rb#9 - def offset; end - - # @return [TimezoneOffset] the offset this transition changes from. - # - # source://tzinfo//lib/tzinfo/timezone_transition.rb#12 - def previous_offset; end - - # When this transition occurs as an `Integer` number of seconds since - # 1970-01-01 00:00:00 UTC ignoring leap seconds (i.e. each day is treated as - # if it were 86,400 seconds long). Equivalent to the result of calling the - # {Timestamp#value value} method on the {Timestamp} returned by {at}. - # - # @return [Integer] when this transition occurs as a number of seconds since - # 1970-01-01 00:00:00 UTC ignoring leap seconds. - # - # source://tzinfo//lib/tzinfo/timezone_transition.rb#21 - def timestamp_value; end -end - -# Base class for rules definining the transition between standard and daylight -# savings time. -# -# @abstract -# @private -# -# source://tzinfo//lib/tzinfo/transition_rule.rb#10 -class TZInfo::TransitionRule - # Initializes a new {TransitionRule}. - # - # @param transition_at [Integer] the time in seconds after midnight local - # time at which the transition occurs. - # @raise [ArgumentError] if `transition_at` is not an `Integer`. - # @return [TransitionRule] a new instance of TransitionRule - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#25 - def initialize(transition_at); end - - # Determines if this {TransitionRule} is equal to another instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {TransitionRule} with the same - # {transition_at} as this {TransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#47 - def ==(r); end - - # Calculates the time of the transition from a given offset on a given year. - # - # @param offset [TimezoneOffset] the current offset at the time the rule - # will transition. - # @param year [Integer] the year in which the transition occurs (local - # time). - # @return [TimestampWithOffset] the time at which the transition occurs. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#37 - def at(offset, year); end - - # Determines if this {TransitionRule} is equal to another instance. - # - # @param r [Object] the instance to test for equality. - # @return [Boolean] `true` if `r` is a {TransitionRule} with the same - # {transition_at} as this {TransitionRule}, otherwise `false`. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#47 - def eql?(r); end - - # @return [Integer] a hash based on {hash_args} (defaulting to - # {transition_at}). - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#54 - def hash; end - - # Returns the number of seconds after midnight local time on the day - # identified by the rule at which the transition occurs. Can be negative to - # denote a time on the prior day. Can be greater than or equal to 86,400 to - # denote a time of the following day. - # - # @return [Integer] the time in seconds after midnight local time at which - # the transition occurs. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#18 - def transition_at; end - - protected - - # @return [Array] an `Array` of parameters that will influence the output of - # {hash}. - # - # source://tzinfo//lib/tzinfo/transition_rule.rb#62 - def hash_args; end -end - -# Represents a period of time in a time zone where the same offset from UTC -# applies. The period of time is bounded at at least one end, either having a -# start transition, end transition or both start and end transitions. -# -# source://tzinfo//lib/tzinfo/transitions_timezone_period.rb#10 -class TZInfo::TransitionsTimezonePeriod < ::TZInfo::TimezonePeriod - # Initializes a {TransitionsTimezonePeriod}. - # - # At least one of `start_transition` and `end_transition` must be specified. - # - # @param start_transition [TimezoneTransition] the transition that defines - # the start of the period, or `nil` if the start is unbounded. - # @param end_transition [TimezoneTransition] the transition that defines the - # end of the period, or `nil` if the end is unbounded. - # @raise [ArgumentError] if both `start_transition` and `end_transition` are - # `nil`. - # @return [TransitionsTimezonePeriod] a new instance of TransitionsTimezonePeriod - # - # source://tzinfo//lib/tzinfo/transitions_timezone_period.rb#27 - def initialize(start_transition, end_transition); end - - # Determines if this {TransitionsTimezonePeriod} is equal to another - # instance. - # - # @param p [Object] the instance to test for equality. - # @return [Boolean] `true` if `p` is a {TransitionsTimezonePeriod} with the - # same {offset}, {start_transition} and {end_transition}, otherwise - # `false`. - # - # source://tzinfo//lib/tzinfo/transitions_timezone_period.rb#47 - def ==(p); end - - # @return [TimezoneTransition] the transition that defines the end of this - # {TimezonePeriod} (`nil` if the end is unbounded). - # - # source://tzinfo//lib/tzinfo/transitions_timezone_period.rb#15 - def end_transition; end - - # Determines if this {TransitionsTimezonePeriod} is equal to another - # instance. - # - # @param p [Object] the instance to test for equality. - # @return [Boolean] `true` if `p` is a {TransitionsTimezonePeriod} with the - # same {offset}, {start_transition} and {end_transition}, otherwise - # `false`. - # - # source://tzinfo//lib/tzinfo/transitions_timezone_period.rb#47 - def eql?(p); end - - # @return [Integer] a hash based on {start_transition} and {end_transition}. - # - # source://tzinfo//lib/tzinfo/transitions_timezone_period.rb#53 - def hash; end - - # @return [String] the internal object state as a programmer-readable - # `String`. - # - # source://tzinfo//lib/tzinfo/transitions_timezone_period.rb#59 - def inspect; end - - # @return [TimezoneTransition] the transition that defines the start of this - # {TimezonePeriod} (`nil` if the start is unbounded). - # - # source://tzinfo//lib/tzinfo/transitions_timezone_period.rb#11 - def start_transition; end -end - -# An implementation of {StringDeduper} using the `String#-@` method where -# that method performs deduplication (Ruby 2.5 and later). -# -# Note that this is slightly different to the plain {StringDeduper} -# implementation. In this implementation, frozen literal strings are already -# in the pool and are candidates for being returned, even when passed -# another equal frozen non-literal string. {StringDeduper} will always -# return frozen strings. -# -# There are also differences in encoding handling. This implementation will -# treat strings with different encodings as different strings. -# {StringDeduper} will treat strings with the compatible encodings as the -# same string. -# -# @private -# -# source://tzinfo//lib/tzinfo/string_deduper.rb#90 -class TZInfo::UnaryMinusGlobalStringDeduper - # @param string [String] the string to deduplicate. - # @return [bool] `string` if it is frozen, otherwise a frozen, possibly - # pre-existing copy of `string`. - # - # source://tzinfo//lib/tzinfo/string_deduper.rb#94 - def dedupe(string); end -end - -# {UnknownTimezone} is raised when calling methods on an instance of -# {Timezone} that was created directly. To obtain {Timezone} instances the -# {Timezone.get} method should be used instead. -# -# source://tzinfo//lib/tzinfo/timezone.rb#32 -class TZInfo::UnknownTimezone < ::StandardError; end - -# The TZInfo version number. -# -# source://tzinfo//lib/tzinfo/version.rb#6 -TZInfo::VERSION = T.let(T.unsafe(nil), String) - -# The {WithOffset} module is included in {TimeWithOffset}, -# {DateTimeWithOffset} and {TimestampWithOffset}. It provides an override for -# the {strftime} method that handles expanding the `%Z` directive according to -# the {TimezoneOffset#abbreviation abbreviation} of the {TimezoneOffset} -# associated with a local time. -# -# source://tzinfo//lib/tzinfo/with_offset.rb#10 -module TZInfo::WithOffset - # Overrides the `Time`, `DateTime` or {Timestamp} version of `strftime`, - # replacing `%Z` with the {TimezoneOffset#abbreviation abbreviation} of the - # associated {TimezoneOffset}. If there is no associated offset, `%Z` is - # expanded by the base class instead. - # - # All the format directives handled by the base class are supported. - # - # @param format [String] the format string. - # @raise [ArgumentError] if `format` is `nil`. - # @return [String] the formatted time. - # - # source://tzinfo//lib/tzinfo/with_offset.rb#21 - def strftime(format); end - - protected - - # Performs a calculation if there is an associated {TimezoneOffset}. - # - # @param result [Object] a result value that can be manipulated by the block - # if there is an associated {TimezoneOffset}. - # @private - # @return [Object] the result of the block if there is an associated - # {TimezoneOffset}, otherwise the `result` parameter. - # @yield [period, result] if there is an associated {TimezoneOffset}, the - # block is yielded to in order to calculate the method result. - # @yieldparam period [TimezoneOffset] the associated {TimezoneOffset}. - # @yieldparam result [Object] the `result` parameter. - # @yieldreturn [Object] the result of the calculation performed if there is - # an associated {TimezoneOffset}. - # - # source://tzinfo//lib/tzinfo/with_offset.rb#56 - def if_timezone_offset(result = T.unsafe(nil)); end -end diff --git a/Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.6.12.rbi b/Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.6.12.rbi deleted file mode 100644 index e8312b2ed7..0000000000 --- a/Library/Homebrew/sorbet/rbi/gems/zeitwerk@2.6.12.rbi +++ /dev/null @@ -1,999 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `zeitwerk` gem. -# Please instead update this file by running `bin/tapioca gem zeitwerk`. - -# source://zeitwerk//lib/zeitwerk/kernel.rb#3 -module Kernel - include ::ActiveSupport::ForkTracker::CoreExt - - private - - # source://zeitwerk//lib/zeitwerk/kernel.rb#27 - def require(path); end - - class << self - # source://zeitwerk//lib/zeitwerk/kernel.rb#27 - def require(path); end - end -end - -# source://zeitwerk//lib/zeitwerk.rb#3 -module Zeitwerk - class << self - # This is a dangerous method. - # - # source://zeitwerk//lib/zeitwerk.rb#20 - def with_loader; end - end -end - -# source://zeitwerk//lib/zeitwerk/error.rb#4 -class Zeitwerk::Error < ::StandardError; end - -# Centralizes the logic for the trace point used to detect the creation of -# explicit namespaces, needed to descend into matching subdirectories right -# after the constant has been defined. -# -# The implementation assumes an explicit namespace is managed by one loader. -# Loaders that reopen namespaces owned by other projects are responsible for -# loading their constant before setup. This is documented. -# -# source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#11 -module Zeitwerk::ExplicitNamespace - extend ::Zeitwerk::RealModName - - class << self - # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#35 - def __register(cpath, loader); end - - # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#53 - def __registered?(cpath); end - - # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#45 - def __unregister_loader(loader); end - - private - - # Maps constant paths that correspond to explicit namespaces according to - # the file system, to the loader responsible for them. - # - # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#20 - def cpaths; end - - # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#58 - def disable_tracer_if_unneeded; end - - # Returns the value of attribute mutex. - # - # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#24 - def mutex; end - - # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#35 - def register(cpath, loader); end - - # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#53 - def registered?(cpath); end - - # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#65 - def tracepoint_class_callback(event); end - - # Returns the value of attribute tracer. - # - # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#28 - def tracer; end - - # source://zeitwerk//lib/zeitwerk/explicit_namespace.rb#45 - def unregister_loader(loader); end - end -end - -# source://zeitwerk//lib/zeitwerk/gem_inflector.rb#5 -class Zeitwerk::GemInflector < ::Zeitwerk::Inflector - # @return [GemInflector] a new instance of GemInflector - # - # source://zeitwerk//lib/zeitwerk/gem_inflector.rb#6 - def initialize(root_file); end - - # source://zeitwerk//lib/zeitwerk/gem_inflector.rb#13 - def camelize(basename, abspath); end -end - -# @private -# -# source://zeitwerk//lib/zeitwerk/gem_loader.rb#5 -class Zeitwerk::GemLoader < ::Zeitwerk::Loader - # @return [GemLoader] a new instance of GemLoader - # - # source://zeitwerk//lib/zeitwerk/gem_loader.rb#19 - def initialize(root_file, namespace:, warn_on_extra_files:); end - - # source://zeitwerk//lib/zeitwerk/gem_loader.rb#34 - def setup; end - - private - - # source://zeitwerk//lib/zeitwerk/gem_loader.rb#42 - def warn_on_extra_files; end - - class << self - # @private - # - # source://zeitwerk//lib/zeitwerk/gem_loader.rb#14 - def __new(root_file, namespace:, warn_on_extra_files:); end - - private - - def new(*_arg0); end - end -end - -# source://zeitwerk//lib/zeitwerk/inflector.rb#4 -class Zeitwerk::Inflector - # Very basic snake case -> camel case conversion. - # - # inflector = Zeitwerk::Inflector.new - # inflector.camelize("post", ...) # => "Post" - # inflector.camelize("users_controller", ...) # => "UsersController" - # inflector.camelize("api", ...) # => "Api" - # - # Takes into account hard-coded mappings configured with `inflect`. - # - # source://zeitwerk//lib/zeitwerk/inflector.rb#15 - def camelize(basename, _abspath); end - - # Configures hard-coded inflections: - # - # inflector = Zeitwerk::Inflector.new - # inflector.inflect( - # "html_parser" => "HTMLParser", - # "mysql_adapter" => "MySQLAdapter" - # ) - # - # inflector.camelize("html_parser", abspath) # => "HTMLParser" - # inflector.camelize("mysql_adapter", abspath) # => "MySQLAdapter" - # inflector.camelize("users_controller", abspath) # => "UsersController" - # - # source://zeitwerk//lib/zeitwerk/inflector.rb#32 - def inflect(inflections); end - - private - - # Hard-coded basename to constant name user maps that override the default - # inflection logic. - # - # source://zeitwerk//lib/zeitwerk/inflector.rb#42 - def overrides; end -end - -# This is a private module. -# -# source://zeitwerk//lib/zeitwerk/internal.rb#4 -module Zeitwerk::Internal - # source://zeitwerk//lib/zeitwerk/internal.rb#5 - def internal(method_name); end -end - -# source://zeitwerk//lib/zeitwerk/loader.rb#7 -class Zeitwerk::Loader - include ::Zeitwerk::RealModName - include ::Zeitwerk::Loader::Callbacks - include ::Zeitwerk::Loader::Helpers - include ::Zeitwerk::Loader::Config - include ::Zeitwerk::Loader::EagerLoad - extend ::Zeitwerk::Internal - extend ::Zeitwerk::RealModName - - # @return [Loader] a new instance of Loader - # - # source://zeitwerk//lib/zeitwerk/loader.rb#99 - def initialize; end - - # source://zeitwerk//lib/zeitwerk/loader.rb#43 - def __autoloaded_dirs; end - - # source://zeitwerk//lib/zeitwerk/loader.rb#33 - def __autoloads; end - - # source://zeitwerk//lib/zeitwerk/loader.rb#77 - def __namespace_dirs; end - - # source://zeitwerk//lib/zeitwerk/loader.rb#310 - def __shadowed_file?(file); end - - # source://zeitwerk//lib/zeitwerk/loader.rb#88 - def __shadowed_files; end - - # source://zeitwerk//lib/zeitwerk/loader.rb#59 - def __to_unload; end - - # @raise [Zeitwerk::Error] - # - # source://zeitwerk//lib/zeitwerk/loader.rb#234 - def cpath_expected_at(path); end - - # Unloads all loaded code, and calls setup again so that the loader is able - # to pick any changes in the file system. - # - # This method is not thread-safe, please see how this can be achieved by - # client code in the README of the project. - # - # @raise [Zeitwerk::Error] - # - # source://zeitwerk//lib/zeitwerk/loader.rb#223 - def reload; end - - # Sets autoloads in the root namespaces. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#119 - def setup; end - - # Removes loaded constants and configured autoloads. - # - # The objects the constants stored are no longer reachable through them. In - # addition, since said objects are normally not referenced from anywhere - # else, they are eligible for garbage collection, which would effectively - # unload them. - # - # This method is public but undocumented. Main interface is `reload`, which - # means `unload` + `setup`. This one is available to be used together with - # `unregister`, which is undocumented too. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#145 - def unload; end - - # Says if the given constant path would be unloaded on reload. This - # predicate returns `false` if reloading is disabled. - # - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader.rb#285 - def unloadable_cpath?(cpath); end - - # Returns an array with the constant paths that would be unloaded on reload. - # This predicate returns an empty array if reloading is disabled. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#293 - def unloadable_cpaths; end - - # This is a dangerous method. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#301 - def unregister; end - - private - - # source://zeitwerk//lib/zeitwerk/loader.rb#456 - def autoload_file(parent, cname, file); end - - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader.rb#514 - def autoload_path_set_by_me_for?(parent, cname); end - - # source://zeitwerk//lib/zeitwerk/loader.rb#426 - def autoload_subdir(parent, cname, subdir); end - - # We keep track of autoloaded directories to remove them from the registry - # at the end of eager loading. - # - # Files are removed as they are autoloaded, but directories need to wait due - # to concurrency (see why in Zeitwerk::Loader::Callbacks#on_dir_autoloaded). - # - # source://zeitwerk//lib/zeitwerk/loader.rb#43 - def autoloaded_dirs; end - - # Maps absolute paths for which an autoload has been set ---and not - # executed--- to their corresponding parent class or module and constant - # name. - # - # "/Users/fxn/blog/app/models/user.rb" => [Object, :User], - # "/Users/fxn/blog/app/models/hotel/pricing.rb" => [Hotel, :Pricing] - # ... - # - # source://zeitwerk//lib/zeitwerk/loader.rb#33 - def autoloads; end - - # source://zeitwerk//lib/zeitwerk/loader.rb#493 - def define_autoload(parent, cname, abspath); end - - # source://zeitwerk//lib/zeitwerk/loader.rb#410 - def define_autoloads_for_dir(dir, parent); end - - # Returns the value of attribute dirs_autoload_monitor. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#96 - def dirs_autoload_monitor; end - - # Returns the value of attribute mutex. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#92 - def mutex; end - - # Maps namespace constant paths to their respective directories. - # - # For example, given this mapping: - # - # "Admin" => [ - # "/Users/fxn/blog/app/controllers/admin", - # "/Users/fxn/blog/app/models/admin", - # ... - # ] - # - # when `Admin` gets defined we know that it plays the role of a namespace - # and that its children are spread over those directories. We'll visit them - # to set up the corresponding autoloads. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#77 - def namespace_dirs; end - - # `dir` is the directory that would have autovivified a namespace. `file` is - # the file where we've found the namespace is explicitly defined. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#482 - def promote_namespace_from_implicit_to_explicit(dir:, file:, parent:, cname:); end - - # source://zeitwerk//lib/zeitwerk/loader.rb#528 - def raise_if_conflicting_directory(dir); end - - # source://zeitwerk//lib/zeitwerk/loader.rb#523 - def register_explicit_namespace(cpath); end - - # source://zeitwerk//lib/zeitwerk/loader.rb#552 - def run_on_unload_callbacks(cpath, value, abspath); end - - # source://zeitwerk//lib/zeitwerk/loader.rb#310 - def shadowed_file?(file); end - - # A shadowed file is a file managed by this loader that is ignored when - # setting autoloads because its matching constant is already taken. - # - # This private set is populated as we descend. For example, if the loader - # has only scanned the top-level, `shadowed_files` does not have shadowed - # files that may exist deep in the project tree yet. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#88 - def shadowed_files; end - - # Stores metadata needed for unloading. Its entries look like this: - # - # "Admin::Role" => [".../admin/role.rb", [Admin, :Role]] - # - # The cpath as key helps implementing unloadable_cpath? The file name is - # stored in order to be able to delete it from $LOADED_FEATURES, and the - # pair [Module, Symbol] is used to remove_const the constant from the class - # or module object. - # - # If reloading is enabled, this hash is filled as constants are autoloaded - # or eager loaded. Otherwise, the collection remains empty. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#59 - def to_unload; end - - # source://zeitwerk//lib/zeitwerk/loader.rb#559 - def unload_autoload(parent, cname); end - - # source://zeitwerk//lib/zeitwerk/loader.rb#565 - def unload_cref(parent, cname); end - - class << self - # Returns an array with the absolute paths of the root directories of all - # registered loaders. This is a read-only collection. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#404 - def all_dirs; end - - # Returns the value of attribute default_logger. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#320 - def default_logger; end - - # Sets the attribute default_logger - # - # @param value the value to set the attribute default_logger to. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#320 - def default_logger=(_arg0); end - - # Broadcasts `eager_load` to all loaders. Those that have not been setup - # are skipped. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#376 - def eager_load_all; end - - # Broadcasts `eager_load_namespace` to all loaders. Those that have not - # been setup are skipped. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#390 - def eager_load_namespace(mod); end - - # This is a shortcut for - # - # require "zeitwerk" - # - # loader = Zeitwerk::Loader.new - # loader.tag = File.basename(__FILE__, ".rb") - # loader.inflector = Zeitwerk::GemInflector.new(__FILE__) - # loader.push_dir(__dir__) - # - # except that this method returns the same object in subsequent calls from - # the same file, in the unlikely case the gem wants to be able to reload. - # - # This method returns a subclass of Zeitwerk::Loader, but the exact type - # is private, client code can only rely on the interface. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#338 - def for_gem(warn_on_extra_files: T.unsafe(nil)); end - - # This is a shortcut for - # - # require "zeitwerk" - # - # loader = Zeitwerk::Loader.new - # loader.tag = namespace.name + "-" + File.basename(__FILE__, ".rb") - # loader.inflector = Zeitwerk::GemInflector.new(__FILE__) - # loader.push_dir(__dir__, namespace: namespace) - # - # except that this method returns the same object in subsequent calls from - # the same file, in the unlikely case the gem wants to be able to reload. - # - # This method returns a subclass of Zeitwerk::Loader, but the exact type - # is private, client code can only rely on the interface. - # - # source://zeitwerk//lib/zeitwerk/loader.rb#359 - def for_gem_extension(namespace); end - end -end - -# source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#3 -module Zeitwerk::Loader::Callbacks - include ::Zeitwerk::RealModName - extend ::Zeitwerk::Internal - - # source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#41 - def __on_dir_autoloaded(dir); end - - # source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#10 - def __on_file_autoloaded(file); end - - # Invoked when a class or module is created or reopened, either from the - # tracer or from module autovivification. If the namespace has matching - # subdirectories, we descend into them now. - # - # @private - # - # source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#81 - def on_namespace_loaded(namespace); end - - private - - # source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#41 - def on_dir_autoloaded(dir); end - - # source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#10 - def on_file_autoloaded(file); end - - # source://zeitwerk//lib/zeitwerk/loader/callbacks.rb#92 - def run_on_load_callbacks(cpath, value, abspath); end -end - -# source://zeitwerk//lib/zeitwerk/loader/config.rb#6 -module Zeitwerk::Loader::Config - include ::Zeitwerk::RealModName - extend ::Zeitwerk::Internal - - # source://zeitwerk//lib/zeitwerk/loader/config.rb#86 - def initialize; end - - # source://zeitwerk//lib/zeitwerk/loader/config.rb#296 - def __ignores?(abspath); end - - def __roots; end - - # Configure directories or glob patterns to be collapsed. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#216 - def collapse(*glob_patterns); end - - # If `namespaces` is falsey (default), returns an array with the absolute - # paths of the root directories as strings. If truthy, returns a hash table - # instead. Keys are the absolute paths of the root directories as strings, - # values are their corresponding namespaces, class or module objects. - # - # If `ignored` is falsey (default), ignored root directories are filtered out. - # - # These are read-only collections, please add to them with `push_dir`. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#156 - def dirs(namespaces: T.unsafe(nil), ignored: T.unsafe(nil)); end - - # Let eager load ignore the given files or directories. The constants defined - # in those files are still autoloadable. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#198 - def do_not_eager_load(*paths); end - - # You need to call this method before setup in order to be able to reload. - # There is no way to undo this, either you want to reload or you don't. - # - # @raise [Zeitwerk::Error] - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#177 - def enable_reloading; end - - # Configure files, directories, or glob patterns to be totally ignored. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#205 - def ignore(*glob_patterns); end - - # Returns the value of attribute inflector. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#11 - def inflector; end - - # Sets the attribute inflector - # - # @param value the value to set the attribute inflector to. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#11 - def inflector=(_arg0); end - - # Logs to `$stdout`, handy shortcut for debugging. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#288 - def log!; end - - # Returns the value of attribute logger. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#14 - def logger; end - - # Sets the attribute logger - # - # @param value the value to set the attribute logger to. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#14 - def logger=(_arg0); end - - # Configure a block to be invoked once a certain constant path is loaded. - # Supports multiple callbacks, and if there are many, they are executed in - # the order in which they were defined. - # - # loader.on_load("SomeApiClient") do |klass, _abspath| - # klass.endpoint = "https://api.dev" - # end - # - # Can also be configured for any constant loaded: - # - # loader.on_load do |cpath, value, abspath| - # # ... - # end - # - # @raise [TypeError] - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#252 - def on_load(cpath = T.unsafe(nil), &block); end - - # Configure a block to be called after setup and on each reload. - # If setup was already done, the block runs immediately. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#228 - def on_setup(&block); end - - # Configure a block to be invoked right before a certain constant is removed. - # Supports multiple callbacks, and if there are many, they are executed in the - # order in which they were defined. - # - # loader.on_unload("Country") do |klass, _abspath| - # klass.clear_cache - # end - # - # Can also be configured for any removed constant: - # - # loader.on_unload do |cpath, value, abspath| - # # ... - # end - # - # @raise [TypeError] - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#277 - def on_unload(cpath = T.unsafe(nil), &block); end - - # Pushes `path` to the list of root directories. - # - # Raises `Zeitwerk::Error` if `path` does not exist, or if another loader in - # the same process already manages that directory or one of its ascendants or - # descendants. - # - # @raise [Zeitwerk::Error] - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#111 - def push_dir(path, namespace: T.unsafe(nil)); end - - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#190 - def reloading_enabled?; end - - # Returns the loader's tag. - # - # Implemented as a method instead of via attr_reader for symmetry with the - # writer below. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#135 - def tag; end - - # Sets a tag for the loader, useful for logging. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#142 - def tag=(tag); end - - private - - # source://zeitwerk//lib/zeitwerk/loader/config.rb#314 - def actual_roots; end - - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#339 - def collapse?(dir); end - - # The actual collection of absolute directory names at the time the collapse - # glob patterns were expanded. Computed on setup, and recomputed on reload. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#57 - def collapse_dirs; end - - # Absolute paths of directories or glob patterns to be collapsed. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#50 - def collapse_glob_patterns; end - - # Absolute paths of files or directories not to be eager loaded. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#63 - def eager_load_exclusions; end - - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#326 - def excluded_from_eager_load?(abspath); end - - # source://zeitwerk//lib/zeitwerk/loader/config.rb#349 - def expand_glob_patterns(glob_patterns); end - - # source://zeitwerk//lib/zeitwerk/loader/config.rb#344 - def expand_paths(paths); end - - # Absolute paths of files, directories, or glob patterns to be totally - # ignored. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#36 - def ignored_glob_patterns; end - - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#309 - def ignored_path?(abspath); end - - # The actual collection of absolute file and directory names at the time the - # ignored glob patterns were expanded. Computed on setup, and recomputed on - # reload. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#44 - def ignored_paths; end - - # source://zeitwerk//lib/zeitwerk/loader/config.rb#296 - def ignores?(abspath); end - - # User-oriented callbacks to be fired when a constant is loaded. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#76 - def on_load_callbacks; end - - # User-oriented callbacks to be fired on setup and on reload. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#69 - def on_setup_callbacks; end - - # User-oriented callbacks to be fired before constants are removed. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#83 - def on_unload_callbacks; end - - # source://zeitwerk//lib/zeitwerk/loader/config.rb#361 - def recompute_collapse_dirs; end - - # source://zeitwerk//lib/zeitwerk/loader/config.rb#356 - def recompute_ignored_paths; end - - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#321 - def root_dir?(dir); end - - # Absolute paths of the root directories, mapped to their respective root namespaces: - # - # "/Users/fxn/blog/app/channels" => Object, - # "/Users/fxn/blog/app/adapters" => ActiveJob::QueueAdapters, - # ... - # - # Stored in a hash to preserve order, easily handle duplicates, and have a - # fast lookup by directory. - # - # This is a private collection maintained by the loader. The public - # interface for it is `push_dir` and `dirs`. - # - # source://zeitwerk//lib/zeitwerk/loader/config.rb#29 - def roots; end -end - -# source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#1 -module Zeitwerk::Loader::EagerLoad - # Eager loads all files in the root directories, recursively. Files do not - # need to be in `$LOAD_PATH`, absolute file names are used. Ignored and - # shadowed files are not eager loaded. You can opt-out specifically in - # specific files and directories with `do_not_eager_load`, and that can be - # overridden passing `force: true`. - # - # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#9 - def eager_load(force: T.unsafe(nil)); end - - # @raise [Zeitwerk::SetupRequired] - # - # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#32 - def eager_load_dir(path); end - - # @raise [Zeitwerk::SetupRequired] - # - # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#74 - def eager_load_namespace(mod); end - - # Loads the given Ruby file. - # - # Raises if the argument is ignored, shadowed, or not managed by the receiver. - # - # The method is implemented as `constantize` for files, in a sense, to be able - # to descend orderly and make sure the file is loadable. - # - # @raise [Zeitwerk::Error] - # - # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#116 - def load_file(path); end - - private - - # The caller is responsible for making sure `namespace` is the namespace that - # corresponds to `dir`. - # - # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#160 - def actual_eager_load_dir(dir, namespace, force: T.unsafe(nil)); end - - # In order to invoke this method, the caller has to ensure `child` is a - # strict namespace descendant of `root_namespace`. - # - # source://zeitwerk//lib/zeitwerk/loader/eager_load.rb#195 - def eager_load_child_namespace(child, child_name, root_dir, root_namespace); end -end - -# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#3 -module Zeitwerk::Loader::Helpers - private - - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#128 - def cdef?(parent, cname); end - - # @raise [NameError] - # - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#134 - def cget(parent, cname); end - - # @raise [Zeitwerk::NameError] - # - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#149 - def cname_for(basename, abspath); end - - # Symbol#name was introduced in Ruby 3.0. It returns always the same - # frozen object, so we may save a few string allocations. - # - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#118 - def cpath(parent, cname); end - - # @raise [NameError] - # - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#140 - def crem(parent, cname); end - - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#67 - def dir?(path); end - - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#45 - def has_at_least_one_ruby_file?(dir); end - - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#72 - def hidden?(basename); end - - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#7 - def log(message); end - - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#15 - def ls(dir); end - - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#62 - def ruby?(path); end - - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#109 - def strict_autoload_path(parent, cname); end - - # source://zeitwerk//lib/zeitwerk/loader/helpers.rb#77 - def walk_up(abspath); end -end - -# source://zeitwerk//lib/zeitwerk/loader/helpers.rb#144 -module Zeitwerk::Loader::Helpers::CNAME_VALIDATOR; end - -# source://zeitwerk//lib/zeitwerk/loader.rb#21 -Zeitwerk::Loader::MUTEX = T.let(T.unsafe(nil), Thread::Mutex) - -# source://zeitwerk//lib/zeitwerk/error.rb#13 -class Zeitwerk::NameError < ::NameError; end - -# source://zeitwerk//lib/zeitwerk/real_mod_name.rb#3 -module Zeitwerk::RealModName - # source://zeitwerk//lib/zeitwerk/real_mod_name.rb#14 - def real_mod_name(mod); end -end - -# source://zeitwerk//lib/zeitwerk/real_mod_name.rb#4 -Zeitwerk::RealModName::UNBOUND_METHOD_MODULE_NAME = T.let(T.unsafe(nil), UnboundMethod) - -# source://zeitwerk//lib/zeitwerk/registry.rb#4 -module Zeitwerk::Registry - class << self - # Maps absolute paths to the loaders responsible for them. - # - # This information is used by our decorated `Kernel#require` to be able to - # invoke callbacks and autovivify modules. - # - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#26 - def autoloads; end - - # Registers gem loaders to let `for_gem` be idempotent in case of reload. - # - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#17 - def gem_loaders_by_root_file; end - - # @private - # @return [Boolean] - # - # source://zeitwerk//lib/zeitwerk/registry.rb#113 - def inception?(cpath); end - - # This hash table addresses an edge case in which an autoload is ignored. - # - # For example, let's suppose we want to autoload in a gem like this: - # - # # lib/my_gem.rb - # loader = Zeitwerk::Loader.new - # loader.push_dir(__dir__) - # loader.setup - # - # module MyGem - # end - # - # if you require "my_gem", as Bundler would do, this happens while setting - # up autoloads: - # - # 1. Object.autoload?(:MyGem) returns `nil` because the autoload for - # the constant is issued by Zeitwerk while the same file is being - # required. - # 2. The constant `MyGem` is undefined while setup runs. - # - # Therefore, a directory `lib/my_gem` would autovivify a module according to - # the existing information. But that would be wrong. - # - # To overcome this fundamental limitation, we keep track of the constant - # paths that are in this situation ---in the example above, "MyGem"--- and - # take this collection into account for the autovivification logic. - # - # Note that you cannot generally address this by moving the setup code - # below the constant definition, because we want libraries to be able to - # use managed constants in the module body: - # - # module MyGem - # include MyConcern - # end - # - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#65 - def inceptions; end - - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#121 - def loader_for(path); end - - # This method returns always a loader, the same instance for the same root - # file. That is how Zeitwerk::Loader.for_gem is idempotent. - # - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#89 - def loader_for_gem(root_file, namespace:, warn_on_extra_files:); end - - # Keeps track of all loaders. Useful to broadcast messages and to prevent - # them from being garbage collected. - # - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#11 - def loaders; end - - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#127 - def on_unload(loader); end - - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#95 - def register_autoload(loader, abspath); end - - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#107 - def register_inception(cpath, abspath, loader); end - - # Registers a loader. - # - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#71 - def register_loader(loader); end - - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#101 - def unregister_autoload(abspath); end - - # @private - # - # source://zeitwerk//lib/zeitwerk/registry.rb#77 - def unregister_loader(loader); end - end -end - -# source://zeitwerk//lib/zeitwerk/error.rb#7 -class Zeitwerk::ReloadingDisabledError < ::Zeitwerk::Error - # @return [ReloadingDisabledError] a new instance of ReloadingDisabledError - # - # source://zeitwerk//lib/zeitwerk/error.rb#8 - def initialize; end -end - -# source://zeitwerk//lib/zeitwerk/error.rb#16 -class Zeitwerk::SetupRequired < ::Zeitwerk::Error - # @return [SetupRequired] a new instance of SetupRequired - # - # source://zeitwerk//lib/zeitwerk/error.rb#17 - def initialize; end -end - -# source://zeitwerk//lib/zeitwerk/version.rb#4 -Zeitwerk::VERSION = T.let(T.unsafe(nil), String)