From 4577ae099bd3d17e60c18a0a7c3e4234998a4391 Mon Sep 17 00:00:00 2001 From: Jacobo Bouzas Quiroga Date: Wed, 27 Nov 2024 13:44:53 +0100 Subject: [PATCH] chore: update sorbet version and fixes --- Gemfile | 4 +- Gemfile.lock | 28 +- examples/sinatra-pet-shelter/Gemfile | 4 +- examples/sinatra-pet-shelter/Gemfile.lock | 53 +- .../sorbet/rbi/annotations/.gitattributes | 1 + .../sorbet/rbi/annotations/activesupport.rbi | 455 + .../sorbet/rbi/annotations/minitest.rbi | 119 + .../sorbet/rbi/dsl/.gitattributes | 1 + .../rbi/dsl/active_support/callbacks.rbi | 21 + .../sorbet/rbi/gems/activesupport@8.0.0.rbi | 20661 ++++++++++++++++ .../sorbet/rbi/gems/benchmark@0.4.0.rbi | 618 + .../sorbet/rbi/gems/bigdecimal@3.1.8.rbi | 78 + .../sorbet/rbi/gems/concurrent-ruby@1.3.4.rbi | 11645 +++++++++ .../sorbet/rbi/gems/connection_pool@2.4.1.rbi | 9 + .../sorbet/rbi/gems/drb@2.2.1.rbi | 1347 + .../sorbet/rbi/gems/dry-inflector@1.1.0.rbi | 648 - .../sorbet/rbi/gems/i18n@1.14.6.rbi | 2275 ++ .../sorbet/rbi/gems/logger@1.6.1.rbi | 920 + .../sorbet/rbi/gems/minitest@5.25.2.rbi | 1547 ++ ...71b89d828ae8b3da80256be9e5b817b48a49c.rbi} | 668 +- .../sorbet/rbi/gems/securerandom@0.3.2.rbi | 395 + .../sorbet/rbi/gems/tzinfo@2.0.6.rbi | 5918 +++++ .../sorbet/rbi/gems/uri@1.0.2.rbi | 2377 ++ lib/resource_registry.rb | 7 +- lib/schema_generator.rb | 34 - resource_registry.gemspec | 36 +- sorbet/rbi/annotations/activesupport.rbi | 3 + sorbet/rbi/dsl/.gitattributes | 1 + sorbet/rbi/dsl/active_support/callbacks.rbi | 21 + ...enchmark@0.3.0.rbi => benchmark@0.4.0.rbi} | 0 ...initest@5.25.1.rbi => minitest@5.25.2.rbi} | 0 sorbet/rbi/gems/rspec-expectations@3.13.1.rbi | 9 + sorbet/rbi/gems/securerandom@0.3.1.rbi | 73 - sorbet/rbi/gems/securerandom@0.3.2.rbi | 395 + sorbet/rbi/gems/uri@1.0.2.rbi | 2377 ++ 35 files changed, 51521 insertions(+), 1227 deletions(-) create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/annotations/.gitattributes create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/annotations/activesupport.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/annotations/minitest.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/dsl/.gitattributes create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/dsl/active_support/callbacks.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/activesupport@8.0.0.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/benchmark@0.4.0.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/bigdecimal@3.1.8.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/concurrent-ruby@1.3.4.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/connection_pool@2.4.1.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/drb@2.2.1.rbi delete mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/dry-inflector@1.1.0.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/i18n@1.14.6.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/logger@1.6.1.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/minitest@5.25.2.rbi rename examples/sinatra-pet-shelter/sorbet/rbi/gems/{resource_registry@0.0.0-2b73ddd272417ca8026e5f13e1103b4c72897824.rbi => resource_registry@0.0.0-61b71b89d828ae8b3da80256be9e5b817b48a49c.rbi} (80%) create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/securerandom@0.3.2.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/tzinfo@2.0.6.rbi create mode 100644 examples/sinatra-pet-shelter/sorbet/rbi/gems/uri@1.0.2.rbi delete mode 100644 lib/schema_generator.rb create mode 100644 sorbet/rbi/dsl/.gitattributes create mode 100644 sorbet/rbi/dsl/active_support/callbacks.rbi rename sorbet/rbi/gems/{benchmark@0.3.0.rbi => benchmark@0.4.0.rbi} (100%) rename sorbet/rbi/gems/{minitest@5.25.1.rbi => minitest@5.25.2.rbi} (100%) create mode 100644 sorbet/rbi/gems/rspec-expectations@3.13.1.rbi delete mode 100644 sorbet/rbi/gems/securerandom@0.3.1.rbi create mode 100644 sorbet/rbi/gems/securerandom@0.3.2.rbi create mode 100644 sorbet/rbi/gems/uri@1.0.2.rbi diff --git a/Gemfile b/Gemfile index 188ad31..4f1a68d 100644 --- a/Gemfile +++ b/Gemfile @@ -6,8 +6,8 @@ gem "activesupport" gem "rspec" gem "rspec-json_expectations" gem "rspec-sorbet", "~> 1.9.2" -gem "sorbet-coerce", ">= 0.2.6" -gem "sorbet-static-and-runtime", ">= 0.5.11609" +gem "sorbet-coerce", "~> 0.7" +gem "sorbet-static-and-runtime", "0.5.11670" gem "tapioca", "~> 0.15.1", require: false gem "syntax_tree", "~> 6.2", require: false diff --git a/Gemfile.lock b/Gemfile.lock index f17f896..b50b6f0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,8 +13,9 @@ GEM minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) base64 (0.2.0) - benchmark (0.3.0) + benchmark (0.4.0) bigdecimal (3.1.8) coderay (1.1.3) concurrent-ruby (1.3.4) @@ -47,7 +48,7 @@ GEM logger (1.6.1) lumberjack (1.2.10) method_source (1.1.0) - minitest (5.25.1) + minitest (5.25.2) nenv (0.3.0) netrc (0.11.0) notiffany (0.1.3) @@ -83,20 +84,20 @@ GEM sorbet-runtime rspec-support (3.13.1) safe_type (1.1.1) - securerandom (0.3.1) + securerandom (0.3.2) shellany (0.0.1) - sorbet (0.5.11609) - sorbet-static (= 0.5.11609) + sorbet (0.5.11670) + sorbet-static (= 0.5.11670) sorbet-coerce (0.7.0) polyfill (~> 1.8) safe_type (~> 1.1, >= 1.1.1) sorbet-runtime (>= 0.4.4704) - sorbet-runtime (0.5.11609) - sorbet-static (0.5.11609-universal-darwin) - sorbet-static (0.5.11609-x86_64-linux) - sorbet-static-and-runtime (0.5.11609) - sorbet (= 0.5.11609) - sorbet-runtime (= 0.5.11609) + sorbet-runtime (0.5.11670) + sorbet-static (0.5.11670-universal-darwin) + sorbet-static (0.5.11670-x86_64-linux) + sorbet-static-and-runtime (0.5.11670) + sorbet (= 0.5.11670) + sorbet-runtime (= 0.5.11670) spoom (1.4.2) erubi (>= 1.10.0) prism (>= 0.28.0) @@ -116,6 +117,7 @@ GEM thor (1.3.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) + uri (1.0.2) yard (0.9.36) yard-sorbet (0.9.0) sorbet-runtime @@ -132,8 +134,8 @@ DEPENDENCIES rspec rspec-json_expectations rspec-sorbet (~> 1.9.2) - sorbet-coerce (>= 0.2.6) - sorbet-static-and-runtime (>= 0.5.11609) + sorbet-coerce (~> 0.7) + sorbet-static-and-runtime (= 0.5.11670) syntax_tree (~> 6.2) tapioca (~> 0.15.1) diff --git a/examples/sinatra-pet-shelter/Gemfile b/examples/sinatra-pet-shelter/Gemfile index 06d2a2b..f9a26e7 100644 --- a/examples/sinatra-pet-shelter/Gemfile +++ b/examples/sinatra-pet-shelter/Gemfile @@ -3,9 +3,7 @@ source "https://rubygems.org" gem "json" -gem "resource_registry", - github: "factorialco/resource-registry", - branch: "adding-example-app" +gem "resource_registry", github: "factorialco/resource-registry", branch: "main" gem "sinatra" gem "sinatra-contrib" gem "tapioca", "~> 0.15.1", require: false diff --git a/examples/sinatra-pet-shelter/Gemfile.lock b/examples/sinatra-pet-shelter/Gemfile.lock index 0091787..f5292b6 100644 --- a/examples/sinatra-pet-shelter/Gemfile.lock +++ b/examples/sinatra-pet-shelter/Gemfile.lock @@ -1,23 +1,44 @@ GIT remote: https://github.com/factorialco/resource-registry.git - revision: 2b73ddd272417ca8026e5f13e1103b4c72897824 - branch: adding-example-app + revision: 61b71b89d828ae8b3da80256be9e5b817b48a49c + branch: chore/update-sorbet-version-and-fixes specs: resource_registry (0.0.0) - dry-inflector (= 1.1.0) - sorbet-coerce (>= 0.2.6) - sorbet-runtime (= 0.5.11609) + activesupport (>= 7.1.3) + sorbet-coerce (~> 0.7) + sorbet-runtime (= 0.5.11670) GEM remote: https://rubygems.org/ specs: + activesupport (8.0.0) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.8) coderay (1.1.3) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) diff-lcs (1.5.1) - dry-inflector (1.1.0) + drb (2.2.1) erubi (1.13.0) + i18n (1.14.6) + concurrent-ruby (~> 1.0) json (2.7.2) + logger (1.6.1) method_source (1.1.0) + minitest (5.25.2) multi_json (1.15.0) mustermann (3.0.3) ruby2_keywords (~> 0.0.1) @@ -52,6 +73,7 @@ GEM rspec-support (3.13.1) ruby2_keywords (0.0.5) safe_type (1.1.1) + securerandom (0.3.2) sinatra (3.2.0) mustermann (~> 3.0) rack (~> 2.2, >= 2.2.4) @@ -63,18 +85,18 @@ GEM rack-protection (= 3.2.0) sinatra (= 3.2.0) tilt (~> 2.0) - sorbet (0.5.11609) - sorbet-static (= 0.5.11609) + sorbet (0.5.11670) + sorbet-static (= 0.5.11670) sorbet-coerce (0.7.0) polyfill (~> 1.8) safe_type (~> 1.1, >= 1.1.1) sorbet-runtime (>= 0.4.4704) - sorbet-runtime (0.5.11609) - sorbet-static (0.5.11609-universal-darwin) - sorbet-static (0.5.11609-x86_64-linux) - sorbet-static-and-runtime (0.5.11609) - sorbet (= 0.5.11609) - sorbet-runtime (= 0.5.11609) + sorbet-runtime (0.5.11670) + sorbet-static (0.5.11670-universal-darwin) + sorbet-static (0.5.11670-x86_64-linux) + sorbet-static-and-runtime (0.5.11670) + sorbet (= 0.5.11670) + sorbet-runtime (= 0.5.11670) spoom (1.5.0) erubi (>= 1.10.0) prism (>= 0.28.0) @@ -91,6 +113,9 @@ GEM yard-sorbet thor (1.3.2) tilt (2.4.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uri (1.0.2) yard (0.9.37) yard-sorbet (0.9.0) sorbet-runtime diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/annotations/.gitattributes b/examples/sinatra-pet-shelter/sorbet/rbi/annotations/.gitattributes new file mode 100644 index 0000000..d2eacd2 --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/annotations/.gitattributes @@ -0,0 +1 @@ +**/*.rbi linguist-vendored=true diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/annotations/activesupport.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/annotations/activesupport.rbi new file mode 100644 index 0000000..20a88d3 --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/annotations/activesupport.rbi @@ -0,0 +1,455 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This file was pulled from a central RBI files repository. +# Please run `bin/tapioca annotations` to update it. + +module ActiveSupport::Testing::Declarative + sig { params(name: String, block: T.proc.bind(T.untyped).void).void } + def test(name, &block); end +end + +class ActiveSupport::EnvironmentInquirer + sig { returns(T::Boolean) } + def development?; end + + sig { returns(T::Boolean) } + def production?; end + + sig { returns(T::Boolean) } + def test?; end + + # @method_missing: delegated to String through ActiveSupport::StringInquirer + sig { returns(T::Boolean) } + def staging?; end +end + +module ActiveSupport::Testing::SetupAndTeardown::ClassMethods + sig { params(args: T.untyped, block: T.nilable(T.proc.bind(T.untyped).void)).void } + def setup(*args, &block); end + + sig { params(args: T.untyped, block: T.nilable(T.proc.bind(T.untyped).void)).void } + def teardown(*args, &block); end +end + +class ActiveSupport::TestCase + sig { params(args: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).void)).void } + def self.setup(*args, &block); end + + sig { params(args: T.untyped, block: T.nilable(T.proc.bind(T.attached_class).void)).void } + def self.teardown(*args, &block); end + + sig { params(name: String, block: T.proc.bind(T.attached_class).void).void } + def self.test(name, &block); end +end + +class ActiveSupport::TimeWithZone + # @shim: Methods on ActiveSupport::TimeWithZone are delegated to `Time` using `method_missing + include ::DateAndTime::Zones + + # @shim: Methods on ActiveSupport::TimeWithZone are delegated to `Time` using `method_missing + include ::DateAndTime::Calculations + + sig { returns(FalseClass) } + def blank?; end + + # @shim: since `present?` is always true, `presence` always returns `self` + sig { returns(T.self_type) } + def presence; end + + # @shim: since `blank?` is always false, `present?` always returns `true` + sig { returns(TrueClass) } + def present?; end +end + +class Object + sig { returns(T::Boolean) } + def blank?; end + + sig { returns(FalseClass) } + def html_safe?; end + + sig { returns(T.nilable(T.self_type)) } + def presence; end + + sig { params(another_object: T.untyped).returns(T.nilable(T.self_type)) } + def presence_in(another_object); end + + sig { returns(T::Boolean) } + def present?; end +end + +class Hash + sig { returns(T::Boolean) } + def blank?; end + + sig { returns(T::Boolean) } + def present?; end + + sig { returns(T::Boolean) } + def extractable_options?; end +end + +class Array + sig { returns(T::Boolean) } + def blank?; end + + sig { returns(T::Boolean) } + def present?; end + + sig { params(position: Integer).returns(T.self_type) } + def from(position); end + + sig { params(position: Integer).returns(T.self_type) } + def to(position); end + + sig { params(elements: T.untyped).returns(T::Array[T.untyped]) } + def including(*elements); end + + sig { params(elements: T.untyped).returns(T.self_type) } + def excluding(*elements); end + + sig { params(elements: T.untyped).returns(T.self_type) } + def without(*elements); end + + sig { returns(T.nilable(Elem)) } + def second; end + + sig { returns(T.nilable(Elem)) } + def third; end + + sig { returns(T.nilable(Elem)) } + def fourth; end + + sig { returns(T.nilable(Elem)) } + def fifth; end + + sig { returns(T.nilable(Elem)) } + def forty_two; end + + sig { returns(T.nilable(Elem)) } + def third_to_last; end + + sig { returns(T.nilable(Elem)) } + def second_to_last; end + + sig { params(options: T::Hash[T.untyped, T.untyped]).returns(String) } + def to_sentence(options = {}); end + + sig { params(format: Symbol).returns(String) } + def to_fs(format = :default); end + + sig { params(format: Symbol).returns(String) } + def to_formatted_s(format = :default); end + + sig { returns(String) } + def to_xml; end + + sig { returns(T::Hash[T.untyped, T.untyped]) } + def extract_options!; end + + sig { type_parameters(:FillType).params(number: Integer, fill_with: T.type_parameter(:FillType), block: T.nilable(T.proc.params(group: T::Array[T.any(Elem, T.type_parameter(:FillType))]).void)).returns(T::Array[T::Array[T.any(Elem, T.type_parameter(:FillType))]]) } + def in_groups(number, fill_with = T.unsafe(nil), &block); end + + sig { type_parameters(:FillType).params(number: Integer, fill_with: T.type_parameter(:FillType), block: T.nilable(T.proc.params(group: T::Array[T.any(Elem, T.type_parameter(:FillType))]).void)).returns(T::Array[T::Array[T.any(Elem, T.type_parameter(:FillType))]]) } + def in_groups_of(number, fill_with = T.unsafe(nil), &block); end + + sig { params(value: T.untyped, block: T.nilable(T.proc.params(element: Elem).returns(T.untyped))).returns(T::Array[T::Array[Elem]]) } + def split(value = nil, &block); end + + sig { params(block: T.nilable(T.proc.params(element: Elem).returns(T.untyped))).returns(T.any(T::Array[Elem], T::Enumerator[Elem])) } + def extract!(&block); end + + sig { returns(ActiveSupport::ArrayInquirer) } + def inquiry; end + + sig { params(object: T.untyped).returns(T::Array[T.untyped]) } + def self.wrap(object); end +end + +class Date + sig { returns(FalseClass) } + def blank?; end + + # @shim: since `present?` is always true, `presence` always returns `self` + sig { returns(T.self_type) } + def presence; end + + # @shim: since `blank?` is always false, `present?` always returns `true` + sig { returns(TrueClass) } + def present?; end +end + +class DateTime + sig { returns(FalseClass) } + def blank?; end + + # @shim: since `present?` is always true, `presence` always returns `self` + sig { returns(T.self_type) } + def presence; end + + # @shim: since `blank?` is always false, `present?` always returns `true` + sig { returns(TrueClass) } + def present?; end +end + +class NilClass + sig { returns(TrueClass) } + def blank?; end + + # @shim: since `present?` is always false, `presence` always returns `nil` + sig { returns(NilClass) } + def presence; end + + # @shim: since `blank?` is always true, `present?` always returns `false` + sig { returns(FalseClass) } + def present?; end +end + +class FalseClass + sig { returns(TrueClass) } + def blank?; end + + # @shim: since `present?` is always false, `presence` always returns `nil` + sig { returns(NilClass) } + def presence; end + + # @shim: since `blank?` is always true, `present?` always returns `false` + sig { returns(FalseClass) } + def present?; end +end + +class TrueClass + sig { returns(FalseClass) } + def blank?; end + + # @shim: since `present?` is always true, `presence` always returns `self` + sig { returns(T.self_type) } + def presence; end + + # @shim: since `blank?` is always false, `present?` always returns `true` + sig { returns(TrueClass) } + def present?; end +end + +class Numeric + sig { returns(FalseClass) } + def blank?; end + + sig { returns(TrueClass) } + def html_safe?; end + + # @shim: since `present?` is always true, `presence` always returns `self` + sig { returns(T.self_type) } + def presence; end + + # @shim: since `blank?` is always false, `present?` always returns `true` + sig { returns(TrueClass) } + def present?; end +end + +class Time + sig { returns(FalseClass) } + def blank?; end + + # @shim: since `present?` is always true, `presence` always returns `self` + sig { returns(T.self_type) } + def presence; end + + # @shim: since `blank?` is always false, `present?` always returns `true` + sig { returns(TrueClass) } + def present?; end + + sig { returns(ActiveSupport::TimeZone) } + def self.zone; end + + sig { returns(T.any(ActiveSupport::TimeWithZone, ::Time)) } + def self.current; end +end + +class Symbol + sig { returns(T::Boolean) } + def blank?; end + + sig { returns(T::Boolean) } + def present?; end + + # alias for `#start_with?` + sig { params(string_or_regexp: T.any(String, Regexp)).returns(T::Boolean) } + def starts_with?(*string_or_regexp); end + + # alias for `#end_with?` + sig { params(string_or_regexp: T.any(String, Regexp)).returns(T::Boolean) } + def ends_with?(*string_or_regexp); end +end + +class String + sig { returns(TrueClass) } + def acts_like_string?; end + + sig { params(position: Integer).returns(T.nilable(String)) } + sig { params(position: T.any(T::Range[Integer], Regexp)).returns(T.nilable(String)) } + sig { params(position: String).returns(T.nilable(String)) } + def at(position); end + + sig { returns(String) } + def as_json; end + + sig { returns(T::Boolean) } + def blank?; end + + sig { params(first_letter: Symbol).returns(String) } + def camelcase(first_letter = :upper); end + + sig { params(first_letter: Symbol).returns(String) } + def camelize(first_letter = :upper); end + + sig { returns(String) } + def classify; end + + sig { returns(T.untyped) } + def constantize; end + + sig { returns(String) } + def dasherize; end + + sig { returns(String) } + def deconstantize; end + + sig { returns(String) } + def demodulize; end + + # alias for `#end_with?` + sig { params(string_or_regexp: T.any(String, Regexp)).returns(T::Boolean) } + def ends_with?(*string_or_regexp); end + + sig { returns(String) } + def downcase_first; end + + sig { params(string: String).returns(T::Boolean) } + def exclude?(string); end + + sig { params(limit: Integer).returns(String) } + def first(limit = 1); end + + sig { params(separate_class_name_and_id_with_underscore: T::Boolean).returns(String) } + def foreign_key(separate_class_name_and_id_with_underscore = true); end + + sig { params(position: Integer).returns(String) } + def from(position); end + + sig { returns(ActiveSupport::SafeBuffer) } + def html_safe; end + + sig { params(capitalize: T::Boolean, keep_id_suffix: T::Boolean).returns(String) } + def humanize(capitalize: true, keep_id_suffix: false); end + + sig { params(zone: T.nilable(T.any(ActiveSupport::TimeZone, String))).returns(T.any(ActiveSupport::TimeWithZone, Time)) } + def in_time_zone(zone = ::Time.zone); end + + sig { params(amount: Integer, indent_string: T.nilable(String), indent_empty_lines: T::Boolean).returns(String) } + def indent(amount, indent_string = nil, indent_empty_lines = false); end + + sig { params(amount: Integer, indent_string: T.nilable(String), indent_empty_lines: T::Boolean).returns(T.nilable(String)) } + def indent!(amount, indent_string = nil, indent_empty_lines = false); end + + sig { returns(ActiveSupport::StringInquirer) } + def inquiry; end + + sig { returns(T::Boolean) } + def is_utf8?; end + + sig { params(limit: Integer).returns(String) } + def last(limit = 1); end + + sig { returns(ActiveSupport::Multibyte::Chars) } + def mb_chars; end + + sig { params(separator: String, preserve_case: T::Boolean, locale: T.nilable(Symbol)).returns(String) } + def parameterize(separator: "-", preserve_case: false, locale: nil); end + + sig { params(count: T.nilable(T.any(Integer, Symbol)), locale: T.nilable(Symbol)).returns(String) } + def pluralize(count = nil, locale = :en); end + + sig { returns(T::Boolean) } + def present?; end + + sig { params(patterns: T.any(String, Regexp)).returns(String) } + def remove(*patterns); end + + sig { params(patterns: T.any(String, Regexp)).returns(String) } + def remove!(*patterns); end + + sig { returns(T.untyped) } + def safe_constantize; end + + sig { params(locale: Symbol).returns(String) } + def singularize(locale = :en); end + + sig { returns(String) } + def squish; end + + sig { returns(String) } + def squish!; end + + # alias for `#start_with?` + sig { params(string_or_regexp: T.any(String, Regexp)).returns(T::Boolean) } + def starts_with?(*string_or_regexp); end + + sig { returns(String) } + def strip_heredoc; end + + sig { returns(String) } + def tableize; end + + sig { params(keep_id_suffix: T::Boolean).returns(String) } + def titlecase(keep_id_suffix: false); end + + sig { params(keep_id_suffix: T::Boolean).returns(String) } + def titleize(keep_id_suffix: false); end + + sig { params(position: Integer).returns(String) } + def to(position); end + + sig { returns(::Date) } + def to_date; end + + sig { returns(::DateTime) } + def to_datetime; end + + sig { params(form: T.nilable(Symbol)).returns(T.nilable(Time)) } + def to_time(form = :local); end + + sig { params(truncate_to: Integer, options: T::Hash[Symbol, T.anything]).returns(String) } + def truncate(truncate_to, options = {}); end + + sig { params(truncate_to: Integer, omission: T.nilable(String)).returns(String) } + def truncate_bytes(truncate_to, omission: "…"); end + + sig { params(words_count: Integer, options: T::Hash[Symbol, T.anything]).returns(String) } + def truncate_words(words_count, options = {}); end + + sig { returns(String) } + def underscore; end + + sig { returns(String) } + def upcase_first; end +end + +class ActiveSupport::ErrorReporter + # @version >= 7.1.0.beta1 + sig { type_parameters(:Block, :Fallback).params(error_classes: T.class_of(Exception), severity: T.nilable(Symbol), context: T.nilable(T::Hash[Symbol, T.untyped]), fallback: T.nilable(T.proc.returns(T.type_parameter(:Fallback))), source: T.nilable(String), blk: T.proc.returns(T.type_parameter(:Block))).returns(T.any(T.type_parameter(:Block), T.type_parameter(:Fallback))) } + def handle(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), fallback: T.unsafe(nil), source: T.unsafe(nil), &blk); end + + # @version >= 7.1.0.beta1 + sig { type_parameters(:Block).params(error_classes: T.class_of(Exception), severity: T.nilable(Symbol), context: T.nilable(T::Hash[Symbol, T.untyped]), source: T.nilable(String), blk: T.proc.returns(T.type_parameter(:Block))).returns(T.type_parameter(:Block)) } + def record(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil), &blk); end + + # @version >= 7.1.0.beta1 + sig { params(error: Exception, handled: T::Boolean, severity: T.nilable(Symbol), context: T::Hash[Symbol, T.untyped], source: T.nilable(String)).void } + def report(error, handled: true, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end + + # @version >= 7.2.0.beta1 + sig { params(error: T.any(Exception, String), severity: T.nilable(Symbol), context: T::Hash[Symbol, T.untyped], source: T.nilable(String)).void } + def unexpected(error, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end +end diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/annotations/minitest.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/annotations/minitest.rbi new file mode 100644 index 0000000..64a8928 --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/annotations/minitest.rbi @@ -0,0 +1,119 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This file was pulled from a central RBI files repository. +# Please run `bin/tapioca annotations` to update it. + +module Minitest::Assertions + sig { params(test: T.anything, msg: T.anything).returns(TrueClass) } + def assert(test, msg = nil); end + + sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) } + def assert_empty(obj, msg = nil); end + + sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) } + def assert_equal(exp, act, msg = nil); end + + sig { params(exp: T.anything, act: T.anything, delta: Numeric, msg: T.anything).returns(TrueClass) } + def assert_in_delta(exp, act, delta = T.unsafe(nil), msg = nil); end + + sig { params(a: T.anything, b: T.anything, epsilon: Numeric, msg: T.anything).returns(TrueClass) } + def assert_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = nil); end + + sig { params(collection: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def assert_includes(collection, obj, msg = nil); end + + sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def assert_instance_of(cls, obj, msg = nil); end + + sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def assert_kind_of(cls, obj, msg = nil); end + + sig { params(matcher: T.any(String, Regexp), obj: T.anything, msg: T.anything).returns(MatchData) } + def assert_match(matcher, obj, msg = nil); end + + sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) } + def assert_nil(obj, msg = nil); end + + sig { params(o1: T.anything, op: T.any(Symbol, String), o2: T.anything, msg: T.anything).returns(TrueClass) } + def assert_operator(o1, op, o2 = T.unsafe(nil), msg = nil); end + + sig { params(stdout: T.nilable(T.any(String, Regexp)), stderr: T.nilable(T.any(String, Regexp)), block: T.proc.void).returns(T::Boolean) } + def assert_output(stdout = nil, stderr = nil, &block); end + + sig { params(path: T.any(String, Pathname), msg: T.anything).returns(TrueClass) } + def assert_path_exists(path, msg = nil); end + + sig { params(block: T.proc.void).returns(TrueClass) } + def assert_pattern(&block); end + + sig { params(o1: T.anything, op: T.any(String, Symbol), msg: T.anything).returns(TrueClass) } + def assert_predicate(o1, op, msg = nil); end + + sig { params(exp: NilClass, block: T.proc.void).returns(StandardError) } + sig { type_parameters(:T).params(exp: T.any(T::Class[T.type_parameter(:T)], Regexp, String), block: T.proc.void).returns(T.type_parameter(:T)) } + def assert_raises(*exp, &block); end + + sig { params(obj: T.anything, meth: T.any(String, Symbol), msg: T.anything, include_all: T::Boolean).returns(TrueClass) } + def assert_respond_to(obj, meth, msg = nil, include_all: false); end + + sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) } + def assert_same(exp, act, msg = nil); end + + sig { params(send_ary: T::Array[T.anything], m: T.anything).returns(T::Boolean) } + def assert_send(send_ary, m = nil); end + + sig { params(block: T.proc.void).returns(T::Boolean) } + def assert_silent(&block); end + + sig { params(sym: Symbol, msg: T.anything, block: T.proc.void).returns(T.anything) } + def assert_throws(sym, msg = nil, &block); end + + sig { params(test: T.anything, msg: T.anything).returns(TrueClass) } + def refute(test, msg = nil); end + + sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_empty(obj, msg = nil); end + + sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) } + def refute_equal(exp, act, msg = nil); end + + sig { params(exp: T.anything, act: T.anything, delta: Numeric, msg: T.anything).returns(TrueClass) } + def refute_in_delta(exp, act, delta = T.unsafe(nil), msg = nil); end + + sig { params(a: T.anything, b: T.anything, epsilon: Numeric, msg: T.anything).returns(TrueClass) } + def refute_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = nil); end + + sig { params(collection: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_includes(collection, obj, msg = nil); end + + sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_instance_of(cls, obj, msg = nil); end + + sig { params(cls: T.anything, obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_kind_of(cls, obj, msg = nil); end + + sig { params(matcher: T.any(String, Regexp), obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_match(matcher, obj, msg = nil); end + + sig { params(obj: T.anything, msg: T.anything).returns(TrueClass) } + def refute_nil(obj, msg = nil); end + + sig { params(block: T.proc.void).returns(TrueClass) } + def refute_pattern(&block); end + + sig { params(o1: T.anything, op: T.any(Symbol, String), o2: T.anything, msg: T.anything).returns(TrueClass) } + def refute_operator(o1, op, o2 = T.unsafe(nil), msg = nil); end + + sig { params(path: T.any(String, Pathname), msg: T.anything).returns(TrueClass) } + def refute_path_exists(path, msg = nil); end + + sig { params(o1: T.anything, op: T.any(String, Symbol), msg: T.anything).returns(TrueClass) } + def refute_predicate(o1, op, msg = nil); end + + sig { params(obj: T.anything, meth: T.any(String, Symbol), msg: T.anything, include_all: T::Boolean).returns(TrueClass) } + def refute_respond_to(obj, meth, msg = nil, include_all: false); end + + sig { params(exp: T.anything, act: T.anything, msg: T.anything).returns(TrueClass) } + def refute_same(exp, act, msg = nil); end +end diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/dsl/.gitattributes b/examples/sinatra-pet-shelter/sorbet/rbi/dsl/.gitattributes new file mode 100644 index 0000000..d9bb82a --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/dsl/.gitattributes @@ -0,0 +1 @@ +**/*.rbi linguist-generated=true diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/dsl/active_support/callbacks.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/dsl/active_support/callbacks.rbi new file mode 100644 index 0000000..15ee6be --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/dsl/active_support/callbacks.rbi @@ -0,0 +1,21 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for dynamic methods in `ActiveSupport::Callbacks`. +# Please instead update this file by running `bin/tapioca dsl ActiveSupport::Callbacks`. + + +module ActiveSupport::Callbacks + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + end + + module GeneratedInstanceMethods + def __callbacks; end + end +end diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/gems/activesupport@8.0.0.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/activesupport@8.0.0.rbi new file mode 100644 index 0000000..eb8d570 --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/activesupport@8.0.0.rbi @@ -0,0 +1,20661 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `activesupport` gem. +# Please instead update this file by running `bin/tapioca gem activesupport`. + + +# :include: ../README.rdoc +# +# source://activesupport//lib/active_support/deep_mergeable.rb#3 +module ActiveSupport + extend ::ActiveSupport::LazyLoadHooks + extend ::ActiveSupport::Autoload + + # source://activesupport//lib/active_support/json/decoding.rb#9 + def parse_json_times; end + + # source://activesupport//lib/active_support/json/decoding.rb#9 + def parse_json_times=(val); end + + # source://activesupport//lib/active_support.rb#100 + def test_order; end + + # source://activesupport//lib/active_support.rb#100 + def test_order=(val); end + + # source://activesupport//lib/active_support.rb#101 + def test_parallelization_threshold; end + + # source://activesupport//lib/active_support.rb#101 + def test_parallelization_threshold=(val); end + + class << self + # source://activesupport//lib/active_support.rb#106 + def cache_format_version; end + + # source://activesupport//lib/active_support.rb#110 + def cache_format_version=(value); end + + # source://activesupport//lib/active_support/deprecator.rb#4 + def deprecator; end + + # source://activesupport//lib/active_support.rb#94 + def eager_load!; end + + # source://activesupport//lib/active_support.rb#104 + def error_reporter; end + + # source://activesupport//lib/active_support.rb#104 + def error_reporter=(_arg0); end + + # source://activesupport//lib/active_support/json/encoding.rb#8 + def escape_html_entities_in_json(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/json/encoding.rb#8 + def escape_html_entities_in_json=(arg); end + + # Returns the currently loaded version of Active Support as a +Gem::Version+. + # + # source://activesupport//lib/active_support/gem_version.rb#5 + def gem_version; end + + # source://activesupport//lib/active_support/json/encoding.rb#8 + def json_encoder(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/json/encoding.rb#8 + def json_encoder=(arg); end + + # source://activesupport//lib/active_support/json/decoding.rb#9 + def parse_json_times; end + + # source://activesupport//lib/active_support/json/decoding.rb#9 + def parse_json_times=(val); end + + # source://activesupport//lib/active_support.rb#100 + def test_order; end + + # source://activesupport//lib/active_support.rb#100 + def test_order=(val); end + + # source://activesupport//lib/active_support.rb#101 + def test_parallelization_threshold; end + + # source://activesupport//lib/active_support.rb#101 + def test_parallelization_threshold=(val); end + + # source://activesupport//lib/active_support/json/encoding.rb#8 + def time_precision(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/json/encoding.rb#8 + def time_precision=(arg); end + + # source://activesupport//lib/active_support.rb#114 + def to_time_preserves_timezone; end + + # source://activesupport//lib/active_support.rb#118 + 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#134 + def utc_to_local_returns_utc_offset_times; end + + # source://activesupport//lib/active_support.rb#138 + def utc_to_local_returns_utc_offset_times=(value); end + + # Returns the currently loaded version of Active Support as a +Gem::Version+. + # + # source://activesupport//lib/active_support/version.rb#7 + def version; end + end +end + +# = Actionable Errors +# +# Actionable errors lets you define actions to resolve an error. +# +# To make an error actionable, include the +ActiveSupport::ActionableError+ +# module and invoke the +action+ class macro to define the action. An action +# needs a name and a block to execute. +# +# source://activesupport//lib/active_support/actionable_error.rb#11 +module ActiveSupport::ActionableError + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveSupport::ActionableError::ClassMethods + + class << self + # source://activesupport//lib/active_support/actionable_error.rb#20 + def actions(error); end + + # source://activesupport//lib/active_support/actionable_error.rb#29 + def dispatch(error, name); end + end + + module GeneratedClassMethods + def _actions; end + def _actions=(value); end + def _actions?; end + end + + module GeneratedInstanceMethods + def _actions; end + def _actions=(value); end + def _actions?; end + end +end + +# source://activesupport//lib/active_support/actionable_error.rb#35 +module ActiveSupport::ActionableError::ClassMethods + # Defines an action that can resolve the error. + # + # class PendingMigrationError < MigrationError + # include ActiveSupport::ActionableError + # + # action "Run pending migrations" do + # ActiveRecord::Tasks::DatabaseTasks.migrate + # end + # end + # + # source://activesupport//lib/active_support/actionable_error.rb#45 + def action(name, &block); end +end + +# source://activesupport//lib/active_support/actionable_error.rb#14 +class ActiveSupport::ActionableError::NonActionable < ::StandardError; end + +# = \Array Inquirer +# +# Wrapping an array in an +ArrayInquirer+ gives a friendlier way to check +# its string-like contents: +# +# variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet]) +# +# variants.phone? # => true +# variants.tablet? # => true +# variants.desktop? # => false +# +# source://activesupport//lib/active_support/array_inquirer.rb#14 +class ActiveSupport::ArrayInquirer < ::Array + # Passes each element of +candidates+ collection to ArrayInquirer collection. + # The method returns true if any element from the ArrayInquirer collection + # is equal to the stringified or symbolized form of any element in the +candidates+ collection. + # + # If +candidates+ collection is not given, method returns true. + # + # variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet]) + # + # variants.any? # => true + # variants.any?(:phone, :tablet) # => true + # variants.any?('phone', 'desktop') # => true + # variants.any?(:desktop, :watch) # => false + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/array_inquirer.rb#27 + def any?(*candidates); end + + private + + # source://activesupport//lib/active_support/array_inquirer.rb#42 + def method_missing(name, *_arg1, **_arg2, &_arg3); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/array_inquirer.rb#38 + def respond_to_missing?(name, include_private = T.unsafe(nil)); end +end + +# = Active Support \Autoload +# +# Autoload and eager load conveniences for your library. +# +# This module allows you to define autoloads based on +# \Rails conventions (i.e. no need to define the path +# it is automatically guessed based on the filename) +# and also define a set of constants that needs to be +# eager loaded: +# +# module MyLib +# extend ActiveSupport::Autoload +# +# autoload :Model +# +# eager_autoload do +# autoload :Cache +# end +# end +# +# Then your library can be eager loaded by simply calling: +# +# MyLib.eager_load! +# +# source://activesupport//lib/active_support/dependencies/autoload.rb#29 +module ActiveSupport::Autoload + # source://activesupport//lib/active_support/dependencies/autoload.rb#30 + def autoload(const_name, path = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/dependencies/autoload.rb#51 + def autoload_at(path); end + + # source://activesupport//lib/active_support/dependencies/autoload.rb#44 + def autoload_under(path); end + + # source://activesupport//lib/active_support/dependencies/autoload.rb#58 + def eager_autoload; end + + # source://activesupport//lib/active_support/dependencies/autoload.rb#65 + def eager_load!; end +end + +# = Backtrace Cleaner +# +# Backtraces often include many lines that are not relevant for the context +# under review. This makes it hard to find the signal amongst the backtrace +# noise, and adds debugging time. With a BacktraceCleaner, filters and +# silencers are used to remove the noisy lines, so that only the most relevant +# lines remain. +# +# Filters are used to modify lines of data, while silencers are used to remove +# lines entirely. The typical filter use case is to remove lengthy path +# information from the start of each line, and view file paths relevant to the +# app directory instead of the file system root. The typical silencer use case +# is to exclude the output of a noisy library from the backtrace, so that you +# can focus on the rest. +# +# bc = ActiveSupport::BacktraceCleaner.new +# root = "#{Rails.root}/" +# bc.add_filter { |line| line.delete_prefix(root) } # strip the Rails.root prefix +# bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems +# bc.clean(exception.backtrace) # perform the cleanup +# +# To reconfigure an existing BacktraceCleaner (like the default one in \Rails) +# and show as much data as possible, you can always call +# BacktraceCleaner#remove_silencers!, which will restore the +# backtrace to a pristine state. If you need to reconfigure an existing +# BacktraceCleaner so that it does not filter or modify the paths of any lines +# of the backtrace, you can call BacktraceCleaner#remove_filters! +# These two methods will give you a completely untouched backtrace. +# +# Inspired by the Quiet Backtrace gem by thoughtbot. +# +# source://activesupport//lib/active_support/backtrace_cleaner.rb#34 +class ActiveSupport::BacktraceCleaner + # @return [BacktraceCleaner] a new instance of BacktraceCleaner + # + # source://activesupport//lib/active_support/backtrace_cleaner.rb#35 + def initialize; end + + # Adds a filter from the block provided. Each line in the backtrace will be + # mapped against this filter. + # + # # Will turn "/my/rails/root/app/models/person.rb" into "app/models/person.rb" + # root = "#{Rails.root}/" + # backtrace_cleaner.add_filter { |line| line.start_with?(root) ? line.from(root.size) : line } + # + # source://activesupport//lib/active_support/backtrace_cleaner.rb#83 + def add_filter(&block); end + + # Adds a silencer from the block provided. If the silencer returns +true+ + # for a given line, it will be excluded from the clean backtrace. + # + # # Will reject all lines that include the word "puma", like "/gems/puma/server.rb" or "/app/my_puma_server/rb" + # backtrace_cleaner.add_silencer { |line| /puma/.match?(line) } + # + # source://activesupport//lib/active_support/backtrace_cleaner.rb#92 + def add_silencer(&block); end + + # Returns the backtrace after all filters and silencers have been run + # against it. Filters run first, then silencers. + # + # source://activesupport//lib/active_support/backtrace_cleaner.rb#45 + def clean(backtrace, kind = T.unsafe(nil)); end + + # Returns the frame with all filters applied. + # returns +nil+ if the frame was silenced. + # + # source://activesupport//lib/active_support/backtrace_cleaner.rb#61 + def clean_frame(frame, kind = T.unsafe(nil)); end + + # Returns the backtrace after all filters and silencers have been run + # against it. Filters run first, then silencers. + # + # source://activesupport//lib/active_support/backtrace_cleaner.rb#45 + def filter(backtrace, kind = T.unsafe(nil)); end + + # Removes all filters, but leaves in the silencers. Useful if you suddenly + # need to see entire filepaths in the backtrace that you had already + # filtered out. + # + # source://activesupport//lib/active_support/backtrace_cleaner.rb#106 + def remove_filters!; end + + # Removes all silencers, but leaves in the filters. Useful if your + # context of debugging suddenly expands as you suspect a bug in one of + # the libraries you use. + # + # source://activesupport//lib/active_support/backtrace_cleaner.rb#99 + def remove_silencers!; end + + private + + # source://activesupport//lib/active_support/backtrace_cleaner.rb#127 + def add_core_silencer; end + + # source://activesupport//lib/active_support/backtrace_cleaner.rb#118 + def add_gem_filter; end + + # source://activesupport//lib/active_support/backtrace_cleaner.rb#131 + def add_gem_silencer; end + + # source://activesupport//lib/active_support/backtrace_cleaner.rb#135 + def add_stdlib_silencer; end + + # source://activesupport//lib/active_support/backtrace_cleaner.rb#139 + def filter_backtrace(backtrace); end + + # source://activesupport//lib/active_support/backtrace_cleaner.rb#113 + def initialize_copy(_other); end + + # source://activesupport//lib/active_support/backtrace_cleaner.rb#155 + def noise(backtrace); end + + # source://activesupport//lib/active_support/backtrace_cleaner.rb#147 + def silence(backtrace); end +end + +# source://activesupport//lib/active_support/backtrace_cleaner.rb#111 +ActiveSupport::BacktraceCleaner::FORMATTED_GEMS_PATTERN = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/benchmark.rb#4 +module ActiveSupport::Benchmark + class << self + # Benchmark realtime in the specified time unit. By default, + # the returned unit is in seconds. + # + # ActiveSupport::Benchmark.realtime { sleep 0.1 } + # # => 0.10007 + # + # ActiveSupport::Benchmark.realtime(:float_millisecond) { sleep 0.1 } + # # => 100.07 + # + # `unit` can be any of the values accepted by Ruby's `Process.clock_gettime`. + # + # source://activesupport//lib/active_support/benchmark.rb#15 + def realtime(unit = T.unsafe(nil), &block); end + end +end + +# = \Benchmarkable +# +# 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), &block); end +end + +# source://activesupport//lib/active_support/core_ext/big_decimal/conversions.rb#7 +module ActiveSupport::BigDecimalWithDefaultFormat + # source://activesupport//lib/active_support/core_ext/big_decimal/conversions.rb#8 + def to_s(format = T.unsafe(nil)); end +end + +# = Active Support Broadcast Logger +# +# The Broadcast logger is a logger used to write messages to multiple IO. It is commonly used +# in development to display messages on STDOUT and also write them to a file (development.log). +# With the Broadcast logger, you can broadcast your logs to a unlimited number of sinks. +# +# The BroadcastLogger acts as a standard logger and all methods you are used to are available. +# However, all the methods on this logger will propagate and be delegated to the other loggers +# that are part of the broadcast. +# +# Broadcasting your logs. +# +# stdout_logger = Logger.new(STDOUT) +# file_logger = Logger.new("development.log") +# broadcast = BroadcastLogger.new(stdout_logger, file_logger) +# +# broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file. +# +# Add a logger to the broadcast. +# +# stdout_logger = Logger.new(STDOUT) +# broadcast = BroadcastLogger.new(stdout_logger) +# file_logger = Logger.new("development.log") +# broadcast.broadcast_to(file_logger) +# +# broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file. +# +# Modifying the log level for all broadcasted loggers. +# +# stdout_logger = Logger.new(STDOUT) +# file_logger = Logger.new("development.log") +# broadcast = BroadcastLogger.new(stdout_logger, file_logger) +# +# broadcast.level = Logger::FATAL # Modify the log level for the whole broadcast. +# +# Stop broadcasting log to a sink. +# +# stdout_logger = Logger.new(STDOUT) +# file_logger = Logger.new("development.log") +# broadcast = BroadcastLogger.new(stdout_logger, file_logger) +# broadcast.info("Hello world!") # Writes the log to STDOUT and the development.log file. +# +# broadcast.stop_broadcasting_to(file_logger) +# broadcast.info("Hello world!") # Writes the log *only* to STDOUT. +# +# At least one sink has to be part of the broadcast. Otherwise, your logs will not +# be written anywhere. For instance: +# +# broadcast = BroadcastLogger.new +# broadcast.info("Hello world") # The log message will appear nowhere. +# +# If you are adding a custom logger with custom methods to the broadcast, +# the `BroadcastLogger` will proxy them and return the raw value, or an array +# of raw values, depending on how many loggers in the broadcasts responded to +# the method: +# +# class MyLogger < ::Logger +# def loggable? +# true +# end +# end +# +# logger = BroadcastLogger.new +# logger.loggable? # => A NoMethodError exception is raised because no loggers in the broadcasts could respond. +# +# logger.broadcast_to(MyLogger.new(STDOUT)) +# logger.loggable? # => true +# logger.broadcast_to(MyLogger.new(STDOUT)) +# puts logger.broadcasts # => [MyLogger, MyLogger] +# logger.loggable? # [true, true] +# +# source://activesupport//lib/active_support/broadcast_logger.rb#74 +class ActiveSupport::BroadcastLogger + include ::ActiveSupport::LoggerSilence + include ::ActiveSupport::LoggerThreadSafeLevel + + # @return [BroadcastLogger] a new instance of BroadcastLogger + # + # source://activesupport//lib/active_support/broadcast_logger.rb#82 + def initialize(*loggers); end + + # source://activesupport//lib/active_support/broadcast_logger.rb#112 + def <<(message); end + + # source://activesupport//lib/active_support/broadcast_logger.rb#116 + def add(*_arg0, **_arg1, &_arg2); end + + # Add logger(s) to the broadcast. + # + # broadcast_logger = ActiveSupport::BroadcastLogger.new + # broadcast_logger.broadcast_to(Logger.new(STDOUT), Logger.new(STDERR)) + # + # source://activesupport//lib/active_support/broadcast_logger.rb#93 + def broadcast_to(*loggers); end + + # Returns all the logger that are part of this broadcast. + # + # source://activesupport//lib/active_support/broadcast_logger.rb#78 + def broadcasts; end + + # source://activesupport//lib/active_support/broadcast_logger.rb#162 + def close; end + + # source://activesupport//lib/active_support/broadcast_logger.rb#121 + def debug(*_arg0, **_arg1, &_arg2); end + + # Sets the log level to Logger::DEBUG for the whole broadcast. + # + # source://activesupport//lib/active_support/broadcast_logger.rb#173 + def debug!; end + + # +True+ if the log level allows entries with severity Logger::DEBUG to be written + # to at least one broadcast. +False+ otherwise. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/broadcast_logger.rb#168 + def debug?; end + + # source://activesupport//lib/active_support/broadcast_logger.rb#133 + def error(*_arg0, **_arg1, &_arg2); end + + # Sets the log level to Logger::ERROR for the whole broadcast. + # + # source://activesupport//lib/active_support/broadcast_logger.rb#206 + def error!; end + + # +True+ if the log level allows entries with severity Logger::ERROR to be written + # to at least one broadcast. +False+ otherwise. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/broadcast_logger.rb#201 + def error?; end + + # source://activesupport//lib/active_support/broadcast_logger.rb#137 + def fatal(*_arg0, **_arg1, &_arg2); end + + # Sets the log level to Logger::FATAL for the whole broadcast. + # + # source://activesupport//lib/active_support/broadcast_logger.rb#217 + def fatal!; end + + # +True+ if the log level allows entries with severity Logger::FATAL to be written + # to at least one broadcast. +False+ otherwise. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/broadcast_logger.rb#212 + def fatal?; end + + # Returns the value of attribute formatter. + # + # source://activesupport//lib/active_support/broadcast_logger.rb#79 + def formatter; end + + # source://activesupport//lib/active_support/broadcast_logger.rb#145 + def formatter=(formatter); end + + # source://activesupport//lib/active_support/broadcast_logger.rb#125 + def info(*_arg0, **_arg1, &_arg2); end + + # Sets the log level to Logger::INFO for the whole broadcast. + # + # source://activesupport//lib/active_support/broadcast_logger.rb#184 + def info!; end + + # +True+ if the log level allows entries with severity Logger::INFO to be written + # to at least one broadcast. +False+ otherwise. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/broadcast_logger.rb#179 + def info?; end + + # source://activesupport//lib/active_support/broadcast_logger.rb#108 + def level; end + + # source://activesupport//lib/active_support/broadcast_logger.rb#151 + def level=(level); end + + # source://activesupport//lib/active_support/broadcast_logger.rb#156 + def local_level=(level); end + + # source://activesupport//lib/active_support/broadcast_logger.rb#116 + def log(*_arg0, **_arg1, &_arg2); end + + # Returns the value of attribute progname. + # + # source://activesupport//lib/active_support/broadcast_logger.rb#80 + def progname; end + + # Sets the attribute progname + # + # @param value the value to set the attribute progname to. + # + # source://activesupport//lib/active_support/broadcast_logger.rb#80 + def progname=(_arg0); end + + # source://activesupport//lib/active_support/broadcast_logger.rb#151 + def sev_threshold=(level); end + + # source://activesupport//lib/active_support/logger_silence.rb#12 + def silencer; end + + # source://activesupport//lib/active_support/logger_silence.rb#12 + def silencer=(val); end + + # Remove a logger from the broadcast. When a logger is removed, messages sent to + # the broadcast will no longer be written to its sink. + # + # sink = Logger.new(STDOUT) + # broadcast_logger = ActiveSupport::BroadcastLogger.new + # + # broadcast_logger.stop_broadcasting_to(sink) + # + # source://activesupport//lib/active_support/broadcast_logger.rb#104 + def stop_broadcasting_to(logger); end + + # source://activesupport//lib/active_support/broadcast_logger.rb#141 + def unknown(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/broadcast_logger.rb#129 + def warn(*_arg0, **_arg1, &_arg2); end + + # Sets the log level to Logger::WARN for the whole broadcast. + # + # source://activesupport//lib/active_support/broadcast_logger.rb#195 + def warn!; end + + # +True+ if the log level allows entries with severity Logger::WARN to be written + # to at least one broadcast. +False+ otherwise. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/broadcast_logger.rb#190 + def warn?; end + + private + + # source://activesupport//lib/active_support/broadcast_logger.rb#230 + def dispatch(&block); end + + # source://activesupport//lib/active_support/broadcast_logger.rb#221 + def initialize_copy(other); end + + # source://activesupport//lib/active_support/broadcast_logger.rb#235 + def method_missing(name, *_arg1, **_arg2, &_arg3); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/broadcast_logger.rb#247 + def respond_to_missing?(method, include_all); end + + class << self + # source://activesupport//lib/active_support/logger_silence.rb#12 + def silencer; end + + # source://activesupport//lib/active_support/logger_silence.rb#12 + def silencer=(val); end + end +end + +# See ActiveSupport::Cache::Store for documentation. +# +# source://activesupport//lib/active_support/cache/entry.rb#6 +module ActiveSupport::Cache + class << self + # Expands out the +key+ argument into a key that can be used for the + # cache store. Optionally accepts a namespace, and all keys will be + # scoped within that namespace. + # + # If the +key+ argument provided is an array, or responds to +to_a+, then + # each of elements in the array will be turned into parameters/keys and + # concatenated into a single key. For example: + # + # ActiveSupport::Cache.expand_cache_key([:foo, :bar]) # => "foo/bar" + # ActiveSupport::Cache.expand_cache_key([:foo, :bar], "namespace") # => "namespace/foo/bar" + # + # The +key+ argument can also respond to +cache_key+ or +to_param+. + # + # source://activesupport//lib/active_support/cache.rb#111 + def expand_cache_key(key, namespace = T.unsafe(nil)); end + + # Returns the value of attribute format_version. + # + # source://activesupport//lib/active_support/cache.rb#58 + def format_version; end + + # Sets the attribute format_version + # + # @param value the value to set the attribute format_version to. + # + # source://activesupport//lib/active_support/cache.rb#58 + def format_version=(_arg0); end + + # Creates a new Store object according to the given options. + # + # If no arguments are passed to this method, then a new + # ActiveSupport::Cache::MemoryStore object will be returned. + # + # If you pass a Symbol as the first argument, then a corresponding cache + # store class under the ActiveSupport::Cache namespace will be created. + # For example: + # + # ActiveSupport::Cache.lookup_store(:memory_store) + # # => returns a new ActiveSupport::Cache::MemoryStore object + # + # ActiveSupport::Cache.lookup_store(:mem_cache_store) + # # => returns a new ActiveSupport::Cache::MemCacheStore object + # + # Any additional arguments will be passed to the corresponding cache store + # class's constructor: + # + # ActiveSupport::Cache.lookup_store(:file_store, '/tmp/cache') + # # => same as: ActiveSupport::Cache::FileStore.new('/tmp/cache') + # + # If the first argument is not a Symbol, then it will simply be returned: + # + # ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new) + # # => returns MyOwnCacheStore.new + # + # source://activesupport//lib/active_support/cache.rb#85 + def lookup_store(store = T.unsafe(nil), *parameters); end + + private + + # source://activesupport//lib/active_support/cache.rb#123 + def retrieve_cache_key(key); end + + # Obtains the specified cache store class, given the name of the +store+. + # Raises an error when the store class cannot be found. + # + # source://activesupport//lib/active_support/cache.rb#135 + def retrieve_store_class(store); end + end +end + +# source://activesupport//lib/active_support/cache/coder.rb#7 +class ActiveSupport::Cache::Coder + # @return [Coder] a new instance of Coder + # + # source://activesupport//lib/active_support/cache/coder.rb#8 + def initialize(serializer, compressor, legacy_serializer: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/coder.rb#14 + def dump(entry); end + + # source://activesupport//lib/active_support/cache/coder.rb#20 + def dump_compressed(entry, threshold); end + + # source://activesupport//lib/active_support/cache/coder.rb#48 + def load(dumped); end + + private + + # source://activesupport//lib/active_support/cache/coder.rb#136 + def dump_version(version); end + + # source://activesupport//lib/active_support/cache/coder.rb#144 + def load_version(dumped_version); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/coder.rb#121 + def signature?(dumped); end + + # source://activesupport//lib/active_support/cache/coder.rb#129 + def try_compress(string, threshold); end + + # source://activesupport//lib/active_support/cache/coder.rb#125 + def type_for_string(value); end +end + +# source://activesupport//lib/active_support/cache/coder.rb#76 +ActiveSupport::Cache::Coder::COMPRESSED_FLAG = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/cache/coder.rb#98 +class ActiveSupport::Cache::Coder::LazyEntry < ::ActiveSupport::Cache::Entry + # @return [LazyEntry] a new instance of LazyEntry + # + # source://activesupport//lib/active_support/cache/coder.rb#99 + def initialize(serializer, compressor, payload, **options); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/coder.rb#114 + def mismatched?(version); end + + # source://activesupport//lib/active_support/cache/coder.rb#106 + def value; end +end + +# source://activesupport//lib/active_support/cache/coder.rb#84 +ActiveSupport::Cache::Coder::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/cache/coder.rb#68 +ActiveSupport::Cache::Coder::OBJECT_DUMP_TYPE = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/cache/coder.rb#80 +ActiveSupport::Cache::Coder::PACKED_EXPIRES_AT_TEMPLATE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/cache/coder.rb#78 +ActiveSupport::Cache::Coder::PACKED_TEMPLATE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/cache/coder.rb#79 +ActiveSupport::Cache::Coder::PACKED_TYPE_TEMPLATE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/cache/coder.rb#82 +ActiveSupport::Cache::Coder::PACKED_VERSION_INDEX = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/cache/coder.rb#81 +ActiveSupport::Cache::Coder::PACKED_VERSION_LENGTH_TEMPLATE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/cache/coder.rb#66 +ActiveSupport::Cache::Coder::SIGNATURE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/cache/coder.rb#96 +ActiveSupport::Cache::Coder::STRING_DESERIALIZERS = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/cache/coder.rb#70 +ActiveSupport::Cache::Coder::STRING_ENCODINGS = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/cache/coder.rb#86 +class ActiveSupport::Cache::Coder::StringDeserializer + # @return [StringDeserializer] a new instance of StringDeserializer + # + # source://activesupport//lib/active_support/cache/coder.rb#87 + def initialize(encoding); end + + # source://activesupport//lib/active_support/cache/coder.rb#91 + def load(payload); end +end + +# source://activesupport//lib/active_support/cache.rb#45 +ActiveSupport::Cache::DEFAULT_COMPRESS_LIMIT = T.let(T.unsafe(nil), Integer) + +# Raised by coders when the cache entry can't be deserialized. +# This error is treated as a cache miss. +# +# source://activesupport//lib/active_support/cache.rb#49 +class ActiveSupport::Cache::DeserializationError < ::StandardError; end + +# This class is used to represent cache entries. Cache entries have a value, an optional +# expiration time, and an optional version. The expiration time is used to support the :race_condition_ttl option +# on the cache. The version is used to support the :version option on the cache for rejecting +# mismatches. +# +# Since cache entries in most instances will be serialized, the internals of this class are highly optimized +# using short instance variable names that are lazily defined. +# +# source://activesupport//lib/active_support/cache/entry.rb#14 +class ActiveSupport::Cache::Entry + # Creates a new cache entry for the specified value. Options supported are + # +:compressed+, +:version+, +:expires_at+ and +:expires_in+. + # + # @return [Entry] a new instance of Entry + # + # source://activesupport//lib/active_support/cache/entry.rb#25 + def initialize(value, compressed: T.unsafe(nil), version: T.unsafe(nil), expires_in: T.unsafe(nil), expires_at: T.unsafe(nil), **_arg5); end + + # Returns the size of the cached value. This could be less than + # value.bytesize if the data is compressed. + # + # source://activesupport//lib/active_support/cache/entry.rb#61 + def bytesize; end + + # source://activesupport//lib/active_support/cache/entry.rb#76 + def compressed(compress_threshold); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/entry.rb#72 + def compressed?; end + + # Duplicates the value in a class. This is used by cache implementations that don't natively + # serialize entries to protect against accidental cache modifications. + # + # source://activesupport//lib/active_support/cache/entry.rb#106 + def dup_value!; end + + # Checks if the entry is expired. The +expires_in+ parameter can override + # the value set when the entry was created. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/entry.rb#43 + def expired?; end + + # source://activesupport//lib/active_support/cache/entry.rb#47 + def expires_at; end + + # source://activesupport//lib/active_support/cache/entry.rb#51 + def expires_at=(value); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/entry.rb#100 + def local?; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/entry.rb#37 + def mismatched?(version); end + + # source://activesupport//lib/active_support/cache/entry.rb#116 + def pack; end + + # source://activesupport//lib/active_support/cache/entry.rb#33 + def value; end + + # Returns the value of attribute version. + # + # source://activesupport//lib/active_support/cache/entry.rb#21 + def version; end + + private + + # source://activesupport//lib/active_support/cache/entry.rb#127 + def marshal_load(payload); end + + # source://activesupport//lib/active_support/cache/entry.rb#123 + def uncompress(value); end + + class << self + # source://activesupport//lib/active_support/cache/entry.rb#16 + def unpack(members); end + end +end + +# = \File \Cache \Store +# +# A cache store implementation which stores everything on the filesystem. +# +# source://activesupport//lib/active_support/cache/file_store.rb#12 +class ActiveSupport::Cache::FileStore < ::ActiveSupport::Cache::Store + # @return [FileStore] a new instance of FileStore + # + # source://activesupport//lib/active_support/cache/file_store.rb#20 + def initialize(cache_path, **options); end + + # Returns the value of attribute cache_path. + # + # source://activesupport//lib/active_support/cache/file_store.rb#13 + def cache_path; end + + # Preemptively iterates through all stored keys and removes the ones which have expired. + # + # source://activesupport//lib/active_support/cache/file_store.rb#40 + def cleanup(options = T.unsafe(nil)); end + + # Deletes all items from the cache. In this case it deletes all the entries in the specified + # file store directory except for .keep or .gitkeep. Be careful which directory is specified in your + # config file when using +FileStore+ because everything in that directory will be deleted. + # + # source://activesupport//lib/active_support/cache/file_store.rb#33 + def clear(options = T.unsafe(nil)); end + + # Decrement a cached integer value. Returns the updated value. + # + # If the key is unset, it will be set to +-amount+. + # + # cache.decrement("foo") # => -1 + # + # To set a specific value, call #write: + # + # cache.write("baz", 5) + # cache.decrement("baz") # => 4 + # + # source://activesupport//lib/active_support/cache/file_store.rb#80 + def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/file_store.rb#89 + def delete_matched(matcher, options = T.unsafe(nil)); end + + # Increment a cached integer value. Returns the updated value. + # + # If the key is unset, it starts from +0+: + # + # cache.increment("foo") # => 1 + # cache.increment("bar", 100) # => 100 + # + # To set a specific value, call #write: + # + # cache.write("baz", 5) + # cache.increment("baz") # => 6 + # + # source://activesupport//lib/active_support/cache/file_store.rb#60 + def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/file_store.rb#101 + def inspect; end + + private + + # Delete empty directories in the cache. + # + # source://activesupport//lib/active_support/cache/file_store.rb#195 + def delete_empty_directories(dir); end + + # source://activesupport//lib/active_support/cache/file_store.rb#131 + def delete_entry(key, **options); end + + # Make sure a file path's directories exist. + # + # source://activesupport//lib/active_support/cache/file_store.rb#204 + def ensure_cache_path(path); end + + # Translate a file path into a key. + # + # source://activesupport//lib/active_support/cache/file_store.rb#189 + 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#148 + def lock_file(file_name, &block); end + + # Modifies the amount of an integer value that is stored in the cache. + # If the key is not found it is created and set to +amount+. + # + # source://activesupport//lib/active_support/cache/file_store.rb#222 + def modify_value(name, amount, options); end + + # Translate a key into a file path. + # + # source://activesupport//lib/active_support/cache/file_store.rb#162 + def normalize_key(key, options); end + + # source://activesupport//lib/active_support/cache/file_store.rb#106 + def read_entry(key, **options); end + + # source://activesupport//lib/active_support/cache/file_store.rb#113 + def read_serialized_entry(key, **_arg1); end + + # source://activesupport//lib/active_support/cache/file_store.rb#208 + def search_dir(dir, &callback); end + + # source://activesupport//lib/active_support/cache/file_store.rb#120 + def write_entry(key, entry, **options); end + + # source://activesupport//lib/active_support/cache/file_store.rb#124 + def write_serialized_entry(key, payload, **options); end + + class << self + # Advertise cache versioning support. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/file_store.rb#26 + def supports_cache_versioning?; end + end +end + +# source://activesupport//lib/active_support/cache/file_store.rb#15 +ActiveSupport::Cache::FileStore::DIR_FORMATTER = T.let(T.unsafe(nil), String) + +# max filename size on file system is 255, minus room for timestamp, pid, and random characters appended by Tempfile (used by atomic write) +# +# source://activesupport//lib/active_support/cache/file_store.rb#16 +ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE = T.let(T.unsafe(nil), Integer) + +# max is 1024, plus some room +# +# source://activesupport//lib/active_support/cache/file_store.rb#17 +ActiveSupport::Cache::FileStore::FILEPATH_MAX_SIZE = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/cache/file_store.rb#18 +ActiveSupport::Cache::FileStore::GITKEEP_FILES = T.let(T.unsafe(nil), Array) + +# = Memory \Cache \Store +# +# A cache store implementation which stores everything into memory in the +# same process. If you're running multiple Ruby on \Rails server processes +# (which is the case if you're using Phusion Passenger or puma clustered mode), +# then this means that \Rails server process instances won't be able +# to share cache data with each other and this may not be the most +# appropriate cache in that scenario. +# +# This cache has a bounded size specified by the +:size+ options to the +# initializer (default is 32Mb). When the cache exceeds the allotted size, +# a cleanup will occur which tries to prune the cache down to three quarters +# of the maximum size by removing the least recently used entries. +# +# Unlike other Cache store implementations, +MemoryStore+ does not compress +# values by default. +MemoryStore+ does not benefit from compression as much +# as other Store implementations, as it does not send data over a network. +# However, when compression is enabled, it still pays the full cost of +# compression in terms of cpu use. +# +# +MemoryStore+ is thread-safe. +# +# source://activesupport//lib/active_support/cache/memory_store.rb#28 +class ActiveSupport::Cache::MemoryStore < ::ActiveSupport::Cache::Store + # @return [MemoryStore] a new instance of MemoryStore + # + # source://activesupport//lib/active_support/cache/memory_store.rb#73 + def initialize(options = T.unsafe(nil)); end + + # Preemptively iterates through all stored keys and removes the ones which have expired. + # + # source://activesupport//lib/active_support/cache/memory_store.rb#101 + def cleanup(options = T.unsafe(nil)); end + + # Delete all data stored in a given cache store. + # + # source://activesupport//lib/active_support/cache/memory_store.rb#93 + def clear(options = T.unsafe(nil)); end + + # Decrement a cached integer value. Returns the updated value. + # + # If the key is unset or has expired, it will be set to +-amount+. + # + # cache.decrement("foo") # => -1 + # + # To set a specific value, call #write: + # + # cache.write("baz", 5) + # cache.decrement("baz") # => 4 + # + # source://activesupport//lib/active_support/cache/memory_store.rb#166 + 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#173 + def delete_matched(matcher, options = T.unsafe(nil)); end + + # Increment a cached integer value. Returns the updated value. + # + # If the key is unset, it will be set to +amount+: + # + # cache.increment("foo") # => 1 + # cache.increment("bar", 100) # => 100 + # + # To set a specific value, call #write: + # + # cache.write("baz", 5) + # cache.increment("baz") # => 6 + # + # source://activesupport//lib/active_support/cache/memory_store.rb#149 + def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/memory_store.rb#185 + def inspect; end + + # To ensure entries fit within the specified memory prune the cache by removing the least + # recently accessed entries. + # + # source://activesupport//lib/active_support/cache/memory_store.rb#114 + def prune(target_size, max_time = T.unsafe(nil)); end + + # Returns true if the cache is currently being pruned. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/memory_store.rb#133 + def pruning?; end + + # Synchronize calls to the cache. This should be called wherever the underlying cache implementation + # is not thread safe. + # + # source://activesupport//lib/active_support/cache/memory_store.rb#191 + def synchronize(&block); end + + private + + # source://activesupport//lib/active_support/cache/memory_store.rb#198 + def cached_size(key, payload); end + + # source://activesupport//lib/active_support/cache/memory_store.rb#231 + def delete_entry(key, **options); end + + # Modifies the amount of an integer value that is stored in the cache. + # If the key is not found it is created and set to +amount+. + # + # source://activesupport//lib/active_support/cache/memory_store.rb#241 + def modify_value(name, amount, options); end + + # source://activesupport//lib/active_support/cache/memory_store.rb#202 + def read_entry(key, **options); end + + # source://activesupport//lib/active_support/cache/memory_store.rb#214 + def write_entry(key, entry, **options); end + + class << self + # Advertise cache versioning support. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/memory_store.rb#88 + def supports_cache_versioning?; end + end +end + +# source://activesupport//lib/active_support/cache/memory_store.rb#29 +module ActiveSupport::Cache::MemoryStore::DupCoder + extend ::ActiveSupport::Cache::MemoryStore::DupCoder + + # source://activesupport//lib/active_support/cache/memory_store.rb#32 + def dump(entry); end + + # source://activesupport//lib/active_support/cache/memory_store.rb#40 + def dump_compressed(entry, threshold); end + + # source://activesupport//lib/active_support/cache/memory_store.rb#45 + def load(entry); end + + private + + # source://activesupport//lib/active_support/cache/memory_store.rb#56 + def dump_value(value); end + + # source://activesupport//lib/active_support/cache/memory_store.rb#64 + def load_value(string); end +end + +# source://activesupport//lib/active_support/cache/memory_store.rb#54 +ActiveSupport::Cache::MemoryStore::DupCoder::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/cache/memory_store.rb#196 +ActiveSupport::Cache::MemoryStore::PER_ENTRY_OVERHEAD = T.let(T.unsafe(nil), Integer) + +# = Null \Cache \Store +# +# A cache store implementation which doesn't actually store anything. Useful in +# development and test environments where you don't want caching turned on but +# need to go through the caching interface. +# +# This cache does implement the local cache strategy, so values will actually +# be cached inside blocks that utilize this strategy. See +# ActiveSupport::Cache::Strategy::LocalCache for more details. +# +# source://activesupport//lib/active_support/cache/null_store.rb#14 +class ActiveSupport::Cache::NullStore < ::ActiveSupport::Cache::Store + include ::ActiveSupport::Cache::Strategy::LocalCache + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#85 + def cleanup(options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#79 + def clear(options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#108 + def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#91 + def delete_matched(matcher, options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#97 + def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/null_store.rb#37 + def inspect; end + + private + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#162 + def delete_entry(key, **_arg1); end + + # source://activesupport//lib/active_support/cache/null_store.rb#42 + def read_entry(key, **s); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#120 + def read_serialized_entry(key, raw: T.unsafe(nil), **options); end + + # source://activesupport//lib/active_support/cache/null_store.rb#49 + def write_entry(key, entry, **_arg2); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#153 + def write_serialized_entry(key, payload, **_arg2); end + + class << self + # Advertise cache versioning support. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/null_store.rb#18 + def supports_cache_versioning?; end + end +end + +# Mapping of canonical option names to aliases that a store will recognize. +# +# source://activesupport//lib/active_support/cache.rb#41 +ActiveSupport::Cache::OPTION_ALIASES = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#8 +module ActiveSupport::Cache::SerializerWithFallback + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#17 + def load(dumped); end + + private + + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#39 + def marshal_load(payload); end + + class << self + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#9 + def [](format); end + end +end + +# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#66 +module ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback + include ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback + + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#88 + def _load(marked); end + + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#73 + def dump(entry); end + + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#77 + def dump_compressed(entry, threshold); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#94 + def dumped?(dumped); end +end + +# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#71 +ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback::MARK_COMPRESSED = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#70 +ActiveSupport::Cache::SerializerWithFallback::Marshal70WithFallback::MARK_UNCOMPRESSED = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#99 +module ActiveSupport::Cache::SerializerWithFallback::Marshal71WithFallback + include ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback::Marshal71WithFallback + + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#109 + def _load(dumped); end + + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#105 + def dump(value); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#113 + def dumped?(dumped); end +end + +# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#103 +ActiveSupport::Cache::SerializerWithFallback::Marshal71WithFallback::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#118 +module ActiveSupport::Cache::SerializerWithFallback::MessagePackWithFallback + include ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback::MessagePackWithFallback + + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#126 + def _load(dumped); end + + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#122 + def dump(value); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#130 + def dumped?(dumped); end + + private + + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#135 + def available?; end +end + +# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#45 +module ActiveSupport::Cache::SerializerWithFallback::PassthroughWithFallback + include ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback + extend ::ActiveSupport::Cache::SerializerWithFallback::PassthroughWithFallback + + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#57 + def _load(entry); end + + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#49 + def dump(entry); end + + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#53 + def dump_compressed(entry, threshold); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#61 + def dumped?(dumped); end +end + +# source://activesupport//lib/active_support/cache/serializer_with_fallback.rb#144 +ActiveSupport::Cache::SerializerWithFallback::SERIALIZERS = T.let(T.unsafe(nil), Hash) + +# = Active Support \Cache \Store +# +# An abstract cache store class. There are multiple cache store +# implementations, each having its own additional features. See the classes +# under the ActiveSupport::Cache module, e.g. +# ActiveSupport::Cache::MemCacheStore. MemCacheStore is currently the most +# popular cache store for large production websites. +# +# Some implementations may not support all methods beyond the basic cache +# methods of #fetch, #write, #read, #exist?, and #delete. +# +# +ActiveSupport::Cache::Store+ can store any Ruby object that is supported +# by its +coder+'s +dump+ and +load+ methods. +# +# cache = ActiveSupport::Cache::MemoryStore.new +# +# cache.read('city') # => nil +# cache.write('city', "Duckburgh") # => true +# cache.read('city') # => "Duckburgh" +# +# cache.write('not serializable', Proc.new {}) # => TypeError +# +# Keys are always translated into Strings and are case sensitive. When an +# object is specified as a key and has a +cache_key+ method defined, this +# method will be called to define the key. Otherwise, the +to_param+ +# method will be called. Hashes and Arrays can also be used as keys. The +# elements will be delimited by slashes, and the elements within a Hash +# will be sorted by key so they are consistent. +# +# cache.read('city') == cache.read(:city) # => true +# +# Nil values can be cached. +# +# If your cache is on a shared infrastructure, you can define a namespace +# for your cache entries. If a namespace is defined, it will be prefixed on +# to every key. The namespace can be either a static value or a Proc. If it +# is a Proc, it will be invoked when each key is evaluated so that you can +# use application logic to invalidate keys. +# +# cache.namespace = -> { @last_mod_time } # Set the namespace to a variable +# @last_mod_time = Time.now # Invalidate the entire cache by changing namespace +# +# source://activesupport//lib/active_support/cache.rb#188 +class ActiveSupport::Cache::Store + # Creates a new cache. + # + # ==== Options + # + # [+:namespace+] + # Sets the namespace for the cache. This option is especially useful if + # your application shares a cache with other applications. + # + # [+:serializer+] + # The serializer for cached values. Must respond to +dump+ and +load+. + # + # The default serializer depends on the cache format version (set via + # +config.active_support.cache_format_version+ when using Rails). The + # default serializer for each format version includes a fallback + # mechanism to deserialize values from any format version. This behavior + # makes it easy to migrate between format versions without invalidating + # the entire cache. + # + # You can also specify serializer: :message_pack to use a + # preconfigured serializer based on ActiveSupport::MessagePack. The + # +:message_pack+ serializer includes the same deserialization fallback + # mechanism, allowing easy migration from (or to) the default + # serializer. The +:message_pack+ serializer may improve performance, + # but it requires the +msgpack+ gem. + # + # [+:compressor+] + # The compressor for serialized cache values. Must respond to +deflate+ + # and +inflate+. + # + # The default compressor is +Zlib+. To define a new custom compressor + # that also decompresses old cache entries, you can check compressed + # values for Zlib's "\x78" signature: + # + # module MyCompressor + # def self.deflate(dumped) + # # compression logic... (make sure result does not start with "\x78"!) + # end + # + # def self.inflate(compressed) + # if compressed.start_with?("\x78") + # Zlib.inflate(compressed) + # else + # # decompression logic... + # end + # end + # end + # + # ActiveSupport::Cache.lookup_store(:redis_cache_store, compressor: MyCompressor) + # + # [+:coder+] + # The coder for serializing and (optionally) compressing cache entries. + # Must respond to +dump+ and +load+. + # + # The default coder composes the serializer and compressor, and includes + # some performance optimizations. If you only need to override the + # serializer or compressor, you should specify the +:serializer+ or + # +:compressor+ options instead. + # + # If the store can handle cache entries directly, you may also specify + # coder: nil to omit the serializer, compressor, and coder. For + # example, if you are using ActiveSupport::Cache::MemoryStore and can + # guarantee that cache values will not be mutated, you can specify + # coder: nil to avoid the overhead of safeguarding against + # mutation. + # + # The +:coder+ option is mutually exclusive with the +:serializer+ and + # +:compressor+ options. Specifying them together will raise an + # +ArgumentError+. + # + # Any other specified options are treated as default options for the + # relevant cache operations, such as #read, #write, and #fetch. + # + # @return [Store] a new instance of Store + # + # source://activesupport//lib/active_support/cache.rb#295 + def initialize(options = T.unsafe(nil)); end + + # Cleans up the cache by removing expired entries. + # + # Options are passed to the underlying cache implementation. + # + # Some implementations may not support this method. + # + # @raise [NotImplementedError] + # + # source://activesupport//lib/active_support/cache.rb#749 + 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#759 + 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#740 + def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end + + # Deletes an entry in the cache. Returns +true+ if an entry is deleted + # and +false+ otherwise. + # + # Options are passed to the underlying cache implementation. + # + # source://activesupport//lib/active_support/cache.rb#676 + 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#722 + def delete_matched(matcher, options = T.unsafe(nil)); end + + # Deletes multiple entries in the cache. Returns the number of deleted + # entries. + # + # Options are passed to the underlying cache implementation. + # + # source://activesupport//lib/active_support/cache.rb#689 + 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#703 + def exist?(name, options = T.unsafe(nil)); end + + # Fetches data from the cache, using the given key. If there is data in + # the cache with the given key, then that data is returned. + # + # If there is no such data in the cache (a cache miss), then +nil+ will be + # returned. However, if a block has been passed, that block will be passed + # the key and executed in the event of a cache miss. The return value of the + # block will be written to the cache under the given cache key, and that + # return value will be returned. + # + # cache.write('today', 'Monday') + # cache.fetch('today') # => "Monday" + # + # cache.fetch('city') # => nil + # cache.fetch('city') do + # 'Duckburgh' + # end + # cache.fetch('city') # => "Duckburgh" + # + # ==== Options + # + # Internally, +fetch+ calls +read_entry+, and calls +write_entry+ on a + # cache miss. Thus, +fetch+ supports the same options as #read and #write. + # Additionally, +fetch+ supports the following options: + # + # * 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 +write+. + # + # * skip_nil: true - Prevents caching a nil result: + # + # cache.fetch('foo') { nil } + # cache.fetch('bar', skip_nil: true) { nil } + # cache.exist?('foo') # => true + # cache.exist?('bar') # => false + # + # * +:race_condition_ttl+ - Specifies the number of seconds during which + # an expired value can be reused while a new value is being generated. + # This can be used to prevent race conditions when cache entries expire, + # by preventing multiple processes from simultaneously regenerating the + # same entry (also known as the dog pile effect). + # + # When a process encounters a cache entry that has expired less than + # +:race_condition_ttl+ seconds ago, it will bump the expiration time by + # +:race_condition_ttl+ seconds before generating a new value. During + # this extended time window, while the process generates a new value, + # other processes will continue to use the old value. After the first + # process writes the new value, other processes will then use it. + # + # If the first process errors out while generating a new value, another + # process can try to generate a new value after the extended time window + # has elapsed. + # + # # Set all values to expire after one minute. + # cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 1) + # + # cache.write("foo", "original value") + # val_1 = nil + # val_2 = nil + # p cache.read("foo") # => "original value" + # + # sleep 1 # wait until the cache expires + # + # t1 = Thread.new do + # # fetch does the following: + # # 1. gets an recent expired entry + # # 2. extends the expiry by 2 seconds (race_condition_ttl) + # # 3. regenerates the new value + # val_1 = cache.fetch("foo", race_condition_ttl: 2) do + # sleep 1 + # "new value 1" + # end + # end + # + # # Wait until t1 extends the expiry of the entry + # # but before generating the new value + # sleep 0.1 + # + # val_2 = cache.fetch("foo", race_condition_ttl: 2) do + # # This block won't be executed because t1 extended the expiry + # "new value 2" + # end + # + # t1.join + # + # p val_1 # => "new value 1" + # p val_2 # => "original value" + # p cache.fetch("foo") # => "new value 1" + # + # # The entry requires 3 seconds to expire (expires_in + race_condition_ttl) + # # We have waited 2 seconds already (sleep(1) + t1.join) thus we need to wait 1 + # # more second to see the entry expire. + # sleep 1 + # + # p cache.fetch("foo") # => nil + # + # ==== Dynamic Options + # + # In some cases it may be necessary to dynamically compute options based + # on the cached value. To support this, an ActiveSupport::Cache::WriteOptions + # instance is passed as the second argument to the block. For example: + # + # cache.fetch("authentication-token:#{user.id}") do |key, options| + # token = authenticate_to_service + # options.expires_at = token.expires_at + # token + # end + # + # source://activesupport//lib/active_support/cache.rb#444 + def fetch(name, options = T.unsafe(nil), &block); end + + # Fetches data from the cache, using the given keys. If there is data in + # the cache with the given keys, then that data is returned. Otherwise, + # the supplied block is called for each key for which there was no data, + # and the result will be written to the cache and returned. + # Therefore, you need to pass a block that returns the data to be written + # to the cache. If you do not want to write the cache when the cache is + # not found, use #read_multi. + # + # Returns a hash with the data for each of the names. For example: + # + # cache.write("bim", "bam") + # cache.fetch_multi("bim", "unknown_key") do |key| + # "Fallback value for key: #{key}" + # end + # # => { "bim" => "bam", + # # "unknown_key" => "Fallback value for key: unknown_key" } + # + # You may also specify additional options via the +options+ argument. See #fetch for details. + # Other options are passed to the underlying cache implementation. For example: + # + # cache.fetch_multi("fizz", expires_in: 5.seconds) do |key| + # "buzz" + # end + # # => {"fizz"=>"buzz"} + # cache.read("fizz") + # # => "buzz" + # sleep(6) + # cache.read("fizz") + # # => nil + # + # @raise [ArgumentError] + # + # source://activesupport//lib/active_support/cache.rb#595 + 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#731 + def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache.rb#189 + def logger; end + + # source://activesupport//lib/active_support/cache.rb#189 + def logger=(val); end + + # Silences the logger within a block. + # + # source://activesupport//lib/active_support/cache.rb#322 + def mute; end + + # source://activesupport//lib/active_support/cache.rb#713 + def new_entry(value, options = T.unsafe(nil)); end + + # Returns the value of attribute options. + # + # source://activesupport//lib/active_support/cache.rb#192 + def options; end + + # source://activesupport//lib/active_support/cache.rb#190 + def raise_on_invalid_cache_expiration_time; end + + # source://activesupport//lib/active_support/cache.rb#190 + def raise_on_invalid_cache_expiration_time=(val); end + + # Reads data from the cache, using the given key. If there is data in + # the cache with the given key, then that data is returned. Otherwise, + # +nil+ is returned. + # + # Note, if data was written with the :expires_in or + # :version options, both of these conditions are applied before + # the data is returned. + # + # ==== Options + # + # * +:namespace+ - Replace the store namespace for this call. + # * +:version+ - Specifies a version for the cache entry. If the cached + # version does not match the requested version, the read will be treated + # as a cache miss. This feature is used to support recyclable cache keys. + # + # Other options will be handled by the specific cache store implementation. + # + # source://activesupport//lib/active_support/cache.rb#498 + def read(name, options = T.unsafe(nil)); end + + # Reads multiple values at once from the cache. Options can be passed + # in the last argument. + # + # Some cache implementation may optimize this method. + # + # Returns a hash mapping the names provided to the values found. + # + # source://activesupport//lib/active_support/cache.rb#536 + def read_multi(*names); end + + # Returns the value of attribute silence. + # + # source://activesupport//lib/active_support/cache.rb#192 + def silence; end + + # Silences the logger. + # + # source://activesupport//lib/active_support/cache.rb#316 + def silence!; end + + # Returns the value of attribute silence. + # + # source://activesupport//lib/active_support/cache.rb#192 + def silence?; end + + # Writes the value to the cache with the key. The value must be supported + # by the +coder+'s +dump+ and +load+ methods. + # + # Returns +true+ if the write succeeded, +nil+ if there was an error talking + # to the cache backend, or +false+ if the write failed for another reason. + # + # By default, cache entries larger than 1kB are compressed. Compression + # allows more data to be stored in the same memory footprint, leading to + # fewer cache evictions and higher hit rates. + # + # ==== Options + # + # * compress: false - Disables compression of the cache entry. + # + # * +:compress_threshold+ - The compression threshold, specified in bytes. + # \Cache entries larger than this threshold will be compressed. Defaults + # to +1.kilobyte+. + # + # * +:expires_in+ - Sets a relative expiration time for the cache entry, + # specified in seconds. +:expire_in+ and +:expired_in+ are aliases for + # +:expires_in+. + # + # cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 5.minutes) + # cache.write(key, value, expires_in: 1.minute) # Set a lower value for one entry + # + # * +:expires_at+ - Sets an absolute expiration time for the cache entry. + # + # cache = ActiveSupport::Cache::MemoryStore.new + # cache.write(key, value, expires_at: Time.now.at_end_of_hour) + # + # * +:version+ - Specifies a version for the cache entry. When reading + # from the cache, if the cached version does not match the requested + # version, the read will be treated as a cache miss. This feature is + # used to support recyclable cache keys. + # + # Other options will be handled by the specific cache store implementation. + # + # source://activesupport//lib/active_support/cache.rb#662 + 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#551 + def write_multi(hash, options = T.unsafe(nil)); end + + private + + # source://activesupport//lib/active_support/cache.rb#1010 + def _instrument(operation, multi: T.unsafe(nil), options: T.unsafe(nil), **payload, &block); end + + # source://activesupport//lib/active_support/cache.rb#764 + def default_serializer; end + + # Deletes an entry from the cache implementation. Subclasses must + # implement this method. + # + # @raise [NotImplementedError] + # + # source://activesupport//lib/active_support/cache.rb#850 + 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#856 + def delete_multi_entries(entries, **options); end + + # source://activesupport//lib/active_support/cache.rb#815 + def deserialize_entry(payload, **_arg1); end + + # Expands key to be a consistent string value. Invokes +cache_key+ if + # object responds to +cache_key+. Otherwise, +to_param+ method will be + # called. If the key is a Hash, then keys will be sorted alphabetically. + # + # source://activesupport//lib/active_support/cache.rb#973 + def expanded_key(key); end + + # source://activesupport//lib/active_support/cache.rb#994 + def expanded_version(key); end + + # source://activesupport//lib/active_support/cache.rb#1048 + def get_entry_value(entry, name, options); end + + # source://activesupport//lib/active_support/cache.rb#1031 + def handle_expired_entry(entry, key, options); end + + # source://activesupport//lib/active_support/cache.rb#890 + def handle_invalid_expires_in(message); end + + # source://activesupport//lib/active_support/cache.rb#1002 + def instrument(operation, key, options = T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/cache.rb#1006 + def instrument_multi(operation, keys, options = T.unsafe(nil), &block); end + + # Adds the namespace defined in the options to a pattern designed to + # match keys. Implementations that support delete_matched should call + # this method to translate a pattern that matches names into one that + # matches namespaced keys. + # + # source://activesupport//lib/active_support/cache.rb#779 + def key_matcher(pattern, options); end + + # Merges the default options with ones specific to a method call. + # + # source://activesupport//lib/active_support/cache.rb#861 + 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#948 + def namespace_key(key, call_options = T.unsafe(nil)); end + + # Expands and namespaces the cache key. + # Raises an exception when the key is +nil+ or an empty string. + # May be overridden by cache stores to do additional normalization. + # + # @raise [ArgumentError] + # + # source://activesupport//lib/active_support/cache.rb#932 + def normalize_key(key, options = T.unsafe(nil)); end + + # Normalize aliased options to their canonical form + # + # source://activesupport//lib/active_support/cache.rb#901 + def normalize_options(options); end + + # source://activesupport//lib/active_support/cache.rb#990 + 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#796 + 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#823 + def read_multi_entries(names, **options); end + + # source://activesupport//lib/active_support/cache.rb#1053 + def save_block_result_to_cache(name, key, options); end + + # source://activesupport//lib/active_support/cache.rb#806 + def serialize_entry(entry, **options); end + + # source://activesupport//lib/active_support/cache.rb#912 + def validate_options(options); end + + # Writes an entry to the cache implementation. Subclasses must implement + # this method. + # + # @raise [NotImplementedError] + # + # source://activesupport//lib/active_support/cache.rb#802 + 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#842 + def write_multi_entries(hash, **options); end + + class << self + # source://activesupport//lib/active_support/cache.rb#189 + def logger; end + + # source://activesupport//lib/active_support/cache.rb#189 + def logger=(val); end + + # source://activesupport//lib/active_support/cache.rb#190 + def raise_on_invalid_cache_expiration_time; end + + # source://activesupport//lib/active_support/cache.rb#190 + def raise_on_invalid_cache_expiration_time=(val); end + + private + + # source://activesupport//lib/active_support/cache.rb#200 + def retrieve_pool_options(options); end + end +end + +# source://activesupport//lib/active_support/cache.rb#51 +module ActiveSupport::Cache::Strategy; end + +# = Local \Cache \Strategy +# +# Caches that implement LocalCache will be backed by an in-memory cache for the +# duration of a block. Repeated calls to the cache for the same key will hit the +# in-memory cache for faster access. +# +# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#13 +module ActiveSupport::Cache::Strategy::LocalCache + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#85 + def cleanup(options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#79 + def clear(options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#108 + def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#91 + def delete_matched(matcher, options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#97 + def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end + + # Middleware class can be inserted as a Rack handler to be local cache for the + # duration of request. + # + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#73 + def middleware; end + + # Use a local cache for the duration of block. + # + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#67 + def with_local_cache(&block); end + + private + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#185 + def bypass_local_cache(&block); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#162 + def delete_entry(key, **_arg1); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#181 + def local_cache; end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#177 + def local_cache_key; end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#134 + def read_multi_entries(names, **options); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#120 + def read_serialized_entry(key, raw: T.unsafe(nil), **options); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#189 + def use_temporary_local_cache(temporary_cache); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#167 + def write_cache_value(name, value, **options); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#153 + def write_serialized_entry(key, payload, **_arg2); end +end + +# Class for storing and registering the local caches. +# +# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#17 +module ActiveSupport::Cache::Strategy::LocalCache::LocalCacheRegistry + extend ::ActiveSupport::Cache::Strategy::LocalCache::LocalCacheRegistry + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#20 + def cache_for(local_cache_key); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#25 + def set_cache_for(local_cache_key, value); end +end + +# = Local \Cache \Store +# +# Simple memory backed cache. This cache is not thread safe and is intended only +# for serving as a temporary memory cache for a single thread. +# +# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#35 +class ActiveSupport::Cache::Strategy::LocalCache::LocalStore + # @return [LocalStore] a new instance of LocalStore + # + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#36 + def initialize; end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#40 + def clear(options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#57 + def delete_entry(key); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#61 + def fetch_entry(key); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#44 + def read_entry(key); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#48 + def read_multi_entries(keys); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#52 + def write_entry(key, entry); end +end + +# -- +# This class wraps up local storage for middlewares. Only the middleware method should +# construct them. +# +# source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#13 +class ActiveSupport::Cache::Strategy::LocalCache::Middleware + # @return [Middleware] a new instance of Middleware + # + # source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#16 + def initialize(name, local_cache_key); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#27 + def call(env); end + + # source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#14 + def local_cache_key; end + + # source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#14 + def name; end + + # source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#22 + def new(app); end +end + +# These options mean something to all cache implementations. Individual cache +# implementations may support additional options. +# +# source://activesupport//lib/active_support/cache.rb#26 +ActiveSupport::Cache::UNIVERSAL_OPTIONS = T.let(T.unsafe(nil), Array) + +# Enables the dynamic configuration of Cache entry options while ensuring +# that conflicting options are not both set. When a block is given to +# ActiveSupport::Cache::Store#fetch, the second argument will be an +# instance of +WriteOptions+. +# +# source://activesupport//lib/active_support/cache.rb#1069 +class ActiveSupport::Cache::WriteOptions + # @return [WriteOptions] a new instance of WriteOptions + # + # source://activesupport//lib/active_support/cache.rb#1070 + def initialize(options); end + + # source://activesupport//lib/active_support/cache.rb#1094 + def expires_at; end + + # Sets the Cache entry's +expires_at+ value. If an +expires_in+ option was + # previously set, this will unset it since +expires_at+ and +expires_in+ + # cannot both be set. + # + # source://activesupport//lib/active_support/cache.rb#1101 + def expires_at=(expires_at); end + + # source://activesupport//lib/active_support/cache.rb#1082 + def expires_in; end + + # Sets the Cache entry's +expires_in+ value. If an +expires_at+ option was + # previously set, this will unset it since +expires_in+ and +expires_at+ + # cannot both be set. + # + # source://activesupport//lib/active_support/cache.rb#1089 + def expires_in=(expires_in); end + + # source://activesupport//lib/active_support/cache.rb#1074 + def version; end + + # source://activesupport//lib/active_support/cache.rb#1078 + def version=(version); end +end + +# = Caching Key Generator +# +# CachingKeyGenerator is a wrapper around KeyGenerator which allows users to avoid +# re-executing the key generation process when it's called using the same +salt+ and +# +key_size+. +# +# source://activesupport//lib/active_support/key_generator.rb#55 +class ActiveSupport::CachingKeyGenerator + # @return [CachingKeyGenerator] a new instance of CachingKeyGenerator + # + # source://activesupport//lib/active_support/key_generator.rb#56 + def initialize(key_generator); end + + # Returns a derived key suitable for use. + # + # source://activesupport//lib/active_support/key_generator.rb#62 + def generate_key(*args); end +end + +# = Active Support \Callbacks +# +# \Callbacks are code hooks that are run at key points in an object's life cycle. +# The typical use case is to have a base class define a set of callbacks +# relevant to the other functionality it supplies, so that subclasses can +# install callbacks that enhance or modify the base functionality without +# needing to override or redefine methods of the base class. +# +# Mixing in this module allows you to define the events in the object's +# life cycle that will support callbacks (via ClassMethods#define_callbacks), +# set the instance methods, procs, or callback objects to be called (via +# ClassMethods#set_callback), and run the installed callbacks at the +# appropriate times (via +run_callbacks+). +# +# By default callbacks are halted by throwing +:abort+. +# See ClassMethods#define_callbacks for details. +# +# Three kinds of callbacks are supported: before callbacks, run before a +# certain event; after callbacks, run after the event; and around callbacks, +# blocks that surround the event, triggering it when they yield. Callback code +# can be contained in instance methods, procs or lambdas, or callback objects +# that respond to certain predetermined methods. See ClassMethods#set_callback +# for details. +# +# class Record +# include ActiveSupport::Callbacks +# define_callbacks :save +# +# def save +# run_callbacks :save do +# puts "- save" +# end +# end +# end +# +# class PersonRecord < Record +# set_callback :save, :before, :saving_message +# def saving_message +# puts "saving..." +# end +# +# set_callback :save, :after do |object| +# puts "saved" +# end +# end +# +# person = PersonRecord.new +# person.save +# +# Output: +# saving... +# - save +# saved +# +# source://activesupport//lib/active_support/callbacks.rb#64 +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#96 + def run_callbacks(kind, type = T.unsafe(nil)); end + + private + + # A hook invoked every time a before callback is halted. + # This can be overridden in ActiveSupport::Callbacks implementors in order + # to provide better debugging/logging. + # + # source://activesupport//lib/active_support/callbacks.rb#149 + def halted_callback_hook(filter, name); end + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + end + + module GeneratedInstanceMethods + def __callbacks; end + end +end + +# source://activesupport//lib/active_support/callbacks.rb#72 +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#336 +module ActiveSupport::Callbacks::CallTemplate + class << self + # Filters support: + # + # Symbols:: A method to call. + # Procs:: A proc to call with the object. + # Objects:: An object with a 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#494 + def build(filter, callback); end + end +end + +# source://activesupport//lib/active_support/callbacks.rb#395 +class ActiveSupport::Callbacks::CallTemplate::InstanceExec0 + # @return [InstanceExec0] a new instance of InstanceExec0 + # + # source://activesupport//lib/active_support/callbacks.rb#396 + def initialize(block); end + + # source://activesupport//lib/active_support/callbacks.rb#400 + def expand(target, value, block); end + + # source://activesupport//lib/active_support/callbacks.rb#410 + def inverted_lambda; end + + # source://activesupport//lib/active_support/callbacks.rb#404 + def make_lambda; end +end + +# source://activesupport//lib/active_support/callbacks.rb#417 +class ActiveSupport::Callbacks::CallTemplate::InstanceExec1 + # @return [InstanceExec1] a new instance of InstanceExec1 + # + # source://activesupport//lib/active_support/callbacks.rb#418 + def initialize(block); end + + # source://activesupport//lib/active_support/callbacks.rb#422 + def expand(target, value, block); end + + # source://activesupport//lib/active_support/callbacks.rb#432 + def inverted_lambda; end + + # source://activesupport//lib/active_support/callbacks.rb#426 + def make_lambda; end +end + +# source://activesupport//lib/active_support/callbacks.rb#439 +class ActiveSupport::Callbacks::CallTemplate::InstanceExec2 + # @return [InstanceExec2] a new instance of InstanceExec2 + # + # source://activesupport//lib/active_support/callbacks.rb#440 + def initialize(block); end + + # @raise [ArgumentError] + # + # source://activesupport//lib/active_support/callbacks.rb#444 + def expand(target, value, block); end + + # source://activesupport//lib/active_support/callbacks.rb#456 + def inverted_lambda; end + + # source://activesupport//lib/active_support/callbacks.rb#449 + def make_lambda; end +end + +# source://activesupport//lib/active_support/callbacks.rb#337 +class ActiveSupport::Callbacks::CallTemplate::MethodCall + # @return [MethodCall] a new instance of MethodCall + # + # source://activesupport//lib/active_support/callbacks.rb#338 + def initialize(method); end + + # Return the parts needed to make this call, with the given + # input values. + # + # Returns an array of the form: + # + # [target, block, method, *arguments] + # + # This array can be used as such: + # + # target.send(method, *arguments, &block) + # + # The actual invocation is left up to the caller to minimize + # call stack pollution. + # + # source://activesupport//lib/active_support/callbacks.rb#355 + def expand(target, value, block); end + + # source://activesupport//lib/active_support/callbacks.rb#365 + def inverted_lambda; end + + # source://activesupport//lib/active_support/callbacks.rb#359 + def make_lambda; end +end + +# source://activesupport//lib/active_support/callbacks.rb#372 +class ActiveSupport::Callbacks::CallTemplate::ObjectCall + # @return [ObjectCall] a new instance of ObjectCall + # + # source://activesupport//lib/active_support/callbacks.rb#373 + def initialize(target, method); end + + # source://activesupport//lib/active_support/callbacks.rb#378 + def expand(target, value, block); end + + # source://activesupport//lib/active_support/callbacks.rb#388 + def inverted_lambda; end + + # source://activesupport//lib/active_support/callbacks.rb#382 + def make_lambda; end +end + +# source://activesupport//lib/active_support/callbacks.rb#464 +class ActiveSupport::Callbacks::CallTemplate::ProcCall + # @return [ProcCall] a new instance of ProcCall + # + # source://activesupport//lib/active_support/callbacks.rb#465 + def initialize(target); end + + # source://activesupport//lib/active_support/callbacks.rb#469 + def expand(target, value, block); end + + # source://activesupport//lib/active_support/callbacks.rb#479 + def inverted_lambda; end + + # source://activesupport//lib/active_support/callbacks.rb#473 + def make_lambda; end +end + +# source://activesupport//lib/active_support/callbacks.rb#230 +class ActiveSupport::Callbacks::Callback + # @return [Callback] a new instance of Callback + # + # source://activesupport//lib/active_support/callbacks.rb#245 + def initialize(name, filter, kind, options, chain_config); end + + # Wraps code with filter + # + # source://activesupport//lib/active_support/callbacks.rb#299 + def apply(callback_sequence); end + + # Returns the value of attribute chain_config. + # + # source://activesupport//lib/active_support/callbacks.rb#243 + def chain_config; end + + # source://activesupport//lib/active_support/callbacks.rb#281 + def compiled; end + + # source://activesupport//lib/active_support/callbacks.rb#303 + def current_scopes; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/callbacks.rb#272 + def duplicates?(other); end + + # Returns the value of attribute filter. + # + # source://activesupport//lib/active_support/callbacks.rb#243 + def filter; end + + # Returns the value of attribute kind. + # + # source://activesupport//lib/active_support/callbacks.rb#242 + def kind; end + + # Sets the attribute kind + # + # @param value the value to set the attribute kind to. + # + # source://activesupport//lib/active_support/callbacks.rb#242 + def kind=(_arg0); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/callbacks.rb#268 + def matches?(_kind, _filter); end + + # source://activesupport//lib/active_support/callbacks.rb#256 + def merge_conditional_options(chain, if_option:, unless_option:); end + + # Returns the value of attribute name. + # + # source://activesupport//lib/active_support/callbacks.rb#242 + def name; end + + # Sets the attribute name + # + # @param value the value to set the attribute name to. + # + # source://activesupport//lib/active_support/callbacks.rb#242 + def name=(_arg0); end + + private + + # source://activesupport//lib/active_support/callbacks.rb#311 + def check_conditionals(conditionals); end + + # source://activesupport//lib/active_support/callbacks.rb#326 + def conditions_lambdas; end + + class << self + # source://activesupport//lib/active_support/callbacks.rb#231 + def build(chain, filter, kind, options); end + end +end + +# source://activesupport//lib/active_support/callbacks.rb#308 +ActiveSupport::Callbacks::Callback::EMPTY_ARRAY = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/callbacks.rb#566 +class ActiveSupport::Callbacks::CallbackChain + include ::Enumerable + + # @return [CallbackChain] a new instance of CallbackChain + # + # source://activesupport//lib/active_support/callbacks.rb#571 + def initialize(name, config); end + + # source://activesupport//lib/active_support/callbacks.rb#631 + def append(*callbacks); end + + # source://activesupport//lib/active_support/callbacks.rb#599 + def clear; end + + # source://activesupport//lib/active_support/callbacks.rb#613 + def compile(type); end + + # Returns the value of attribute config. + # + # source://activesupport//lib/active_support/callbacks.rb#569 + def config; end + + # source://activesupport//lib/active_support/callbacks.rb#593 + def delete(o); end + + # source://activesupport//lib/active_support/callbacks.rb#583 + def each(&block); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/callbacks.rb#585 + def empty?; end + + # source://activesupport//lib/active_support/callbacks.rb#584 + def index(o); end + + # source://activesupport//lib/active_support/callbacks.rb#587 + def insert(index, o); end + + # Returns the value of attribute name. + # + # source://activesupport//lib/active_support/callbacks.rb#569 + def name; end + + # source://activesupport//lib/active_support/callbacks.rb#635 + def prepend(*callbacks); end + + protected + + # Returns the value of attribute chain. + # + # source://activesupport//lib/active_support/callbacks.rb#640 + def chain; end + + private + + # source://activesupport//lib/active_support/callbacks.rb#643 + def append_one(callback); end + + # source://activesupport//lib/active_support/callbacks.rb#663 + def default_terminator; end + + # source://activesupport//lib/active_support/callbacks.rb#606 + def initialize_copy(other); end + + # source://activesupport//lib/active_support/callbacks.rb#650 + def prepend_one(callback); end + + # source://activesupport//lib/active_support/callbacks.rb#657 + 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#517 +class ActiveSupport::Callbacks::CallbackSequence + # @return [CallbackSequence] a new instance of CallbackSequence + # + # source://activesupport//lib/active_support/callbacks.rb#518 + def initialize(nested = T.unsafe(nil), call_template = T.unsafe(nil), user_conditions = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/callbacks.rb#533 + def after(after); end + + # source://activesupport//lib/active_support/callbacks.rb#539 + def around(call_template, user_conditions); end + + # source://activesupport//lib/active_support/callbacks.rb#527 + def before(before); end + + # source://activesupport//lib/active_support/callbacks.rb#553 + def expand_call_template(arg, block); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/callbacks.rb#549 + def final?; end + + # source://activesupport//lib/active_support/callbacks.rb#561 + def invoke_after(arg); end + + # source://activesupport//lib/active_support/callbacks.rb#557 + def invoke_before(arg); end + + # Returns the value of attribute nested. + # + # source://activesupport//lib/active_support/callbacks.rb#547 + def nested; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/callbacks.rb#543 + def skip?(arg); end +end + +# source://activesupport//lib/active_support/callbacks.rb#675 +module ActiveSupport::Callbacks::ClassMethods + # This is used internally to append, prepend and skip callbacks to the + # CallbackChain. + # + # source://activesupport//lib/active_support/callbacks.rb#685 + 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#900 + def define_callbacks(*names); end + + # source://activesupport//lib/active_support/callbacks.rb#676 + def normalize_callback_params(filters, block); end + + # Remove all set callbacks for the given event. + # + # source://activesupport//lib/active_support/callbacks.rb#810 + 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#736 + 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. + # + # Note: this example uses +PersonRecord+ and +#saving_message+, which you + # can see defined here[rdoc-ref:ActiveSupport::Callbacks] + # + # class Writer < PersonRecord + # attr_accessor :age + # skip_callback :save, :before, :saving_message, if: -> { age > 18 } + # end + # + # When if option returns true, callback is skipped. + # + # writer = Writer.new + # writer.age = 20 + # writer.save + # + # Output: + # - save + # saved + # + # When if option returns false, callback is NOT skipped. + # + # young_writer = Writer.new + # young_writer.age = 17 + # young_writer.save + # + # Output: + # saving... + # - save + # saved + # + # An 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#785 + def skip_callback(name, *filter_list, &block); end + + protected + + # source://activesupport//lib/active_support/callbacks.rb#931 + def get_callbacks(name); end + + # source://activesupport//lib/active_support/callbacks.rb#935 + def set_callbacks(name, callbacks); end +end + +# source://activesupport//lib/active_support/callbacks.rb#152 +module ActiveSupport::Callbacks::Conditionals; end + +# source://activesupport//lib/active_support/callbacks.rb#153 +class ActiveSupport::Callbacks::Conditionals::Value + # @return [Value] a new instance of Value + # + # source://activesupport//lib/active_support/callbacks.rb#154 + def initialize(&block); end + + # source://activesupport//lib/active_support/callbacks.rb#157 + def call(target, value); end +end + +# source://activesupport//lib/active_support/callbacks.rb#161 +module ActiveSupport::Callbacks::Filters; end + +# source://activesupport//lib/active_support/callbacks.rb#193 +class ActiveSupport::Callbacks::Filters::After + # @return [After] a new instance of After + # + # source://activesupport//lib/active_support/callbacks.rb#195 + def initialize(user_callback, user_conditions, chain_config); end + + # source://activesupport//lib/active_support/callbacks.rb#213 + def apply(callback_sequence); end + + # source://activesupport//lib/active_support/callbacks.rb#201 + def call(env); end + + # Returns the value of attribute halting. + # + # source://activesupport//lib/active_support/callbacks.rb#194 + def halting; end + + # Returns the value of attribute user_callback. + # + # source://activesupport//lib/active_support/callbacks.rb#194 + def user_callback; end + + # Returns the value of attribute user_conditions. + # + # source://activesupport//lib/active_support/callbacks.rb#194 + def user_conditions; end +end + +# source://activesupport//lib/active_support/callbacks.rb#218 +class ActiveSupport::Callbacks::Filters::Around + # @return [Around] a new instance of Around + # + # source://activesupport//lib/active_support/callbacks.rb#219 + def initialize(user_callback, user_conditions); end + + # source://activesupport//lib/active_support/callbacks.rb#224 + def apply(callback_sequence); end +end + +# source://activesupport//lib/active_support/callbacks.rb#164 +class ActiveSupport::Callbacks::Filters::Before + # @return [Before] a new instance of Before + # + # source://activesupport//lib/active_support/callbacks.rb#165 + def initialize(user_callback, user_conditions, chain_config, filter, name); end + + # source://activesupport//lib/active_support/callbacks.rb#188 + def apply(callback_sequence); end + + # source://activesupport//lib/active_support/callbacks.rb#172 + def call(env); end + + # Returns the value of attribute filter. + # + # source://activesupport//lib/active_support/callbacks.rb#170 + def filter; end + + # Returns the value of attribute halted_lambda. + # + # source://activesupport//lib/active_support/callbacks.rb#170 + def halted_lambda; end + + # Returns the value of attribute name. + # + # source://activesupport//lib/active_support/callbacks.rb#170 + def name; end + + # Returns the value of attribute user_callback. + # + # source://activesupport//lib/active_support/callbacks.rb#170 + def user_callback; end + + # Returns the value of attribute user_conditions. + # + # source://activesupport//lib/active_support/callbacks.rb#170 + def user_conditions; end +end + +# source://activesupport//lib/active_support/callbacks.rb#162 +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/class_attribute.rb#4 +module ActiveSupport::ClassAttribute + class << self + # source://activesupport//lib/active_support/class_attribute.rb#6 + def redefine(owner, name, value); end + end +end + +# source://activesupport//lib/active_support/code_generator.rb#4 +class ActiveSupport::CodeGenerator + # @return [CodeGenerator] a new instance of CodeGenerator + # + # source://activesupport//lib/active_support/code_generator.rb#53 + def initialize(owner, path, line); end + + # @yield [@sources] + # + # source://activesupport//lib/active_support/code_generator.rb#61 + def class_eval; end + + # source://activesupport//lib/active_support/code_generator.rb#65 + def define_cached_method(canonical_name, namespace:, as: T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/code_generator.rb#69 + def execute; end + + class << self + # source://activesupport//lib/active_support/code_generator.rb#41 + def batch(owner, path, line); end + end +end + +# source://activesupport//lib/active_support/code_generator.rb#5 +class ActiveSupport::CodeGenerator::MethodSet + # @return [MethodSet] a new instance of MethodSet + # + # source://activesupport//lib/active_support/code_generator.rb#8 + def initialize(namespace); end + + # source://activesupport//lib/active_support/code_generator.rb#28 + def apply(owner, path, line); end + + # source://activesupport//lib/active_support/code_generator.rb#15 + def define_cached_method(canonical_name, as: T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/code_generator.rb#6 +ActiveSupport::CodeGenerator::MethodSet::METHOD_CACHES = T.let(T.unsafe(nil), Hash) + +# 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#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 + +# = Active Support \Concern +# +# A typical module looks like this: +# +# module M +# def self.included(base) +# base.extend ClassMethods +# base.class_eval do +# scope :disabled, -> { where(disabled: true) } +# end +# end +# +# module ClassMethods +# ... +# end +# end +# +# By using +ActiveSupport::Concern+ the above module could instead be +# written as: +# +# require "active_support/concern" +# +# module M +# extend ActiveSupport::Concern +# +# included do +# scope :disabled, -> { where(disabled: true) } +# end +# +# class_methods do +# ... +# end +# end +# +# Moreover, it gracefully handles module dependencies. Given a +Foo+ module +# and a +Bar+ module which depends on the former, we would typically write the +# following: +# +# module Foo +# def self.included(base) +# base.class_eval do +# def self.method_injected_by_foo +# ... +# end +# end +# end +# end +# +# module Bar +# def self.included(base) +# base.method_injected_by_foo +# end +# end +# +# class Host +# include Foo # We need to include this dependency for Bar +# include Bar # Bar is the module that Host really needs +# end +# +# But why should +Host+ care about +Bar+'s dependencies, namely +Foo+? We +# could try to hide these from +Host+ directly including +Foo+ in +Bar+: +# +# module Bar +# include Foo +# def self.included(base) +# base.method_injected_by_foo +# end +# end +# +# class Host +# include Bar +# end +# +# Unfortunately this won't work, since when +Foo+ is included, its 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#112 +module ActiveSupport::Concern + # source://activesupport//lib/active_support/concern.rb#129 + def append_features(base); end + + # Define class methods from given block. + # You can define private class methods as well. + # + # module Example + # extend ActiveSupport::Concern + # + # class_methods do + # def foo; puts 'foo'; end + # + # private + # def bar; puts 'bar'; end + # end + # end + # + # class Buzz + # include Example + # end + # + # Buzz.foo # => "foo" + # Buzz.bar # => private method 'bar' called for Buzz:Class(NoMethodError) + # + # source://activesupport//lib/active_support/concern.rb#209 + def class_methods(&class_methods_module_definition); end + + # Evaluate given block in context of base class, + # so that you can write class macros here. + # When you define more than one +included+ block, it raises an exception. + # + # source://activesupport//lib/active_support/concern.rb#158 + def included(base = T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/concern.rb#142 + def prepend_features(base); end + + # Evaluate given block in context of base class, + # so that you can write class macros here. + # When you define more than one +prepended+ block, it raises an exception. + # + # source://activesupport//lib/active_support/concern.rb#175 + def prepended(base = T.unsafe(nil), &block); end + + class << self + # source://activesupport//lib/active_support/concern.rb#125 + def extended(base); end + end +end + +# source://activesupport//lib/active_support/concern.rb#113 +class ActiveSupport::Concern::MultipleIncludedBlocks < ::StandardError + # @return [MultipleIncludedBlocks] a new instance of MultipleIncludedBlocks + # + # source://activesupport//lib/active_support/concern.rb#114 + def initialize; end +end + +# source://activesupport//lib/active_support/concern.rb#119 +class ActiveSupport::Concern::MultiplePrependBlocks < ::StandardError + # @return [MultiplePrependBlocks] a new instance of MultiplePrependBlocks + # + # source://activesupport//lib/active_support/concern.rb#120 + def initialize; end +end + +# source://activesupport//lib/active_support/concurrency/share_lock.rb#6 +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#10 +class ActiveSupport::Concurrency::ShareLock + include ::MonitorMixin + + # @return [ShareLock] a new instance of ShareLock + # + # source://activesupport//lib/active_support/concurrency/share_lock.rb#49 + 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#147 + 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#17 + def raw_state; end + + # Execute the supplied block while holding the Share lock. + # + # source://activesupport//lib/active_support/concurrency/share_lock.rb#158 + 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#75 + 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#113 + 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#95 + def stop_exclusive(compatible: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/concurrency/share_lock.rb#130 + 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#170 + 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#203 + def busy_for_exclusive?(purpose); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/concurrency/share_lock.rb#208 + def busy_for_sharing?(purpose); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/concurrency/share_lock.rb#213 + def eligible_waiters?(compatible); end + + # source://activesupport//lib/active_support/concurrency/share_lock.rb#217 + def wait_for(method, &block); end +end + +# = Active Support \Configurable +# +# Configurable provides a config method to store and retrieve +# configuration options as an OrderedOptions. +# +# source://activesupport//lib/active_support/configurable.rb#11 +module ActiveSupport::Configurable + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveSupport::Configurable::ClassMethods + + # Reads and writes attributes from a configuration OrderedOptions. + # + # require "active_support/configurable" + # + # class User + # include ActiveSupport::Configurable + # end + # + # user = User.new + # + # user.config.allowed_access = true + # user.config.level = 1 + # + # user.config.allowed_access # => true + # user.config.level # => 1 + # + # source://activesupport//lib/active_support/configurable.rb#155 + def config; end +end + +# source://activesupport//lib/active_support/configurable.rb#29 +module ActiveSupport::Configurable::ClassMethods + # source://activesupport//lib/active_support/configurable.rb#30 + def config; end + + # @yield [config] + # + # source://activesupport//lib/active_support/configurable.rb#39 + def configure; end + + private + + # Allows you to add shortcut so that you don't have to refer to attribute + # through config. Also look at the example for config to contrast. + # + # Defines both class and instance config accessors. + # + # class User + # include ActiveSupport::Configurable + # config_accessor :allowed_access + # end + # + # User.allowed_access # => nil + # User.allowed_access = false + # User.allowed_access # => false + # + # user = User.new + # user.allowed_access # => false + # user.allowed_access = true + # user.allowed_access # => true + # + # User.allowed_access # => false + # + # The attribute name must be a valid method name in Ruby. + # + # class User + # include ActiveSupport::Configurable + # config_accessor :"1_Badname" + # end + # # => NameError: invalid config attribute name + # + # To omit the instance writer method, pass 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 default or a block to set up the attribute with a default value. + # + # class User + # include ActiveSupport::Configurable + # config_accessor :allowed_access, default: false + # config_accessor :hair_colors do + # [:brown, :black, :blonde, :red] + # end + # end + # + # User.allowed_access # => false + # User.hair_colors # => [:brown, :black, :blonde, :red] + # + # source://activesupport//lib/active_support/configurable.rb#111 + def config_accessor(*names, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/configurable.rb#132 + def inherited(subclass); end +end + +# source://activesupport//lib/active_support/configurable.rb#14 +class ActiveSupport::Configurable::Configuration < ::ActiveSupport::InheritableOptions + # source://activesupport//lib/active_support/configurable.rb#15 + def compile_methods!; end + + class << self + # Compiles reader methods so we don't have to go through method_missing. + # + # source://activesupport//lib/active_support/configurable.rb#20 + def compile_methods!(keys); end + end +end + +# Reads a YAML configuration file, evaluating any ERB, then +# parsing the resulting YAML. +# +# Warns in case of YAML confusing characters, like invisible +# non-breaking spaces. +# +# source://activesupport//lib/active_support/configuration_file.rb#9 +class ActiveSupport::ConfigurationFile + # @return [ConfigurationFile] a new instance of ConfigurationFile + # + # source://activesupport//lib/active_support/configuration_file.rb#12 + def initialize(content_path); end + + # source://activesupport//lib/active_support/configuration_file.rb#21 + def parse(context: T.unsafe(nil), **options); end + + private + + # source://activesupport//lib/active_support/configuration_file.rb#44 + def read(content_path); end + + # source://activesupport//lib/active_support/configuration_file.rb#54 + def render(context); end + + class << self + # source://activesupport//lib/active_support/configuration_file.rb#17 + def parse(content_path, **options); end + end +end + +# source://activesupport//lib/active_support/configuration_file.rb#10 +class ActiveSupport::ConfigurationFile::FormatError < ::StandardError; end + +# source://activesupport//lib/active_support/core_ext/erb/util.rb#6 +module ActiveSupport::CoreExt; end + +# source://activesupport//lib/active_support/core_ext/erb/util.rb#7 +module ActiveSupport::CoreExt::ERBUtil + # A utility method for escaping HTML tag characters. + # This method is also aliased as h. + # + # puts html_escape('is a > 0 & a < 10?') + # # => is a > 0 & a < 10? + # + # source://activesupport//lib/active_support/core_ext/erb/util.rb#25 + def h(s); end + + # A utility method for escaping HTML tag characters. + # This method is also aliased as h. + # + # puts html_escape('is a > 0 & a < 10?') + # # => is a > 0 & a < 10? + # + # source://activesupport//lib/active_support/core_ext/erb/util.rb#25 + def html_escape(s); end + + # HTML escapes strings but doesn't wrap them with an ActiveSupport::SafeBuffer. + # This method is not for public consumption! Seriously! + # + # source://activesupport//lib/active_support/core_ext/erb/util.rb#10 + def unwrapped_html_escape(s); end +end + +# source://activesupport//lib/active_support/core_ext/erb/util.rb#31 +module ActiveSupport::CoreExt::ERBUtilPrivate + include ::ActiveSupport::CoreExt::ERBUtil + + private + + # source://activesupport//lib/active_support/core_ext/erb/util.rb#25 + def h(s); end + + # source://activesupport//lib/active_support/core_ext/erb/util.rb#25 + def html_escape(s); end + + # source://activesupport//lib/active_support/core_ext/erb/util.rb#10 + def unwrapped_html_escape(s); end +end + +# = Current Attributes +# +# Abstract super class that provides a thread-isolated attributes singleton, which resets automatically +# before and after each request. This allows you to keep all the per-request attributes easily +# available to the whole system. +# +# The following full app-like example demonstrates how to use a Current class to +# facilitate easy access to the global, per-request attributes without passing them deeply +# around everywhere: +# +# # app/models/current.rb +# class Current < ActiveSupport::CurrentAttributes +# attribute :account, :user +# attribute :request_id, :user_agent, :ip_address +# +# resets { Time.zone = nil } +# +# def user=(user) +# super +# self.account = user.account +# Time.zone = user.time_zone +# end +# end +# +# # app/controllers/concerns/authentication.rb +# module Authentication +# extend ActiveSupport::Concern +# +# included do +# before_action :authenticate +# end +# +# private +# def authenticate +# if authenticated_user = User.find_by(id: cookies.encrypted[:user_id]) +# Current.user = authenticated_user +# else +# redirect_to new_session_url +# end +# end +# end +# +# # app/controllers/concerns/set_current_request_details.rb +# module SetCurrentRequestDetails +# extend ActiveSupport::Concern +# +# included do +# before_action do +# Current.request_id = request.uuid +# Current.user_agent = request.user_agent +# Current.ip_address = request.ip +# end +# end +# end +# +# class ApplicationController < ActionController::Base +# include Authentication +# include SetCurrentRequestDetails +# end +# +# class MessagesController < ApplicationController +# def create +# Current.account.messages.create(message_params) +# end +# end +# +# class Message < ApplicationRecord +# belongs_to :creator, default: -> { Current.user } +# after_create { |message| Event.create(record: message) } +# end +# +# class Event < ApplicationRecord +# before_create do +# self.request_id = Current.request_id +# self.user_agent = Current.user_agent +# self.ip_address = Current.ip_address +# end +# end +# +# A word of caution: It's easy to overdo a global singleton like Current and tangle your model as a result. +# Current should only be used for a few, top-level globals, like account, user, and request details. +# The attributes stuck in Current should be used by more or less all actions on all requests. If you start +# sticking controller-specific attributes in there, you're going to create a mess. +# +# source://activesupport//lib/active_support/current_attributes.rb#92 +class ActiveSupport::CurrentAttributes + include ::ActiveSupport::Callbacks + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + + # @return [CurrentAttributes] a new instance of CurrentAttributes + # + # source://activesupport//lib/active_support/current_attributes.rb#199 + def initialize; end + + # source://activesupport//lib/active_support/callbacks.rb#69 + def __callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#923 + def _reset_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#911 + def _run_reset_callbacks(&block); end + + # Returns the value of attribute attributes. + # + # source://activesupport//lib/active_support/current_attributes.rb#197 + def attributes; end + + # Sets the attribute attributes + # + # @param value the value to set the attribute attributes to. + # + # source://activesupport//lib/active_support/current_attributes.rb#197 + def attributes=(_arg0); end + + # source://activesupport//lib/active_support/current_attributes.rb#195 + def defaults; end + + # source://activesupport//lib/active_support/current_attributes.rb#195 + def defaults?; end + + # Reset all attributes. Should be called before and after actions, when used as a per-request singleton. + # + # source://activesupport//lib/active_support/current_attributes.rb#218 + def reset; end + + # Expose one or more attributes within a block. Old values are returned after the block concludes. + # Example demonstrating the common use of needing to set Current attributes outside the request-cycle: + # + # class Chat::PublicationJob < ApplicationJob + # def perform(attributes, room_number, creator) + # Current.set(person: creator) do + # Chat::Publisher.publish(attributes: attributes, room_number: room_number) + # end + # end + # end + # + # source://activesupport//lib/active_support/current_attributes.rb#213 + def set(attributes, &block); end + + private + + # source://activesupport//lib/active_support/current_attributes.rb#225 + def resolve_defaults; end + + class << self + # source://activesupport//lib/active_support/class_attribute.rb#12 + def __callbacks; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def __callbacks=(new_value); end + + # source://activesupport//lib/active_support/callbacks.rb#915 + def _reset_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#919 + def _reset_callbacks=(value); end + + # Calls this callback after #reset is called on the instance. Used for resetting external collaborators, like Time.zone. + # + # source://activesupport//lib/active_support/current_attributes.rb#149 + def after_reset(*methods, &block); end + + # Declares one or more attributes that will be given both class and instance accessor methods. + # + # ==== Options + # + # * :default - The default value for the attributes. If the value + # is a proc or lambda, it will be called whenever an instance is + # constructed. Otherwise, the value will be duplicated with +#dup+. + # Default values are re-assigned when the attributes are reset. + # + # source://activesupport//lib/active_support/current_attributes.rb#114 + def attribute(*names, default: T.unsafe(nil)); end + + # Calls this callback before #reset is called on the instance. Used for resetting external collaborators that depend on current values. + # + # source://activesupport//lib/active_support/current_attributes.rb#144 + def before_reset(*methods, &block); end + + # source://activesupport//lib/active_support/current_attributes.rb#160 + def clear_all; end + + # source://activesupport//lib/active_support/class_attribute.rb#12 + def defaults; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def defaults=(new_value); end + + # source://activesupport//lib/active_support/current_attributes.rb#195 + def defaults?; end + + # Returns singleton instance for this class in this thread. If none exists, one is created. + # + # source://activesupport//lib/active_support/current_attributes.rb#102 + def instance; end + + # source://activesupport//lib/active_support/current_attributes.rb#154 + def reset(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/current_attributes.rb#156 + def reset_all; end + + # Calls this callback after #reset is called on the instance. Used for resetting external collaborators, like Time.zone. + # + # source://activesupport//lib/active_support/current_attributes.rb#149 + def resets(*methods, &block); end + + # source://activesupport//lib/active_support/current_attributes.rb#154 + def set(*_arg0, **_arg1, &_arg2); end + + private + + # source://activesupport//lib/active_support/current_attributes.rb#170 + def current_instances; end + + # source://activesupport//lib/active_support/current_attributes.rb#174 + def current_instances_key; end + + # source://activesupport//lib/active_support/current_attributes.rb#166 + def generated_attribute_methods; end + + # @private + # + # source://activesupport//lib/active_support/current_attributes.rb#186 + def method_added(name); end + + # source://activesupport//lib/active_support/current_attributes.rb#178 + def method_missing(name, *_arg1, **_arg2, &_arg3); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/current_attributes.rb#182 + def respond_to_missing?(name, _); end + end +end + +# source://activesupport//lib/active_support/current_attributes.rb#96 +ActiveSupport::CurrentAttributes::INVALID_ATTRIBUTE_NAMES = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/current_attributes.rb#98 +ActiveSupport::CurrentAttributes::NOT_SET = T.let(T.unsafe(nil), Object) + +# Provides +deep_merge+ and +deep_merge!+ methods. Expects the including class +# to provide a merge!(other, &block) method. +# +# source://activesupport//lib/active_support/deep_mergeable.rb#6 +module ActiveSupport::DeepMergeable + # Returns a new instance with the values from +other+ merged recursively. + # + # class Hash + # include ActiveSupport::DeepMergeable + # end + # + # hash_1 = { a: true, b: { c: [1, 2, 3] } } + # hash_2 = { a: false, b: { x: [3, 4, 5] } } + # + # hash_1.deep_merge(hash_2) + # # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } } + # + # A block can be provided to merge non-DeepMergeable values: + # + # hash_1 = { a: 100, b: 200, c: { c1: 100 } } + # hash_2 = { b: 250, c: { c1: 200 } } + # + # hash_1.deep_merge(hash_2) do |key, this_val, other_val| + # this_val + other_val + # end + # # => { a: 100, b: 450, c: { c1: 300 } } + # + # source://activesupport//lib/active_support/deep_mergeable.rb#29 + def deep_merge(other, &block); end + + # Same as #deep_merge, but modifies +self+. + # + # source://activesupport//lib/active_support/deep_mergeable.rb#34 + def deep_merge!(other, &block); end + + # Returns true if +other+ can be deep merged into +self+. Classes may + # override this method to restrict or expand the domain of deep mergeable + # values. Defaults to checking that +other+ is of type +self.class+. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/deep_mergeable.rb#49 + def deep_merge?(other); end +end + +# source://activesupport//lib/active_support/delegation.rb#14 +module ActiveSupport::Delegation + class << self + # source://activesupport//lib/active_support/delegation.rb#21 + def generate(owner, methods, location: T.unsafe(nil), to: T.unsafe(nil), prefix: T.unsafe(nil), allow_nil: T.unsafe(nil), nilable: T.unsafe(nil), private: T.unsafe(nil), as: T.unsafe(nil), signature: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/delegation.rb#150 + def generate_method_missing(owner, target, allow_nil: T.unsafe(nil)); end + end +end + +# source://activesupport//lib/active_support/delegation.rb#18 +ActiveSupport::Delegation::RESERVED_METHOD_NAMES = T.let(T.unsafe(nil), Set) + +# source://activesupport//lib/active_support/delegation.rb#15 +ActiveSupport::Delegation::RUBY_RESERVED_KEYWORDS = T.let(T.unsafe(nil), Array) + +# Error generated by +delegate+ when a method is called on +nil+ and +allow_nil+ +# option is not used. +# +# source://activesupport//lib/active_support/delegation.rb#6 +class ActiveSupport::DelegationError < ::NoMethodError + class << self + # source://activesupport//lib/active_support/delegation.rb#8 + def nil_target(method_name, target); end + end +end + +# source://activesupport//lib/active_support/dependencies/interlock.rb#6 +module ActiveSupport::Dependencies + class << self + # source://activesupport//lib/active_support/dependencies.rb#61 + def _autoloaded_tracked_classes; end + + # source://activesupport//lib/active_support/dependencies.rb#61 + def _autoloaded_tracked_classes=(_arg0); end + + # source://activesupport//lib/active_support/dependencies.rb#55 + def _eager_load_paths; end + + # source://activesupport//lib/active_support/dependencies.rb#55 + def _eager_load_paths=(_arg0); end + + # source://activesupport//lib/active_support/dependencies.rb#48 + def autoload_once_paths; end + + # source://activesupport//lib/active_support/dependencies.rb#48 + def autoload_once_paths=(_arg0); end + + # source://activesupport//lib/active_support/dependencies.rb#42 + def autoload_paths; end + + # source://activesupport//lib/active_support/dependencies.rb#42 + def autoload_paths=(_arg0); end + + # source://activesupport//lib/active_support/dependencies.rb#68 + def autoloader; end + + # source://activesupport//lib/active_support/dependencies.rb#68 + def autoloader=(_arg0); end + + # Private method that reloads constants autoloaded by the main autoloader. + # + # Rails.application.reloader.reload! is the public interface for application + # reload. That involves more things, like deleting unloaded classes from the + # internal state of the descendants tracker, or reloading routes. + # + # source://activesupport//lib/active_support/dependencies.rb#75 + def clear; end + + # Private method that helps configuring the autoloaders. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/dependencies.rb#93 + def eager_load?(path); end + + # source://activesupport//lib/active_support/dependencies.rb#9 + def interlock; end + + # source://activesupport//lib/active_support/dependencies.rb#9 + def interlock=(_arg0); end + + # Execute the supplied block while holding an exclusive lock, + # preventing any other thread from being inside a #run_interlock + # block at the same time. + # + # source://activesupport//lib/active_support/dependencies.rb#23 + def load_interlock(&block); end + + # Execute the supplied block without interference from any + # concurrent loads. + # + # source://activesupport//lib/active_support/dependencies.rb#16 + def run_interlock(&block); end + + # Private method used by require_dependency. + # + # source://activesupport//lib/active_support/dependencies.rb#83 + def search_for_file(relpath); end + + # Execute the supplied block while holding an exclusive lock, + # preventing any other thread from being inside a #run_interlock + # block at the same time. + # + # source://activesupport//lib/active_support/dependencies.rb#30 + def unload_interlock(&block); end + end +end + +# source://activesupport//lib/active_support/dependencies/interlock.rb#7 +class ActiveSupport::Dependencies::Interlock + # @return [Interlock] a new instance of Interlock + # + # source://activesupport//lib/active_support/dependencies/interlock.rb#8 + def initialize; end + + # source://activesupport//lib/active_support/dependencies/interlock.rb#32 + def done_running; end + + # source://activesupport//lib/active_support/dependencies/interlock.rb#24 + def done_unloading; end + + # source://activesupport//lib/active_support/dependencies/interlock.rb#12 + def loading(&block); end + + # source://activesupport//lib/active_support/dependencies/interlock.rb#40 + def permit_concurrent_loads(&block); end + + # source://activesupport//lib/active_support/dependencies/interlock.rb#44 + def raw_state(&block); end + + # source://activesupport//lib/active_support/dependencies/interlock.rb#36 + def running(&block); end + + # source://activesupport//lib/active_support/dependencies/interlock.rb#28 + def start_running; end + + # source://activesupport//lib/active_support/dependencies/interlock.rb#20 + def start_unloading; end + + # source://activesupport//lib/active_support/dependencies/interlock.rb#16 + def unloading(&block); end +end + +# source://activesupport//lib/active_support/dependencies/require_dependency.rb#3 +module ActiveSupport::Dependencies::RequireDependency + # Warning: This method is obsolete. The semantics of the autoloader + # match Ruby's and you do not need to be defensive with load order anymore. + # Just refer to classes and modules normally. + # + # Engines that do not control the mode in which their parent application runs + # should call +require_dependency+ where needed in case the runtime mode is + # +:classic+. + # + # source://activesupport//lib/active_support/dependencies/require_dependency.rb#11 + def require_dependency(filename); end +end + +# = Active Support \Deprecation +# +# \Deprecation specifies the API used by \Rails to deprecate methods, instance variables, objects, and constants. It's +# also available for gems or applications. +# +# For a gem, use Deprecation.new to create a Deprecation object and store it in your module or class (in order for +# users to be able to configure it). +# +# module MyLibrary +# def self.deprecator +# @deprecator ||= ActiveSupport::Deprecation.new("2.0", "MyLibrary") +# end +# end +# +# For a Railtie or Engine, you may also want to add it to the application's deprecators, so that the application's +# configuration can be applied to it. +# +# module MyLibrary +# class Railtie < Rails::Railtie +# initializer "my_library.deprecator" do |app| +# app.deprecators[:my_library] = MyLibrary.deprecator +# end +# end +# end +# +# With the above initializer, configuration settings like the following will affect +MyLibrary.deprecator+: +# +# # in config/environments/test.rb +# config.active_support.deprecation = :raise +# +# source://activesupport//lib/active_support/deprecation.rb#33 +class ActiveSupport::Deprecation + include ::ActiveSupport::Deprecation::Behavior + include ::ActiveSupport::Deprecation::Reporting + include ::ActiveSupport::Deprecation::Disallowed + include ::ActiveSupport::Deprecation::MethodWrapper + + # It accepts two parameters on initialization. The first is a version of library + # and the second is a library name. + # + # ActiveSupport::Deprecation.new('2.0', 'MyLibrary') + # + # @return [Deprecation] a new instance of Deprecation + # + # source://activesupport//lib/active_support/deprecation.rb#71 + def initialize(deprecation_horizon = T.unsafe(nil), gem_name = T.unsafe(nil)); end + + # The version number in which the deprecated behavior will be removed, by default. + # + # source://activesupport//lib/active_support/deprecation.rb#65 + def deprecation_horizon; end + + # The version number in which the deprecated behavior will be removed, by default. + # + # source://activesupport//lib/active_support/deprecation.rb#65 + def deprecation_horizon=(_arg0); end + + class << self + # source://activesupport//lib/active_support/deprecation.rb#60 + def _instance; end + end +end + +# Behavior module allows to determine how to display deprecation messages. +# You can create a custom behavior or set any from the +DEFAULT_BEHAVIORS+ +# constant. Available behaviors are: +# +# [+:raise+] Raise ActiveSupport::DeprecationException. +# [+:stderr+] Log all deprecation warnings to $stderr. +# [+:log+] Log all deprecation warnings to +Rails.logger+. +# [+:notify+] Use ActiveSupport::Notifications to notify +deprecation.rails+. +# [+:report+] Use ActiveSupport::ErrorReporter to report deprecations. +# [+:silence+] Do nothing. On \Rails, set config.active_support.report_deprecations = false to disable all behaviors. +# +# Setting behaviors only affects deprecations that happen after boot time. +# For more information you can read the documentation of the #behavior= method. +# +# source://activesupport//lib/active_support/deprecation/behaviors.rb#69 +module ActiveSupport::Deprecation::Behavior + # Returns the current behavior or if one isn't set, defaults to +:stderr+. + # + # source://activesupport//lib/active_support/deprecation/behaviors.rb#74 + def behavior; end + + # Sets the behavior to the specified value. Can be a single value, array, + # or an object that responds to +call+. + # + # Available behaviors: + # + # [+:raise+] Raise ActiveSupport::DeprecationException. + # [+:stderr+] Log all deprecation warnings to $stderr. + # [+:log+] Log all deprecation warnings to +Rails.logger+. + # [+:notify+] Use ActiveSupport::Notifications to notify +deprecation.rails+. + # [+:report+] Use ActiveSupport::ErrorReporter to report deprecations. + # [+:silence+] Do nothing. + # + # Setting behaviors only affects deprecations that happen after boot time. + # Deprecation warnings raised by gems are not affected by this setting + # because they happen before \Rails boots up. + # + # deprecator = ActiveSupport::Deprecation.new + # deprecator.behavior = :stderr + # deprecator.behavior = [:stderr, :log] + # deprecator.behavior = MyCustomHandler + # deprecator.behavior = ->(message, callstack, deprecation_horizon, gem_name) { + # # custom stuff + # } + # + # If you are using \Rails, you can set + # config.active_support.report_deprecations = false to disable + # all deprecation behaviors. This is similar to the +:silence+ option but + # more performant. + # + # source://activesupport//lib/active_support/deprecation/behaviors.rb#111 + def behavior=(behavior); end + + # Whether to print a backtrace along with the warning. + # + # source://activesupport//lib/active_support/deprecation/behaviors.rb#71 + def debug; end + + # Whether to print a backtrace along with the warning. + # + # source://activesupport//lib/active_support/deprecation/behaviors.rb#71 + def debug=(_arg0); end + + # Returns the current behavior for disallowed deprecations or if one isn't set, defaults to +:raise+. + # + # source://activesupport//lib/active_support/deprecation/behaviors.rb#79 + def disallowed_behavior; end + + # Sets the behavior for disallowed deprecations (those configured by + # ActiveSupport::Deprecation#disallowed_warnings=) to the specified + # value. As with #behavior=, this can be a single value, array, or an + # object that responds to +call+. + # + # source://activesupport//lib/active_support/deprecation/behaviors.rb#119 + def disallowed_behavior=(behavior); end + + private + + # source://activesupport//lib/active_support/deprecation/behaviors.rb#124 + def arity_coerce(behavior); end + + # source://activesupport//lib/active_support/deprecation/behaviors.rb#143 + def arity_of_callable(callable); end +end + +# Default warning behaviors per Rails.env. +# +# source://activesupport//lib/active_support/deprecation/behaviors.rb#13 +ActiveSupport::Deprecation::DEFAULT_BEHAVIORS = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/deprecation/constant_accessor.rb#5 +module ActiveSupport::Deprecation::DeprecatedConstantAccessor + class << self + # @private + # + # source://activesupport//lib/active_support/deprecation/constant_accessor.rb#6 + def included(base); end + end +end + +# DeprecatedConstantProxy transforms a constant into a deprecated one. It takes the full names of an old +# (deprecated) constant and of a new constant (both in string form) and a deprecator. The deprecated constant now +# returns the value of the new one. +# +# PLANETS = %w(mercury venus earth mars jupiter saturn uranus neptune pluto) +# +# # (In a later update, the original implementation of `PLANETS` has been removed.) +# +# PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune) +# PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new("PLANETS", "PLANETS_POST_2006", ActiveSupport::Deprecation.new) +# +# PLANETS.map { |planet| planet.capitalize } +# # => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead. +# (Backtrace information…) +# ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"] +# +# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#120 +class ActiveSupport::Deprecation::DeprecatedConstantProxy < ::Module + # @return [DeprecatedConstantProxy] a new instance of DeprecatedConstantProxy + # + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#128 + def initialize(old_const, new_const, deprecator, message: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#158 + def append_features(base); end + + # Returns the class of the new constant. + # + # PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune) + # PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('PLANETS', 'PLANETS_POST_2006') + # PLANETS.class # => Array + # + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#154 + def class; end + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#168 + def extended(base); end + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#147 + def hash(*_arg0, **_arg1, &_arg2); end + + # Don't give a deprecation warning on inspect since test/unit and error + # logs rely on it for diagnostics. + # + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#141 + def inspect; end + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#147 + def instance_methods(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#147 + def name(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#163 + def prepend_features(base); end + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#147 + def respond_to?(*_arg0, **_arg1, &_arg2); end + + private + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#178 + def const_missing(name); end + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#183 + def method_missing(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#174 + def target; end + + class << self + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#121 + def new(*args, **options, &block); end + end +end + +# DeprecatedInstanceVariableProxy transforms an instance variable into a deprecated one. It takes an instance of a +# class, a method on that class, an instance variable, and a deprecator as the last argument. +# +# Trying to use the deprecated instance variable will result in a deprecation warning, pointing to the method as a +# replacement. +# +# class Example +# def initialize +# @request = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(self, :request, :@request, ActiveSupport::Deprecation.new) +# @_request = :special_request +# end +# +# def request +# @_request +# end +# +# def old_request +# @request +# end +# end +# +# example = Example.new +# # => # +# +# example.old_request.to_s +# # => DEPRECATION WARNING: @request is deprecated! Call request.to_s instead of +# @request.to_s +# (Backtrace information…) +# "special_request" +# +# example.request.to_s +# # => "special_request" +# +# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#87 +class ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy < ::ActiveSupport::Deprecation::DeprecationProxy + # @return [DeprecatedInstanceVariableProxy] a new instance of DeprecatedInstanceVariableProxy + # + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#88 + def initialize(instance, method, var = T.unsafe(nil), deprecator:); end + + private + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#96 + def target; end + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#100 + def warn(callstack, called, args); end +end + +# DeprecatedObjectProxy transforms an object into a deprecated one. It takes an object, a deprecation message, and +# a deprecator. +# +# deprecated_object = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(Object.new, "This object is now deprecated", ActiveSupport::Deprecation.new) +# # => # +# +# deprecated_object.to_s +# DEPRECATION WARNING: This object is now deprecated. +# (Backtrace) +# # => "#" +# +# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#38 +class ActiveSupport::Deprecation::DeprecatedObjectProxy < ::ActiveSupport::Deprecation::DeprecationProxy + # @return [DeprecatedObjectProxy] a new instance of DeprecatedObjectProxy + # + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#39 + def initialize(object, message, deprecator); end + + private + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#46 + def target; end + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#50 + def warn(callstack, called, args); end +end + +# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#5 +class ActiveSupport::Deprecation::DeprecationProxy + # Don't give a deprecation warning on inspect since test/unit and error + # logs rely on it for diagnostics. + # + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#17 + def inspect; end + + private + + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#22 + def method_missing(called, *args, &block); end + + class << self + # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#6 + def new(*args, **kwargs, &block); end + end +end + +# A managed collection of deprecators. Configuration methods, such as +# #behavior=, affect all deprecators in the collection. Additionally, the +# #silence method silences all deprecators in the collection for the +# duration of a given block. +# +# source://activesupport//lib/active_support/deprecation/deprecators.rb#9 +class ActiveSupport::Deprecation::Deprecators + # @return [Deprecators] a new instance of Deprecators + # + # source://activesupport//lib/active_support/deprecation/deprecators.rb#10 + def initialize; end + + # Returns a deprecator added to this collection via #[]=. + # + # source://activesupport//lib/active_support/deprecation/deprecators.rb#16 + def [](name); end + + # Adds a given +deprecator+ to this collection. The deprecator will be + # immediately configured with any options previously set on this + # collection. + # + # deprecators = ActiveSupport::Deprecation::Deprecators.new + # deprecators.debug = true + # + # foo_deprecator = ActiveSupport::Deprecation.new("2.0", "Foo") + # foo_deprecator.debug # => false + # + # deprecators[:foo] = foo_deprecator + # deprecators[:foo].debug # => true + # foo_deprecator.debug # => true + # + # source://activesupport//lib/active_support/deprecation/deprecators.rb#34 + def []=(name, deprecator); end + + # Sets the deprecation warning behavior for all deprecators in this + # collection. + # + # See ActiveSupport::Deprecation#behavior=. + # + # source://activesupport//lib/active_support/deprecation/deprecators.rb#60 + def behavior=(behavior); end + + # Sets the debug flag for all deprecators in this collection. + # + # source://activesupport//lib/active_support/deprecation/deprecators.rb#52 + def debug=(debug); end + + # Sets the disallowed deprecation warning behavior for all deprecators in + # this collection. + # + # See ActiveSupport::Deprecation#disallowed_behavior=. + # + # source://activesupport//lib/active_support/deprecation/deprecators.rb#68 + def disallowed_behavior=(disallowed_behavior); end + + # Sets the disallowed deprecation warnings for all deprecators in this + # collection. + # + # See ActiveSupport::Deprecation#disallowed_warnings=. + # + # source://activesupport//lib/active_support/deprecation/deprecators.rb#76 + def disallowed_warnings=(disallowed_warnings); end + + # Iterates over all deprecators in this collection. If no block is given, + # returns an +Enumerator+. + # + # source://activesupport//lib/active_support/deprecation/deprecators.rb#41 + def each(&block); end + + # Silences all deprecators in this collection for the duration of the + # given block. + # + # See ActiveSupport::Deprecation#silence. + # + # source://activesupport//lib/active_support/deprecation/deprecators.rb#84 + def silence(&block); end + + # Sets the silenced flag for all deprecators in this collection. + # + # source://activesupport//lib/active_support/deprecation/deprecators.rb#47 + def silenced=(silenced); end + + private + + # source://activesupport//lib/active_support/deprecation/deprecators.rb#97 + def apply_options(deprecator); end + + # source://activesupport//lib/active_support/deprecation/deprecators.rb#92 + def set_option(name, value); end +end + +# source://activesupport//lib/active_support/deprecation/disallowed.rb#5 +module ActiveSupport::Deprecation::Disallowed + # Returns the configured criteria used to identify deprecation messages + # which should be treated as disallowed. + # + # source://activesupport//lib/active_support/deprecation/disallowed.rb#21 + def disallowed_warnings; end + + # Sets the criteria used to identify deprecation messages which should be + # disallowed. Can be an array containing strings, symbols, or regular + # expressions. (Symbols are treated as strings.) These are compared against + # the text of the generated deprecation warning. + # + # Additionally the scalar symbol +:all+ may be used to treat all + # deprecations as disallowed. + # + # Deprecations matching a substring or regular expression will be handled + # using the configured Behavior#disallowed_behavior rather than + # Behavior#behavior. + # + # source://activesupport//lib/active_support/deprecation/disallowed.rb#17 + def disallowed_warnings=(_arg0); end + + private + + # @return [Boolean] + # + # source://activesupport//lib/active_support/deprecation/disallowed.rb#26 + def deprecation_disallowed?(message); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/deprecation/disallowed.rb#39 + def explicitly_allowed?(message); end +end + +# source://activesupport//lib/active_support/deprecation.rb#57 +ActiveSupport::Deprecation::MUTEX = T.let(T.unsafe(nil), Thread::Mutex) + +# source://activesupport//lib/active_support/deprecation/method_wrappers.rb#8 +module ActiveSupport::Deprecation::MethodWrapper + # Declare that a method has been deprecated. + # + # class Fred + # def aaa; end + # def bbb; end + # def ccc; end + # def ddd; end + # def eee; end + # end + # + # deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem') + # + # deprecator.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead') + # # => Fred + # + # Fred.new.aaa + # # DEPRECATION WARNING: aaa is deprecated and will be removed from MyGem next-release. (called from irb_binding at (irb):10) + # # => nil + # + # Fred.new.bbb + # # DEPRECATION WARNING: bbb is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):11) + # # => nil + # + # Fred.new.ccc + # # DEPRECATION WARNING: ccc is deprecated and will be removed from MyGem next-release (use Bar#ccc instead). (called from irb_binding at (irb):12) + # # => nil + # + # source://activesupport//lib/active_support/deprecation/method_wrappers.rb#35 + def deprecate_methods(target_module, *method_names); end +end + +# source://activesupport//lib/active_support/deprecation/reporting.rb#7 +module ActiveSupport::Deprecation::Reporting + # Allow previously disallowed deprecation warnings within the block. + # 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. + # + # deprecator = ActiveSupport::Deprecation.new + # deprecator.disallowed_behavior = :raise + # deprecator.disallowed_warnings = [ + # "something broke" + # ] + # + # deprecator.warn('something broke!') + # # => ActiveSupport::DeprecationException + # + # deprecator.allow ['something broke'] do + # deprecator.warn('something broke!') + # end + # # => nil + # + # deprecator.allow ['something broke'], if: Rails.env.production? do + # deprecator.warn('something broke!') + # end + # # => ActiveSupport::DeprecationException for dev/test, nil for production + # + # source://activesupport//lib/active_support/deprecation/reporting.rb#89 + def allow(allowed_warnings = T.unsafe(nil), if: T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/deprecation/reporting.rb#48 + def begin_silence; end + + # source://activesupport//lib/active_support/deprecation/reporting.rb#99 + def deprecation_warning(deprecated_method_name, message = T.unsafe(nil), caller_backtrace = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/deprecation/reporting.rb#52 + def end_silence; end + + # Name of gem where method is deprecated + # + # source://activesupport//lib/active_support/deprecation/reporting.rb#11 + def gem_name; end + + # Name of gem where method is deprecated + # + # source://activesupport//lib/active_support/deprecation/reporting.rb#11 + def gem_name=(_arg0); end + + # Silence deprecation warnings within the block. + # + # deprecator = ActiveSupport::Deprecation.new + # deprecator.warn('something broke!') + # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)" + # + # deprecator.silence do + # deprecator.warn('something broke!') + # end + # # => nil + # + # source://activesupport//lib/active_support/deprecation/reporting.rb#41 + def silence(&block); end + + # source://activesupport//lib/active_support/deprecation/reporting.rb#56 + def silenced; end + + # Whether to print a message (silent mode) + # + # source://activesupport//lib/active_support/deprecation/reporting.rb#9 + def silenced=(_arg0); end + + # Outputs a deprecation warning to the output configured by + # ActiveSupport::Deprecation#behavior. + # + # ActiveSupport::Deprecation.new.warn('something broke!') + # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)" + # + # source://activesupport//lib/active_support/deprecation/reporting.rb#18 + def warn(message = T.unsafe(nil), callstack = T.unsafe(nil)); end + + private + + # Outputs a deprecation warning message + # + # deprecated_method_warning(:method_name) + # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon}" + # deprecated_method_warning(:method_name, :another_method) + # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (use another_method instead)" + # deprecated_method_warning(:method_name, "Optional message") + # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (Optional message)" + # + # source://activesupport//lib/active_support/deprecation/reporting.rb#115 + def deprecated_method_warning(method_name, message = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/deprecation/reporting.rb#129 + def deprecation_caller_message(callstack); end + + # source://activesupport//lib/active_support/deprecation/reporting.rb#124 + def deprecation_message(callstack, message = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/deprecation/reporting.rb#140 + def extract_callstack(callstack); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/deprecation/reporting.rb#155 + def ignored_callstack?(path); end +end + +# source://activesupport//lib/active_support/deprecation/reporting.rb#153 +ActiveSupport::Deprecation::Reporting::LIB_DIR = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/deprecation/reporting.rb#152 +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 + +# = Active Support Descendants Tracker +# +# This module provides an internal implementation to track descendants +# which is faster than iterating through +ObjectSpace+. +# +# However Ruby 3.1 provide a fast native +Class#subclasses+ method, +# so if you know your code won't be executed on older rubies, including +# +ActiveSupport::DescendantsTracker+ does not provide any benefit. +# +# source://activesupport//lib/active_support/descendants_tracker.rb#14 +module ActiveSupport::DescendantsTracker + # source://activesupport//lib/active_support/descendants_tracker.rb#107 + def descendants; end + + class << self + # source://activesupport//lib/active_support/descendants_tracker.rb#78 + def clear(classes); end + + # source://activesupport//lib/active_support/descendants_tracker.rb#102 + def descendants(klass); end + + # source://activesupport//lib/active_support/descendants_tracker.rb#69 + def disable_clear!; end + + # source://activesupport//lib/active_support/descendants_tracker.rb#89 + def reject!(classes); end + + # source://activesupport//lib/active_support/descendants_tracker.rb#98 + def subclasses(klass); end + end +end + +# source://activesupport//lib/active_support/descendants_tracker.rb#58 +module ActiveSupport::DescendantsTracker::ReloadedClassesFiltering + # source://activesupport//lib/active_support/descendants_tracker.rb#63 + def descendants; end + + # source://activesupport//lib/active_support/descendants_tracker.rb#59 + def subclasses; end +end + +# On TruffleRuby `ObjectSpace::WeakMap` keys are strong references. +# So we use `object_id` as a key and the actual object as a value. +# +# JRuby for now doesn't have Class#descendant, but when it will, it will likely +# have the same WeakMap semantic than Truffle so we future proof this as much as possible. +# +# source://activesupport//lib/active_support/descendants_tracker.rb#20 +class ActiveSupport::DescendantsTracker::WeakSet < ::ObjectSpace::WeakMap + # source://activesupport//lib/active_support/descendants_tracker.rb#23 + def <<(object); end + + def to_a; end +end + +# source://activesupport//lib/active_support/digest.rb#6 +class ActiveSupport::Digest + class << self + # source://activesupport//lib/active_support/digest.rb#8 + def hash_digest_class; end + + # @raise [ArgumentError] + # + # source://activesupport//lib/active_support/digest.rb#12 + def hash_digest_class=(klass); end + + # source://activesupport//lib/active_support/digest.rb#17 + def hexdigest(arg); end + end +end + +# = Active Support \Duration +# +# Provides accurate date and time measurements using Date#advance and +# Time#advance, respectively. It mainly supports the methods on Numeric. +# +# 1.month.ago # equivalent to Time.now.advance(months: -1) +# +# source://activesupport//lib/active_support/duration.rb#14 +class ActiveSupport::Duration + # @return [Duration] a new instance of Duration + # + # source://activesupport//lib/active_support/duration.rb#226 + def initialize(value, parts, variable = T.unsafe(nil)); end + + # Returns the modulo of this Duration by another Duration or Numeric. + # Numeric values are treated as seconds. + # + # source://activesupport//lib/active_support/duration.rb#312 + def %(other); end + + # Multiplies this Duration by a Numeric and returns a new Duration. + # + # source://activesupport//lib/active_support/duration.rb#287 + def *(other); end + + # Adds another Duration or a Numeric to this Duration. Numeric values + # are treated as seconds. + # + # source://activesupport//lib/active_support/duration.rb#268 + def +(other); end + + # source://activesupport//lib/active_support/duration.rb#326 + def +@; end + + # Subtracts another Duration or a Numeric from this Duration. Numeric + # values are treated as seconds. + # + # source://activesupport//lib/active_support/duration.rb#282 + def -(other); end + + # source://activesupport//lib/active_support/duration.rb#322 + def -@; end + + # Divides this Duration by a Numeric and returns a new Duration. + # + # source://activesupport//lib/active_support/duration.rb#298 + def /(other); end + + # Compares one Duration with another or a Numeric to this Duration. + # Numeric values are treated as seconds. + # + # source://activesupport//lib/active_support/duration.rb#258 + def <=>(other); end + + # Returns +true+ if +other+ is also a Duration instance with the + # same +value+, or if other == value. + # + # source://activesupport//lib/active_support/duration.rb#341 + def ==(other); end + + # source://activesupport//lib/active_support/duration.rb#481 + def _parts; end + + # source://activesupport//lib/active_support/duration.rb#224 + def abs(&_arg0); end + + # Calculates a new Time or Date that is as far in the future + # as this Duration represents. + # + # source://activesupport//lib/active_support/duration.rb#436 + def after(time = T.unsafe(nil)); end + + # Calculates a new Time or Date that is as far in the past + # as this Duration represents. + # + # source://activesupport//lib/active_support/duration.rb#444 + def ago(time = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/duration.rb#459 + def as_json(options = T.unsafe(nil)); end + + # Calculates a new Time or Date that is as far in the past + # as this Duration represents. + # + # source://activesupport//lib/active_support/duration.rb#444 + def before(time = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/duration.rb#245 + def coerce(other); end + + # source://activesupport//lib/active_support/duration.rb#467 + def encode_with(coder); end + + # Returns +true+ if +other+ is also a Duration instance, which has the + # same parts as this one. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/duration.rb#426 + def eql?(other); end + + # Calculates a new Time or Date that is as far in the future + # as this Duration represents. + # + # source://activesupport//lib/active_support/duration.rb#436 + def from_now(time = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/duration.rb#430 + def hash; end + + # Returns the amount of days a duration covers as a float + # + # 12.hours.in_days # => 0.5 + # + # source://activesupport//lib/active_support/duration.rb#399 + def in_days; end + + # Returns the amount of hours a duration covers as a float + # + # 1.day.in_hours # => 24.0 + # + # source://activesupport//lib/active_support/duration.rb#392 + def in_hours; end + + # Returns the amount of minutes a duration covers as a float + # + # 1.day.in_minutes # => 1440.0 + # + # source://activesupport//lib/active_support/duration.rb#385 + def in_minutes; end + + # Returns the amount of months a duration covers as a float + # + # 9.weeks.in_months # => 2.07 + # + # source://activesupport//lib/active_support/duration.rb#413 + def in_months; end + + # Returns the number of seconds that this Duration represents. + # + # 1.minute.to_i # => 60 + # 1.hour.to_i # => 3600 + # 1.day.to_i # => 86400 + # + # Note that this conversion makes some assumptions about the + # duration of some periods, e.g. months are always 1/12 of year + # and years are 365.2425 days: + # + # # equivalent to (1.year / 12).to_i + # 1.month.to_i # => 2629746 + # + # # equivalent to 365.2425.days.to_i + # 1.year.to_i # => 31556952 + # + # In such cases, Ruby's core + # Date[https://docs.ruby-lang.org/en/master/Date.html] and + # Time[https://docs.ruby-lang.org/en/master/Time.html] should be used for precision + # date and time arithmetic. + # + # source://activesupport//lib/active_support/duration.rb#377 + def in_seconds; end + + # Returns the amount of weeks a duration covers as a float + # + # 2.months.in_weeks # => 8.696 + # + # source://activesupport//lib/active_support/duration.rb#406 + def in_weeks; end + + # Returns the amount of years a duration covers as a float + # + # 30.days.in_years # => 0.082 + # + # source://activesupport//lib/active_support/duration.rb#420 + def in_years; end + + # source://activesupport//lib/active_support/duration.rb#463 + def init_with(coder); end + + # source://activesupport//lib/active_support/duration.rb#450 + def inspect; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/duration.rb#335 + def instance_of?(klass); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/duration.rb#330 + def is_a?(klass); end + + # Build ISO 8601 Duration string for this duration. + # The +precision+ parameter can be used to limit seconds' precision of duration. + # + # source://activesupport//lib/active_support/duration.rb#473 + def iso8601(precision: T.unsafe(nil)); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/duration.rb#330 + def kind_of?(klass); end + + # source://activesupport//lib/active_support/duration.rb#224 + def negative?(&_arg0); end + + # Returns a copy of the parts hash that defines the duration. + # + # 5.minutes.parts # => {:minutes=>5} + # 3.years.parts # => {:years=>3} + # + # source://activesupport//lib/active_support/duration.rb#241 + def parts; end + + # source://activesupport//lib/active_support/duration.rb#224 + def positive?(&_arg0); end + + # Calculates a new Time or Date that is as far in the future + # as this Duration represents. + # + # source://activesupport//lib/active_support/duration.rb#436 + def since(time = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/duration.rb#224 + def to_f(&_arg0); end + + # Returns the number of seconds that this Duration represents. + # + # 1.minute.to_i # => 60 + # 1.hour.to_i # => 3600 + # 1.day.to_i # => 86400 + # + # Note that this conversion makes some assumptions about the + # duration of some periods, e.g. months are always 1/12 of year + # and years are 365.2425 days: + # + # # equivalent to (1.year / 12).to_i + # 1.month.to_i # => 2629746 + # + # # equivalent to 365.2425.days.to_i + # 1.year.to_i # => 31556952 + # + # In such cases, Ruby's core + # Date[https://docs.ruby-lang.org/en/master/Date.html] and + # Time[https://docs.ruby-lang.org/en/master/Time.html] should be used for precision + # date and time arithmetic. + # + # source://activesupport//lib/active_support/duration.rb#377 + def to_i; end + + # Returns the amount of seconds a duration covers as a string. + # For more information check to_i method. + # + # 1.day.to_s # => "86400" + # + # source://activesupport//lib/active_support/duration.rb#353 + def to_s; end + + # Calculates a new Time or Date that is as far in the past + # as this Duration represents. + # + # source://activesupport//lib/active_support/duration.rb#444 + def until(time = T.unsafe(nil)); end + + # Returns the value of attribute value. + # + # source://activesupport//lib/active_support/duration.rb#133 + def value; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/duration.rb#477 + def variable?; end + + # source://activesupport//lib/active_support/duration.rb#224 + def zero?(&_arg0); end + + private + + # source://activesupport//lib/active_support/duration.rb#516 + def method_missing(*_arg0, **_arg1, &_arg2); end + + # @raise [TypeError] + # + # source://activesupport//lib/active_support/duration.rb#520 + def raise_type_error(other); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/duration.rb#512 + def respond_to_missing?(method, _); end + + # source://activesupport//lib/active_support/duration.rb#486 + def sum(sign, time = T.unsafe(nil)); end + + class << self + # source://activesupport//lib/active_support/duration.rb#149 + def ===(other); end + + # Creates a new Duration from a seconds value that is converted + # to the individual parts: + # + # ActiveSupport::Duration.build(31556952).parts # => {:years=>1} + # ActiveSupport::Duration.build(2716146).parts # => {:months=>1, :days=>1} + # + # source://activesupport//lib/active_support/duration.rb#189 + def build(value); end + + # source://activesupport//lib/active_support/duration.rb#167 + def days(value); end + + # source://activesupport//lib/active_support/duration.rb#163 + def hours(value); end + + # source://activesupport//lib/active_support/duration.rb#159 + def minutes(value); end + + # source://activesupport//lib/active_support/duration.rb#175 + def months(value); end + + # Creates a new Duration from string formatted according to ISO 8601 Duration. + # + # See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information. + # This method allows negative parts to be present in pattern. + # If invalid string is provided, it will raise +ActiveSupport::Duration::ISO8601Parser::ParsingError+. + # + # source://activesupport//lib/active_support/duration.rb#144 + def parse(iso8601duration); end + + # source://activesupport//lib/active_support/duration.rb#155 + def seconds(value); end + + # source://activesupport//lib/active_support/duration.rb#171 + def weeks(value); end + + # source://activesupport//lib/active_support/duration.rb#179 + def years(value); end + + private + + # source://activesupport//lib/active_support/duration.rb#217 + def calculate_total_seconds(parts); end + end +end + +# Parses a string formatted according to ISO 8601 Duration into the hash. +# +# See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information. +# +# This parser allows negative parts to be present in pattern. +# +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#12 +class ActiveSupport::Duration::ISO8601Parser + # @return [ISO8601Parser] a new instance of ISO8601Parser + # + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#34 + def initialize(string); end + + # Returns the value of attribute mode. + # + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#32 + def mode; end + + # Sets the attribute mode + # + # @param value the value to set the attribute mode to. + # + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#32 + def mode=(_arg0); end + + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#41 + def parse!; end + + # Returns the value of attribute parts. + # + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#31 + def parts; end + + # Returns the value of attribute scanner. + # + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#31 + def scanner; end + + # Returns the value of attribute sign. + # + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#32 + def sign; end + + # Sets the attribute sign + # + # @param value the value to set the attribute sign to. + # + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#32 + def sign=(_arg0); end + + private + + # @return [Boolean] + # + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#83 + def finished?; end + + # Parses number which can be a float with either comma or period. + # + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#88 + def number; end + + # @raise [ParsingError] + # + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#96 + def raise_parsing_error(reason = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#92 + def scan(pattern); end + + # Checks for various semantic errors as stated in ISO 8601 standard. + # + # source://activesupport//lib/active_support/duration/iso8601_parser.rb#101 + def validate!; end +end + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#17 +ActiveSupport::Duration::ISO8601Parser::COMMA = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#22 +ActiveSupport::Duration::ISO8601Parser::DATE_COMPONENT = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#28 +ActiveSupport::Duration::ISO8601Parser::DATE_COMPONENTS = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#20 +ActiveSupport::Duration::ISO8601Parser::DATE_MARKER = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#25 +ActiveSupport::Duration::ISO8601Parser::DATE_TO_PART = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#16 +ActiveSupport::Duration::ISO8601Parser::PERIOD = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#15 +ActiveSupport::Duration::ISO8601Parser::PERIOD_OR_COMMA = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#13 +class ActiveSupport::Duration::ISO8601Parser::ParsingError < ::ArgumentError; end + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#19 +ActiveSupport::Duration::ISO8601Parser::SIGN_MARKER = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#23 +ActiveSupport::Duration::ISO8601Parser::TIME_COMPONENT = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#29 +ActiveSupport::Duration::ISO8601Parser::TIME_COMPONENTS = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#21 +ActiveSupport::Duration::ISO8601Parser::TIME_MARKER = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/duration/iso8601_parser.rb#26 +ActiveSupport::Duration::ISO8601Parser::TIME_TO_PART = T.let(T.unsafe(nil), Hash) + +# Serializes duration to string according to ISO 8601 Duration format. +# +# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#6 +class ActiveSupport::Duration::ISO8601Serializer + # @return [ISO8601Serializer] a new instance of ISO8601Serializer + # + # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#9 + def initialize(duration, precision: T.unsafe(nil)); end + + # Builds and returns output string. + # + # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#15 + def serialize; end + + private + + # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#55 + def format_seconds(seconds); end + + # Return pair of duration's parts and whole duration sign. + # Parts are summarized (as they can become repetitive due to addition, etc). + # Zero parts are removed as not significant. + # + # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#38 + def normalize; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#51 + def week_mixed_with_date?(parts); end +end + +# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#7 +ActiveSupport::Duration::ISO8601Serializer::DATE_COMPONENTS = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/duration.rb#130 +ActiveSupport::Duration::PARTS = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/duration.rb#120 +ActiveSupport::Duration::PARTS_IN_SECONDS = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/duration.rb#115 +ActiveSupport::Duration::SECONDS_PER_DAY = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/duration.rb#114 +ActiveSupport::Duration::SECONDS_PER_HOUR = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/duration.rb#113 +ActiveSupport::Duration::SECONDS_PER_MINUTE = T.let(T.unsafe(nil), Integer) + +# 1/12 of a gregorian year +# +# source://activesupport//lib/active_support/duration.rb#117 +ActiveSupport::Duration::SECONDS_PER_MONTH = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/duration.rb#116 +ActiveSupport::Duration::SECONDS_PER_WEEK = T.let(T.unsafe(nil), Integer) + +# length of a gregorian year (365.2425 days) +# +# source://activesupport//lib/active_support/duration.rb#118 +ActiveSupport::Duration::SECONDS_PER_YEAR = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/duration.rb#15 +class ActiveSupport::Duration::Scalar < ::Numeric + # @return [Scalar] a new instance of Scalar + # + # source://activesupport//lib/active_support/duration.rb#19 + def initialize(value); end + + # source://activesupport//lib/active_support/duration.rb#85 + def %(other); end + + # source://activesupport//lib/active_support/duration.rb#66 + def *(other); end + + # source://activesupport//lib/active_support/duration.rb#41 + def +(other); end + + # source://activesupport//lib/active_support/duration.rb#53 + def -(other); end + + # source://activesupport//lib/active_support/duration.rb#27 + def -@; end + + # source://activesupport//lib/active_support/duration.rb#77 + def /(other); end + + # source://activesupport//lib/active_support/duration.rb#31 + def <=>(other); end + + # source://activesupport//lib/active_support/duration.rb#23 + def coerce(other); end + + # source://activesupport//lib/active_support/duration.rb#17 + def to_f(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/duration.rb#17 + def to_i(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/duration.rb#17 + def to_s(*_arg0, **_arg1, &_arg2); end + + # Returns the value of attribute value. + # + # source://activesupport//lib/active_support/duration.rb#16 + def value; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/duration.rb#93 + def variable?; end + + private + + # source://activesupport//lib/active_support/duration.rb#98 + def calculate(op, other); end + + # @raise [TypeError] + # + # source://activesupport//lib/active_support/duration.rb#108 + def raise_type_error(other); end +end + +# source://activesupport//lib/active_support/duration.rb#131 +ActiveSupport::Duration::VARIABLE_PARTS = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/core_ext/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/core_ext/enumerable.rb#4 +module ActiveSupport::EnumerableCoreExt; end + +# source://activesupport//lib/active_support/core_ext/enumerable.rb#5 +module ActiveSupport::EnumerableCoreExt::Constants + private + + # source://activesupport//lib/active_support/core_ext/enumerable.rb#7 + def const_missing(name); end +end + +# HACK: For performance reasons, Enumerable shouldn't have any constants of its own. +# So we move SoleItemExpectedError into ActiveSupport::EnumerableCoreExt. +# +# source://activesupport//lib/active_support/core_ext/enumerable.rb#25 +ActiveSupport::EnumerableCoreExt::SoleItemExpectedError = Enumerable::SoleItemExpectedError + +# source://activesupport//lib/active_support/environment_inquirer.rb#9 +class ActiveSupport::EnvironmentInquirer < ::ActiveSupport::StringInquirer + # @raise [ArgumentError] + # @return [EnvironmentInquirer] a new instance of EnvironmentInquirer + # + # source://activesupport//lib/active_support/environment_inquirer.rb#15 + def initialize(env); end + + # source://activesupport//lib/active_support/environment_inquirer.rb#29 + def development?; end + + # Returns true if we're in the development or test environment. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/environment_inquirer.rb#36 + def local?; end + + # source://activesupport//lib/active_support/environment_inquirer.rb#29 + def production?; end + + # source://activesupport//lib/active_support/environment_inquirer.rb#29 + def test?; end +end + +# Optimization for the three default environments, so this inquirer doesn't need to rely on +# the slower delegation through method_missing that StringInquirer would normally entail. +# +# source://activesupport//lib/active_support/environment_inquirer.rb#10 +ActiveSupport::EnvironmentInquirer::DEFAULT_ENVIRONMENTS = T.let(T.unsafe(nil), Array) + +# Environments that'll respond true for #local? +# +# source://activesupport//lib/active_support/environment_inquirer.rb#13 +ActiveSupport::EnvironmentInquirer::LOCAL_ENVIRONMENTS = T.let(T.unsafe(nil), Array) + +# = Active Support \Error Reporter +# +# +ActiveSupport::ErrorReporter+ is a common interface for error reporting services. +# +# To rescue and report any unhandled error, you can use the #handle method: +# +# Rails.error.handle do +# do_something! +# end +# +# If an error is raised, it will be reported and swallowed. +# +# Alternatively, if you want to report the error but not swallow it, you can use #record: +# +# Rails.error.record do +# do_something! +# end +# +# Both methods can be restricted to handle only a specific error class: +# +# maybe_tags = Rails.error.handle(Redis::BaseError) { redis.get("tags") } +# +# source://activesupport//lib/active_support/error_reporter.rb#26 +class ActiveSupport::ErrorReporter + # @return [ErrorReporter] a new instance of ErrorReporter + # + # source://activesupport//lib/active_support/error_reporter.rb#35 + def initialize(*subscribers, logger: T.unsafe(nil)); end + + # Returns the value of attribute debug_mode. + # + # source://activesupport//lib/active_support/error_reporter.rb#31 + def debug_mode; end + + # Sets the attribute debug_mode + # + # @param value the value to set the attribute debug_mode to. + # + # source://activesupport//lib/active_support/error_reporter.rb#31 + def debug_mode=(_arg0); end + + # Prevent a subscriber from being notified of errors for the + # duration of the block. You may pass in the subscriber itself, or its class. + # + # This can be helpful for error reporting service integrations, when they wish + # to handle any errors higher in the stack. + # + # source://activesupport//lib/active_support/error_reporter.rb#185 + def disable(subscriber); end + + # Evaluates the given block, reporting and swallowing any unhandled error. + # If no error is raised, returns the return value of the block. Otherwise, + # returns the result of +fallback.call+, or +nil+ if +fallback+ is not + # specified. + # + # # Will report a TypeError to all subscribers and return nil. + # Rails.error.handle do + # 1 + '1' + # end + # + # Can be restricted to handle only specific error classes: + # + # maybe_tags = Rails.error.handle(Redis::BaseError) { redis.get("tags") } + # + # ==== Options + # + # * +:severity+ - This value is passed along to subscribers to indicate how + # important the error report is. Can be +:error+, +:warning+, or +:info+. + # Defaults to +:warning+. + # + # * +:context+ - Extra information that is passed along to subscribers. For + # example: + # + # Rails.error.handle(context: { section: "admin" }) do + # # ... + # end + # + # * +:fallback+ - A callable that provides +handle+'s return value when an + # unhandled error is raised. For example: + # + # user = Rails.error.handle(fallback: -> { User.anonymous }) do + # User.find_by(params) + # end + # + # * +:source+ - This value is passed along to subscribers to indicate the + # source of the error. Subscribers can use this value to ignore certain + # errors. Defaults to "application". + # + # source://activesupport//lib/active_support/error_reporter.rb#78 + def handle(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), fallback: T.unsafe(nil), source: T.unsafe(nil)); end + + # Returns the value of attribute logger. + # + # source://activesupport//lib/active_support/error_reporter.rb#31 + def logger; end + + # Sets the attribute logger + # + # @param value the value to set the attribute logger to. + # + # source://activesupport//lib/active_support/error_reporter.rb#31 + def logger=(_arg0); end + + # Evaluates the given block, reporting and re-raising any unhandled error. + # If no error is raised, returns the return value of the block. + # + # # Will report a TypeError to all subscribers and re-raise it. + # Rails.error.record do + # 1 + '1' + # end + # + # Can be restricted to handle only specific error classes: + # + # tags = Rails.error.record(Redis::BaseError) { redis.get("tags") } + # + # ==== Options + # + # * +:severity+ - This value is passed along to subscribers to indicate how + # important the error report is. Can be +:error+, +:warning+, or +:info+. + # Defaults to +:error+. + # + # * +:context+ - Extra information that is passed along to subscribers. For + # example: + # + # Rails.error.record(context: { section: "admin" }) do + # # ... + # end + # + # * +:source+ - This value is passed along to subscribers to indicate the + # source of the error. Subscribers can use this value to ignore certain + # errors. Defaults to "application". + # + # source://activesupport//lib/active_support/error_reporter.rb#114 + def record(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end + + # Report an error directly to subscribers. You can use this method when the + # block-based #handle and #record methods are not suitable. + # + # Rails.error.report(error) + # + # source://activesupport//lib/active_support/error_reporter.rb#210 + def report(error, handled: T.unsafe(nil), severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end + + # Update the execution context that is accessible to error subscribers. Any + # context passed to #handle, #record, or #report will be merged with the + # context set here. + # + # Rails.error.set_context(section: "checkout", user_id: @user.id) + # + # source://activesupport//lib/active_support/error_reporter.rb#201 + def set_context(*_arg0, **_arg1, &_arg2); end + + # Register a new error subscriber. The subscriber must respond to + # + # report(Exception, handled: Boolean, severity: (:error OR :warning OR :info), context: Hash, source: String) + # + # The +report+ method should never raise an error. + # + # source://activesupport//lib/active_support/error_reporter.rb#161 + def subscribe(subscriber); end + + # Either report the given error when in production, or raise it when in development or test. + # + # When called in production, after the error is reported, this method will return + # nil and execution will continue. + # + # When called in development, the original error is wrapped in a different error class to ensure + # it's not being rescued higher in the stack and will be surfaced to the developer. + # + # This method is intended for reporting violated assertions about preconditions, or similar + # cases that can and should be gracefully handled in production, but that aren't supposed to happen. + # + # The error can be either an exception instance or a String. + # + # example: + # + # def edit + # if published? + # Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible") + # return false + # end + # # ... + # end + # + # source://activesupport//lib/active_support/error_reporter.rb#145 + def unexpected(error, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end + + # Unregister an error subscriber. Accepts either a subscriber or a class. + # + # subscriber = MyErrorSubscriber.new + # Rails.error.subscribe(subscriber) + # + # Rails.error.unsubscribe(subscriber) + # # or + # Rails.error.unsubscribe(MyErrorSubscriber) + # + # source://activesupport//lib/active_support/error_reporter.rb#176 + def unsubscribe(subscriber); end + + private + + # source://activesupport//lib/active_support/error_reporter.rb#243 + def ensure_backtrace(error); end +end + +# source://activesupport//lib/active_support/error_reporter.rb#29 +ActiveSupport::ErrorReporter::DEFAULT_RESCUE = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/error_reporter.rb#28 +ActiveSupport::ErrorReporter::DEFAULT_SOURCE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/error_reporter.rb#27 +ActiveSupport::ErrorReporter::SEVERITIES = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/error_reporter.rb#33 +class ActiveSupport::ErrorReporter::UnexpectedError < ::Exception; end + +# source://activesupport//lib/active_support/execution_context.rb#4 +module ActiveSupport::ExecutionContext + class << self + # source://activesupport//lib/active_support/execution_context.rb#34 + def []=(key, value); end + + # source://activesupport//lib/active_support/execution_context.rb#7 + def after_change(&block); end + + # source://activesupport//lib/active_support/execution_context.rb#43 + def clear; end + + # Updates the execution context. If a block is given, it resets the provided keys to their + # previous value once the block exits. + # + # source://activesupport//lib/active_support/execution_context.rb#13 + def set(**options); end + + # source://activesupport//lib/active_support/execution_context.rb#39 + def to_h; end + + private + + # source://activesupport//lib/active_support/execution_context.rb#48 + def store; end + end +end + +# source://activesupport//lib/active_support/execution_wrapper.rb#7 +class ActiveSupport::ExecutionWrapper + include ::ActiveSupport::Callbacks + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + + # source://activesupport//lib/active_support/callbacks.rb#69 + def __callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#923 + def _complete_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#923 + def _run_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#911 + def _run_complete_callbacks(&block); end + + # source://activesupport//lib/active_support/callbacks.rb#911 + def _run_run_callbacks(&block); end + + # source://activesupport//lib/active_support/execution_wrapper.rb#141 + def complete; end + + # Complete this in-flight execution. This method *must* be called + # exactly once on the result of any call to +run!+. + # + # Where possible, prefer +wrap+. + # + # source://activesupport//lib/active_support/execution_wrapper.rb#135 + def complete!; end + + # source://activesupport//lib/active_support/execution_wrapper.rb#127 + def run; end + + # source://activesupport//lib/active_support/execution_wrapper.rb#122 + def run!; end + + private + + # source://activesupport//lib/active_support/execution_wrapper.rb#146 + def hook_state; end + + class << self + # source://activesupport//lib/active_support/class_attribute.rb#12 + def __callbacks; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def __callbacks=(new_value); end + + # source://activesupport//lib/active_support/callbacks.rb#915 + def _complete_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#919 + def _complete_callbacks=(value); end + + # source://activesupport//lib/active_support/callbacks.rb#915 + def _run_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#919 + def _run_callbacks=(value); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/execution_wrapper.rb#118 + def active?; end + + # source://activesupport//lib/active_support/execution_wrapper.rb#114 + def active_key; end + + # source://activesupport//lib/active_support/execution_wrapper.rb#110 + def error_reporter; end + + # source://activesupport//lib/active_support/execution_wrapper.rb#100 + def perform; end + + # Register an object to be invoked during both the +run+ and + # +complete+ steps. + # + # +hook.complete+ will be passed the value returned from +hook.run+, + # and will only be invoked if +run+ has previously been called. + # (Mostly, this means it won't be invoked if an exception occurs in + # a preceding +to_run+ block; all ordinary +to_complete+ blocks are + # invoked in that situation.) + # + # source://activesupport//lib/active_support/execution_wrapper.rb#50 + def register_hook(hook, outer: T.unsafe(nil)); end + + # Run this execution. + # + # Returns an instance, whose +complete!+ method *must* be invoked + # after the work has been performed. + # + # Where possible, prefer +wrap+. + # + # source://activesupport//lib/active_support/execution_wrapper.rb#66 + def run!(reset: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/execution_wrapper.rb#21 + def to_complete(*args, &block); end + + # source://activesupport//lib/active_support/execution_wrapper.rb#17 + def to_run(*args, &block); end + + # Perform the work in the supplied block as an execution. + # + # source://activesupport//lib/active_support/execution_wrapper.rb#86 + def wrap(source: T.unsafe(nil)); end + end +end + +# source://activesupport//lib/active_support/execution_wrapper.rb#32 +class ActiveSupport::ExecutionWrapper::CompleteHook < ::Struct + # source://activesupport//lib/active_support/execution_wrapper.rb#33 + def after(target); end + + # source://activesupport//lib/active_support/execution_wrapper.rb#33 + def before(target); end + + # Returns the value of attribute hook + # + # @return [Object] the current value of hook + def hook; end + + # Sets the attribute hook + # + # @param value [Object] the value to set the attribute hook to. + # @return [Object] the newly set value + def hook=(_); end + + class << self + def [](*_arg0); end + def inspect; end + def keyword_init?; end + def members; end + def new(*_arg0); end + end +end + +# source://activesupport//lib/active_support/execution_wrapper.rb#10 +ActiveSupport::ExecutionWrapper::Null = T.let(T.unsafe(nil), Object) + +# source://activesupport//lib/active_support/execution_wrapper.rb#25 +class ActiveSupport::ExecutionWrapper::RunHook < ::Struct + # source://activesupport//lib/active_support/execution_wrapper.rb#26 + def before(target); end + + # Returns the value of attribute hook + # + # @return [Object] the current value of hook + def hook; end + + # Sets the attribute hook + # + # @param value [Object] the value to set the attribute hook to. + # @return [Object] the newly set value + def hook=(_); end + + class << self + def [](*_arg0); end + def inspect; end + def keyword_init?; end + def members; end + def new(*_arg0); end + end +end + +# source://activesupport//lib/active_support/executor.rb#6 +class ActiveSupport::Executor < ::ActiveSupport::ExecutionWrapper; end + +# = \File Update Checker +# +# FileUpdateChecker specifies the API used by \Rails to watch files +# and control reloading. The API depends on four methods: +# +# * +initialize+ which expects two parameters and one block as +# described below. +# +# * +updated?+ which returns a boolean if there were updates in +# the filesystem or not. +# +# * +execute+ which executes the given block on initialization +# and updates the latest watched files and timestamp. +# +# * +execute_if_updated+ which just executes the block if it was updated. +# +# After initialization, a call to +execute_if_updated+ must execute +# the block only if there was really a change in the filesystem. +# +# This class is used by \Rails to reload the I18n framework whenever +# they are changed upon a new request. +# +# i18n_reloader = ActiveSupport::FileUpdateChecker.new(paths) do +# I18n.reload! +# end +# +# ActiveSupport::Reloader.to_prepare do +# i18n_reloader.execute_if_updated +# end +# +# source://activesupport//lib/active_support/file_update_checker.rb#35 +class ActiveSupport::FileUpdateChecker + # It accepts two parameters on initialization. The first is an array + # of files and the second is an optional hash of directories. The hash must + # have directories as keys and the value is an array of extensions to be + # watched under that directory. + # + # This method must also receive a block that will be called once a path + # changes. The array of files and list of directories cannot be changed + # after FileUpdateChecker has been initialized. + # + # @return [FileUpdateChecker] a new instance of FileUpdateChecker + # + # source://activesupport//lib/active_support/file_update_checker.rb#44 + def initialize(files, dirs = T.unsafe(nil), &block); end + + # Executes the given block and updates the latest watched files and + # timestamp. + # + # source://activesupport//lib/active_support/file_update_checker.rb#82 + def execute; end + + # Execute the block given if updated. + # + # source://activesupport//lib/active_support/file_update_checker.rb#92 + def execute_if_updated; end + + # Check if any of the entries were updated. If so, the watched and/or + # updated_at values are cached until the block is executed via +execute+ + # or +execute_if_updated+. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/file_update_checker.rb#63 + def updated?; end + + private + + # source://activesupport//lib/active_support/file_update_checker.rb#158 + def compile_ext(array); end + + # source://activesupport//lib/active_support/file_update_checker.rb#144 + def compile_glob(hash); end + + # source://activesupport//lib/active_support/file_update_checker.rb#154 + def escape(key); end + + # This method returns the maximum mtime of the files in +paths+, or +nil+ + # if the array is empty. + # + # Files with a mtime in the future are ignored. Such abnormal situation + # can happen for example if the user changes the clock by hand. It is + # healthy to consider this edge case because with mtimes in the future + # reloading is not triggered. + # + # source://activesupport//lib/active_support/file_update_checker.rb#122 + def max_mtime(paths); end + + # source://activesupport//lib/active_support/file_update_checker.rb#111 + def updated_at(paths); end + + # source://activesupport//lib/active_support/file_update_checker.rb#103 + def watched; end +end + +# source://activesupport//lib/active_support/fork_tracker.rb#4 +module ActiveSupport::ForkTracker + class << self + # source://activesupport//lib/active_support/fork_tracker.rb#31 + def after_fork(&block); end + + # source://activesupport//lib/active_support/fork_tracker.rb#19 + def after_fork_callback; end + + # source://activesupport//lib/active_support/fork_tracker.rb#27 + def hook!; end + + # source://activesupport//lib/active_support/fork_tracker.rb#36 + def unregister(callback); end + end +end + +# source://activesupport//lib/active_support/fork_tracker.rb#5 +module ActiveSupport::ForkTracker::CoreExt + # source://activesupport//lib/active_support/fork_tracker.rb#6 + def _fork; end +end + +# = Active Support \Gzip +# +# A convenient wrapper for the zlib standard library that allows +# compression/decompression of strings with gzip. +# +# gzip = ActiveSupport::Gzip.compress('compress me!') +# # => "\x1F\x8B\b\x00o\x8D\xCDO\x00\x03K\xCE\xCF-(J-.V\xC8MU\x04\x00R>n\x83\f\x00\x00\x00" +# +# ActiveSupport::Gzip.decompress(gzip) +# # => "compress me!" +# +# source://activesupport//lib/active_support/gzip.rb#17 +module ActiveSupport::Gzip + class << self + # Compresses a string using gzip. + # + # source://activesupport//lib/active_support/gzip.rb#32 + def compress(source, level = T.unsafe(nil), strategy = T.unsafe(nil)); end + + # Decompresses a gzipped string. + # + # source://activesupport//lib/active_support/gzip.rb#27 + def decompress(source); end + end +end + +# source://activesupport//lib/active_support/gzip.rb#18 +class ActiveSupport::Gzip::Stream < ::StringIO + # @return [Stream] a new instance of Stream + # + # source://activesupport//lib/active_support/gzip.rb#19 + def initialize(*_arg0); end + + # source://activesupport//lib/active_support/gzip.rb#23 + def close; end +end + +# = \Hash With Indifferent Access +# +# 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#70 + 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#168 + 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#98 + 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#181 + def assoc(key); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#371 + def compact; end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#320 + 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#223 + def default(key = T.unsafe(nil)); end + + # Removes the specified key from the hash. + # + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#303 + 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#208 + 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#264 + 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#311 + 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#58 + 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#195 + 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#251 + 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#151 + 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#151 + 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#151 + 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#151 + 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#273 + 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#132 + def merge!(*other_hashes, &block); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#66 + 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#328 + 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#298 + 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#283 + 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#289 + def reverse_merge!(other_hash); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#323 + def select(*args, &block); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#361 + def slice(*keys); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#366 + 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#98 + def store(key, value); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#318 + def symbolize_keys; end + + # Convert to a regular hash with string keys. + # + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#376 + def to_hash; end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#318 + def to_options; end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#321 + def to_options!; end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#383 + def to_proc; end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#340 + def transform_keys(hash = T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#345 + def transform_keys!(hash = T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#333 + def transform_values(&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#132 + 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#237 + 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#283 + 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#289 + def with_defaults!(other_hash); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#62 + 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#311 + def without(*keys); end + + private + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#388 + def convert_key(key); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#392 + def convert_value(value, conversion: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#405 + def convert_value_to_hash(value); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#416 + def set_defaults(target); end + + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#424 + def update_with_single_argument(other_hash, block); end + + class << self + # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#85 + def [](*args); end + end +end + +# source://activesupport//lib/active_support/hash_with_indifferent_access.rb#338 +ActiveSupport::HashWithIndifferentAccess::NOT_GIVEN = T.let(T.unsafe(nil), Object) + +# = Active Support \Inflector +# +# The Inflector transforms words from singular to plural, class names to table +# names, modularized class names to ones without, and class names to foreign +# keys. The default inflections for pluralization, singularization, and +# uncountable words are kept in inflections.rb. +# +# The \Rails core team has stated patches for the inflections library will not +# be accepted in order to avoid breaking legacy applications which may be +# relying on errant inflections. If you discover an incorrect inflection and +# require it for your application or wish to define rules for languages other +# than English, please correct or add them yourself (explained below). +# +# source://activesupport//lib/active_support/inflector/inflections.rb#7 +module ActiveSupport::Inflector + extend ::ActiveSupport::Inflector + + # Converts strings to UpperCamelCase. + # If the +uppercase_first_letter+ parameter is set to false, then produces + # lowerCamelCase. + # + # Also converts '/' to '::' which is useful for converting + # paths to namespaces. + # + # camelize('active_model') # => "ActiveModel" + # camelize('active_model', false) # => "activeModel" + # camelize('active_model/errors') # => "ActiveModel::Errors" + # camelize('active_model/errors', false) # => "activeModel::Errors" + # + # As a rule of thumb you can think of +camelize+ as the inverse of + # #underscore, though there are cases where that does not hold: + # + # camelize(underscore('SSLError')) # => "SslError" + # + # source://activesupport//lib/active_support/inflector/methods.rb#70 + def camelize(term, uppercase_first_letter = T.unsafe(nil)); end + + # Creates a class name from a plural table name like \Rails does for table + # names to models. Note that this returns a string and not a Class. (To + # convert to an actual class follow +classify+ with #constantize.) + # + # classify('ham_and_eggs') # => "HamAndEgg" + # classify('posts') # => "Post" + # + # Singular names are not handled correctly: + # + # classify('calculus') # => "Calculu" + # + # source://activesupport//lib/active_support/inflector/methods.rb#218 + def classify(table_name); end + + # Tries to find a constant with the name specified in the argument string. + # + # constantize('Module') # => Module + # constantize('Foo::Bar') # => Foo::Bar + # + # The name is assumed to be the one of a top-level constant, no matter + # whether it starts with "::" or not. No lexical context is taken into + # account: + # + # C = 'outside' + # module M + # C = 'inside' + # C # => 'inside' + # constantize('C') # => 'outside', same as ::C + # end + # + # NameError is raised when the name is not in CamelCase or the constant is + # unknown. + # + # source://activesupport//lib/active_support/inflector/methods.rb#289 + def constantize(camel_cased_word); end + + # Replaces underscores with dashes in the string. + # + # dasherize('puni_puni') # => "puni-puni" + # + # source://activesupport//lib/active_support/inflector/methods.rb#226 + def dasherize(underscored_word); end + + # Removes the rightmost segment from the constant expression in the string. + # + # deconstantize('Net::HTTP') # => "Net" + # deconstantize('::Net::HTTP') # => "::Net" + # deconstantize('String') # => "" + # deconstantize('::String') # => "" + # deconstantize('') # => "" + # + # See also #demodulize. + # + # source://activesupport//lib/active_support/inflector/methods.rb#256 + def deconstantize(path); end + + # Removes the module part from the expression in the string. + # + # demodulize('ActiveSupport::Inflector::Inflections') # => "Inflections" + # demodulize('Inflections') # => "Inflections" + # demodulize('::Inflections') # => "Inflections" + # demodulize('') # => "" + # + # See also #deconstantize. + # + # source://activesupport//lib/active_support/inflector/methods.rb#238 + def demodulize(path); end + + # Converts the first character in the string to lowercase. + # + # downcase_first('If they enjoyed The Matrix') # => "if they enjoyed The Matrix" + # downcase_first('I') # => "i" + # downcase_first('') # => "" + # + # source://activesupport//lib/active_support/inflector/methods.rb#175 + def downcase_first(string); end + + # Creates a foreign key name from a class name. + # +separate_class_name_and_id_with_underscore+ sets whether + # the method should put '_' between the name and 'id'. + # + # foreign_key('Message') # => "message_id" + # foreign_key('Message', false) # => "messageid" + # foreign_key('Admin::Post') # => "post_id" + # + # source://activesupport//lib/active_support/inflector/methods.rb#267 + def foreign_key(class_name, separate_class_name_and_id_with_underscore = T.unsafe(nil)); end + + # Tweaks an attribute name for display to end users. + # + # Specifically, performs these transformations: + # + # * Applies human inflection rules to the argument. + # * Deletes leading underscores, if any. + # * Removes an "_id" suffix if present. + # * Replaces underscores with spaces, if any. + # * Downcases all words except acronyms. + # * Capitalizes the first word. + # The capitalization of the first word can be turned off by setting the + # +:capitalize+ option to false (default is true). + # + # The trailing '_id' can be kept and capitalized by setting the + # optional parameter +keep_id_suffix+ to true (default is false). + # + # humanize('employee_salary') # => "Employee salary" + # humanize('author_id') # => "Author" + # humanize('author_id', capitalize: false) # => "author" + # humanize('_id') # => "Id" + # humanize('author_id', keep_id_suffix: true) # => "Author id" + # + # If "SSL" was defined to be an acronym: + # + # humanize('ssl_error') # => "SSL error" + # + # source://activesupport//lib/active_support/inflector/methods.rb#135 + def humanize(lower_case_and_underscored_word, capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end + + # Yields a singleton instance of Inflector::Inflections so you can specify + # additional inflector rules. If passed an optional locale, rules for other + # languages can be specified. If not specified, defaults to :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#265 + def inflections(locale = T.unsafe(nil)); end + + # Returns the suffix that should be added to a number to denote the position + # in an ordered sequence such as 1st, 2nd, 3rd, 4th. + # + # ordinal(1) # => "st" + # ordinal(2) # => "nd" + # ordinal(1002) # => "nd" + # ordinal(1003) # => "rd" + # ordinal(-11) # => "th" + # ordinal(-1021) # => "st" + # + # source://activesupport//lib/active_support/inflector/methods.rb#334 + def ordinal(number); end + + # Turns a number into an ordinal string used to denote the position in an + # ordered sequence such as 1st, 2nd, 3rd, 4th. + # + # ordinalize(1) # => "1st" + # ordinalize(2) # => "2nd" + # ordinalize(1002) # => "1002nd" + # ordinalize(1003) # => "1003rd" + # ordinalize(-11) # => "-11th" + # ordinalize(-1021) # => "-1021st" + # + # source://activesupport//lib/active_support/inflector/methods.rb#347 + def ordinalize(number); end + + # Replaces special characters in a string so that it may be used as part of + # a 'pretty' URL. + # + # parameterize("Donald E. Knuth") # => "donald-e-knuth" + # parameterize("^très|Jolie-- ") # => "tres-jolie" + # + # To use a custom separator, override the +separator+ argument. + # + # parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth" + # parameterize("^très|Jolie__ ", separator: '_') # => "tres_jolie" + # + # To preserve the case of the characters in a string, use the +preserve_case+ argument. + # + # parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth" + # parameterize("^très|Jolie-- ", preserve_case: true) # => "tres-Jolie" + # + # It preserves dashes and underscores unless they are used as separators: + # + # parameterize("^très|Jolie__ ") # => "tres-jolie__" + # parameterize("^très|Jolie-- ", separator: "_") # => "tres_jolie--" + # parameterize("^très_Jolie-- ", separator: ".") # => "tres_jolie--" + # + # If the optional parameter +locale+ is specified, + # the word will be parameterized as a word of that language. + # By default, this parameter is set to nil and it will use + # the configured I18n.locale. + # + # source://activesupport//lib/active_support/inflector/transliterate.rb#123 + def parameterize(string, separator: T.unsafe(nil), preserve_case: T.unsafe(nil), locale: T.unsafe(nil)); end + + # Returns the plural form of the word in the string. + # + # If passed an optional +locale+ parameter, the word will be + # pluralized using rules defined for that language. By default, + # this parameter is set to :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#33 + def pluralize(word, locale = T.unsafe(nil)); end + + # Tries to find a constant with the name specified in the argument string. + # + # safe_constantize('Module') # => Module + # safe_constantize('Foo::Bar') # => Foo::Bar + # + # The name is assumed to be the one of a top-level constant, no matter + # whether it starts with "::" or not. No lexical context is taken into + # account: + # + # C = 'outside' + # module M + # C = 'inside' + # C # => 'inside' + # safe_constantize('C') # => 'outside', same as ::C + # end + # + # +nil+ is returned when the name is not in CamelCase or the constant (or + # part of it) is unknown. + # + # safe_constantize('blargle') # => nil + # safe_constantize('UnknownModule') # => nil + # safe_constantize('UnknownModule::Foo::Bar') # => nil + # + # source://activesupport//lib/active_support/inflector/methods.rb#315 + def safe_constantize(camel_cased_word); end + + # The reverse of #pluralize, returns the singular form of a word in a + # string. + # + # If passed an optional +locale+ parameter, the word will be + # singularized using rules defined for that language. By default, + # this parameter is set to :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#50 + def singularize(word, locale = T.unsafe(nil)); end + + # Creates the name of a table like \Rails does for models to table names. + # This method uses the #pluralize method on the last word in the string. + # + # tableize('RawScaledScorer') # => "raw_scaled_scorers" + # tableize('ham_and_egg') # => "ham_and_eggs" + # tableize('fancyCategory') # => "fancy_categories" + # + # source://activesupport//lib/active_support/inflector/methods.rb#204 + def tableize(class_name); end + + # Capitalizes all the words and replaces some characters in the string to + # create a nicer looking title. +titleize+ is meant for creating pretty + # output. It is not used in the \Rails internals. + # + # The trailing '_id','Id'.. can be kept and capitalized by setting the + # optional parameter +keep_id_suffix+ to true. + # By default, this parameter is false. + # + # titleize('man from the boondocks') # => "Man From The Boondocks" + # titleize('x-men: the last stand') # => "X Men: The Last Stand" + # titleize('TheManWithoutAPast') # => "The Man Without A Past" + # titleize('raiders_of_the_lost_ark') # => "Raiders Of The Lost Ark" + # titleize('string_ending_with_id', keep_id_suffix: true) # => "String Ending With Id" + # + # source://activesupport//lib/active_support/inflector/methods.rb#192 + def titleize(word, keep_id_suffix: T.unsafe(nil)); end + + # Replaces non-ASCII characters with an ASCII approximation, or if none + # exists, a replacement character which defaults to "?". + # + # transliterate('Ærøskøbing') + # # => "AEroskobing" + # + # Default approximations are provided for Western/Latin characters, + # e.g, "ø", "ñ", "é", "ß", etc. + # + # This method is I18n aware, so you can set up custom approximations for a + # locale. This can be useful, for example, to transliterate German's "ü" + # and "ö" to "ue" and "oe", or to add support for transliterating Russian + # to ASCII. + # + # In order to make your custom transliterations available, you must set + # them as the 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#99 + def underscore(camel_cased_word); end + + # Converts the first character in the string to uppercase. + # + # upcase_first('what a Lovely Day') # => "What a Lovely Day" + # upcase_first('w') # => "W" + # upcase_first('') # => "" + # + # source://activesupport//lib/active_support/inflector/methods.rb#166 + def upcase_first(string); end + + private + + # Applies inflection rules for +singularize+ and +pluralize+. + # + # If passed an optional +locale+ parameter, the uncountables will be + # found for that locale. + # + # apply_inflections('post', inflections.plurals, :en) # => "posts" + # apply_inflections('posts', inflections.singulars, :en) # => "post" + # + # source://activesupport//lib/active_support/inflector/methods.rb#376 + def apply_inflections(word, rules, locale = T.unsafe(nil)); end + + # Mounts a regular expression, returned as a string to ease interpolation, + # that will match part by part the given constant. + # + # const_regexp("Foo::Bar::Baz") # => "Foo(::Bar(::Baz)?)?" + # const_regexp("::") # => "::" + # + # source://activesupport//lib/active_support/inflector/methods.rb#357 + def const_regexp(camel_cased_word); end +end + +# source://activesupport//lib/active_support/inflector/transliterate.rb#8 +ActiveSupport::Inflector::ALLOWED_ENCODINGS_FOR_TRANSLITERATE = T.let(T.unsafe(nil), Array) + +# = Active Support \Inflections +# +# A singleton instance of this class is yielded by Inflector.inflections, +# which can then be used to specify additional inflection rules. If passed +# an optional locale, rules for other languages can be specified. The +# default locale is :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 'cactus', 'cacti' +# +# inflect.uncountable 'equipment' +# end +# +# New rules are added at the top. So in the example above, the irregular +# rule for cactus will now be the first of the pluralization and +# singularization rules that is runs. This guarantees that your rules run +# before any of the rules that may already have been loaded. +# +# source://activesupport//lib/active_support/inflector/inflections.rb#30 +class ActiveSupport::Inflector::Inflections + # @return [Inflections] a new instance of Inflections + # + # source://activesupport//lib/active_support/inflector/inflections.rb#80 + def initialize; end + + # Specifies a new acronym. An acronym must be specified as it will appear + # in a camelized string. An underscore string that contains the acronym + # will retain the acronym when passed to +camelize+, +humanize+, or + # +titleize+. A camelized string that contains the acronym will maintain + # the acronym when titleized or humanized, and will convert the acronym + # into a non-delimited single lowercase word when passed to +underscore+. + # + # acronym 'HTML' + # titleize 'html' # => 'HTML' + # camelize 'html' # => 'HTML' + # underscore 'MyHTML' # => 'my_html' + # + # The acronym, however, must occur as a delimited unit and not be part of + # another word for conversions to recognize it: + # + # acronym 'HTTP' + # camelize 'my_http_delimited' # => 'MyHTTPDelimited' + # camelize 'https' # => 'Https', not 'HTTPs' + # underscore 'HTTPS' # => 'http_s', not 'https' + # + # acronym 'HTTPS' + # camelize 'https' # => 'HTTPS' + # underscore 'HTTPS' # => 'https' + # + # Note: Acronyms that are passed to +pluralize+ will no longer be + # recognized, since the acronym will not occur as a delimited unit in the + # pluralized result. To work around this, you must specify the pluralized + # form as an acronym as well: + # + # acronym 'API' + # camelize(pluralize('api')) # => 'Apis' + # + # acronym 'APIs' + # camelize(pluralize('api')) # => 'APIs' + # + # +acronym+ may be used to specify any word that contains an acronym or + # otherwise needs to maintain a non-standard capitalization. The only + # restriction is that the word must begin with a capital letter. + # + # acronym 'RESTful' + # underscore 'RESTful' # => 'restful' + # underscore 'RESTfulController' # => 'restful_controller' + # titleize 'RESTfulController' # => 'RESTful Controller' + # camelize 'restful' # => 'RESTful' + # camelize 'restful_controller' # => 'RESTfulController' + # + # acronym 'McDonald' + # underscore 'McDonald' # => 'mcdonald' + # camelize 'mcdonald' # => 'McDonald' + # + # source://activesupport//lib/active_support/inflector/inflections.rb#142 + def acronym(word); end + + # Returns the value of attribute acronyms. + # + # source://activesupport//lib/active_support/inflector/inflections.rb#76 + def acronyms; end + + # source://activesupport//lib/active_support/inflector/inflections.rb#78 + def acronyms_camelize_regex; end + + # source://activesupport//lib/active_support/inflector/inflections.rb#78 + def acronyms_underscore_regex; end + + # Clears the loaded inflections within a given scope (default is + # :all). Give the scope as a symbol of the inflection type, the + # options are: :plurals, :singulars, :uncountables, + # :humans, :acronyms. + # + # clear :all + # clear :plurals + # + # source://activesupport//lib/active_support/inflector/inflections.rb#231 + def clear(scope = T.unsafe(nil)); end + + # Specifies a humanized form of a string by a regular expression rule or + # by a string mapping. When using a regular expression based replacement, + # the normal humanize formatting is called after the replacement. When a + # string is used, the human form should be specified as desired (example: + # 'The name', not 'the_name'). + # + # human /_cnt$/i, '\1_count' + # human 'legacy_col_person_name', 'Name' + # + # source://activesupport//lib/active_support/inflector/inflections.rb#220 + def human(rule, replacement); end + + # Returns the value of attribute humans. + # + # source://activesupport//lib/active_support/inflector/inflections.rb#76 + def humans; end + + # Specifies a new irregular that applies to both pluralization and + # singularization at the same time. This can only be used for strings, not + # regular expressions. You simply pass the irregular in singular and + # plural form. + # + # irregular 'cactus', 'cacti' + # irregular 'person', 'people' + # + # source://activesupport//lib/active_support/inflector/inflections.rb#174 + def irregular(singular, plural); end + + # Specifies a new pluralization rule and its replacement. The rule can + # either be a string or a regular expression. The replacement should + # always be a string that may include references to the matched data from + # the rule. + # + # source://activesupport//lib/active_support/inflector/inflections.rb#151 + def plural(rule, replacement); end + + # Returns the value of attribute plurals. + # + # source://activesupport//lib/active_support/inflector/inflections.rb#76 + def plurals; end + + # Specifies a new singularization rule and its replacement. The rule can + # either be a string or a regular expression. The replacement should + # always be a string that may include references to the matched data from + # the rule. + # + # source://activesupport//lib/active_support/inflector/inflections.rb#161 + def singular(rule, replacement); end + + # Returns the value of attribute singulars. + # + # source://activesupport//lib/active_support/inflector/inflections.rb#76 + def singulars; end + + # Specifies words that are uncountable and should not be inflected. + # + # uncountable 'money' + # uncountable 'money', 'information' + # uncountable %w( money information rice ) + # + # source://activesupport//lib/active_support/inflector/inflections.rb#208 + def uncountable(*words); end + + # Returns the value of attribute uncountables. + # + # source://activesupport//lib/active_support/inflector/inflections.rb#76 + def uncountables; end + + private + + # source://activesupport//lib/active_support/inflector/inflections.rb#250 + def define_acronym_regex_patterns; end + + # Private, for the test suite. + # + # source://activesupport//lib/active_support/inflector/inflections.rb#86 + def initialize_dup(orig); end + + class << self + # source://activesupport//lib/active_support/inflector/inflections.rb#65 + def instance(locale = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/inflector/inflections.rb#69 + def instance_or_fallback(locale); end + end +end + +# source://activesupport//lib/active_support/inflector/inflections.rb#33 +class ActiveSupport::Inflector::Inflections::Uncountables < ::Array + # @return [Uncountables] a new instance of Uncountables + # + # source://activesupport//lib/active_support/inflector/inflections.rb#34 + def initialize; end + + # source://activesupport//lib/active_support/inflector/inflections.rb#44 + def <<(*word); end + + # source://activesupport//lib/active_support/inflector/inflections.rb#48 + def add(words); end + + # source://activesupport//lib/active_support/inflector/inflections.rb#39 + def delete(entry); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/inflector/inflections.rb#55 + def uncountable?(str); end + + private + + # source://activesupport//lib/active_support/inflector/inflections.rb#60 + def to_regex(string); end +end + +# = Inheritable Options +# +# +InheritableOptions+ provides a constructor to build an OrderedOptions +# hash inherited from another hash. +# +# Use this if you already have some hash and you want to create a new one based on it. +# +# h = ActiveSupport::InheritableOptions.new({ girl: 'Mary', boy: 'John' }) +# h.girl # => 'Mary' +# h.boy # => 'John' +# +# If the existing hash has string keys, call Hash#symbolize_keys on it. +# +# h = ActiveSupport::InheritableOptions.new({ 'girl' => 'Mary', 'boy' => 'John' }.symbolize_keys) +# h.girl # => 'Mary' +# h.boy # => 'John' +# +# source://activesupport//lib/active_support/ordered_options.rb#89 +class ActiveSupport::InheritableOptions < ::ActiveSupport::OrderedOptions + # @return [InheritableOptions] a new instance of InheritableOptions + # + # source://activesupport//lib/active_support/ordered_options.rb#90 + def initialize(parent = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/ordered_options.rb#107 + def ==(other); end + + # source://activesupport//lib/active_support/ordered_options.rb#142 + def each(&block); end + + # source://activesupport//lib/active_support/ordered_options.rb#134 + def inheritable_copy; end + + # source://activesupport//lib/active_support/ordered_options.rb#111 + def inspect; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/ordered_options.rb#126 + def key?(key); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/ordered_options.rb#130 + def overridden?(key); end + + # source://activesupport//lib/active_support/ordered_options.rb#119 + def pretty_print(pp); end + + # source://activesupport//lib/active_support/ordered_options.rb#138 + def to_a; end + + # source://activesupport//lib/active_support/ordered_options.rb#103 + def to_h; end + + # source://activesupport//lib/active_support/ordered_options.rb#115 + def to_s; end + + private + + def own_key?(_arg0); end +end + +# source://activesupport//lib/active_support/isolated_execution_state.rb#4 +module ActiveSupport::IsolatedExecutionState + class << self + # source://activesupport//lib/active_support/isolated_execution_state.rb#35 + def [](key); end + + # source://activesupport//lib/active_support/isolated_execution_state.rb#39 + def []=(key, value); end + + # source://activesupport//lib/active_support/isolated_execution_state.rb#51 + def clear; end + + # source://activesupport//lib/active_support/isolated_execution_state.rb#55 + def context; end + + # source://activesupport//lib/active_support/isolated_execution_state.rb#47 + def delete(key); end + + # Returns the value of attribute isolation_level. + # + # source://activesupport//lib/active_support/isolated_execution_state.rb#11 + def isolation_level; end + + # source://activesupport//lib/active_support/isolated_execution_state.rb#13 + def isolation_level=(level); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/isolated_execution_state.rb#43 + def key?(key); end + + # Returns the value of attribute scope. + # + # source://activesupport//lib/active_support/isolated_execution_state.rb#11 + def scope; end + + # source://activesupport//lib/active_support/isolated_execution_state.rb#59 + def share_with(other); end + + # source://activesupport//lib/active_support/isolated_execution_state.rb#31 + def unique_id; end + + private + + # source://activesupport//lib/active_support/isolated_execution_state.rb#67 + def state; end + end +end + +# source://activesupport//lib/active_support/json/decoding.rb#11 +module ActiveSupport::JSON + class << self + # Parses a JSON string (JavaScript Object Notation) into a hash. + # See http://www.json.org for more info. + # + # ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}") + # => {"team" => "rails", "players" => "36"} + # + # source://activesupport//lib/active_support/json/decoding.rb#22 + def decode(json); end + + # source://activesupport//lib/active_support/json/encoding.rb#22 + def dump(value, options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/json/encoding.rb#22 + def encode(value, options = T.unsafe(nil)); end + + # Parses a JSON string (JavaScript Object Notation) into a hash. + # See http://www.json.org for more info. + # + # ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}") + # => {"team" => "rails", "players" => "36"} + # + # source://activesupport//lib/active_support/json/decoding.rb#22 + def load(json); end + + # Returns the class of the error that will be raised when there is an + # error in decoding JSON. Using this method means you won't directly + # depend on the ActiveSupport's JSON implementation, in case it changes + # in the future. + # + # begin + # obj = ActiveSupport::JSON.decode(some_string) + # rescue ActiveSupport::JSON.parse_error + # Rails.logger.warn("Attempted to decode invalid JSON: #{some_string}") + # end + # + # source://activesupport//lib/active_support/json/decoding.rb#43 + def parse_error; end + + private + + # source://activesupport//lib/active_support/json/decoding.rb#48 + def convert_dates_from(data); end + end +end + +# source://activesupport//lib/active_support/json/decoding.rb#14 +ActiveSupport::JSON::DATETIME_REGEX = T.let(T.unsafe(nil), Regexp) + +# matches YAML-formatted dates +# +# source://activesupport//lib/active_support/json/decoding.rb#13 +ActiveSupport::JSON::DATE_REGEX = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/json/encoding.rb#28 +module ActiveSupport::JSON::Encoding + class << self + # If true, encode >, <, & as escaped unicode sequences (e.g. > as \u003e) + # as a safety measure. + # + # source://activesupport//lib/active_support/json/encoding.rb#103 + def escape_html_entities_in_json; end + + # If true, encode >, <, & as escaped unicode sequences (e.g. > as \u003e) + # as a safety measure. + # + # source://activesupport//lib/active_support/json/encoding.rb#103 + def escape_html_entities_in_json=(_arg0); end + + # Sets the encoder used by \Rails to encode Ruby objects into JSON strings + # in +Object#to_json+ and +ActiveSupport::JSON.encode+. + # + # source://activesupport//lib/active_support/json/encoding.rb#111 + def json_encoder; end + + # Sets the encoder used by \Rails to encode Ruby objects into JSON strings + # in +Object#to_json+ and +ActiveSupport::JSON.encode+. + # + # source://activesupport//lib/active_support/json/encoding.rb#111 + def json_encoder=(_arg0); end + + # Sets the precision of encoded time values. + # Defaults to 3 (equivalent to millisecond precision) + # + # source://activesupport//lib/active_support/json/encoding.rb#107 + def time_precision; end + + # Sets the precision of encoded time values. + # Defaults to 3 (equivalent to millisecond precision) + # + # source://activesupport//lib/active_support/json/encoding.rb#107 + def time_precision=(_arg0); end + + # If true, use ISO 8601 format for dates and times. Otherwise, fall back + # to the Active Support legacy format. + # + # source://activesupport//lib/active_support/json/encoding.rb#99 + def use_standard_json_time_format; end + + # If true, use ISO 8601 format for dates and times. Otherwise, fall back + # to the Active Support legacy format. + # + # source://activesupport//lib/active_support/json/encoding.rb#99 + def use_standard_json_time_format=(_arg0); end + end +end + +# source://activesupport//lib/active_support/json/encoding.rb#29 +class ActiveSupport::JSON::Encoding::JSONGemEncoder + # @return [JSONGemEncoder] a new instance of JSONGemEncoder + # + # source://activesupport//lib/active_support/json/encoding.rb#32 + def initialize(options = T.unsafe(nil)); end + + # Encode the given object into a JSON string + # + # source://activesupport//lib/active_support/json/encoding.rb#37 + def encode(value); end + + # Returns the value of attribute options. + # + # source://activesupport//lib/active_support/json/encoding.rb#30 + def options; end + + private + + # Convert an object into a "JSON-ready" representation composed of + # primitives like Hash, Array, String, Symbol, Numeric, + # and +true+/+false+/+nil+. + # Recursively calls #as_json to the object to recursively build a + # fully JSON-ready object. + # + # This allows developers to implement #as_json without having to + # worry about what base types of objects they are allowed to return + # or having to remember to call #as_json recursively. + # + # Note: the +options+ hash passed to +object.to_json+ is only passed + # to +object.as_json+, not any of this method's recursive +#as_json+ + # calls. + # + # source://activesupport//lib/active_support/json/encoding.rb#70 + def jsonify(value); end + + # Encode a "jsonified" Ruby data structure using the JSON gem + # + # source://activesupport//lib/active_support/json/encoding.rb#91 + def stringify(jsonified); end +end + +# = Key Generator +# +# KeyGenerator is a simple wrapper around OpenSSL's implementation of PBKDF2. +# It can be used to derive a number of keys for various purposes from a given secret. +# This lets \Rails applications have a single secure secret, but avoid reusing that +# key in multiple incompatible contexts. +# +# source://activesupport//lib/active_support/key_generator.rb#13 +class ActiveSupport::KeyGenerator + # @return [KeyGenerator] a new instance of KeyGenerator + # + # source://activesupport//lib/active_support/key_generator.rb#28 + def initialize(secret, options = T.unsafe(nil)); end + + # Returns a derived key suitable for use. The default +key_size+ is chosen + # to be compatible with the default settings of ActiveSupport::MessageVerifier. + # i.e. OpenSSL::Digest::SHA1#block_length + # + # source://activesupport//lib/active_support/key_generator.rb#41 + def generate_key(salt, key_size = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/key_generator.rb#45 + def inspect; end + + class << self + # source://activesupport//lib/active_support/key_generator.rb#23 + def hash_digest_class; end + + # source://activesupport//lib/active_support/key_generator.rb#15 + def hash_digest_class=(klass); end + end +end + +# = Lazy Load Hooks +# +# LazyLoadHooks allows \Rails to lazily load a lot of components and thus +# making the app boot faster. Because of this feature now there is no need to +# require +ActiveRecord::Base+ at boot time purely to apply +# configuration. Instead a hook is registered that applies configuration once +# +ActiveRecord::Base+ is loaded. Here +ActiveRecord::Base+ is +# used as example but this feature can be applied elsewhere too. +# +# Here is an example where on_load method is called to register a hook. +# +# initializer 'active_record.initialize_timezone' do +# ActiveSupport.on_load(:active_record) do +# self.time_zone_aware_attributes = true +# self.default_timezone = :utc +# end +# end +# +# When the entirety of +ActiveRecord::Base+ has been +# evaluated then run_load_hooks is invoked. The very last line of +# +ActiveRecord::Base+ is: +# +# ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base) +# +# run_load_hooks will then execute all the hooks that were registered +# with the on_load method. In the case of the above example, it will +# execute the block of code that is in the +initializer+. +# +# Registering a hook that has already run results in that hook executing +# immediately. This allows hooks to be nested for code that relies on +# multiple lazily loaded components: +# +# initializer "action_text.renderer" do +# ActiveSupport.on_load(:action_controller_base) do +# ActiveSupport.on_load(:action_text_content) do +# self.default_renderer = Class.new(ActionController::Base).renderer +# end +# end +# end +# +# source://activesupport//lib/active_support/lazy_load_hooks.rb#43 +module ActiveSupport::LazyLoadHooks + # Declares a block that will be executed when a \Rails component is fully + # loaded. If the component has already loaded, the block is executed + # immediately. + # + # Options: + # + # * :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#60 + def on_load(name, options = T.unsafe(nil), &block); end + + # Executes all blocks registered to +name+ via on_load, using +base+ as the + # evaluation context. + # + # ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base) + # + # In the case of the above example, it will execute all hooks registered + # for +:active_record+ within the class +ActiveRecord::Base+. + # + # source://activesupport//lib/active_support/lazy_load_hooks.rb#75 + def run_load_hooks(name, base = T.unsafe(nil)); end + + private + + # source://activesupport//lib/active_support/lazy_load_hooks.rb#91 + def execute_hook(name, base, options, block); end + + # source://activesupport//lib/active_support/lazy_load_hooks.rb#83 + def with_execution_control(name, block, once); end + + class << self + # source://activesupport//lib/active_support/lazy_load_hooks.rb#44 + def extended(base); end + end +end + +# = Active Support Log \Subscriber +# +# +ActiveSupport::LogSubscriber+ is an object set to consume +# ActiveSupport::Notifications with the sole purpose of logging them. +# The log subscriber dispatches notifications to a registered object based +# on its given namespace. +# +# An example would be Active Record log subscriber responsible for logging +# queries: +# +# module ActiveRecord +# class LogSubscriber < ActiveSupport::LogSubscriber +# attach_to :active_record +# +# def sql(event) +# info "#{event.payload[:name]} (#{event.duration}) #{event.payload[:sql]}" +# end +# end +# end +# +# ActiveRecord::LogSubscriber.logger must be set as well, but it is assigned +# automatically in a \Rails environment. +# +# After configured, whenever a "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 +# +# +ActiveSupport::LogSubscriber+ also has some helpers to deal with +# logging. For example, ActiveSupport::LogSubscriber.flush_all! will ensure +# that all logs are flushed, and it is called in Rails::Rack::Logger after a +# request finishes. +# +# source://activesupport//lib/active_support/log_subscriber.rb#64 +class ActiveSupport::LogSubscriber < ::ActiveSupport::Subscriber + # @return [LogSubscriber] a new instance of LogSubscriber + # + # source://activesupport//lib/active_support/log_subscriber.rb#133 + def initialize; end + + # source://activesupport//lib/active_support/log_subscriber.rb#146 + def call(event); end + + # source://activesupport//lib/active_support/log_subscriber.rb#83 + def colorize_logging; end + + # source://activesupport//lib/active_support/log_subscriber.rb#83 + def colorize_logging=(val); end + + # source://activesupport//lib/active_support/log_subscriber.rb#163 + def debug(progname = T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/log_subscriber.rb#163 + def error(progname = T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/log_subscriber.rb#158 + def event_levels=(_arg0); end + + # source://activesupport//lib/active_support/log_subscriber.rb#163 + def fatal(progname = T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/log_subscriber.rb#163 + def info(progname = T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/log_subscriber.rb#138 + def logger; end + + # source://activesupport//lib/active_support/log_subscriber.rb#152 + def publish_event(event); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/log_subscriber.rb#142 + def silenced?(event); end + + # source://activesupport//lib/active_support/log_subscriber.rb#163 + def unknown(progname = T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/log_subscriber.rb#163 + def warn(progname = T.unsafe(nil), &block); end + + private + + # Set color by using a symbol or one of the defined constants. Set modes + # by specifying bold, italic, or underline options. Inspired by Highline, + # this method will automatically clear formatting at the end of the returned String. + # + # source://activesupport//lib/active_support/log_subscriber.rb#172 + def color(text, color, mode_options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/log_subscriber.rb#186 + def log_exception(name, e); end + + # source://activesupport//lib/active_support/log_subscriber.rb#180 + def mode_from(options); end + + class << self + # source://activesupport//lib/active_support/log_subscriber.rb#99 + def attach_to(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/log_subscriber.rb#83 + def colorize_logging; end + + # source://activesupport//lib/active_support/log_subscriber.rb#83 + def colorize_logging=(val); end + + # Flush all log_subscribers' logger. + # + # source://activesupport//lib/active_support/log_subscriber.rb#112 + def flush_all!; end + + # source://activesupport//lib/active_support/class_attribute.rb#12 + def log_levels; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def log_levels=(new_value); end + + # source://activesupport//lib/active_support/log_subscriber.rb#84 + def log_levels?; end + + # source://activesupport//lib/active_support/log_subscriber.rb#107 + def log_subscribers; end + + # source://activesupport//lib/active_support/log_subscriber.rb#93 + def logger; end + + # Sets the attribute logger + # + # @param value the value to set the attribute logger to. + # + # source://activesupport//lib/active_support/log_subscriber.rb#105 + def logger=(_arg0); end + + private + + # source://activesupport//lib/active_support/log_subscriber.rb#117 + def fetch_public_methods(subscriber, inherit_all); end + + # source://activesupport//lib/active_support/log_subscriber.rb#121 + def set_event_levels; end + + # source://activesupport//lib/active_support/log_subscriber.rb#127 + def subscribe_log_level(method, level); end + end +end + +# ANSI sequence colors +# +# source://activesupport//lib/active_support/log_subscriber.rb#74 +ActiveSupport::LogSubscriber::BLACK = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/log_subscriber.rb#78 +ActiveSupport::LogSubscriber::BLUE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/log_subscriber.rb#80 +ActiveSupport::LogSubscriber::CYAN = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/log_subscriber.rb#76 +ActiveSupport::LogSubscriber::GREEN = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/log_subscriber.rb#86 +ActiveSupport::LogSubscriber::LEVEL_CHECKS = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/log_subscriber.rb#79 +ActiveSupport::LogSubscriber::MAGENTA = T.let(T.unsafe(nil), String) + +# ANSI sequence modes +# +# source://activesupport//lib/active_support/log_subscriber.rb#66 +ActiveSupport::LogSubscriber::MODES = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/log_subscriber.rb#75 +ActiveSupport::LogSubscriber::RED = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/log_subscriber.rb#81 +ActiveSupport::LogSubscriber::WHITE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/log_subscriber.rb#77 +ActiveSupport::LogSubscriber::YELLOW = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/logger.rb#8 +class ActiveSupport::Logger < ::Logger + include ::ActiveSupport::LoggerSilence + include ::ActiveSupport::LoggerThreadSafeLevel + + # @return [Logger] a new instance of Logger + # + # source://activesupport//lib/active_support/logger.rb#33 + def initialize(*args, **kwargs); end + + # source://activesupport//lib/active_support/logger_silence.rb#12 + def silencer; end + + # source://activesupport//lib/active_support/logger_silence.rb#12 + def silencer=(val); end + + class << self + # Returns true if the logger destination matches one of the sources + # + # logger = Logger.new(STDOUT) + # ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT) + # # => true + # + # logger = Logger.new('/var/log/rails.log') + # ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log') + # # => true + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/logger.rb#20 + def logger_outputs_to?(logger, *sources); end + + # source://activesupport//lib/active_support/logger.rb#47 + def normalize_sources(sources); end + + # source://activesupport//lib/active_support/logger_silence.rb#12 + def silencer; end + + # source://activesupport//lib/active_support/logger_silence.rb#12 + def silencer=(val); end + end +end + +# Simple formatter which only displays the message. +# +# source://activesupport//lib/active_support/logger.rb#39 +class ActiveSupport::Logger::SimpleFormatter < ::Logger::Formatter + # This method is invoked when a log event occurs + # + # source://activesupport//lib/active_support/logger.rb#41 + def call(severity, timestamp, progname, msg); end +end + +# source://activesupport//lib/active_support/logger_silence.rb#8 +module ActiveSupport::LoggerSilence + extend ::ActiveSupport::Concern + include ::ActiveSupport::LoggerThreadSafeLevel + + # Silences the logger for the duration of the block. + # + # source://activesupport//lib/active_support/logger_silence.rb#17 + def silence(severity = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/logger_thread_safe_level.rb#7 +module ActiveSupport::LoggerThreadSafeLevel + extend ::ActiveSupport::Concern + + # source://activesupport//lib/active_support/logger_thread_safe_level.rb#30 + def level; end + + # source://activesupport//lib/active_support/logger_thread_safe_level.rb#10 + def local_level; end + + # source://activesupport//lib/active_support/logger_thread_safe_level.rb#14 + def local_level=(level); end + + # Change the thread-local level for the duration of the given block. + # + # source://activesupport//lib/active_support/logger_thread_safe_level.rb#35 + def log_at(level); end + + private + + # source://activesupport//lib/active_support/logger_thread_safe_level.rb#43 + def local_level_key; end +end + +# = Active Support Message Encryptor +# +# MessageEncryptor is a simple way to encrypt values which get stored +# somewhere you don't trust. +# +# The cipher text and initialization vector are base64 encoded and returned +# to you. +# +# This can be used in situations similar to the MessageVerifier, but +# where you don't want users to be able to determine the value of the payload. +# +# len = ActiveSupport::MessageEncryptor.key_len +# salt = SecureRandom.random_bytes(len) +# key = ActiveSupport::KeyGenerator.new('password').generate_key(salt, len) # => "\x89\xE0\x156\xAC..." +# crypt = ActiveSupport::MessageEncryptor.new(key) # => # +# encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..." +# crypt.decrypt_and_verify(encrypted_data) # => "my secret data" +# +# The +decrypt_and_verify+ method will raise an +# +ActiveSupport::MessageEncryptor::InvalidMessage+ exception if the data +# provided cannot be decrypted or verified. +# +# crypt.decrypt_and_verify('not encrypted data') # => ActiveSupport::MessageEncryptor::InvalidMessage +# +# === Confining messages to a specific purpose +# +# By default any message can be used throughout your app. But they can also be +# confined to a specific +:purpose+. +# +# token = crypt.encrypt_and_sign("this is the chair", purpose: :login) +# +# Then that same purpose must be passed when verifying to get the data back out: +# +# crypt.decrypt_and_verify(token, purpose: :login) # => "this is the chair" +# crypt.decrypt_and_verify(token, purpose: :shipping) # => nil +# crypt.decrypt_and_verify(token) # => nil +# +# Likewise, if a message has no purpose it won't be returned when verifying with +# a specific purpose. +# +# token = crypt.encrypt_and_sign("the conversation is lively") +# crypt.decrypt_and_verify(token, purpose: :scare_tactics) # => nil +# crypt.decrypt_and_verify(token) # => "the conversation is lively" +# +# === Making messages expire +# +# By default messages last forever and verifying one year from now will still +# return the original value. But messages can be set to expire at a given +# time with +:expires_in+ or +:expires_at+. +# +# crypt.encrypt_and_sign(parcel, expires_in: 1.month) +# crypt.encrypt_and_sign(doowad, expires_at: Time.now.end_of_year) +# +# Then the messages can be verified and returned up to the expire time. +# Thereafter, verifying returns +nil+. +# +# === Rotating keys +# +# MessageEncryptor also supports rotating out old configurations by falling +# back to a stack of encryptors. Call +rotate+ to build and add an encryptor +# so +decrypt_and_verify+ will also try the fallback. +# +# By default any rotated encryptors use the values of the primary +# encryptor unless specified otherwise. +# +# You'd give your encryptor the new defaults: +# +# crypt = ActiveSupport::MessageEncryptor.new(@secret, cipher: "aes-256-gcm") +# +# Then gradually rotate the old values out by adding them as fallbacks. Any message +# generated with the old values will then work until the rotation is removed. +# +# crypt.rotate old_secret # Fallback to an old secret instead of @secret. +# crypt.rotate cipher: "aes-256-cbc" # Fallback to an old cipher instead of aes-256-gcm. +# +# Though if both the secret and the cipher was changed at the same time, +# the above should be combined into: +# +# crypt.rotate old_secret, cipher: "aes-256-cbc" +# +# source://activesupport//lib/active_support/message_encryptor.rb#90 +class ActiveSupport::MessageEncryptor < ::ActiveSupport::Messages::Codec + include ::ActiveSupport::Messages::Rotator + + # Initialize a new MessageEncryptor. +secret+ must be at least as long as + # the cipher key size. For the default 'aes-256-gcm' cipher, this is 256 + # bits. If you are using a user-entered secret, you can generate a suitable + # key by using ActiveSupport::KeyGenerator or a similar key + # derivation function. + # + # The first additional parameter is used as the signature key for + # MessageVerifier. This allows you to specify keys to encrypt and sign + # data. Ignored when using an AEAD cipher like 'aes-256-gcm'. + # + # ActiveSupport::MessageEncryptor.new('secret', 'signature_secret') + # + # ==== Options + # + # [+:cipher+] + # Cipher to use. Can be any cipher returned by +OpenSSL::Cipher.ciphers+. + # Default is 'aes-256-gcm'. + # + # [+:digest+] + # Digest used for signing. Ignored when using an AEAD cipher like + # 'aes-256-gcm'. + # + # [+:serializer+] + # The serializer used to serialize message data. You can specify any + # object that responds to +dump+ and +load+, or you can choose from + # several preconfigured serializers: +:marshal+, +:json_allow_marshal+, + # +:json+, +:message_pack_allow_marshal+, +:message_pack+. + # + # The preconfigured serializers include a fallback mechanism to support + # multiple deserialization formats. For example, the +:marshal+ serializer + # will serialize using +Marshal+, but can deserialize using +Marshal+, + # ActiveSupport::JSON, or ActiveSupport::MessagePack. This makes it easy + # to migrate between serializers. + # + # The +:marshal+, +:json_allow_marshal+, and +:message_pack_allow_marshal+ + # serializers support deserializing using +Marshal+, but the others do + # not. Beware that +Marshal+ is a potential vector for deserialization + # attacks in cases where a message signing secret has been leaked. If + # possible, choose a serializer that does not support +Marshal+. + # + # The +:message_pack+ and +:message_pack_allow_marshal+ serializers use + # ActiveSupport::MessagePack, which can roundtrip some Ruby types that are + # not supported by JSON, and may provide improved performance. However, + # these require the +msgpack+ gem. + # + # When using \Rails, the default depends on +config.active_support.message_serializer+. + # Otherwise, the default is +:marshal+. + # + # [+:url_safe+] + # By default, MessageEncryptor generates RFC 4648 compliant strings + # which are not URL-safe. In other words, they can contain "+" and "/". + # If you want to generate URL-safe strings (in compliance with "Base 64 + # Encoding with URL and Filename Safe Alphabet" in RFC 4648), you can + # pass +true+. + # + # [+:force_legacy_metadata_serializer+] + # Whether to use the legacy metadata serializer, which serializes the + # message first, then wraps it in an envelope which is also serialized. This + # was the default in \Rails 7.0 and below. + # + # If you don't pass a truthy value, the default is set using + # +config.active_support.use_message_serializer_for_metadata+. + # + # @return [MessageEncryptor] a new instance of MessageEncryptor + # + # source://activesupport//lib/active_support/messages/rotator.rb#6 + def initialize(*args, on_rotation: T.unsafe(nil), **options); end + + # source://activesupport//lib/active_support/message_encryptor.rb#256 + def create_message(value, **options); end + + # Decrypt and verify a message. We need to verify the message in order to + # avoid padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/. + # + # ==== Options + # + # [+:purpose+] + # The purpose that the message was generated with. If the purpose does not + # match, +decrypt_and_verify+ will return +nil+. + # + # message = encryptor.encrypt_and_sign("hello", purpose: "greeting") + # encryptor.decrypt_and_verify(message, purpose: "greeting") # => "hello" + # encryptor.decrypt_and_verify(message) # => nil + # + # message = encryptor.encrypt_and_sign("bye") + # encryptor.decrypt_and_verify(message) # => "bye" + # encryptor.decrypt_and_verify(message, purpose: "greeting") # => nil + # + # source://activesupport//lib/active_support/message_encryptor.rb#241 + def decrypt_and_verify(message, **options); end + + # Encrypt and sign a message. We need to sign the message in order to avoid + # padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/. + # + # ==== Options + # + # [+:expires_at+] + # The datetime at which the message expires. After this datetime, + # verification of the message will fail. + # + # message = encryptor.encrypt_and_sign("hello", expires_at: Time.now.tomorrow) + # encryptor.decrypt_and_verify(message) # => "hello" + # # 24 hours later... + # encryptor.decrypt_and_verify(message) # => nil + # + # [+:expires_in+] + # The duration for which the message is valid. After this duration has + # elapsed, verification of the message will fail. + # + # message = encryptor.encrypt_and_sign("hello", expires_in: 24.hours) + # encryptor.decrypt_and_verify(message) # => "hello" + # # 24 hours later... + # encryptor.decrypt_and_verify(message) # => nil + # + # [+:purpose+] + # The purpose of the message. If specified, the same purpose must be + # specified when verifying the message; otherwise, verification will fail. + # (See #decrypt_and_verify.) + # + # source://activesupport//lib/active_support/message_encryptor.rb#220 + def encrypt_and_sign(value, **options); end + + # source://activesupport//lib/active_support/message_encryptor.rb#264 + def inspect; end + + # source://activesupport//lib/active_support/messages/rotator.rb#23 + def read_message(message, on_rotation: T.unsafe(nil), **options); end + + private + + # Returns the value of attribute aead_mode. + # + # source://activesupport//lib/active_support/message_encryptor.rb#371 + def aead_mode; end + + # Returns the value of attribute aead_mode. + # + # source://activesupport//lib/active_support/message_encryptor.rb#371 + def aead_mode?; end + + # source://activesupport//lib/active_support/message_encryptor.rb#295 + def decrypt(encrypted_message); end + + # source://activesupport//lib/active_support/message_encryptor.rb#277 + def encrypt(data); end + + # source://activesupport//lib/active_support/message_encryptor.rb#340 + def extract_part(encrypted_message, rindex, length); end + + # source://activesupport//lib/active_support/message_encryptor.rb#350 + def extract_parts(encrypted_message); end + + # source://activesupport//lib/active_support/message_encryptor.rb#336 + def join_parts(parts); end + + # source://activesupport//lib/active_support/message_encryptor.rb#320 + def length_after_encode(length_before_encode); end + + # source://activesupport//lib/active_support/message_encryptor.rb#332 + def length_of_encoded_auth_tag; end + + # source://activesupport//lib/active_support/message_encryptor.rb#328 + def length_of_encoded_iv; end + + # source://activesupport//lib/active_support/message_encryptor.rb#367 + def new_cipher; end + + # source://activesupport//lib/active_support/message_encryptor.rb#269 + def sign(data); end + + # source://activesupport//lib/active_support/message_encryptor.rb#273 + def verify(data); end + + class << self + # source://activesupport//lib/active_support/message_encryptor.rb#96 + def default_cipher; end + + # Given a cipher, returns the key length of the cipher to help generate the key of desired size + # + # source://activesupport//lib/active_support/message_encryptor.rb#252 + def key_len(cipher = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/message_encryptor.rb#93 + def use_authenticated_message_encryption; end + + # source://activesupport//lib/active_support/message_encryptor.rb#93 + def use_authenticated_message_encryption=(val); end + end +end + +# source://activesupport//lib/active_support/message_encryptor.rb#118 +ActiveSupport::MessageEncryptor::AUTH_TAG_LENGTH = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/message_encryptor.rb#115 +class ActiveSupport::MessageEncryptor::InvalidMessage < ::StandardError; end + +# source://activesupport//lib/active_support/message_encryptor.rb#105 +module ActiveSupport::MessageEncryptor::NullSerializer + class << self + # source://activesupport//lib/active_support/message_encryptor.rb#110 + def dump(value); end + + # source://activesupport//lib/active_support/message_encryptor.rb#106 + def load(value); end + end +end + +# source://activesupport//lib/active_support/message_encryptor.rb#116 +ActiveSupport::MessageEncryptor::OpenSSLCipherError = OpenSSL::Cipher::CipherError + +# source://activesupport//lib/active_support/message_encryptor.rb#119 +ActiveSupport::MessageEncryptor::SEPARATOR = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/message_encryptors.rb#6 +class ActiveSupport::MessageEncryptors < ::ActiveSupport::Messages::RotationCoordinator + private + + # source://activesupport//lib/active_support/message_encryptors.rb#135 + def build(salt, secret_generator:, secret_generator_options:, **options); end +end + +# = Active Support Message Verifier +# +# +MessageVerifier+ makes it easy to generate and verify messages which are +# signed to prevent tampering. +# +# In a \Rails application, you can use +Rails.application.message_verifier+ +# to manage unique instances of verifiers for each use case. +# {Learn more}[link:classes/Rails/Application.html#method-i-message_verifier]. +# +# This is useful for cases like remember-me tokens and auto-unsubscribe links +# where the session store isn't suitable or available. +# +# First, generate a signed message: +# cookies[:remember_me] = Rails.application.message_verifier(:remember_me).generate([@user.id, 2.weeks.from_now]) +# +# Later verify that message: +# +# id, time = Rails.application.message_verifier(:remember_me).verify(cookies[:remember_me]) +# if time.future? +# self.current_user = User.find(id) +# end +# +# === Signing is not encryption +# +# The signed messages are not encrypted. The payload is merely encoded (Base64 by default) and can be decoded by +# anyone. The signature is just assuring that the message wasn't tampered with. For example: +# +# message = Rails.application.message_verifier('my_purpose').generate('never put secrets here') +# # => "BAhJIhtuZXZlciBwdXQgc2VjcmV0cyBoZXJlBjoGRVQ=--a0c1c0827919da5e949e989c971249355735e140" +# Base64.decode64(message.split("--").first) # no key needed +# # => 'never put secrets here' +# +# If you also need to encrypt the contents, you must use ActiveSupport::MessageEncryptor instead. +# +# === Confine messages to a specific purpose +# +# It's not recommended to use the same verifier for different purposes in your application. +# Doing so could allow a malicious actor to re-use a signed message to perform an unauthorized +# action. +# You can reduce this risk by confining signed messages to a specific +:purpose+. +# +# token = @verifier.generate("signed message", purpose: :login) +# +# Then that same purpose must be passed when verifying to get the data back out: +# +# @verifier.verified(token, purpose: :login) # => "signed message" +# @verifier.verified(token, purpose: :shipping) # => nil +# @verifier.verified(token) # => nil +# +# @verifier.verify(token, purpose: :login) # => "signed message" +# @verifier.verify(token, purpose: :shipping) # => raises ActiveSupport::MessageVerifier::InvalidSignature +# @verifier.verify(token) # => raises ActiveSupport::MessageVerifier::InvalidSignature +# +# Likewise, if a message has no purpose it won't be returned when verifying with +# a specific purpose. +# +# token = @verifier.generate("signed message") +# @verifier.verified(token, purpose: :redirect) # => nil +# @verifier.verified(token) # => "signed message" +# +# @verifier.verify(token, purpose: :redirect) # => raises ActiveSupport::MessageVerifier::InvalidSignature +# @verifier.verify(token) # => "signed message" +# +# === Expiring messages +# +# By default messages last forever and verifying one year from now will still +# return the original value. But messages can be set to expire at a given +# time with +:expires_in+ or +:expires_at+. +# +# @verifier.generate("signed message", expires_in: 1.month) +# @verifier.generate("signed message", expires_at: Time.now.end_of_year) +# +# Messages can then be verified and returned until expiry. +# Thereafter, the +verified+ method returns +nil+ while +verify+ raises +# +ActiveSupport::MessageVerifier::InvalidSignature+. +# +# === Rotating keys +# +# MessageVerifier also supports rotating out old configurations by falling +# back to a stack of verifiers. Call +rotate+ to build and add a verifier so +# either +verified+ or +verify+ will also try verifying with the fallback. +# +# By default any rotated verifiers use the values of the primary +# verifier unless specified otherwise. +# +# You'd give your verifier the new defaults: +# +# verifier = ActiveSupport::MessageVerifier.new(@secret, digest: "SHA512", serializer: JSON) +# +# Then gradually rotate the old values out by adding them as fallbacks. Any message +# generated with the old values will then work until the rotation is removed. +# +# verifier.rotate(old_secret) # Fallback to an old secret instead of @secret. +# verifier.rotate(digest: "SHA256") # Fallback to an old digest instead of SHA512. +# verifier.rotate(serializer: Marshal) # Fallback to an old serializer instead of JSON. +# +# Though the above would most likely be combined into one rotation: +# +# verifier.rotate(old_secret, digest: "SHA256", serializer: Marshal) +# +# source://activesupport//lib/active_support/message_verifier.rb#110 +class ActiveSupport::MessageVerifier < ::ActiveSupport::Messages::Codec + include ::ActiveSupport::Messages::Rotator + + # Initialize a new MessageVerifier with a secret for the signature. + # + # ==== Options + # + # [+:digest+] + # Digest used for signing. The default is "SHA1". See + # +OpenSSL::Digest+ for alternatives. + # + # [+:serializer+] + # The serializer used to serialize message data. You can specify any + # object that responds to +dump+ and +load+, or you can choose from + # several preconfigured serializers: +:marshal+, +:json_allow_marshal+, + # +:json+, +:message_pack_allow_marshal+, +:message_pack+. + # + # The preconfigured serializers include a fallback mechanism to support + # multiple deserialization formats. For example, the +:marshal+ serializer + # will serialize using +Marshal+, but can deserialize using +Marshal+, + # ActiveSupport::JSON, or ActiveSupport::MessagePack. This makes it easy + # to migrate between serializers. + # + # The +:marshal+, +:json_allow_marshal+, and +:message_pack_allow_marshal+ + # serializers support deserializing using +Marshal+, but the others do + # not. Beware that +Marshal+ is a potential vector for deserialization + # attacks in cases where a message signing secret has been leaked. If + # possible, choose a serializer that does not support +Marshal+. + # + # The +:message_pack+ and +:message_pack_allow_marshal+ serializers use + # ActiveSupport::MessagePack, which can roundtrip some Ruby types that are + # not supported by JSON, and may provide improved performance. However, + # these require the +msgpack+ gem. + # + # When using \Rails, the default depends on +config.active_support.message_serializer+. + # Otherwise, the default is +:marshal+. + # + # [+:url_safe+] + # By default, MessageVerifier generates RFC 4648 compliant strings which are + # not URL-safe. In other words, they can contain "+" and "/". If you want to + # generate URL-safe strings (in compliance with "Base 64 Encoding with URL + # and Filename Safe Alphabet" in RFC 4648), you can pass +true+. + # + # [+:force_legacy_metadata_serializer+] + # Whether to use the legacy metadata serializer, which serializes the + # message first, then wraps it in an envelope which is also serialized. This + # was the default in \Rails 7.0 and below. + # + # If you don't pass a truthy value, the default is set using + # +config.active_support.use_message_serializer_for_metadata+. + # + # @raise [ArgumentError] + # @return [MessageVerifier] a new instance of MessageVerifier + # + # source://activesupport//lib/active_support/messages/rotator.rb#6 + def initialize(*args, on_rotation: T.unsafe(nil), **options); end + + # source://activesupport//lib/active_support/message_verifier.rb#308 + def create_message(value, **options); end + + # Generates a signed message for the provided value. + # + # The message is signed with the +MessageVerifier+'s secret. + # Returns Base64-encoded message joined with the generated signature. + # + # verifier = ActiveSupport::MessageVerifier.new("secret") + # verifier.generate("signed message") # => "BAhJIhNzaWduZWQgbWVzc2FnZQY6BkVU--f67d5f27c3ee0b8483cebf2103757455e947493b" + # + # ==== Options + # + # [+:expires_at+] + # The datetime at which the message expires. After this datetime, + # verification of the message will fail. + # + # message = verifier.generate("hello", expires_at: Time.now.tomorrow) + # verifier.verified(message) # => "hello" + # # 24 hours later... + # verifier.verified(message) # => nil + # verifier.verify(message) # => raises ActiveSupport::MessageVerifier::InvalidSignature + # + # [+:expires_in+] + # The duration for which the message is valid. After this duration has + # elapsed, verification of the message will fail. + # + # message = verifier.generate("hello", expires_in: 24.hours) + # verifier.verified(message) # => "hello" + # # 24 hours later... + # verifier.verified(message) # => nil + # verifier.verify(message) # => raises ActiveSupport::MessageVerifier::InvalidSignature + # + # [+:purpose+] + # The purpose of the message. If specified, the same purpose must be + # specified when verifying the message; otherwise, verification will fail. + # (See #verified and #verify.) + # + # source://activesupport//lib/active_support/message_verifier.rb#304 + def generate(value, **options); end + + # source://activesupport//lib/active_support/message_verifier.rb#316 + def inspect; end + + # source://activesupport//lib/active_support/messages/rotator.rb#23 + def read_message(message, on_rotation: T.unsafe(nil), **options); end + + # Checks if a signed message could have been generated by signing an object + # with the +MessageVerifier+'s secret. + # + # verifier = ActiveSupport::MessageVerifier.new("secret") + # signed_message = verifier.generate("signed message") + # verifier.valid_message?(signed_message) # => true + # + # tampered_message = signed_message.chop # editing the message invalidates the signature + # verifier.valid_message?(tampered_message) # => false + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/message_verifier.rb#181 + def valid_message?(message); end + + # Decodes the signed message using the +MessageVerifier+'s secret. + # + # verifier = ActiveSupport::MessageVerifier.new("secret") + # + # signed_message = verifier.generate("signed message") + # verifier.verified(signed_message) # => "signed message" + # + # Returns +nil+ if the message was not signed with the same secret. + # + # other_verifier = ActiveSupport::MessageVerifier.new("different_secret") + # other_verifier.verified(signed_message) # => nil + # + # Returns +nil+ if the message is not Base64-encoded. + # + # invalid_message = "f--46a0120593880c733a53b6dad75b42ddc1c8996d" + # verifier.verified(invalid_message) # => nil + # + # Raises any error raised while decoding the signed message. + # + # incompatible_message = "test--dad7b06c94abba8d46a15fafaef56c327665d5ff" + # verifier.verified(incompatible_message) # => TypeError: incompatible marshal file format + # + # ==== Options + # + # [+:purpose+] + # The purpose that the message was generated with. If the purpose does not + # match, +verified+ will return +nil+. + # + # message = verifier.generate("hello", purpose: "greeting") + # verifier.verified(message, purpose: "greeting") # => "hello" + # verifier.verified(message, purpose: "chatting") # => nil + # verifier.verified(message) # => nil + # + # message = verifier.generate("bye") + # verifier.verified(message) # => "bye" + # verifier.verified(message, purpose: "greeting") # => nil + # + # source://activesupport//lib/active_support/message_verifier.rb#222 + def verified(message, **options); end + + # Decodes the signed message using the +MessageVerifier+'s secret. + # + # verifier = ActiveSupport::MessageVerifier.new("secret") + # signed_message = verifier.generate("signed message") + # + # verifier.verify(signed_message) # => "signed message" + # + # Raises +InvalidSignature+ if the message was not signed with the same + # secret or was not Base64-encoded. + # + # other_verifier = ActiveSupport::MessageVerifier.new("different_secret") + # other_verifier.verify(signed_message) # => ActiveSupport::MessageVerifier::InvalidSignature + # + # ==== Options + # + # [+:purpose+] + # The purpose that the message was generated with. If the purpose does not + # match, +verify+ will raise ActiveSupport::MessageVerifier::InvalidSignature. + # + # message = verifier.generate("hello", purpose: "greeting") + # verifier.verify(message, purpose: "greeting") # => "hello" + # verifier.verify(message, purpose: "chatting") # => raises InvalidSignature + # verifier.verify(message) # => raises InvalidSignature + # + # message = verifier.generate("bye") + # verifier.verify(message) # => "bye" + # verifier.verify(message, purpose: "greeting") # => raises InvalidSignature + # + # source://activesupport//lib/active_support/message_verifier.rb#260 + def verify(message, **options); end + + private + + # source://activesupport//lib/active_support/message_verifier.rb#347 + def digest_length_in_hex; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/message_verifier.rb#364 + def digest_matches_data?(digest, data); end + + # source://activesupport//lib/active_support/message_verifier.rb#326 + def extract_encoded(signed); end + + # source://activesupport//lib/active_support/message_verifier.rb#343 + def generate_digest(data); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/message_verifier.rb#355 + def separator_at?(signed_message, index); end + + # source://activesupport//lib/active_support/message_verifier.rb#359 + def separator_index_for(signed_message); end + + # source://activesupport//lib/active_support/message_verifier.rb#321 + def sign_encoded(encoded); end +end + +# source://activesupport//lib/active_support/message_verifier.rb#113 +class ActiveSupport::MessageVerifier::InvalidSignature < ::StandardError; end + +# source://activesupport//lib/active_support/message_verifier.rb#115 +ActiveSupport::MessageVerifier::SEPARATOR = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/message_verifier.rb#116 +ActiveSupport::MessageVerifier::SEPARATOR_LENGTH = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/message_verifiers.rb#6 +class ActiveSupport::MessageVerifiers < ::ActiveSupport::Messages::RotationCoordinator + private + + # source://activesupport//lib/active_support/message_verifiers.rb#131 + def build(salt, secret_generator:, secret_generator_options:, **options); end +end + +# source://activesupport//lib/active_support/messages/rotator.rb#4 +module ActiveSupport::Messages; end + +# source://activesupport//lib/active_support/messages/codec.rb#9 +class ActiveSupport::Messages::Codec + include ::ActiveSupport::Messages::Metadata + + # @return [Codec] a new instance of Codec + # + # source://activesupport//lib/active_support/messages/codec.rb#15 + def initialize(**options); end + + private + + # source://activesupport//lib/active_support/messages/codec.rb#45 + def catch_and_ignore(throwable, &block); end + + # source://activesupport//lib/active_support/messages/codec.rb#52 + def catch_and_raise(throwable, as: T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/messages/codec.rb#29 + def decode(encoded, url_safe: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/messages/codec.rb#39 + def deserialize(serialized); end + + # source://activesupport//lib/active_support/messages/codec.rb#25 + def encode(data, url_safe: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/messages/codec.rb#35 + def serialize(data); end + + # Returns the value of attribute serializer. + # + # source://activesupport//lib/active_support/messages/codec.rb#23 + def serializer; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/messages/codec.rb#60 + def use_message_serializer_for_metadata?; end + + class << self + # source://activesupport//lib/active_support/class_attribute.rb#12 + def default_serializer; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def default_serializer=(new_value); end + end +end + +# source://activesupport//lib/active_support/messages/metadata.rb#9 +module ActiveSupport::Messages::Metadata + private + + # source://activesupport//lib/active_support/messages/metadata.rb#128 + def deserialize_from_json(serialized); end + + # source://activesupport//lib/active_support/messages/metadata.rb#141 + def deserialize_from_json_safe_string(string); end + + # source://activesupport//lib/active_support/messages/metadata.rb#43 + def deserialize_with_metadata(message, **expected_metadata); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/messages/metadata.rb#96 + def dual_serialized_metadata_envelope_json?(string); end + + # source://activesupport//lib/active_support/messages/metadata.rb#78 + def extract_from_metadata_envelope(envelope, purpose: T.unsafe(nil)); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/messages/metadata.rb#92 + def metadata_envelope?(object); end + + # source://activesupport//lib/active_support/messages/metadata.rb#114 + def parse_expiry(expires_at); end + + # source://activesupport//lib/active_support/messages/metadata.rb#100 + def pick_expiry(expires_at, expires_in); end + + # source://activesupport//lib/active_support/messages/metadata.rb#124 + def serialize_to_json(data); end + + # source://activesupport//lib/active_support/messages/metadata.rb#137 + def serialize_to_json_safe_string(data); end + + # source://activesupport//lib/active_support/messages/metadata.rb#30 + def serialize_with_metadata(data, **metadata); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/messages/metadata.rb#60 + def use_message_serializer_for_metadata?; end + + # source://activesupport//lib/active_support/messages/metadata.rb#64 + def wrap_in_metadata_envelope(hash, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/messages/metadata.rb#71 + def wrap_in_metadata_legacy_envelope(hash, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end + + class << self + # source://activesupport//lib/active_support/messages/metadata.rb#10 + def use_message_serializer_for_metadata; end + + # source://activesupport//lib/active_support/messages/metadata.rb#10 + def use_message_serializer_for_metadata=(_arg0); end + end +end + +# source://activesupport//lib/active_support/messages/metadata.rb#12 +ActiveSupport::Messages::Metadata::ENVELOPE_SERIALIZERS = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/messages/metadata.rb#19 +ActiveSupport::Messages::Metadata::TIMESTAMP_SERIALIZERS = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/messages/rotation_coordinator.rb#7 +class ActiveSupport::Messages::RotationCoordinator + # @raise [ArgumentError] + # @return [RotationCoordinator] a new instance of RotationCoordinator + # + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#10 + def initialize(&secret_generator); end + + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#18 + def [](salt); end + + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#22 + def []=(salt, codec); end + + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#39 + def clear_rotations; end + + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#45 + def on_rotation(&callback); end + + # @raise [ArgumentError] + # + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#26 + def rotate(**options, &block); end + + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#35 + def rotate_defaults; end + + # Returns the value of attribute transitional. + # + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#8 + def transitional; end + + # Sets the attribute transitional + # + # @param value the value to set the attribute transitional to. + # + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#8 + def transitional=(_arg0); end + + private + + # @raise [NotImplementedError] + # + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#88 + def build(salt, secret_generator:, secret_generator_options:, **options); end + + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#76 + def build_with_rotations(salt); end + + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#51 + def changing_configuration!; end + + # source://activesupport//lib/active_support/messages/rotation_coordinator.rb#62 + def normalize_options(options); end +end + +# source://activesupport//lib/active_support/messages/rotator.rb#5 +module ActiveSupport::Messages::Rotator + # source://activesupport//lib/active_support/messages/rotator.rb#6 + def initialize(*args, on_rotation: T.unsafe(nil), **options); end + + # source://activesupport//lib/active_support/messages/rotator.rb#18 + def fall_back_to(fallback); end + + # source://activesupport//lib/active_support/messages/rotator.rb#23 + def read_message(message, on_rotation: T.unsafe(nil), **options); end + + # source://activesupport//lib/active_support/messages/rotator.rb#14 + def rotate(*args, **options); end + + private + + # source://activesupport//lib/active_support/messages/rotator.rb#44 + def build_rotation(*args, **options); end + + # source://activesupport//lib/active_support/messages/rotator.rb#48 + def catch_rotation_error(&block); end +end + +# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#8 +module ActiveSupport::Messages::SerializerWithFallback + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#17 + def load(dumped); end + + private + + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#33 + def detect_format(dumped); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#44 + def fallback?(format); end + + class << self + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#9 + def [](format); end + end +end + +# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#48 +module ActiveSupport::Messages::SerializerWithFallback::AllowMarshal + private + + # @return [Boolean] + # + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#50 + def fallback?(format); end +end + +# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#78 +module ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback + + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#90 + def _load(dumped); end + + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#86 + def dump(object); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#96 + def dumped?(dumped); end + + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#82 + def format; end + + private + + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#101 + def detect_format(dumped); end +end + +# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#94 +ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback::JSON_START_WITH = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#107 +module ActiveSupport::Messages::SerializerWithFallback::JsonWithFallbackAllowMarshal + include ::ActiveSupport::Messages::SerializerWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal + extend ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal + extend ::ActiveSupport::Messages::SerializerWithFallback::JsonWithFallbackAllowMarshal +end + +# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#55 +module ActiveSupport::Messages::SerializerWithFallback::MarshalWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::MarshalWithFallback + + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#67 + def _load(dumped); end + + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#63 + def dump(object); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#73 + def dumped?(dumped); end + + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#59 + def format; end +end + +# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#71 +ActiveSupport::Messages::SerializerWithFallback::MarshalWithFallback::MARSHAL_SIGNATURE = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#113 +module ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback + + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#125 + def _load(dumped); end + + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#121 + def dump(object); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#129 + def dumped?(dumped); end + + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#117 + def format; end + + private + + # @return [Boolean] + # + # source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#134 + def available?; end +end + +# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#143 +module ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallbackAllowMarshal + include ::ActiveSupport::Messages::SerializerWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback + include ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal + extend ::ActiveSupport::Messages::SerializerWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallback + extend ::ActiveSupport::Messages::SerializerWithFallback::AllowMarshal + extend ::ActiveSupport::Messages::SerializerWithFallback::MessagePackWithFallbackAllowMarshal +end + +# source://activesupport//lib/active_support/messages/serializer_with_fallback.rb#149 +ActiveSupport::Messages::SerializerWithFallback::SERIALIZERS = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/multibyte.rb#4 +module ActiveSupport::Multibyte + class << self + # Returns the current proxy class. + # + # source://activesupport//lib/active_support/multibyte.rb#19 + def proxy_class; end + + # The proxy class returned when calling mb_chars. You can use this accessor + # to configure your own proxy class so you can support other encodings. See + # the ActiveSupport::Multibyte::Chars implementation for an example how to + # do this. + # + # ActiveSupport::Multibyte.proxy_class = CharsForUTF32 + # + # source://activesupport//lib/active_support/multibyte.rb#14 + def proxy_class=(klass); end + end +end + +# = Active Support \Multibyte \Chars +# +# Chars enables you to work transparently with UTF-8 encoding in the Ruby +# String class without having extensive knowledge about the encoding. A +# Chars object accepts a string upon initialization and proxies String +# methods in an encoding safe manner. All the normal String methods are also +# implemented on the proxy. +# +# String methods are proxied through the Chars object, and can be accessed +# through the +mb_chars+ method. Methods which would normally return a +# String object now return a Chars object so methods can be chained. +# +# 'The Perfect String '.mb_chars.downcase.strip +# # => # +# +# Chars objects are perfectly interchangeable with String objects as long as +# no explicit class checks are made. If certain methods do explicitly check +# the class, call +to_s+ before you pass chars objects to them. +# +# bad.explicit_checking_method 'T'.mb_chars.downcase.to_s +# +# The default Chars implementation assumes that the encoding of the string +# is UTF-8, if you want to handle different encodings you can write your own +# multibyte string handler and configure it through +# ActiveSupport::Multibyte.proxy_class. +# +# class CharsForUTF32 +# def size +# @wrapped_string.size / 4 +# end +# +# def self.accepts?(string) +# string.length % 4 == 0 +# end +# end +# +# ActiveSupport::Multibyte.proxy_class = CharsForUTF32 +# +# source://activesupport//lib/active_support/multibyte/chars.rb#47 +class ActiveSupport::Multibyte::Chars + include ::Comparable + + # Creates a new Chars instance by wrapping _string_. + # + # @return [Chars] a new instance of Chars + # + # source://activesupport//lib/active_support/multibyte/chars.rb#56 + def initialize(string); end + + # source://activesupport//lib/active_support/multibyte/chars.rb#53 + def <=>(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/multibyte/chars.rb#53 + def =~(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/multibyte/chars.rb#53 + def acts_like_string?(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/multibyte/chars.rb#161 + def as_json(options = T.unsafe(nil)); end + + # Performs composition on all the characters. + # + # 'é'.length # => 1 + # 'é'.mb_chars.compose.to_s.length # => 1 + # + # source://activesupport//lib/active_support/multibyte/chars.rb#140 + def compose; end + + # Performs canonical decomposition on all the characters. + # + # 'é'.length # => 1 + # 'é'.mb_chars.decompose.to_s.length # => 2 + # + # source://activesupport//lib/active_support/multibyte/chars.rb#132 + def decompose; end + + # Returns the number of grapheme clusters in the string. + # + # 'क्षि'.mb_chars.length # => 4 + # 'क्षि'.mb_chars.grapheme_length # => 2 + # + # source://activesupport//lib/active_support/multibyte/chars.rb#148 + def grapheme_length; end + + # Limits the byte size of the string to a number of bytes without breaking + # characters. Usable when the storage for a string is limited for some + # reason. + # + # 'こんにちは'.mb_chars.limit(7).to_s # => "こん" + # + # source://activesupport//lib/active_support/multibyte/chars.rb#115 + def limit(limit); end + + # source://activesupport//lib/active_support/multibyte/chars.rb#53 + def match?(*_arg0, **_arg1, &_arg2); end + + # Forward all undefined methods to the wrapped string. + # + # source://activesupport//lib/active_support/multibyte/chars.rb#62 + def method_missing(method, *_arg1, **_arg2, &_arg3); end + + # Reverses all characters in the string. + # + # 'Café'.mb_chars.reverse.to_s # => 'éfaC' + # + # source://activesupport//lib/active_support/multibyte/chars.rb#106 + def reverse; end + + # source://activesupport//lib/active_support/multibyte/chars.rb#166 + def reverse!(*args); end + + # Works like 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#96 + 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#83 + def split(*args); end + + # Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent + # resulting in a valid UTF-8 string. + # + # Passing +true+ will forcibly tidy all bytes, assuming that the string's + # encoding is entirely CP1252 or ISO-8859-1. + # + # source://activesupport//lib/active_support/multibyte/chars.rb#157 + def tidy_bytes(force = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/multibyte/chars.rb#166 + def tidy_bytes!(*args); end + + # Capitalizes the first letter of every word, when possible. + # + # "ÉL QUE SE ENTERÓ".mb_chars.titleize.to_s # => "Él Que Se Enteró" + # "日本語".mb_chars.titleize.to_s # => "日本語" + # + # source://activesupport//lib/active_support/multibyte/chars.rb#123 + def titlecase; end + + # Capitalizes the first letter of every word, when possible. + # + # "ÉL QUE SE ENTERÓ".mb_chars.titleize.to_s # => "Él Que Se Enteró" + # "日本語".mb_chars.titleize.to_s # => "日本語" + # + # source://activesupport//lib/active_support/multibyte/chars.rb#123 + def titleize; end + + # Returns the value of attribute wrapped_string. + # + # source://activesupport//lib/active_support/multibyte/chars.rb#49 + def to_s; end + + # Returns the value of attribute wrapped_string. + # + # source://activesupport//lib/active_support/multibyte/chars.rb#49 + def to_str; end + + # Returns the value of attribute wrapped_string. + # + # source://activesupport//lib/active_support/multibyte/chars.rb#49 + def wrapped_string; end + + private + + # source://activesupport//lib/active_support/multibyte/chars.rb#173 + def chars(string); end + + # Returns +true+ if _obj_ responds to the given method. Private methods + # are included in the search only if the optional second parameter + # evaluates to +true+. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/multibyte/chars.rb#74 + def respond_to_missing?(method, include_private); end +end + +# source://activesupport//lib/active_support/multibyte/unicode.rb#5 +module ActiveSupport::Multibyte::Unicode + extend ::ActiveSupport::Multibyte::Unicode + + # Compose decomposed characters to the composed form. + # + # source://activesupport//lib/active_support/multibyte/unicode.rb#21 + def compose(codepoints); end + + # Decompose composed characters to the decomposed form. + # + # source://activesupport//lib/active_support/multibyte/unicode.rb#12 + def decompose(type, codepoints); end + + # Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent + # resulting in a valid UTF-8 string. + # + # Passing +true+ will forcibly tidy all bytes, assuming that the string's + # encoding is entirely CP1252 or ISO-8859-1. + # + # source://activesupport//lib/active_support/multibyte/unicode.rb#30 + def tidy_bytes(string, force = T.unsafe(nil)); end + + private + + # source://activesupport//lib/active_support/multibyte/unicode.rb#37 + def recode_windows1252_chars(string); end +end + +# The Unicode version that is supported by the implementation +# +# source://activesupport//lib/active_support/multibyte/unicode.rb#9 +ActiveSupport::Multibyte::Unicode::UNICODE_VERSION = T.let(T.unsafe(nil), String) + +# = \Notifications +# +# +ActiveSupport::Notifications+ provides an instrumentation API for +# Ruby. +# +# == Instrumenters +# +# To instrument an event you just need to do: +# +# ActiveSupport::Notifications.instrument('render', extra: :information) do +# render plain: 'Foo' +# end +# +# That first executes the block and then notifies all subscribers once done. +# +# In the example above +render+ is the name of the event, and the rest is called +# the _payload_. The payload is a mechanism that allows instrumenters to pass +# extra information to subscribers. Payloads consist of a hash whose contents +# are arbitrary and generally depend on the event. +# +# == Subscribers +# +# You can consume those events and the information they provide by registering +# a subscriber. +# +# ActiveSupport::Notifications.subscribe('render') do |event| +# event.name # => "render" +# event.duration # => 10 (in milliseconds) +# event.payload # => { extra: :information } +# event.allocations # => 1826 (objects) +# end +# +# +Event+ objects record CPU time and allocations. If you don't need this +# it's also possible to pass a block that accepts five arguments: +# +# ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload| +# name # => String, name of the event (such as 'render' from above) +# start # => Time, when the instrumented block started execution +# finish # => Time, when the instrumented block ended execution +# id # => String, unique ID for the instrumenter that fired the event +# payload # => Hash, the payload +# end +# +# Here, the +start+ and +finish+ values represent wall-clock time. If you are +# concerned about accuracy, you can register a monotonic subscriber. +# +# ActiveSupport::Notifications.monotonic_subscribe('render') do |name, start, finish, id, payload| +# name # => String, name of the event (such as 'render' from above) +# start # => Float, monotonic time when the instrumented block started execution +# finish # => Float, monotonic time when the instrumented block ended execution +# id # => String, unique ID for the instrumenter that fired the event +# payload # => Hash, the payload +# end +# +# For instance, let's store all "render" events in an array: +# +# events = [] +# +# ActiveSupport::Notifications.subscribe('render') do |event| +# events << event +# end +# +# That code returns right away, you are just subscribing to "render" events. +# The block is saved and will be called whenever someone instruments "render": +# +# ActiveSupport::Notifications.instrument('render', extra: :information) do +# render plain: 'Foo' +# end +# +# event = events.first +# event.name # => "render" +# event.duration # => 10 (in milliseconds) +# event.payload # => { extra: :information } +# event.allocations # => 1826 (objects) +# +# If an exception happens during that particular instrumentation the payload will +# have a key :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 {|event| ... } +# ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do +# ... +# end +# +# the callback will be called for all "sql.active_record" events instrumented +# during the execution of the block. The callback is unsubscribed automatically +# after that. +# +# To record +started+ and +finished+ values with monotonic time, +# specify the optional :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 |event| +# ... +# end +# +# To prevent that block from being called anymore, just unsubscribe passing +# that reference: +# +# ActiveSupport::Notifications.unsubscribe(subscriber) +# +# You can also unsubscribe by passing the name of the subscriber object. Note +# that this will unsubscribe all subscriptions with the given name: +# +# ActiveSupport::Notifications.unsubscribe("render") +# +# Subscribers using a regexp or other pattern-matching object will remain subscribed +# to all events that match their original pattern, unless those events match a string +# passed to +unsubscribe+: +# +# subscriber = ActiveSupport::Notifications.subscribe(/render/) { } +# ActiveSupport::Notifications.unsubscribe('render_template.action_view') +# subscriber.matches?('render_template.action_view') # => false +# subscriber.matches?('render_partial.action_view') # => true +# +# == Default Queue +# +# Notifications ships with a queue implementation that consumes and publishes events +# to all log subscribers. You can use any queue implementation you want. +# +# source://activesupport//lib/active_support/notifications/instrumenter.rb#7 +module ActiveSupport::Notifications + class << self + # source://activesupport//lib/active_support/notifications.rb#208 + def instrument(name, payload = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/notifications.rb#269 + def instrumenter; end + + # Performs the same functionality as #subscribe, but the +start+ and + # +finish+ block arguments are in monotonic time instead of wall-clock + # time. Monotonic time will not jump forward or backward (due to NTP or + # Daylights Savings). Use +monotonic_subscribe+ when accuracy of time + # duration is important. For example, computing elapsed time between + # two events. + # + # source://activesupport//lib/active_support/notifications.rb#254 + def monotonic_subscribe(pattern = T.unsafe(nil), callback = T.unsafe(nil), &block); end + + # Returns the value of attribute notifier. + # + # source://activesupport//lib/active_support/notifications.rb#198 + def notifier; end + + # Sets the attribute notifier + # + # @param value the value to set the attribute notifier to. + # + # source://activesupport//lib/active_support/notifications.rb#198 + def notifier=(_arg0); end + + # source://activesupport//lib/active_support/notifications.rb#200 + def publish(name, *args); end + + # source://activesupport//lib/active_support/notifications.rb#204 + def publish_event(event); end + + # Subscribe to a given event name with the passed +block+. + # + # You can subscribe to events by passing a String to match exact event + # names, or by passing a Regexp to match all events that match a pattern. + # + # If the block passed to the method only takes one argument, + # it will yield an +Event+ object to the block: + # + # ActiveSupport::Notifications.subscribe(/render/) do |event| + # @event = event + # end + # + # Otherwise the +block+ will receive five arguments with information + # about the event: + # + # ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload| + # name # => String, name of the event (such as 'render' from above) + # start # => Time, when the instrumented block started execution + # finish # => Time, when the instrumented block ended execution + # id # => String, unique ID for the instrumenter that fired the event + # payload # => Hash, the payload + # end + # + # Raises an error if invalid event name type is passed: + # + # ActiveSupport::Notifications.subscribe(:render) {|event| ...} + # #=> ArgumentError (pattern must be specified as a String, Regexp or empty) + # + # source://activesupport//lib/active_support/notifications.rb#244 + def subscribe(pattern = T.unsafe(nil), callback = T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/notifications.rb#258 + def subscribed(callback, pattern = T.unsafe(nil), monotonic: T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/notifications.rb#265 + def unsubscribe(subscriber_or_name); end + + private + + # source://activesupport//lib/active_support/notifications.rb#274 + def registry; end + end +end + +# source://activesupport//lib/active_support/notifications/instrumenter.rb#106 +class ActiveSupport::Notifications::Event + # @return [Event] a new instance of Event + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#110 + def initialize(name, start, ending, transaction_id, payload); end + + # Returns the number of allocations made between the call to #start! and + # the call to #finish!. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#176 + def allocations; end + + # Returns the CPU time (in milliseconds) passed between the call to + # #start! and the call to #finish!. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#163 + def cpu_time; end + + # Returns the difference in milliseconds between when the execution of the + # event started and when it ended. + # + # ActiveSupport::Notifications.subscribe('wait') do |event| + # @event = event + # end + # + # ActiveSupport::Notifications.instrument('wait') do + # sleep 1 + # end + # + # @event.duration # => 1000.138 + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#198 + def duration; end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#128 + def end; end + + # Record information at the time this event finishes + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#154 + def finish!; end + + # Returns the time spent in GC (in milliseconds) between the call to #start! + # and the call to #finish! + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#182 + def gc_time; end + + # Returns the idle time time (in milliseconds) passed between the call to + # #start! and the call to #finish!. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#169 + def idle_time; end + + # Returns the value of attribute name. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#107 + def name; end + + # Returns the value of attribute payload. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#108 + def payload; end + + # Sets the attribute payload + # + # @param value the value to set the attribute payload to. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#108 + def payload=(_arg0); end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#132 + def record; end + + # Record information at the time this event starts + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#146 + def start!; end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#124 + def time; end + + # Returns the value of attribute transaction_id. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#107 + def transaction_id; end + + private + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#203 + def now; end + + # Likely on JRuby, TruffleRuby + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#230 + def now_allocations; end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#210 + def now_cpu; end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#220 + def now_gc; end +end + +# This is a default queue implementation that ships with Notifications. +# It just pushes events to all registered log subscribers. +# +# This class is thread safe. All methods are reentrant. +# +# source://activesupport//lib/active_support/notifications/fanout.rb#49 +class ActiveSupport::Notifications::Fanout + include ::ActiveSupport::Notifications::FanoutIteration + + # @return [Fanout] a new instance of Fanout + # + # source://activesupport//lib/active_support/notifications/fanout.rb#50 + def initialize; end + + # source://activesupport//lib/active_support/notifications/fanout.rb#297 + def all_listeners_for(name); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#272 + def build_handle(name, id, payload); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#101 + def clear_cache(key = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#283 + def finish(name, id, payload, listeners = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#187 + def groups_for(name); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#59 + def inspect; end + + # source://activesupport//lib/active_support/notifications/fanout.rb#306 + def listeners_for(name); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/notifications/fanout.rb#310 + def listening?(name); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#289 + def publish(name, *args); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#293 + def publish_event(event); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#276 + def start(name, id, payload); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#64 + def subscribe(pattern = T.unsafe(nil), callable = T.unsafe(nil), monotonic: T.unsafe(nil), &block); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#81 + def unsubscribe(subscriber_or_name); end + + # This is a sync queue, so there is no waiting. + # + # source://activesupport//lib/active_support/notifications/fanout.rb#315 + def wait; end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#113 +class ActiveSupport::Notifications::Fanout::BaseGroup + include ::ActiveSupport::Notifications::FanoutIteration + + # @return [BaseGroup] a new instance of BaseGroup + # + # source://activesupport//lib/active_support/notifications/fanout.rb#116 + def initialize(listeners, name, id, payload); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#120 + def each(&block); end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#125 +class ActiveSupport::Notifications::Fanout::BaseTimeGroup < ::ActiveSupport::Notifications::Fanout::BaseGroup + # source://activesupport//lib/active_support/notifications/fanout.rb#130 + def finish(name, id, payload); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#126 + def start(name, id, payload); end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#166 +class ActiveSupport::Notifications::Fanout::EventObjectGroup < ::ActiveSupport::Notifications::Fanout::BaseGroup + # source://activesupport//lib/active_support/notifications/fanout.rb#172 + def finish(name, id, payload); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#167 + def start(name, id, payload); end + + private + + # source://activesupport//lib/active_support/notifications/fanout.rb#182 + def build_event(name, id, payload); end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#152 +class ActiveSupport::Notifications::Fanout::EventedGroup < ::ActiveSupport::Notifications::Fanout::BaseGroup + # source://activesupport//lib/active_support/notifications/fanout.rb#159 + def finish(name, id, payload); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#153 + def start(name, id, payload); end +end + +# A +Handle+ is used to record the start and finish time of event. +# +# Both #start and #finish must each be called exactly once. +# +# Where possible, it's best to use the block form: ActiveSupport::Notifications.instrument. +# +Handle+ is a low-level API intended for cases where the block form can't be used. +# +# handle = ActiveSupport::Notifications.instrumenter.build_handle("my.event", {}) +# begin +# handle.start +# # work to be instrumented +# ensure +# handle.finish +# end +# +# source://activesupport//lib/active_support/notifications/fanout.rb#227 +class ActiveSupport::Notifications::Fanout::Handle + include ::ActiveSupport::Notifications::FanoutIteration + + # @return [Handle] a new instance of Handle + # + # source://activesupport//lib/active_support/notifications/fanout.rb#230 + def initialize(notifier, name, id, payload); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#249 + def finish; end + + # source://activesupport//lib/active_support/notifications/fanout.rb#253 + def finish_with_values(name, id, payload); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#240 + def start; end + + private + + # source://activesupport//lib/active_support/notifications/fanout.rb#263 + def ensure_state!(expected); end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#138 +class ActiveSupport::Notifications::Fanout::MonotonicTimedGroup < ::ActiveSupport::Notifications::Fanout::BaseTimeGroup + private + + # source://activesupport//lib/active_support/notifications/fanout.rb#140 + def now; end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#318 +module ActiveSupport::Notifications::Fanout::Subscribers + class << self + # source://activesupport//lib/active_support/notifications/fanout.rb#319 + def new(pattern, listener, monotonic); end + end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#433 +class ActiveSupport::Notifications::Fanout::Subscribers::EventObject < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented + # source://activesupport//lib/active_support/notifications/fanout.rb#434 + def group_class; end + + # source://activesupport//lib/active_support/notifications/fanout.rb#438 + def publish_event(event); end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#375 +class ActiveSupport::Notifications::Fanout::Subscribers::Evented + # @return [Evented] a new instance of Evented + # + # source://activesupport//lib/active_support/notifications/fanout.rb#378 + def initialize(pattern, delegate); end + + # Returns the value of attribute delegate. + # + # source://activesupport//lib/active_support/notifications/fanout.rb#376 + def delegate; end + + # source://activesupport//lib/active_support/notifications/fanout.rb#386 + def group_class; end + + # Returns the value of attribute pattern. + # + # source://activesupport//lib/active_support/notifications/fanout.rb#376 + def pattern; end + + # source://activesupport//lib/active_support/notifications/fanout.rb#390 + def publish(name, *args); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#396 + def publish_event(event); end + + # Returns the value of attribute silenceable. + # + # source://activesupport//lib/active_support/notifications/fanout.rb#376 + def silenceable; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/notifications/fanout.rb#404 + def silenced?(name); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/notifications/fanout.rb#408 + def subscribed_to?(name); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#412 + def unsubscribe!(name); end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#338 +class ActiveSupport::Notifications::Fanout::Subscribers::Matcher + # @return [Matcher] a new instance of Matcher + # + # source://activesupport//lib/active_support/notifications/fanout.rb#351 + def initialize(pattern); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#360 + def ===(name); end + + # Returns the value of attribute exclusions. + # + # source://activesupport//lib/active_support/notifications/fanout.rb#339 + def exclusions; end + + # Returns the value of attribute pattern. + # + # source://activesupport//lib/active_support/notifications/fanout.rb#339 + def pattern; end + + # source://activesupport//lib/active_support/notifications/fanout.rb#356 + def unsubscribe!(name); end + + class << self + # source://activesupport//lib/active_support/notifications/fanout.rb#341 + def wrap(pattern); end + end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#364 +class ActiveSupport::Notifications::Fanout::Subscribers::Matcher::AllMessages + # source://activesupport//lib/active_support/notifications/fanout.rb#365 + def ===(name); end + + # source://activesupport//lib/active_support/notifications/fanout.rb#369 + def unsubscribe!(*_arg0); end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#427 +class ActiveSupport::Notifications::Fanout::Subscribers::MonotonicTimed < ::ActiveSupport::Notifications::Fanout::Subscribers::Timed + # source://activesupport//lib/active_support/notifications/fanout.rb#428 + def group_class; end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#417 +class ActiveSupport::Notifications::Fanout::Subscribers::Timed < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented + # source://activesupport//lib/active_support/notifications/fanout.rb#418 + def group_class; end + + # source://activesupport//lib/active_support/notifications/fanout.rb#422 + def publish(name, *args); end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#145 +class ActiveSupport::Notifications::Fanout::TimedGroup < ::ActiveSupport::Notifications::Fanout::BaseTimeGroup + private + + # source://activesupport//lib/active_support/notifications/fanout.rb#147 + def now; end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#18 +module ActiveSupport::Notifications::FanoutIteration + private + + # source://activesupport//lib/active_support/notifications/fanout.rb#20 + def iterate_guarding_exceptions(collection); end +end + +# source://activesupport//lib/active_support/notifications/fanout.rb#8 +class ActiveSupport::Notifications::InstrumentationSubscriberError < ::RuntimeError + # @return [InstrumentationSubscriberError] a new instance of InstrumentationSubscriberError + # + # source://activesupport//lib/active_support/notifications/fanout.rb#11 + def initialize(exceptions); end + + # Returns the value of attribute exceptions. + # + # source://activesupport//lib/active_support/notifications/fanout.rb#9 + def exceptions; end +end + +# Instrumenters are stored in a thread local. +# +# source://activesupport//lib/active_support/notifications/instrumenter.rb#9 +class ActiveSupport::Notifications::Instrumenter + # @return [Instrumenter] a new instance of Instrumenter + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#12 + def initialize(notifier); end + + # Returns a "handle" for an event with the given +name+ and +payload+. + # + # #start and #finish must each be called exactly once on the returned object. + # + # Where possible, it's best to use #instrument, which will record the + # start and finish of the event and correctly handle any exceptions. + # +build_handle+ is a low-level API intended for cases where using + # +instrument+ isn't possible. + # + # See ActiveSupport::Notifications::Fanout::Handle. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#78 + def build_handle(name, payload); end + + # Send a finish notification with +name+ and +payload+. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#92 + def finish(name, payload); end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#96 + def finish_with_state(listeners_state, name, payload); end + + # Returns the value of attribute id. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#10 + def id; end + + # Given a block, instrument it by measuring the time taken to execute + # and publish it. Without a block, simply send a message via the + # notifier. Notice that events get sent even if an error occurs in the + # passed-in block. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#54 + def instrument(name, payload = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#82 + def new_event(name, payload = T.unsafe(nil)); end + + # Send a start notification with +name+ and +payload+. + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#87 + def start(name, payload); end + + private + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#101 + def unique_id; end +end + +# source://activesupport//lib/active_support/notifications/instrumenter.rb#21 +class ActiveSupport::Notifications::Instrumenter::LegacyHandle + # @return [LegacyHandle] a new instance of LegacyHandle + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#34 + def initialize(notifier, name, id, payload); end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#45 + def finish; end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#41 + def start; end +end + +# source://activesupport//lib/active_support/notifications/instrumenter.rb#22 +class ActiveSupport::Notifications::Instrumenter::LegacyHandle::Wrapper + # @return [Wrapper] a new instance of Wrapper + # + # source://activesupport//lib/active_support/notifications/instrumenter.rb#23 + def initialize(notifier); end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#27 + def build_handle(name, id, payload); end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#31 + def finish(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/notifications/instrumenter.rb#31 + def start(*_arg0, **_arg1, &_arg2); end +end + +# = Number Helper +# +# Provides methods for formatting numbers into currencies, percentages, +# phone numbers, and more. +# +# Example usage in a class: +# class Topic +# include ActiveSupport::NumberHelper +# +# def price +# number_to_currency(@price) +# end +# end +# +# Example usage in a module: +# require "active_support/number_helper" +# +# module NumberFormatting +# def format_price(price) +# ActiveSupport::NumberHelper.number_to_currency(price) +# end +# end +# +# source://activesupport//lib/active_support/number_helper.rb#26 +module ActiveSupport::NumberHelper + extend ::ActiveSupport::Autoload + extend ::ActiveSupport::NumberHelper + + # Formats a +number+ into a currency string. + # + # number_to_currency(1234567890.50) # => "$1,234,567,890.50" + # number_to_currency(1234567890.506) # => "$1,234,567,890.51" + # number_to_currency("12x34") # => "$12x34" + # + # number_to_currency(1234567890.50, unit: "£", separator: ",", delimiter: "") + # # => "£1234567890,50" + # + # The currency unit and number formatting of the current locale will be used + # unless otherwise specified via options. No currency conversion is + # performed. If the user is given a way to change their locale, they will + # also be able to change the relative value of the currency displayed with + # this helper. If your application will ever support multiple locales, you + # may want to specify a constant +:locale+ option or consider using a + # library capable of currency conversion. + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # number_to_currency(1234567890.506, locale: :fr) + # # => "1 234 567 890,51 €" + # + # [+:precision+] + # The level of precision. Defaults to 2. + # + # number_to_currency(1234567890.123, precision: 3) # => "$1,234,567,890.123" + # number_to_currency(0.456789, precision: 0) # => "$0" + # + # [+:round_mode+] + # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to + # +:default+. + # + # number_to_currency(1234567890.01, precision: 0, round_mode: :up) + # # => "$1,234,567,891" + # + # [+:unit+] + # The denomination of the currency. Defaults to "$". + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # [+:format+] + # The format for non-negative numbers. %u represents the currency, + # and %n represents the number. Defaults to "%u%n". + # + # number_to_currency(1234567890.50, format: "%n %u") + # # => "1,234,567,890.50 $" + # + # [+:negative_format+] + # The format for negative numbers. %u and %n behave the + # same as in +:format+, but %n represents the absolute value of + # the number. Defaults to the value of +:format+ prepended with -. + # + # number_to_currency(-1234567890.50, negative_format: "(%u%n)") + # # => "($1,234,567,890.50)" + # + # [+:strip_insignificant_zeros+] + # Whether to remove insignificant zeros after the decimal separator. + # Defaults to false. + # + # number_to_currency(1234567890.50, strip_insignificant_zeros: true) + # # => "$1,234,567,890.5" + # + # source://activesupport//lib/active_support/number_helper.rb#161 + def number_to_currency(number, options = T.unsafe(nil)); end + + # Formats +number+ by grouping thousands with a delimiter. + # + # number_to_delimited(12345678) # => "12,345,678" + # number_to_delimited("123456") # => "123,456" + # number_to_delimited(12345678.9876) # => "12,345,678.9876" + # number_to_delimited("12x34") # => "12x34" + # + # number_to_delimited(12345678.9876, delimiter: ".", separator: ",") + # # => "12.345.678,9876" + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # number_to_delimited(12345678.05, locale: :fr) + # # => "12 345 678,05" + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # number_to_delimited(12345678, delimiter: ".") + # # => "12.345.678" + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # number_to_delimited(12345678.05, separator: " ") + # # => "12,345,678 05" + # + # [+:delimiter_pattern+] + # A regexp to determine the placement of delimiters. Helpful when using + # currency formats like INR. + # + # number_to_delimited("123456.78", delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/) + # # => "1,23,456.78" + # + # source://activesupport//lib/active_support/number_helper.rb#264 + def number_to_delimited(number, options = T.unsafe(nil)); end + + # Formats +number+ into a more human-friendly representation. Useful for + # numbers that can become very large and too hard to read. + # + # number_to_human(123) # => "123" + # number_to_human(1234) # => "1.23 Thousand" + # number_to_human(12345) # => "12.3 Thousand" + # number_to_human(1234567) # => "1.23 Million" + # number_to_human(1234567890) # => "1.23 Billion" + # number_to_human(1234567890123) # => "1.23 Trillion" + # number_to_human(1234567890123456) # => "1.23 Quadrillion" + # number_to_human(1234567890123456789) # => "1230 Quadrillion" + # + # See #number_to_human_size if you want to pretty-print a file size. + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # [+:precision+] + # The level of precision. Defaults to 3. + # + # number_to_human(123456, precision: 2) # => "120 Thousand" + # number_to_human(123456, precision: 4) # => "123.5 Thousand" + # + # [+:round_mode+] + # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to + # +:default+. + # + # number_to_human(123456, precision: 2, round_mode: :up) + # # => "130 Thousand" + # + # [+:significant+] + # Whether +:precision+ should be applied to significant digits instead of + # fractional digits. Defaults to true. + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # number_to_human(123456, precision: 4, separator: ",") + # # => "123,5 Thousand" + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # [+:strip_insignificant_zeros+] + # Whether to remove insignificant zeros after the decimal separator. + # Defaults to true. + # + # number_to_human(1000000) # => "1 Million" + # number_to_human(1000000, strip_insignificant_zeros: false) # => "1.00 Million" + # number_to_human(10.01) # => "10" + # number_to_human(10.01, strip_insignificant_zeros: false) # => "10.0" + # + # [+:format+] + # The format of the output. %n represents the number, and + # %u represents the quantifier (e.g., "Thousand"). Defaults to + # "%n %u". + # + # [+:units+] + # A Hash of custom unit quantifier names. + # + # number_to_human(1, units: { unit: "m", thousand: "km" }) # => "1 m" + # number_to_human(100, units: { unit: "m", thousand: "km" }) # => "100 m" + # number_to_human(1000, units: { unit: "m", thousand: "km" }) # => "1 km" + # number_to_human(100000, units: { unit: "m", thousand: "km" }) # => "100 km" + # number_to_human(10000000, units: { unit: "m", thousand: "km" }) # => "10000 km" + # + # The following keys are supported for integer units: +:unit+, +:ten+, + # +:hundred+, +:thousand+, +:million+, +:billion+, +:trillion+, + # +:quadrillion+. Additionally, the following keys are supported for + # fractional units: +:deci+, +:centi+, +:mili+, +:micro+, +:nano+, + # +:pico+, +:femto+. + # + # The Hash can also be defined as a scope in an I18n locale. For example: + # + # en: + # distance: + # centi: + # one: "centimeter" + # other: "centimeters" + # unit: + # one: "meter" + # other: "meters" + # thousand: + # one: "kilometer" + # other: "kilometers" + # + # Then it can be specified by name: + # + # number_to_human(1, units: :distance) # => "1 meter" + # number_to_human(100, units: :distance) # => "100 meters" + # number_to_human(1000, units: :distance) # => "1 kilometer" + # number_to_human(100000, units: :distance) # => "100 kilometers" + # number_to_human(10000000, units: :distance) # => "10000 kilometers" + # number_to_human(0.1, units: :distance) # => "10 centimeters" + # number_to_human(0.01, units: :distance) # => "1 centimeter" + # + # source://activesupport//lib/active_support/number_helper.rb#475 + def number_to_human(number, options = T.unsafe(nil)); end + + # Formats +number+ as bytes into a more human-friendly representation. + # Useful for reporting file sizes to users. + # + # number_to_human_size(123) # => "123 Bytes" + # number_to_human_size(1234) # => "1.21 KB" + # number_to_human_size(12345) # => "12.1 KB" + # number_to_human_size(1234567) # => "1.18 MB" + # number_to_human_size(1234567890) # => "1.15 GB" + # number_to_human_size(1234567890123) # => "1.12 TB" + # number_to_human_size(1234567890123456) # => "1.1 PB" + # number_to_human_size(1234567890123456789) # => "1.07 EB" + # + # See #number_to_human if you want to pretty-print a generic number. + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # [+:precision+] + # The level of precision. Defaults to 3. + # + # number_to_human_size(123456, precision: 2) # => "120 KB" + # number_to_human_size(1234567, precision: 2) # => "1.2 MB" + # + # [+:round_mode+] + # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to + # +:default+. + # + # number_to_human_size(123456, precision: 2, round_mode: :up) + # # => "130 KB" + # + # [+:significant+] + # Whether +:precision+ should be applied to significant digits instead of + # fractional digits. Defaults to true. + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # number_to_human_size(1234567, separator: ",") + # # => "1,18 MB" + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # [+:strip_insignificant_zeros+] + # Whether to remove insignificant zeros after the decimal separator. + # Defaults to true. + # + # source://activesupport//lib/active_support/number_helper.rb#373 + def number_to_human_size(number, options = T.unsafe(nil)); end + + # Formats +number+ as a percentage string. + # + # number_to_percentage(100) # => "100.000%" + # number_to_percentage("99") # => "99.000%" + # number_to_percentage("99x") # => "99x%" + # + # number_to_percentage(12345.6789, delimiter: ".", separator: ",", precision: 2) + # # => "12.345,68%" + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # number_to_percentage(1000, locale: :fr) + # # => "1000,000%" + # + # [+:precision+] + # The level of precision, or +nil+ to preserve +number+'s precision. + # Defaults to 2. + # + # number_to_percentage(12.3456789, precision: 4) # => "12.3457%" + # number_to_percentage(99.999, precision: 0) # => "100%" + # number_to_percentage(99.999, precision: nil) # => "99.999%" + # + # [+:round_mode+] + # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to + # +:default+. + # + # number_to_percentage(12.3456789, precision: 4, round_mode: :down) + # # => "12.3456%" + # + # [+:significant+] + # Whether +:precision+ should be applied to significant digits instead of + # fractional digits. Defaults to false. + # + # number_to_percentage(12345.6789) # => "12345.679%" + # number_to_percentage(12345.6789, significant: true) # => "12300%" + # number_to_percentage(12345.6789, precision: 2) # => "12345.68%" + # number_to_percentage(12345.6789, precision: 2, significant: true) # => "12000%" + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # [+:strip_insignificant_zeros+] + # Whether to remove insignificant zeros after the decimal separator. + # Defaults to false. + # + # [+:format+] + # The format of the output. %n represents the number. Defaults to + # "%n%". + # + # number_to_percentage(100, format: "%n %") + # # => "100.000 %" + # + # source://activesupport//lib/active_support/number_helper.rb#223 + def number_to_percentage(number, options = T.unsafe(nil)); end + + # Formats +number+ into a phone number. + # + # number_to_phone(5551234) # => "555-1234" + # number_to_phone("5551234") # => "555-1234" + # number_to_phone(1235551234) # => "123-555-1234" + # number_to_phone("12x34") # => "12x34" + # + # number_to_phone(1235551234, delimiter: ".", country_code: 1, extension: 1343) + # # => "+1.123.555.1234 x 1343" + # + # ==== Options + # + # [+:area_code+] + # Whether to use parentheses for the area code. Defaults to false. + # + # number_to_phone(1235551234, area_code: true) + # # => "(123) 555-1234" + # + # [+:delimiter+] + # The digit group delimiter to use. Defaults to "-". + # + # number_to_phone(1235551234, delimiter: " ") + # # => "123 555 1234" + # + # [+:country_code+] + # A country code to prepend. + # + # number_to_phone(1235551234, country_code: 1) + # # => "+1-123-555-1234" + # + # [+:extension+] + # An extension to append. + # + # number_to_phone(1235551234, extension: 555) + # # => "123-555-1234 x 555" + # + # [+:pattern+] + # A regexp that specifies how the digits should be grouped. The first + # three captures from the regexp are treated as digit groups. + # + # number_to_phone(13312345678, pattern: /(\d{3})(\d{4})(\d{4})$/) + # # => "133-1234-5678" + # number_to_phone(75561234567, pattern: /(\d{1,4})(\d{4})(\d{4})$/, area_code: true) + # # => "(755) 6123-4567" + # + # source://activesupport//lib/active_support/number_helper.rb#88 + def number_to_phone(number, options = T.unsafe(nil)); end + + # Formats +number+ to a specific level of precision. + # + # number_to_rounded(12345.6789) # => "12345.679" + # number_to_rounded(12345.6789, precision: 2) # => "12345.68" + # number_to_rounded(12345.6789, precision: 0) # => "12345" + # number_to_rounded(12345, precision: 5) # => "12345.00000" + # + # ==== Options + # + # [+:locale+] + # The locale to use for formatting. Defaults to the current locale. + # + # number_to_rounded(111.234, locale: :fr) + # # => "111,234" + # + # [+:precision+] + # The level of precision, or +nil+ to preserve +number+'s precision. + # Defaults to 3. + # + # number_to_rounded(12345.6789, precision: nil) + # # => "12345.6789" + # + # [+:round_mode+] + # Specifies how rounding is performed. See +BigDecimal.mode+. Defaults to + # +:default+. + # + # number_to_rounded(12.34, precision: 0, round_mode: :up) + # # => "13" + # + # [+:significant+] + # Whether +:precision+ should be applied to significant digits instead of + # fractional digits. Defaults to false. + # + # number_to_rounded(12345.6789) # => "12345.679" + # number_to_rounded(12345.6789, significant: true) # => "12300" + # number_to_rounded(12345.6789, precision: 2) # => "12345.68" + # number_to_rounded(12345.6789, precision: 2, significant: true) # => "12000" + # + # [+:separator+] + # The decimal separator. Defaults to ".". + # + # [+:delimiter+] + # The thousands delimiter. Defaults to ",". + # + # [+:strip_insignificant_zeros+] + # Whether to remove insignificant zeros after the decimal separator. + # Defaults to false. + # + # number_to_rounded(12.34, strip_insignificant_zeros: false) # => "12.340" + # number_to_rounded(12.34, strip_insignificant_zeros: true) # => "12.34" + # number_to_rounded(12.3456, strip_insignificant_zeros: true) # => "12.346" + # + # source://activesupport//lib/active_support/number_helper.rb#320 + def number_to_rounded(number, options = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/number_helper/number_converter.rb#12 +class ActiveSupport::NumberHelper::NumberConverter + # @return [NumberConverter] a new instance of NumberConverter + # + # source://activesupport//lib/active_support/number_helper/number_converter.rb#124 + def initialize(number, options); end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#130 + def execute; end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#14 + def namespace; end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#14 + def namespace=(_arg0); end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#14 + def namespace?; end + + # Returns the value of attribute number. + # + # source://activesupport//lib/active_support/number_helper/number_converter.rb#19 + def number; end + + # Returns the value of attribute opts. + # + # source://activesupport//lib/active_support/number_helper/number_converter.rb#19 + def opts; end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#17 + def validate_float; end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#17 + def validate_float=(_arg0); end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#17 + def validate_float?; end + + private + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#149 + def default_format_options; end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#174 + def default_value(key); end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#145 + def format_options; end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#155 + def i18n_format_options; end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#141 + def options; end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#170 + def translate_in_locale(key, **i18n_options); end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#166 + def translate_number_value_with_default(key, **i18n_options); end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#178 + def valid_bigdecimal; end + + class << self + # source://activesupport//lib/active_support/number_helper/number_converter.rb#120 + def convert(number, options); end + + # source://activesupport//lib/active_support/class_attribute.rb#12 + def namespace; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def namespace=(new_value); end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#14 + def namespace?; end + + # source://activesupport//lib/active_support/class_attribute.rb#12 + def validate_float; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def validate_float=(new_value); end + + # source://activesupport//lib/active_support/number_helper/number_converter.rb#17 + def validate_float?; end + end +end + +# source://activesupport//lib/active_support/number_helper/number_converter.rb#21 +ActiveSupport::NumberHelper::NumberConverter::DEFAULTS = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#7 +class ActiveSupport::NumberHelper::NumberToCurrencyConverter < ::ActiveSupport::NumberHelper::NumberConverter + # source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#10 + def convert; end + + private + + # source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#38 + def i18n_opts; end + + # source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#29 + def options; end + + class << self + # source://activesupport//lib/active_support/class_attribute.rb#12 + def namespace; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def namespace=(new_value); 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/class_attribute.rb#12 + def validate_float; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def validate_float=(new_value); 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/class_attribute.rb#12 + def namespace; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def namespace=(new_value); end + + # source://activesupport//lib/active_support/class_attribute.rb#12 + def validate_float; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def validate_float=(new_value); 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/class_attribute.rb#12 + def namespace; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def namespace=(new_value); end + + # source://activesupport//lib/active_support/class_attribute.rb#12 + def validate_float; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def validate_float=(new_value); 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/class_attribute.rb#12 + def namespace; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def namespace=(new_value); end + end +end + +# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#8 +class ActiveSupport::NumberHelper::NumberToPhoneConverter < ::ActiveSupport::NumberHelper::NumberConverter + # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#9 + def convert; end + + private + + # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#16 + def convert_to_phone_number(number); end + + # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#24 + def convert_with_area_code(number); end + + # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#31 + def convert_without_area_code(number); end + + # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#47 + def country_code(code); end + + # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#43 + def delimiter; end + + # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#51 + def phone_ext(ext); end + + # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#55 + def regexp_pattern(default_pattern); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#39 + def start_with_delimiter?(number); end +end + +# source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#7 +class ActiveSupport::NumberHelper::NumberToRoundedConverter < ::ActiveSupport::NumberHelper::NumberConverter + # source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#11 + def convert; end + + private + + # source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#49 + def format_number(number); end + + # source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#45 + def strip_insignificant_zeros; end + + class << self + # source://activesupport//lib/active_support/class_attribute.rb#12 + def namespace; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def namespace=(new_value); end + + # source://activesupport//lib/active_support/class_attribute.rb#12 + def validate_float; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def validate_float=(new_value); end + end +end + +# source://activesupport//lib/active_support/number_helper/rounding_helper.rb#5 +class ActiveSupport::NumberHelper::RoundingHelper + # @return [RoundingHelper] a new instance of RoundingHelper + # + # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#8 + def initialize(options); end + + # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#20 + def digit_count(number); end + + # Returns the value of attribute options. + # + # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#6 + def options; end + + # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#12 + def round(number); end + + private + + # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#37 + def absolute_precision(number); end + + # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#26 + def convert_to_decimal(number); end +end + +# source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#7 +module ActiveSupport::NumericWithFormat + # \Numeric With Format + # + # Provides options for converting numbers into formatted strings. + # Options are provided for phone numbers, currency, percentage, + # precision, positional notation, file size, and pretty printing. + # + # This method is aliased to to_formatted_s. + # + # ==== Options + # + # For details on which formats use which options, see ActiveSupport::NumberHelper + # + # ==== Examples + # + # Phone Numbers: + # 5551234.to_fs(:phone) # => "555-1234" + # 1235551234.to_fs(:phone) # => "123-555-1234" + # 1235551234.to_fs(:phone, area_code: true) # => "(123) 555-1234" + # 1235551234.to_fs(:phone, delimiter: ' ') # => "123 555 1234" + # 1235551234.to_fs(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555" + # 1235551234.to_fs(:phone, country_code: 1) # => "+1-123-555-1234" + # 1235551234.to_fs(:phone, country_code: 1, extension: 1343, delimiter: '.') + # # => "+1.123.555.1234 x 1343" + # + # Currency: + # 1234567890.50.to_fs(:currency) # => "$1,234,567,890.50" + # 1234567890.506.to_fs(:currency) # => "$1,234,567,890.51" + # 1234567890.506.to_fs(:currency, precision: 3) # => "$1,234,567,890.506" + # 1234567890.506.to_fs(:currency, round_mode: :down) # => "$1,234,567,890.50" + # 1234567890.506.to_fs(:currency, locale: :fr) # => "1 234 567 890,51 €" + # -1234567890.50.to_fs(:currency, negative_format: '(%u%n)') + # # => "($1,234,567,890.50)" + # 1234567890.50.to_fs(:currency, unit: '£', separator: ',', delimiter: '') + # # => "£1234567890,50" + # 1234567890.50.to_fs(:currency, unit: '£', separator: ',', delimiter: '', format: '%n %u') + # # => "1234567890,50 £" + # + # Percentage: + # 100.to_fs(:percentage) # => "100.000%" + # 100.to_fs(:percentage, precision: 0) # => "100%" + # 1000.to_fs(:percentage, delimiter: '.', separator: ',') # => "1.000,000%" + # 302.24398923423.to_fs(:percentage, precision: 5) # => "302.24399%" + # 302.24398923423.to_fs(:percentage, round_mode: :down) # => "302.243%" + # 1000.to_fs(:percentage, locale: :fr) # => "1 000,000%" + # 100.to_fs(:percentage, format: '%n %') # => "100.000 %" + # + # Delimited: + # 12345678.to_fs(:delimited) # => "12,345,678" + # 12345678.05.to_fs(:delimited) # => "12,345,678.05" + # 12345678.to_fs(:delimited, delimiter: '.') # => "12.345.678" + # 12345678.to_fs(:delimited, delimiter: ',') # => "12,345,678" + # 12345678.05.to_fs(:delimited, separator: ' ') # => "12,345,678 05" + # 12345678.05.to_fs(:delimited, locale: :fr) # => "12 345 678,05" + # 98765432.98.to_fs(:delimited, delimiter: ' ', separator: ',') + # # => "98 765 432,98" + # + # Rounded: + # 111.2345.to_fs(:rounded) # => "111.235" + # 111.2345.to_fs(:rounded, precision: 2) # => "111.23" + # 111.2345.to_fs(:rounded, precision: 2, round_mode: :up) # => "111.24" + # 13.to_fs(:rounded, precision: 5) # => "13.00000" + # 389.32314.to_fs(:rounded, precision: 0) # => "389" + # 111.2345.to_fs(:rounded, significant: true) # => "111" + # 111.2345.to_fs(:rounded, precision: 1, significant: true) # => "100" + # 13.to_fs(:rounded, precision: 5, significant: true) # => "13.000" + # 111.234.to_fs(:rounded, locale: :fr) # => "111,234" + # 13.to_fs(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true) + # # => "13" + # 389.32314.to_fs(:rounded, precision: 4, significant: true) # => "389.3" + # 1111.2345.to_fs(:rounded, precision: 2, separator: ',', delimiter: '.') + # # => "1.111,23" + # + # Human-friendly size in Bytes: + # 123.to_fs(:human_size) # => "123 Bytes" + # 1234.to_fs(:human_size) # => "1.21 KB" + # 12345.to_fs(:human_size) # => "12.1 KB" + # 1234567.to_fs(:human_size) # => "1.18 MB" + # 1234567890.to_fs(:human_size) # => "1.15 GB" + # 1234567890123.to_fs(:human_size) # => "1.12 TB" + # 1234567890123456.to_fs(:human_size) # => "1.1 PB" + # 1234567890123456789.to_fs(:human_size) # => "1.07 EB" + # 1234567.to_fs(:human_size, precision: 2) # => "1.2 MB" + # 1234567.to_fs(:human_size, precision: 2, round_mode: :up) # => "1.3 MB" + # 483989.to_fs(:human_size, precision: 2) # => "470 KB" + # 1234567.to_fs(:human_size, precision: 2, separator: ',') # => "1,2 MB" + # 1234567890123.to_fs(:human_size, precision: 5) # => "1.1228 TB" + # 524288000.to_fs(:human_size, precision: 5) # => "500 MB" + # + # Human-friendly format: + # 123.to_fs(:human) # => "123" + # 1234.to_fs(:human) # => "1.23 Thousand" + # 12345.to_fs(:human) # => "12.3 Thousand" + # 1234567.to_fs(:human) # => "1.23 Million" + # 1234567890.to_fs(:human) # => "1.23 Billion" + # 1234567890123.to_fs(:human) # => "1.23 Trillion" + # 1234567890123456.to_fs(:human) # => "1.23 Quadrillion" + # 1234567890123456789.to_fs(:human) # => "1230 Quadrillion" + # 489939.to_fs(:human, precision: 2) # => "490 Thousand" + # 489939.to_fs(:human, precision: 2, round_mode: :down) # => "480 Thousand" + # 489939.to_fs(:human, precision: 4) # => "489.9 Thousand" + # 1234567.to_fs(:human, precision: 4, + # significant: false) # => "1.2346 Million" + # 1234567.to_fs(:human, precision: 1, + # separator: ',', + # significant: false) # => "1,2 Million" + # + # source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#113 + def to_formatted_s(format = T.unsafe(nil), options = T.unsafe(nil)); end + + # \Numeric With Format + # + # Provides options for converting numbers into formatted strings. + # Options are provided for phone numbers, currency, percentage, + # precision, positional notation, file size, and pretty printing. + # + # This method is aliased to to_formatted_s. + # + # ==== Options + # + # For details on which formats use which options, see ActiveSupport::NumberHelper + # + # ==== Examples + # + # Phone Numbers: + # 5551234.to_fs(:phone) # => "555-1234" + # 1235551234.to_fs(:phone) # => "123-555-1234" + # 1235551234.to_fs(:phone, area_code: true) # => "(123) 555-1234" + # 1235551234.to_fs(:phone, delimiter: ' ') # => "123 555 1234" + # 1235551234.to_fs(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555" + # 1235551234.to_fs(:phone, country_code: 1) # => "+1-123-555-1234" + # 1235551234.to_fs(:phone, country_code: 1, extension: 1343, delimiter: '.') + # # => "+1.123.555.1234 x 1343" + # + # Currency: + # 1234567890.50.to_fs(:currency) # => "$1,234,567,890.50" + # 1234567890.506.to_fs(:currency) # => "$1,234,567,890.51" + # 1234567890.506.to_fs(:currency, precision: 3) # => "$1,234,567,890.506" + # 1234567890.506.to_fs(:currency, round_mode: :down) # => "$1,234,567,890.50" + # 1234567890.506.to_fs(:currency, locale: :fr) # => "1 234 567 890,51 €" + # -1234567890.50.to_fs(:currency, negative_format: '(%u%n)') + # # => "($1,234,567,890.50)" + # 1234567890.50.to_fs(:currency, unit: '£', separator: ',', delimiter: '') + # # => "£1234567890,50" + # 1234567890.50.to_fs(:currency, unit: '£', separator: ',', delimiter: '', format: '%n %u') + # # => "1234567890,50 £" + # + # Percentage: + # 100.to_fs(:percentage) # => "100.000%" + # 100.to_fs(:percentage, precision: 0) # => "100%" + # 1000.to_fs(:percentage, delimiter: '.', separator: ',') # => "1.000,000%" + # 302.24398923423.to_fs(:percentage, precision: 5) # => "302.24399%" + # 302.24398923423.to_fs(:percentage, round_mode: :down) # => "302.243%" + # 1000.to_fs(:percentage, locale: :fr) # => "1 000,000%" + # 100.to_fs(:percentage, format: '%n %') # => "100.000 %" + # + # Delimited: + # 12345678.to_fs(:delimited) # => "12,345,678" + # 12345678.05.to_fs(:delimited) # => "12,345,678.05" + # 12345678.to_fs(:delimited, delimiter: '.') # => "12.345.678" + # 12345678.to_fs(:delimited, delimiter: ',') # => "12,345,678" + # 12345678.05.to_fs(:delimited, separator: ' ') # => "12,345,678 05" + # 12345678.05.to_fs(:delimited, locale: :fr) # => "12 345 678,05" + # 98765432.98.to_fs(:delimited, delimiter: ' ', separator: ',') + # # => "98 765 432,98" + # + # Rounded: + # 111.2345.to_fs(:rounded) # => "111.235" + # 111.2345.to_fs(:rounded, precision: 2) # => "111.23" + # 111.2345.to_fs(:rounded, precision: 2, round_mode: :up) # => "111.24" + # 13.to_fs(:rounded, precision: 5) # => "13.00000" + # 389.32314.to_fs(:rounded, precision: 0) # => "389" + # 111.2345.to_fs(:rounded, significant: true) # => "111" + # 111.2345.to_fs(:rounded, precision: 1, significant: true) # => "100" + # 13.to_fs(:rounded, precision: 5, significant: true) # => "13.000" + # 111.234.to_fs(:rounded, locale: :fr) # => "111,234" + # 13.to_fs(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true) + # # => "13" + # 389.32314.to_fs(:rounded, precision: 4, significant: true) # => "389.3" + # 1111.2345.to_fs(:rounded, precision: 2, separator: ',', delimiter: '.') + # # => "1.111,23" + # + # Human-friendly size in Bytes: + # 123.to_fs(:human_size) # => "123 Bytes" + # 1234.to_fs(:human_size) # => "1.21 KB" + # 12345.to_fs(:human_size) # => "12.1 KB" + # 1234567.to_fs(:human_size) # => "1.18 MB" + # 1234567890.to_fs(:human_size) # => "1.15 GB" + # 1234567890123.to_fs(:human_size) # => "1.12 TB" + # 1234567890123456.to_fs(:human_size) # => "1.1 PB" + # 1234567890123456789.to_fs(:human_size) # => "1.07 EB" + # 1234567.to_fs(:human_size, precision: 2) # => "1.2 MB" + # 1234567.to_fs(:human_size, precision: 2, round_mode: :up) # => "1.3 MB" + # 483989.to_fs(:human_size, precision: 2) # => "470 KB" + # 1234567.to_fs(:human_size, precision: 2, separator: ',') # => "1,2 MB" + # 1234567890123.to_fs(:human_size, precision: 5) # => "1.1228 TB" + # 524288000.to_fs(:human_size, precision: 5) # => "500 MB" + # + # Human-friendly format: + # 123.to_fs(:human) # => "123" + # 1234.to_fs(:human) # => "1.23 Thousand" + # 12345.to_fs(:human) # => "12.3 Thousand" + # 1234567.to_fs(:human) # => "1.23 Million" + # 1234567890.to_fs(:human) # => "1.23 Billion" + # 1234567890123.to_fs(:human) # => "1.23 Trillion" + # 1234567890123456.to_fs(:human) # => "1.23 Quadrillion" + # 1234567890123456789.to_fs(:human) # => "1230 Quadrillion" + # 489939.to_fs(:human, precision: 2) # => "490 Thousand" + # 489939.to_fs(:human, precision: 2, round_mode: :down) # => "480 Thousand" + # 489939.to_fs(:human, precision: 4) # => "489.9 Thousand" + # 1234567.to_fs(:human, precision: 4, + # significant: false) # => "1.2346 Million" + # 1234567.to_fs(:human, precision: 1, + # separator: ',', + # significant: false) # => "1,2 Million" + # + # source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#113 + def to_fs(format = T.unsafe(nil), options = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/option_merger.rb#6 +class ActiveSupport::OptionMerger + # @return [OptionMerger] a new instance of OptionMerger + # + # source://activesupport//lib/active_support/option_merger.rb#11 + def initialize(context, options); end + + private + + # source://activesupport//lib/active_support/option_merger.rb#16 + def method_missing(method, *arguments, &block); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/option_merger.rb#34 + def respond_to_missing?(*_arg0, **_arg1, &_arg2); end +end + +# DEPRECATED: +ActiveSupport::OrderedHash+ implements a hash that preserves +# insertion order. +# +# oh = ActiveSupport::OrderedHash.new +# oh[:a] = 1 +# oh[:b] = 2 +# oh.keys # => [:a, :b], this order is guaranteed +# +# Also, maps the +omap+ feature for YAML files +# (See https://yaml.org/type/omap.html) to support ordered items +# when loading from YAML. +# +# +ActiveSupport::OrderedHash+ is namespaced to prevent conflicts +# with other implementations. +# +# source://activesupport//lib/active_support/ordered_hash.rb#24 +class ActiveSupport::OrderedHash < ::Hash + # source://activesupport//lib/active_support/ordered_hash.rb#29 + def encode_with(coder); end + + # Returns true to make sure that this hash is extractable via 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 + +# = Ordered Options +# +# +OrderedOptions+ inherits from +Hash+ and provides dynamic accessor methods. +# +# With a +Hash+, key-value pairs are typically managed like this: +# +# h = {} +# h[:boy] = 'John' +# h[:girl] = 'Mary' +# h[:boy] # => 'John' +# h[:girl] # => 'Mary' +# h[:dog] # => nil +# +# Using +OrderedOptions+, the above code can be written as: +# +# h = ActiveSupport::OrderedOptions.new +# h.boy = 'John' +# h.girl = 'Mary' +# h.boy # => 'John' +# h.girl # => 'Mary' +# h.dog # => nil +# +# To raise an exception when the value is blank, append a +# bang to the key name, like: +# +# h.dog! # => raises KeyError: :dog is blank +# +# source://activesupport//lib/active_support/ordered_options.rb#33 +class ActiveSupport::OrderedOptions < ::Hash + # source://activesupport//lib/active_support/ordered_options.rb#41 + def [](key); end + + # source://activesupport//lib/active_support/ordered_options.rb#37 + def []=(key, value); end + + # source://activesupport//lib/active_support/ordered_options.rb#45 + def dig(key, *identifiers); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/ordered_options.rb#64 + def extractable_options?; end + + # source://activesupport//lib/active_support/ordered_options.rb#68 + def inspect; end + + # source://activesupport//lib/active_support/ordered_options.rb#49 + def method_missing(method, *args); end + + protected + + # preserve the original #[] method + def _get(_arg0); end + + private + + # @return [Boolean] + # + # source://activesupport//lib/active_support/ordered_options.rb#60 + def respond_to_missing?(name, include_private); end +end + +# = \Range With Format +# +# source://activesupport//lib/active_support/core_ext/range/conversions.rb#5 +module ActiveSupport::RangeWithFormat + # Convert range to a formatted string. See RANGE_FORMATS for predefined formats. + # + # This method is aliased to to_formatted_s. + # + # range = (1..100) # => 1..100 + # + # range.to_s # => "1..100" + # range.to_fs(:db) # => "BETWEEN '1' AND '100'" + # + # range = (1..) # => 1.. + # range.to_fs(:db) # => ">= '1'" + # + # range = (..100) # => ..100 + # range.to_fs(:db) # => "<= '100'" + # + # == Adding your own range formats to to_fs + # 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_fs(:db)} and #{stop.to_fs(:db)}" } + # + # source://activesupport//lib/active_support/core_ext/range/conversions.rb#51 + def to_formatted_s(format = T.unsafe(nil)); end + + # Convert range to a formatted string. See RANGE_FORMATS for predefined formats. + # + # This method is aliased to to_formatted_s. + # + # range = (1..100) # => 1..100 + # + # range.to_s # => "1..100" + # range.to_fs(:db) # => "BETWEEN '1' AND '100'" + # + # range = (1..) # => 1.. + # range.to_fs(:db) # => ">= '1'" + # + # range = (..100) # => ..100 + # range.to_fs(:db) # => "<= '100'" + # + # == Adding your own range formats to to_fs + # 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_fs(:db)} and #{stop.to_fs(:db)}" } + # + # source://activesupport//lib/active_support/core_ext/range/conversions.rb#51 + def to_fs(format = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/core_ext/range/conversions.rb#6 +ActiveSupport::RangeWithFormat::RANGE_FORMATS = T.let(T.unsafe(nil), Hash) + +# = Active Support \Reloader +# +# This class defines several callbacks: +# +# to_prepare -- Run once at application startup, and also from +# +to_run+. +# +# to_run -- Run before a work run that is reloading. If +# +reload_classes_only_on_change+ is true (the default), the class +# unload will have already occurred. +# +# to_complete -- Run after a work run that has reloaded. If +# +reload_classes_only_on_change+ is false, the class unload will +# have occurred after the work run, but before this callback. +# +# before_class_unload -- Run immediately before the classes are +# unloaded. +# +# after_class_unload -- Run immediately after the classes are +# unloaded. +# +# source://activesupport//lib/active_support/reloader.rb#28 +class ActiveSupport::Reloader < ::ActiveSupport::ExecutionWrapper + # @return [Reloader] a new instance of Reloader + # + # source://activesupport//lib/active_support/reloader.rb#99 + def initialize; end + + # source://activesupport//lib/active_support/callbacks.rb#923 + def _class_unload_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#923 + def _prepare_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#911 + def _run_class_unload_callbacks(&block); end + + # source://activesupport//lib/active_support/callbacks.rb#911 + def _run_prepare_callbacks(&block); end + + # source://activesupport//lib/active_support/reloader.rb#85 + def check; end + + # source://activesupport//lib/active_support/reloader.rb#85 + def check=(_arg0); end + + # source://activesupport//lib/active_support/reloader.rb#85 + def check?; end + + # source://activesupport//lib/active_support/reloader.rb#126 + def class_unload!(&block); end + + # source://activesupport//lib/active_support/reloader.rb#131 + def complete!; end + + # source://activesupport//lib/active_support/reloader.rb#84 + def executor; end + + # source://activesupport//lib/active_support/reloader.rb#84 + def executor=(_arg0); end + + # source://activesupport//lib/active_support/reloader.rb#84 + def executor?; end + + # Release the unload lock if it has been previously obtained + # + # source://activesupport//lib/active_support/reloader.rb#114 + def release_unload_lock!; end + + # Acquire the ActiveSupport::Dependencies::Interlock unload lock, + # ensuring it will be released automatically + # + # source://activesupport//lib/active_support/reloader.rb#106 + def require_unload_lock!; end + + # source://activesupport//lib/active_support/reloader.rb#121 + def run!; end + + class << self + # source://activesupport//lib/active_support/class_attribute.rb#12 + def __callbacks; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def __callbacks=(new_value); end + + # source://activesupport//lib/active_support/callbacks.rb#915 + def _class_unload_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#919 + def _class_unload_callbacks=(value); end + + # source://activesupport//lib/active_support/callbacks.rb#915 + def _prepare_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#919 + def _prepare_callbacks=(value); end + + # Registers a callback that will run immediately after the classes are unloaded. + # + # source://activesupport//lib/active_support/reloader.rb#44 + def after_class_unload(*args, &block); end + + # Registers a callback that will run immediately before the classes are unloaded. + # + # source://activesupport//lib/active_support/reloader.rb#39 + def before_class_unload(*args, &block); end + + # source://activesupport//lib/active_support/class_attribute.rb#12 + def check; end + + # source://activesupport//lib/active_support/reloader.rb#87 + def check!; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def check=(new_value); end + + # source://activesupport//lib/active_support/reloader.rb#85 + def check?; end + + # source://activesupport//lib/active_support/class_attribute.rb#12 + def executor; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def executor=(new_value); end + + # source://activesupport//lib/active_support/reloader.rb#84 + def executor?; end + + # source://activesupport//lib/active_support/reloader.rb#95 + def prepare!; end + + # Initiate a manual reload + # + # source://activesupport//lib/active_support/reloader.rb#51 + def reload!; end + + # source://activesupport//lib/active_support/reloader.rb#91 + def reloaded!; end + + # source://activesupport//lib/active_support/reloader.rb#62 + def run!(reset: T.unsafe(nil)); end + + # Registers a callback that will run once at application startup and every time the code is reloaded. + # + # source://activesupport//lib/active_support/reloader.rb#34 + def to_prepare(*args, &block); end + + # Run the supplied block as a work unit, reloading code as needed + # + # source://activesupport//lib/active_support/reloader.rb#71 + def wrap(**kwargs); end + end +end + +# = Active Support \Rescuable +# +# Rescuable module adds support for easier exception handling. +# +# source://activesupport//lib/active_support/rescuable.rb#11 +module ActiveSupport::Rescuable + extend ::ActiveSupport::Concern + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + mixes_in_class_methods ::ActiveSupport::Rescuable::ClassMethods + + # Internal handler lookup. Delegates to class method. Some libraries call + # this directly, so keeping it around for compatibility. + # + # source://activesupport//lib/active_support/rescuable.rb#172 + def handler_for_rescue(exception); end + + # Delegates to the class method, but uses the instance as the subject for + # rescue_from handlers (method calls, +instance_exec+ blocks). + # + # source://activesupport//lib/active_support/rescuable.rb#166 + def rescue_with_handler(exception); end + + module GeneratedClassMethods + def rescue_handlers; end + def rescue_handlers=(value); end + def rescue_handlers?; end + end + + module GeneratedInstanceMethods + def rescue_handlers; end + def rescue_handlers=(value); end + def rescue_handlers?; end + end +end + +# source://activesupport//lib/active_support/rescuable.rb#18 +module ActiveSupport::Rescuable::ClassMethods + # source://activesupport//lib/active_support/rescuable.rb#105 + def handler_for_rescue(exception, object: T.unsafe(nil)); end + + # Registers exception classes with a handler to be called by 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 + # rescue_from ActiveRecord::RecordInvalid, with: :show_record_errors + # + # rescue_from "MyApp::BaseError" do |exception| + # redirect_to root_url, alert: exception.message + # end + # + # private + # def deny_access + # head :forbidden + # end + # + # def show_record_errors(exception) + # redirect_back_or_to root_url, alert: exception.record.errors.full_messages.to_sentence + # end + # end + # + # Exceptions raised inside exception handlers are not propagated up. + # + # source://activesupport//lib/active_support/rescuable.rb#53 + def rescue_from(*klasses, with: T.unsafe(nil), &block); end + + # Matches an exception to a handler based on the exception class. + # + # If no handler matches the exception, check for a handler matching the + # (optional) +exception.cause+. If no handler matches the exception or its + # cause, this returns +nil+, so you can deal with unhandled exceptions. + # Be sure to re-raise unhandled exceptions if this is what you expect. + # + # begin + # # ... + # rescue => exception + # rescue_with_handler(exception) || raise + # end + # + # Returns the exception if it was handled and +nil+ if it was not. + # + # source://activesupport//lib/active_support/rescuable.rb#90 + def rescue_with_handler(exception, object: T.unsafe(nil), visited_exceptions: T.unsafe(nil)); end + + private + + # source://activesupport//lib/active_support/rescuable.rb#139 + def constantize_rescue_handler_class(class_or_name); end + + # source://activesupport//lib/active_support/rescuable.rb#124 + def find_rescue_handler(exception); end +end + +# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#19 +class ActiveSupport::SafeBuffer < ::String + # @return [SafeBuffer] a new instance of SafeBuffer + # + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#70 + def initialize(str = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#123 + def %(args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#116 + def *(_); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#112 + def +(other); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#80 + def <<(value); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#38 + def [](*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#104 + def []=(arg1, arg2, arg3 = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#88 + def bytesplice(*args, value); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def capitalize(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def capitalize!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def chomp(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def chomp!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def chop(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def chop!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#59 + def chr; end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#80 + def concat(value); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def delete(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def delete!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def delete_prefix(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def delete_prefix!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def delete_suffix(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def delete_suffix!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def downcase(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def downcase!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#146 + def encode_with(coder); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#167 + def gsub(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#178 + def gsub!(*args, &block); end + + # Returns the value of attribute html_safe. + # + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#134 + def html_safe?; end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#92 + def insert(index, value); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def lstrip(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def lstrip!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def next(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def next!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#96 + def prepend(value); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#100 + def replace(value); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def reverse(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def reverse!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def rstrip(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def rstrip!(*args); end + + # @raise [SafeConcatError] + # + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#65 + def safe_concat(value); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def scrub(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def scrub!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#38 + def slice(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#51 + def slice!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def squeeze(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def squeeze!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def strip(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def strip!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#167 + def sub(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#178 + def sub!(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def succ(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def succ!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def swapcase(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def swapcase!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#142 + def to_param; end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#138 + def to_s; end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def tr(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def tr!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def tr_s(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def tr_s!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def unicode_normalize(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def unicode_normalize!(*args); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#153 + def upcase(*args, &block); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#157 + def upcase!(*args); end + + private + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#193 + def explicit_html_escape_interpolated_argument(arg); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#197 + def implicit_html_escape_interpolated_argument(arg); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#75 + def initialize_copy(other); end + + def original_concat(*_arg0); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#205 + def set_block_back_references(block, match_data); end + + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#211 + def string_into_safe_buffer(new_string, is_html_safe); end +end + +# Raised when ActiveSupport::SafeBuffer#safe_concat is called on unsafe buffers. +# +# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#32 +class ActiveSupport::SafeBuffer::SafeConcatError < ::StandardError + # @return [SafeConcatError] a new instance of SafeConcatError + # + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#33 + def initialize; end +end + +# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#20 +ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#26 +ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS_WITH_BACKREF = T.let(T.unsafe(nil), Array) + +# = Secure Compare Rotator +# +# The ActiveSupport::SecureCompareRotator is a wrapper around ActiveSupport::SecurityUtils.secure_compare +# and allows you to rotate a previously defined value to a new one. +# +# It can be used as follow: +# +# rotator = ActiveSupport::SecureCompareRotator.new('new_production_value') +# rotator.rotate('previous_production_value') +# rotator.secure_compare!('previous_production_value') +# +# One real use case example would be to rotate a basic auth credentials: +# +# class MyController < ApplicationController +# def authenticate_request +# rotator = ActiveSupport::SecureCompareRotator.new('new_password') +# rotator.rotate('old_password') +# +# authenticate_or_request_with_http_basic do |username, password| +# rotator.secure_compare!(password) +# rescue ActiveSupport::SecureCompareRotator::InvalidMatch +# false +# end +# end +# end +# +# source://activesupport//lib/active_support/secure_compare_rotator.rb#32 +class ActiveSupport::SecureCompareRotator + include ::ActiveSupport::SecurityUtils + + # @return [SecureCompareRotator] a new instance of SecureCompareRotator + # + # source://activesupport//lib/active_support/secure_compare_rotator.rb#37 + def initialize(value, on_rotation: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/secure_compare_rotator.rb#43 + def rotate(previous_value); end + + # source://activesupport//lib/active_support/secure_compare_rotator.rb#47 + def secure_compare!(other_value, on_rotation: T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/secure_compare_rotator.rb#35 +class ActiveSupport::SecureCompareRotator::InvalidMatch < ::StandardError; end + +# source://activesupport//lib/active_support/security_utils.rb#4 +module ActiveSupport::SecurityUtils + private + + # @raise [ArgumentError] + # + # source://activesupport//lib/active_support/security_utils.rb#11 + def fixed_length_secure_compare(a, b); end + + # Secure string comparison for strings of variable length. + # + # While a timing attack would not be able to discern the content of + # a secret compared via secure_compare, it is possible to determine + # the secret length. This should be considered when using secure_compare + # to compare weak, short secrets to user input. + # + # source://activesupport//lib/active_support/security_utils.rb#33 + def secure_compare(a, b); end + + class << self + # @raise [ArgumentError] + # + # source://activesupport//lib/active_support/security_utils.rb#11 + def fixed_length_secure_compare(a, b); end + + # Secure string comparison for strings of variable length. + # + # While a timing attack would not be able to discern the content of + # a secret compared via secure_compare, it is possible to determine + # the secret length. This should be considered when using secure_compare + # to compare weak, short secrets to user input. + # + # source://activesupport//lib/active_support/security_utils.rb#33 + def secure_compare(a, b); end + end +end + +# = \String Inquirer +# +# Wrapping a string in this class gives you a prettier way to test +# for equality. The value returned by 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, *_arg1, **_arg2, &_arg3); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/string_inquirer.rb#23 + def respond_to_missing?(method_name, include_private = T.unsafe(nil)); end +end + +# = Active Support \Subscriber +# +# +ActiveSupport::Subscriber+ is an object set to consume +# ActiveSupport::Notifications. The subscriber dispatches notifications to +# a registered object based on its given namespace. +# +# An example would be an Active Record subscriber responsible for collecting +# statistics about queries: +# +# module ActiveRecord +# class StatsSubscriber < ActiveSupport::Subscriber +# attach_to :active_record +# +# def sql(event) +# Statsd.timing("sql.#{event.payload[:name]}", event.duration) +# end +# end +# end +# +# After configured, whenever a "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#32 +class ActiveSupport::Subscriber + # @return [Subscriber] a new instance of Subscriber + # + # source://activesupport//lib/active_support/subscriber.rb#131 + def initialize; end + + # source://activesupport//lib/active_support/subscriber.rb#136 + def call(event); end + + # source://activesupport//lib/active_support/subscriber.rb#129 + def patterns; end + + # source://activesupport//lib/active_support/subscriber.rb#141 + def publish_event(event); end + + class << self + # Attach the subscriber to a namespace. + # + # source://activesupport//lib/active_support/subscriber.rb#35 + def attach_to(namespace, subscriber = T.unsafe(nil), notifier = T.unsafe(nil), inherit_all: T.unsafe(nil)); end + + # Detach the subscriber from a namespace. + # + # source://activesupport//lib/active_support/subscriber.rb#50 + def detach_from(namespace, notifier = T.unsafe(nil)); end + + # Adds event subscribers for all new methods added to the class. + # + # source://activesupport//lib/active_support/subscriber.rb#69 + def method_added(event); end + + # source://activesupport//lib/active_support/subscriber.rb#79 + def subscribers; end + + private + + # source://activesupport//lib/active_support/subscriber.rb#86 + def add_event_subscriber(event); end + + # source://activesupport//lib/active_support/subscriber.rb#124 + def fetch_public_methods(subscriber, inherit_all); end + + # source://activesupport//lib/active_support/subscriber.rb#108 + def find_attached_subscriber; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/subscriber.rb#112 + def invalid_event?(event); end + + # Returns the value of attribute namespace. + # + # source://activesupport//lib/active_support/subscriber.rb#84 + def namespace; end + + # Returns the value of attribute notifier. + # + # source://activesupport//lib/active_support/subscriber.rb#84 + def notifier; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/subscriber.rb#120 + def pattern_subscribed?(pattern); end + + # source://activesupport//lib/active_support/subscriber.rb#116 + def prepare_pattern(event); end + + # source://activesupport//lib/active_support/subscriber.rb#97 + def remove_event_subscriber(event); end + + # Returns the value of attribute subscriber. + # + # source://activesupport//lib/active_support/subscriber.rb#84 + def subscriber; end + end +end + +# = Active Support Tagged Logging +# +# Wraps any standard Logger object to provide tagging capabilities. +# +# May be called with a block: +# +# logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) +# logger.tagged('BCX') { logger.info 'Stuff' } # Logs "[BCX] Stuff" +# logger.tagged('BCX', "Jason") { |tagged_logger| tagged_logger.info 'Stuff' } # Logs "[BCX] [Jason] Stuff" +# logger.tagged('BCX') { logger.tagged('Jason') { logger.info 'Stuff' } } # Logs "[BCX] [Jason] Stuff" +# +# If called without a block, a new logger will be returned with applied tags: +# +# logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) +# logger.tagged("BCX").info "Stuff" # Logs "[BCX] Stuff" +# logger.tagged("BCX", "Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff" +# logger.tagged("BCX").tagged("Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff" +# +# This is used by the default Rails.logger as configured by Railties to make +# it easy to stamp log lines with subdomains, request ids, and anything else +# to aid debugging of multi-user production applications. +# +# source://activesupport//lib/active_support/tagged_logging.rb#29 +module ActiveSupport::TaggedLogging + # source://activesupport//lib/active_support/tagged_logging.rb#139 + def clear_tags!(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/tagged_logging.rb#152 + def flush; end + + # source://activesupport//lib/active_support/tagged_logging.rb#139 + def pop_tags(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/tagged_logging.rb#139 + def push_tags(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/tagged_logging.rb#141 + def tagged(*tags); end + + class << self + # Returns an `ActiveSupport::Logger` that has already been wrapped with tagged logging concern. + # + # source://activesupport//lib/active_support/tagged_logging.rb#117 + def logger(*args, **kwargs); end + + # source://activesupport//lib/active_support/tagged_logging.rb#121 + def new(logger); end + end +end + +# source://activesupport//lib/active_support/tagged_logging.rb#30 +module ActiveSupport::TaggedLogging::Formatter + # This method is invoked when a log event occurs. + # + # source://activesupport//lib/active_support/tagged_logging.rb#32 + def call(severity, timestamp, progname, msg); end + + # source://activesupport//lib/active_support/tagged_logging.rb#51 + def clear_tags!; end + + # source://activesupport//lib/active_support/tagged_logging.rb#61 + def current_tags; end + + # source://activesupport//lib/active_support/tagged_logging.rb#47 + def pop_tags(count = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/tagged_logging.rb#43 + def push_tags(*tags); end + + # source://activesupport//lib/active_support/tagged_logging.rb#55 + def tag_stack; end + + # source://activesupport//lib/active_support/tagged_logging.rb#36 + def tagged(*tags); end + + # source://activesupport//lib/active_support/tagged_logging.rb#65 + def tags_text; end +end + +# source://activesupport//lib/active_support/tagged_logging.rb#108 +module ActiveSupport::TaggedLogging::LocalTagStorage + # Returns the value of attribute tag_stack. + # + # source://activesupport//lib/active_support/tagged_logging.rb#109 + def tag_stack; end + + # Sets the attribute tag_stack + # + # @param value the value to set the attribute tag_stack to. + # + # source://activesupport//lib/active_support/tagged_logging.rb#109 + def tag_stack=(_arg0); end + + class << self + # @private + # + # source://activesupport//lib/active_support/tagged_logging.rb#111 + def extended(base); end + end +end + +# source://activesupport//lib/active_support/tagged_logging.rb#70 +class ActiveSupport::TaggedLogging::TagStack + # @return [TagStack] a new instance of TagStack + # + # source://activesupport//lib/active_support/tagged_logging.rb#73 + def initialize; end + + # source://activesupport//lib/active_support/tagged_logging.rb#91 + def clear; end + + # source://activesupport//lib/active_support/tagged_logging.rb#96 + def format_message(message); end + + # source://activesupport//lib/active_support/tagged_logging.rb#86 + def pop_tags(count); end + + # source://activesupport//lib/active_support/tagged_logging.rb#78 + def push_tags(tags); end + + # Returns the value of attribute tags. + # + # source://activesupport//lib/active_support/tagged_logging.rb#71 + def tags; end +end + +# source://activesupport//lib/active_support/test_case.rb#21 +class ActiveSupport::TestCase < ::Minitest::Test + include ::ActiveSupport::Testing::SetupAndTeardown + include ::ActiveSupport::Testing::TestsWithoutAssertions + include ::ActiveSupport::Testing::TaggedLogging + include ::ActiveSupport::Callbacks + include ::ActiveSupport::Testing::Assertions + include ::ActiveSupport::Testing::ErrorReporterAssertions + include ::ActiveSupport::Testing::Deprecation + include ::ActiveSupport::Testing::ConstantStubbing + include ::ActiveSupport::Testing::TimeHelpers + include ::ActiveSupport::Testing::FileFixtures + extend ::ActiveSupport::Callbacks::ClassMethods + extend ::ActiveSupport::DescendantsTracker + extend ::ActiveSupport::Testing::SetupAndTeardown::ClassMethods + extend ::ActiveSupport::Testing::Declarative + + # source://activesupport//lib/active_support/callbacks.rb#69 + def __callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#911 + def _run_setup_callbacks(&block); end + + # source://activesupport//lib/active_support/callbacks.rb#911 + def _run_teardown_callbacks(&block); end + + # source://activesupport//lib/active_support/callbacks.rb#923 + def _setup_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#923 + def _teardown_callbacks; end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#731 + def assert_no_match(matcher, obj, msg = T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#660 + def assert_not_empty(obj, msg = T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#671 + def assert_not_equal(exp, act, msg = T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#683 + def assert_not_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#695 + def assert_not_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#702 + def assert_not_includes(collection, obj, msg = T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#713 + def assert_not_instance_of(cls, obj, msg = T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#723 + def assert_not_kind_of(cls, obj, msg = T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#741 + def assert_not_nil(obj, msg = T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#776 + def assert_not_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#799 + def assert_not_predicate(o1, op, msg = T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#808 + def assert_not_respond_to(obj, meth, msg = T.unsafe(nil), include_all: T.unsafe(nil)); end + + # source://minitest/5.25.2/lib/minitest/assertions.rb#817 + def assert_not_same(exp, act, msg = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/testing/file_fixtures.rb#20 + def file_fixture_path; end + + # source://activesupport//lib/active_support/testing/file_fixtures.rb#20 + def file_fixture_path?; end + + # source://activesupport//lib/active_support/test_case.rb#300 + def inspect; end + + # source://minitest/5.25.2/lib/minitest.rb#376 + def method_name; end + + class << self + # source://activesupport//lib/active_support/class_attribute.rb#12 + def __callbacks; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def __callbacks=(new_value); end + + # source://activesupport//lib/active_support/callbacks.rb#915 + def _setup_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#919 + def _setup_callbacks=(value); end + + # source://activesupport//lib/active_support/callbacks.rb#915 + def _teardown_callbacks; end + + # source://activesupport//lib/active_support/callbacks.rb#919 + def _teardown_callbacks=(value); end + + # source://activesupport//lib/active_support/class_attribute.rb#12 + def file_fixture_path; end + + # source://activesupport//lib/active_support/class_attribute.rb#15 + def file_fixture_path=(new_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 + # databases and will not work with system tests. + # + # parallelize(workers: :number_of_processors, with: :threads) + # + # The threaded parallelization uses minitest's parallel executor directly. + # The processes parallelization uses a Ruby DRb server. + # + # Because parallelization presents an overhead, it is only enabled when the + # number of tests to run is above the +threshold+ param. The default value is + # 50, and it's configurable via +config.active_support.test_parallelization_threshold+. + # + # source://activesupport//lib/active_support/test_case.rb#81 + def parallelize(workers: T.unsafe(nil), with: T.unsafe(nil), threshold: T.unsafe(nil)); end + + # Set up hook for parallel testing. This can be used if you have multiple + # databases or any behavior that needs to be run after the process is forked + # but before the tests run. + # + # Note: this feature is not available with the threaded parallelization. + # + # In your +test_helper.rb+ add the following: + # + # class ActiveSupport::TestCase + # parallelize_setup do + # # create databases + # end + # end + # + # source://activesupport//lib/active_support/test_case.rb#101 + def parallelize_setup(&block); end + + # Clean up hook for parallel testing. This can be used to drop databases + # if your app uses multiple write/read databases or other clean up before + # the tests finish. This runs before the forked process is closed. + # + # Note: this feature is not available with the threaded parallelization. + # + # In your +test_helper.rb+ add the following: + # + # class ActiveSupport::TestCase + # parallelize_teardown do + # # drop databases + # end + # end + # + # source://activesupport//lib/active_support/test_case.rb#118 + def parallelize_teardown(&block); end + + # Returns the order in which test cases are run. + # + # ActiveSupport::TestCase.test_order # => :random + # + # Possible values are +:random+, +:parallel+, +:alpha+, +:sorted+. + # Defaults to +:random+. + # + # source://activesupport//lib/active_support/test_case.rb#44 + def test_order; end + + # Sets the order in which test cases are run. + # + # ActiveSupport::TestCase.test_order = :random # => :random + # + # Valid values are: + # * +:random+ (to run tests in random order) + # * +:parallel+ (to run tests in parallel) + # * +:sorted+ (to run tests alphabetically by method name) + # * +:alpha+ (equivalent to +:sorted+) + # + # source://activesupport//lib/active_support/test_case.rb#34 + def test_order=(new_order); end + end +end + +# source://activesupport//lib/active_support/test_case.rb#22 +ActiveSupport::TestCase::Assertion = Minitest::Assertion + +# source://activesupport//lib/active_support/testing/tagged_logging.rb#4 +module ActiveSupport::Testing; end + +# source://activesupport//lib/active_support/testing/assertions.rb#7 +module ActiveSupport::Testing::Assertions + # Assertion that the result of evaluating an expression is changed before + # and after invoking the passed in block. + # + # assert_changes 'Status.all_good?' do + # post :create, params: { status: { ok: false } } + # end + # + # You can pass the block as a string to be evaluated in the context of + # the block. A lambda can be passed for the block as well. + # + # assert_changes -> { Status.all_good? } do + # post :create, params: { status: { ok: false } } + # end + # + # The assertion is useful to test side effects. The passed block can be + # anything that can be converted to string with #to_s. + # + # assert_changes :@object do + # @object = 42 + # end + # + # The keyword arguments +:from+ and +:to+ can be given to specify the + # expected initial value and the expected value after the block was + # executed. + # + # assert_changes :@object, from: nil, to: :foo do + # @object = :foo + # end + # + # An error message can be specified. + # + # assert_changes -> { Status.all_good? }, 'Expected the status to be bad' do + # post :create, params: { status: { incident: true } } + # end + # + # source://activesupport//lib/active_support/testing/assertions.rb#195 + def assert_changes(expression, message = T.unsafe(nil), from: T.unsafe(nil), to: T.unsafe(nil), &block); end + + # Test numeric difference between the return value of an expression as a + # result of what is evaluated in the yielded block. + # + # assert_difference 'Article.count' do + # post :create, params: { article: {...} } + # end + # + # An arbitrary expression is passed in and evaluated. + # + # assert_difference 'Article.last.comments(:reload).size' do + # post :create, params: { comment: {...} } + # end + # + # An arbitrary positive or negative difference can be specified. + # The default is +1+. + # + # assert_difference 'Article.count', -1 do + # post :delete, params: { id: ... } + # end + # + # An array of expressions can also be passed in and evaluated. + # + # assert_difference [ 'Article.count', 'Post.count' ], 2 do + # post :create, params: { article: {...} } + # end + # + # A hash of expressions/numeric differences can also be passed in and evaluated. + # + # assert_difference ->{ Article.count } => 1, ->{ Notification.count } => 2 do + # post :create, params: { article: {...} } + # end + # + # A lambda or a list of lambdas can be passed in and evaluated: + # + # assert_difference ->{ Article.count }, 2 do + # post :create, params: { article: {...} } + # end + # + # assert_difference [->{ Article.count }, ->{ Post.count }], 2 do + # post :create, params: { article: {...} } + # end + # + # An error message can be specified. + # + # assert_difference 'Article.count', -1, 'An Article should be destroyed' do + # post :delete, params: { id: ... } + # end + # + # source://activesupport//lib/active_support/testing/assertions.rb#101 + def assert_difference(expression, *args, &block); end + + # Assertion that the result of evaluating an expression is not changed before + # and after invoking the passed in block. + # + # assert_no_changes 'Status.all_good?' do + # post :create, params: { status: { ok: true } } + # end + # + # Provide the optional keyword argument +:from+ to specify the expected + # initial value. + # + # assert_no_changes -> { Status.all_good? }, from: true do + # post :create, params: { status: { ok: true } } + # end + # + # An error message can be specified. + # + # assert_no_changes -> { Status.all_good? }, 'Expected the status to be good' do + # post :create, params: { status: { ok: false } } + # end + # + # source://activesupport//lib/active_support/testing/assertions.rb#252 + def assert_no_changes(expression, message = T.unsafe(nil), from: T.unsafe(nil), &block); end + + # Assertion that the numeric result of evaluating an expression is not + # changed before and after invoking the passed in block. + # + # assert_no_difference 'Article.count' do + # post :create, params: { article: invalid_attributes } + # end + # + # A lambda can be passed in and evaluated. + # + # assert_no_difference -> { Article.count } do + # post :create, params: { article: invalid_attributes } + # end + # + # An error message can be specified. + # + # assert_no_difference 'Article.count', 'An Article should not be created' do + # post :create, params: { article: invalid_attributes } + # end + # + # An array of expressions can also be passed in and evaluated. + # + # assert_no_difference [ 'Article.count', -> { Post.count } ] do + # post :create, params: { article: invalid_attributes } + # end + # + # source://activesupport//lib/active_support/testing/assertions.rb#157 + 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#48 + def assert_nothing_raised; end + + # Asserts that a block raises one of +exp+. This is an enhancement of the + # standard Minitest assertion method with the ability to test error + # messages. + # + # assert_raises(ArgumentError, match: /incorrect param/i) do + # perform_service(param: 'exception') + # end + # + # source://activesupport//lib/active_support/testing/assertions.rb#34 + def assert_raise(*exp, match: T.unsafe(nil), &block); end + + # Asserts that a block raises one of +exp+. This is an enhancement of the + # standard Minitest assertion method with the ability to test error + # messages. + # + # assert_raises(ArgumentError, match: /incorrect param/i) do + # perform_service(param: 'exception') + # end + # + # source://activesupport//lib/active_support/testing/assertions.rb#34 + def assert_raises(*exp, match: T.unsafe(nil), &block); end + + private + + # source://activesupport//lib/active_support/testing/assertions.rb#286 + def _assert_nothing_raised_or_warn(assertion, &block); end + + # source://activesupport//lib/active_support/testing/assertions.rb#301 + def _callable_to_source_string(callable); end +end + +# source://activesupport//lib/active_support/testing/assertions.rb#8 +ActiveSupport::Testing::Assertions::UNTRACKED = T.let(T.unsafe(nil), Object) + +# Resolves a constant from a minitest spec name. +# +# Given the following spec-style test: +# +# describe WidgetsController, :index do +# describe "authenticated user" do +# describe "returns widgets" do +# it "has a controller that exists" do +# assert_kind_of WidgetsController, @controller +# end +# end +# end +# end +# +# The test will have the following name: +# +# "WidgetsController::index::authenticated user::returns widgets" +# +# The constant WidgetsController can be resolved from the name. +# The following code will resolve the constant: +# +# controller = determine_constant_from_test_name(name) do |constant| +# Class === constant && constant < ::ActionController::Metal +# end +# +# source://activesupport//lib/active_support/testing/constant_lookup.rb#32 +module ActiveSupport::Testing::ConstantLookup + extend ::ActiveSupport::Concern + + mixes_in_class_methods ::ActiveSupport::Testing::ConstantLookup::ClassMethods +end + +# source://activesupport//lib/active_support/testing/constant_lookup.rb#35 +module ActiveSupport::Testing::ConstantLookup::ClassMethods + # source://activesupport//lib/active_support/testing/constant_lookup.rb#36 + def determine_constant_from_test_name(test_name); end +end + +# source://activesupport//lib/active_support/testing/constant_stubbing.rb#5 +module ActiveSupport::Testing::ConstantStubbing + # Changes the value of a constant for the duration of a block. Example: + # + # # World::List::Import::LARGE_IMPORT_THRESHOLD = 5000 + # stub_const(World::List::Import, :LARGE_IMPORT_THRESHOLD, 1) do + # assert_equal 1, World::List::Import::LARGE_IMPORT_THRESHOLD + # end + # + # assert_equal 5000, World::List::Import::LARGE_IMPORT_THRESHOLD + # + # Using this method rather than forcing World::List::Import::LARGE_IMPORT_THRESHOLD = 5000 prevents + # warnings from being thrown, and ensures that the old value is returned after the test has completed. + # + # If the constant doesn't already exists, but you need it set for the duration of the block + # you can do so by passing `exists: false`. + # + # stub_const(object, :SOME_CONST, 1, exists: false) do + # assert_equal 1, SOME_CONST + # end + # + # Note: Stubbing a const will stub it across all threads. So if you have concurrent threads + # (like separate test suites running in parallel) that all depend on the same constant, it's possible + # divergent stubbing will trample on each other. + # + # source://activesupport//lib/active_support/testing/constant_stubbing.rb#28 + def stub_const(mod, constant, new_value, exists: T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/testing/declarative.rb#5 +module ActiveSupport::Testing::Declarative + # Helper to define a test method using a String. Under the hood, it replaces + # spaces with underscores and defines the test method. + # + # test "verify something" do + # ... + # end + # + # source://activesupport//lib/active_support/testing/declarative.rb#13 + def test(name, &block); end +end + +# source://activesupport//lib/active_support/testing/deprecation.rb#7 +module ActiveSupport::Testing::Deprecation + # :call-seq: + # assert_deprecated(deprecator, &block) + # assert_deprecated(match, deprecator, &block) + # + # Asserts that a matching deprecation warning was emitted by the given deprecator during the execution of the yielded block. + # + # assert_deprecated(/foo/, CustomDeprecator) do + # CustomDeprecator.warn "foo should no longer be used" + # end + # + # The +match+ object may be a +Regexp+, or +String+ appearing in the message. + # + # assert_deprecated('foo', CustomDeprecator) do + # CustomDeprecator.warn "foo should no longer be used" + # end + # + # If the +match+ is omitted (or explicitly +nil+), any deprecation warning will match. + # + # assert_deprecated(CustomDeprecator) do + # CustomDeprecator.warn "foo should no longer be used" + # end + # + # source://activesupport//lib/active_support/testing/deprecation.rb#30 + def assert_deprecated(match = T.unsafe(nil), deprecator = T.unsafe(nil), &block); end + + # Asserts that no deprecation warnings are emitted by the given deprecator during the execution of the yielded block. + # + # assert_not_deprecated(CustomDeprecator) do + # CustomDeprecator.warn "message" # fails assertion + # end + # + # assert_not_deprecated(ActiveSupport::Deprecation.new) do + # CustomDeprecator.warn "message" # passes assertion, different deprecator + # end + # + # source://activesupport//lib/active_support/testing/deprecation.rb#55 + def assert_not_deprecated(deprecator, &block); end + + # Returns the return value of the block and an array of all the deprecation warnings emitted by the given + # +deprecator+ during the execution of the yielded block. + # + # collect_deprecations(CustomDeprecator) do + # CustomDeprecator.warn "message" + # ActiveSupport::Deprecation.new.warn "other message" + # :result + # end # => [:result, ["message"]] + # + # source://activesupport//lib/active_support/testing/deprecation.rb#69 + def collect_deprecations(deprecator); end +end + +# source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#5 +module ActiveSupport::Testing::ErrorReporterAssertions + # Assertion that the block should cause at least one exception to be reported + # to +Rails.error+. + # + # Passes if the evaluated code in the yielded block reports a matching exception. + # + # assert_error_reported(IOError) do + # Rails.error.report(IOError.new("Oops")) + # end + # + # To test further details about the reported exception, you can use the return + # value. + # + # report = assert_error_reported(IOError) do + # # ... + # end + # assert_equal "Oops", report.error.message + # assert_equal "admin", report.context[:section] + # assert_equal :warning, report.severity + # assert_predicate report, :handled? + # + # source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#88 + def assert_error_reported(error_class = T.unsafe(nil), &block); end + + # Assertion that the block should not cause an exception to be reported + # to +Rails.error+. + # + # Passes if evaluated code in the yielded block reports no exception. + # + # assert_no_error_reported do + # perform_service(param: 'no_exception') + # end + # + # source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#62 + def assert_no_error_reported(&block); end +end + +# source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#6 +module ActiveSupport::Testing::ErrorReporterAssertions::ErrorCollector + class << self + # source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#16 + def record; end + + # source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#29 + def report(error, **kwargs); end + + private + + # source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#38 + def subscribe; end + end +end + +# source://activesupport//lib/active_support/testing/error_reporter_assertions.rb#10 +class ActiveSupport::Testing::ErrorReporterAssertions::ErrorCollector::Report < ::Struct + # Returns the value of attribute context + # + # @return [Object] the current value of context + def context; end + + # Sets the attribute context + # + # @param value [Object] the value to set the attribute context to. + # @return [Object] the newly set value + def context=(_); end + + # Returns the value of attribute error + # + # @return [Object] the current value of error + def error; end + + # Sets the attribute error + # + # @param value [Object] the value to set the attribute error to. + # @return [Object] the newly set value + def error=(_); end + + # Returns the value of attribute handled + # + # @return [Object] the current value of handled + def handled; end + + # Sets the attribute handled + # + # @param value [Object] the value to set the attribute handled to. + # @return [Object] the newly set value + def handled=(_); end + + # Returns the value of attribute handled + # + # @return [Object] the current value of handled + def handled?; end + + # Returns the value of attribute severity + # + # @return [Object] the current value of severity + def severity; end + + # Sets the attribute severity + # + # @param value [Object] the value to set the attribute severity to. + # @return [Object] the newly set value + def severity=(_); end + + # Returns the value of attribute source + # + # @return [Object] the current value of source + def source; end + + # Sets the attribute source + # + # @param value [Object] the value to set the attribute source to. + # @return [Object] the newly set value + def source=(_); end + + class << self + def [](*_arg0); end + def inspect; end + def keyword_init?; end + def members; end + def new(*_arg0); end + end +end + +# Adds simple access to sample files called file fixtures. +# File fixtures are normal files stored in +# 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#7 +module ActiveSupport::Testing::Isolation + include ::ActiveSupport::Testing::Isolation::Forking + + # source://activesupport//lib/active_support/testing/isolation.rb#20 + def run; end + + class << self + # @return [Boolean] + # + # source://activesupport//lib/active_support/testing/isolation.rb#16 + def forking_env?; end + + # source://activesupport//lib/active_support/testing/isolation.rb#10 + def included(klass); end + end +end + +# source://activesupport//lib/active_support/testing/isolation.rb#35 +module ActiveSupport::Testing::Isolation::Forking + # source://activesupport//lib/active_support/testing/isolation.rb#36 + def run_in_isolation(&blk); end +end + +# source://activesupport//lib/active_support/testing/isolation.rb#73 +module ActiveSupport::Testing::Isolation::Subprocess + # Complicated H4X to get this working in Windows / JRuby with + # no forking. + # + # source://activesupport//lib/active_support/testing/isolation.rb#78 + def run_in_isolation(&blk); end +end + +# source://activesupport//lib/active_support/testing/isolation.rb#74 +ActiveSupport::Testing::Isolation::Subprocess::ORIG_ARGV = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/testing/isolation.rb#8 +class ActiveSupport::Testing::Isolation::SubprocessCrashed < ::StandardError; end + +# source://activesupport//lib/active_support/testing/parallelization/server.rb#8 +class ActiveSupport::Testing::Parallelization + # @return [Parallelization] a new instance of Parallelization + # + # source://activesupport//lib/active_support/testing/parallelization.rb#28 + def initialize(worker_count); end + + # source://activesupport//lib/active_support/testing/parallelization.rb#41 + def <<(work); end + + # source://activesupport//lib/active_support/testing/parallelization.rb#18 + def after_fork_hooks; end + + # source://activesupport//lib/active_support/testing/parallelization.rb#26 + def run_cleanup_hooks; end + + # source://activesupport//lib/active_support/testing/parallelization.rb#49 + def shutdown; end + + # source://activesupport//lib/active_support/testing/parallelization.rb#45 + def size; end + + # source://activesupport//lib/active_support/testing/parallelization.rb#35 + def start; end + + class << self + # source://activesupport//lib/active_support/testing/parallelization.rb#14 + def after_fork_hook(&blk); end + + # source://activesupport//lib/active_support/testing/parallelization.rb#18 + def after_fork_hooks; end + + # source://activesupport//lib/active_support/testing/parallelization.rb#22 + def run_cleanup_hook(&blk); end + + # source://activesupport//lib/active_support/testing/parallelization.rb#26 + def run_cleanup_hooks; end + end +end + +# source://activesupport//lib/active_support/testing/parallelization/server.rb#9 +class ActiveSupport::Testing::Parallelization::PrerecordResultClass < ::Struct + # Returns the value of attribute name + # + # @return [Object] the current value of name + def name; end + + # Sets the attribute name + # + # @param value [Object] the value to set the attribute name to. + # @return [Object] the newly set value + def name=(_); end + + class << self + def [](*_arg0); end + def inspect; end + def keyword_init?; end + def members; end + def new(*_arg0); end + end +end + +# source://activesupport//lib/active_support/testing/parallelization/server.rb#11 +class ActiveSupport::Testing::Parallelization::Server + include ::DRb::DRbUndumped + + # @return [Server] a new instance of Server + # + # source://activesupport//lib/active_support/testing/parallelization/server.rb#14 + def initialize; end + + # source://activesupport//lib/active_support/testing/parallelization/server.rb#31 + def <<(o); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/testing/parallelization/server.rb#51 + def active_workers?; end + + # source://activesupport//lib/active_support/testing/parallelization/server.rb#55 + def interrupt; end + + # source://activesupport//lib/active_support/testing/parallelization/server.rb#36 + def pop; end + + # @raise [DRb::DRbConnError] + # + # source://activesupport//lib/active_support/testing/parallelization/server.rb#20 + def record(reporter, result); end + + # source://activesupport//lib/active_support/testing/parallelization/server.rb#59 + def shutdown; end + + # source://activesupport//lib/active_support/testing/parallelization/server.rb#43 + def start_worker(worker_id); end + + # source://activesupport//lib/active_support/testing/parallelization/server.rb#47 + def stop_worker(worker_id); end +end + +# source://activesupport//lib/active_support/testing/parallelization/worker.rb#6 +class ActiveSupport::Testing::Parallelization::Worker + # @return [Worker] a new instance of Worker + # + # source://activesupport//lib/active_support/testing/parallelization/worker.rb#7 + def initialize(number, url); end + + # source://activesupport//lib/active_support/testing/parallelization/worker.rb#80 + def after_fork; end + + # source://activesupport//lib/active_support/testing/parallelization/worker.rb#42 + def perform_job(job); end + + # source://activesupport//lib/active_support/testing/parallelization/worker.rb#86 + def run_cleanup; end + + # source://activesupport//lib/active_support/testing/parallelization/worker.rb#56 + def safe_record(reporter, result); end + + # source://activesupport//lib/active_support/testing/parallelization/worker.rb#14 + def start; end + + # source://activesupport//lib/active_support/testing/parallelization/worker.rb#36 + def work_from_queue; end + + private + + # source://activesupport//lib/active_support/testing/parallelization/worker.rb#93 + def add_setup_exception(result); end + + # source://activesupport//lib/active_support/testing/parallelization/worker.rb#97 + def set_process_title(status); end +end + +# source://activesupport//lib/active_support/testing/parallelize_executor.rb#5 +class ActiveSupport::Testing::ParallelizeExecutor + # @return [ParallelizeExecutor] a new instance of ParallelizeExecutor + # + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#8 + def initialize(size:, with:, threshold: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#22 + def <<(work); end + + # Returns the value of attribute parallelize_with. + # + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#6 + def parallelize_with; end + + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#26 + def shutdown; end + + # Returns the value of attribute size. + # + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#6 + def size; end + + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#15 + def start; end + + # Returns the value of attribute threshold. + # + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#6 + def threshold; end + + private + + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#35 + def build_parallel_executor; end + + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#72 + def execution_info; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#60 + def many_workers?; end + + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#31 + def parallel_executor; end + + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#47 + def parallelize; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#52 + def parallelized?; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#56 + def should_parallelize?; end + + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#68 + def show_execution_info; end + + # source://activesupport//lib/active_support/testing/parallelize_executor.rb#64 + def tests_count; end +end + +# Adds support for +setup+ and +teardown+ callbacks. +# These callbacks serve as a replacement to overwriting the +# #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#9 +class ActiveSupport::Testing::SimpleStubs + # @return [SimpleStubs] a new instance of SimpleStubs + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#12 + def initialize; end + + # Stubs object.method_name with the given block + # If the method is already stubbed, remove that stub + # so that removing this stub will restore the original implementation. + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # target = Time.zone.local(2004, 11, 24, 1, 4, 44) + # simple_stubs.stub_object(Time, :now) { at(target.to_i) } + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#23 + def stub_object(object, method_name, &block); end + + # Returns true if any stubs are set, false if there are none + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#53 + def stubbed?; end + + # Returns the Stub for object#method_name + # (nil if it is not stubbed) + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#48 + def stubbing(object, method_name); end + + # Remove all object-method stubs held by this instance + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#37 + def unstub_all!; end + + private + + # Restores the original object.method described by the Stub + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#59 + def unstub_object(stub); end +end + +# source://activesupport//lib/active_support/testing/time_helpers.rb#10 +class ActiveSupport::Testing::SimpleStubs::Stub < ::Struct + # Returns the value of attribute method_name + # + # @return [Object] the current value of method_name + def method_name; end + + # Sets the attribute method_name + # + # @param value [Object] the value to set the attribute method_name to. + # @return [Object] the newly set value + def method_name=(_); end + + # Returns the value of attribute object + # + # @return [Object] the current value of object + def object; end + + # Sets the attribute object + # + # @param value [Object] the value to set the attribute object to. + # @return [Object] the newly set value + def object=(_); end + + # Returns the value of attribute original_method + # + # @return [Object] the current value of original_method + def original_method; end + + # Sets the attribute original_method + # + # @param value [Object] the value to set the attribute original_method to. + # @return [Object] the newly set value + def original_method=(_); end + + class << self + def [](*_arg0); end + def inspect; end + def keyword_init?; end + def members; end + def new(*_arg0); end + end +end + +# Logs a "PostsControllerTest: test name" heading before each test to +# make test.log easier to search and follow along with. +# +# source://activesupport//lib/active_support/testing/tagged_logging.rb#7 +module ActiveSupport::Testing::TaggedLogging + # source://activesupport//lib/active_support/testing/tagged_logging.rb#10 + def before_setup; end + + # source://activesupport//lib/active_support/testing/tagged_logging.rb#8 + def tagged_logger=(_arg0); end + + private + + # source://activesupport//lib/active_support/testing/tagged_logging.rb#22 + def tagged_logger; end +end + +# Warns when a test case does not perform any assertions. +# +# This is helpful in detecting broken tests that do not perform intended assertions. +# +# source://activesupport//lib/active_support/testing/tests_without_assertions.rb#8 +module ActiveSupport::Testing::TestsWithoutAssertions + # source://activesupport//lib/active_support/testing/tests_without_assertions.rb#9 + def after_teardown; end +end + +# Contains helpers that help you test passage of time. +# +# source://activesupport//lib/active_support/testing/time_helpers.rb#68 +module ActiveSupport::Testing::TimeHelpers + # source://activesupport//lib/active_support/testing/time_helpers.rb#69 + def after_teardown; end + + # Calls +travel_to+ with +Time.now+. Forwards optional with_usec argument. + # + # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00 + # freeze_time + # sleep(1) + # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00 + # + # This method also accepts a block, which will return the current time back to its original + # state at the end of the block: + # + # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00 + # freeze_time do + # sleep(1) + # User.create.created_at # => Sun, 09 Jul 2017 15:34:49 EST -05:00 + # end + # Time.current # => Sun, 09 Jul 2017 15:34:50 EST -05:00 + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#257 + def freeze_time(with_usec: T.unsafe(nil), &block); end + + # Changes current time to the time in the future or in the past by a given time difference by + # stubbing +Time.now+, +Date.today+, and +DateTime.now+. The stubs are automatically removed + # at the end of the test. + # + # Note that the usec for the resulting time will be set to 0 to prevent rounding + # errors with external services, like MySQL (which will round instead of floor, + # leading to off-by-one-second errors), unless the with_usec argument + # is set to true. + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # travel 1.day + # Time.current # => Sun, 10 Nov 2013 15:34:49 EST -05:00 + # Date.current # => Sun, 10 Nov 2013 + # DateTime.current # => Sun, 10 Nov 2013 15:34:49 -0500 + # + # This method also accepts a block, which will return the current time back to its original + # state at the end of the block: + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # travel 1.day do + # User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00 + # end + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#97 + def travel(duration, with_usec: T.unsafe(nil), &block); end + + # Returns the current time back to its original state, by removing the stubs added by + # +travel+, +travel_to+, and +freeze_time+. + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # + # travel_back + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # This method also accepts a block, which brings the stubs back at the end of the block: + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # + # travel_back do + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # end + # + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#231 + def travel_back; end + + # Changes current time to the given time by stubbing +Time.now+, +Time.new+, + # +Date.today+, and +DateTime.now+ to return the time or date passed into this method. + # The stubs are automatically removed at the end of the test. + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # Date.current # => Wed, 24 Nov 2004 + # DateTime.current # => Wed, 24 Nov 2004 01:04:44 -0500 + # + # Dates are taken as their timestamp at the beginning of the day in the + # application time zone. 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), unless the with_usec argument + # is set to true. + # + # This method also accepts a block, which will return the current time back to its original + # state at the end of the block: + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) do + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # end + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#133 + def travel_to(date_or_time, with_usec: T.unsafe(nil)); end + + # Returns the current time back to its original state, by removing the stubs added by + # +travel+, +travel_to+, and +freeze_time+. + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # + # travel_back + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # This method also accepts a block, which brings the stubs back at the end of the block: + # + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # + # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # + # travel_back do + # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00 + # end + # + # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#231 + def unfreeze_time; end + + private + + # Returns the value of attribute in_block. + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#266 + def in_block; end + + # Sets the attribute in_block + # + # @param value the value to set the attribute in_block to. + # + # source://activesupport//lib/active_support/testing/time_helpers.rb#266 + def in_block=(_arg0); end + + # source://activesupport//lib/active_support/testing/time_helpers.rb#262 + def simple_stubs; end +end + +# = Active Support \Time With Zone +# +# A Time-like class that can represent a time in any time zone. Necessary +# because standard Ruby Time instances are limited to UTC and the +# system's 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_fs(:rfc822) # => "Sun, 18 May 2008 13:27:25 -0400" +# t + 1.day # => Mon, 19 May 2008 13:27:25.031505668 EDT -04:00 +# t.beginning_of_year # => Tue, 01 Jan 2008 00:00:00.000000000 EST -05:00 +# t > Time.utc(1999) # => true +# t.is_a?(Time) # => true +# t.is_a?(ActiveSupport::TimeWithZone) # => true +# +# source://activesupport//lib/active_support/time_with_zone.rb#44 +class ActiveSupport::TimeWithZone + include ::DateAndTime::Compatibility + include ::Comparable + + # @return [TimeWithZone] a new instance of TimeWithZone + # + # source://activesupport//lib/active_support/time_with_zone.rb#51 + def initialize(utc_time, time_zone, local_time = T.unsafe(nil), period = T.unsafe(nil)); end + + # Adds an interval of time to the current object's time and returns that + # value as a new TimeWithZone object. + # + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 + # now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00 + # + # If we're adding a Duration of variable length (i.e., years, months, days), + # move forward from #time, otherwise move forward from #utc, for accuracy + # when moving across DST boundaries. + # + # For instance, a time + 24.hours will advance exactly 24 hours, while a + # time + 1.day will advance 23-25 hours, depending on the day. + # + # now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 + # now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00 + # + # source://activesupport//lib/active_support/time_with_zone.rb#298 + def +(other); end + + # Subtracts an interval of time and returns a new TimeWithZone object unless + # the other value +acts_like?+ time. In which case, it will subtract the + # other time and return the difference in seconds as a Float. + # + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 + # now - 1000 # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00 + # + # If subtracting a Duration of variable length (i.e., years, months, days), + # move backward from #time, otherwise move backward from #utc, for accuracy + # when moving across DST boundaries. + # + # For instance, a time - 24.hours will go subtract exactly 24 hours, while a + # time - 1.day will subtract 23-25 hours, depending on the day. + # + # now - 24.hours # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 + # now - 1.day # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00 + # + # If both the TimeWithZone object and the other value act like Time, a Float + # will be returned. + # + # Time.zone.now - 1.day.ago # => 86399.999967 + # + # source://activesupport//lib/active_support/time_with_zone.rb#341 + def -(other); end + + # Use the time in UTC for comparisons. + # + # source://activesupport//lib/active_support/time_with_zone.rb#231 + def <=>(other); end + + # So that +self+ acts_like?(:time). + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#504 + 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#430 + 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#369 + 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").as_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").as_json + # # => "2005/02/01 05:15:10 -1000" + # + # source://activesupport//lib/active_support/time_with_zone.rb#166 + def as_json(options = T.unsafe(nil)); end + + def before?(_arg0); end + + # Returns true if the current object's time is within the specified + # +min+ and +max+ time. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#239 + def between?(min, max); end + + # An instance of ActiveSupport::TimeWithZone is never blank + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#515 + 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.000000000 EST -05:00 + # t.change(min: 30) # => Fri, 14 Apr 2017 11:30:00.000000000 EST -05:00 + # t.change(offset: "-10:00") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00 + # t.change(zone: "Hawaii") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00 + # + # source://activesupport//lib/active_support/time_with_zone.rb#390 + 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#63 + def comparable_time; end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + def day; end + + # Returns true if the current time is within Daylight Savings \Time for the + # specified time zone. + # + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # Time.zone.parse("2012-5-30").dst? # => true + # Time.zone.parse("2012-11-30").dst? # => false + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#94 + def dst?; end + + # source://activesupport//lib/active_support/time_with_zone.rb#178 + def encode_with(coder); end + + # Returns +true+ if +other+ is equal to current object. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#274 + def eql?(other); end + + # Returns a formatted string of the offset from UTC, or an alternative + # string if the time zone is already UTC. + # + # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)" + # Time.zone.now.formatted_offset(true) # => "-05:00" + # Time.zone.now.formatted_offset(false) # => "-0500" + # Time.zone = 'UTC' # => "UTC" + # Time.zone.now.formatted_offset(true, "0") # => "0" + # + # source://activesupport//lib/active_support/time_with_zone.rb#125 + def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/time_with_zone.rb#523 + 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#269 + def future?; end + + # Returns a Time instance of the simultaneous time in the UTC timezone. + # + # source://activesupport//lib/active_support/time_with_zone.rb#63 + def getgm; end + + # Returns a Time instance of the simultaneous time in the system timezone. + # + # source://activesupport//lib/active_support/time_with_zone.rb#83 + def getlocal(utc_offset = T.unsafe(nil)); end + + # Returns a Time instance of the simultaneous time in the UTC timezone. + # + # source://activesupport//lib/active_support/time_with_zone.rb#63 + def getutc; end + + # Returns true if the current time zone is set to UTC. + # + # Time.zone = 'UTC' # => 'UTC' + # Time.zone.now.utc? # => true + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # Time.zone.now.utc? # => false + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#105 + def gmt?; end + + # Returns the offset from current time to UTC time in seconds. + # + # source://activesupport//lib/active_support/time_with_zone.rb#111 + def gmt_offset; end + + # Returns a Time instance of the simultaneous time in the UTC timezone. + # + # source://activesupport//lib/active_support/time_with_zone.rb#63 + def gmtime; end + + # Returns the offset from current time to UTC time in seconds. + # + # source://activesupport//lib/active_support/time_with_zone.rb#111 + def gmtoff; end + + # source://activesupport//lib/active_support/time_with_zone.rb#278 + def hash; end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + def hour; end + + # Returns a string of the object's date and time in the format used by + # HTTP requests. + # + # Time.zone.now.httpdate # => "Tue, 01 Jan 2013 04:39:43 GMT" + # + # source://activesupport//lib/active_support/time_with_zone.rb#186 + def httpdate; end + + # Adds an interval of time to the current object's time and returns that + # value as a new TimeWithZone object. + # + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 + # now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00 + # + # If we're adding a Duration of variable length (i.e., years, months, days), + # move forward from #time, otherwise move forward from #utc, for accuracy + # when moving across DST boundaries. + # + # For instance, a time + 24.hours will advance exactly 24 hours, while a + # time + 1.day will advance 23-25 hours, depending on the day. + # + # now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 + # now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00 + # + # source://activesupport//lib/active_support/time_with_zone.rb#298 + def in(other); end + + # Returns the simultaneous time in Time.zone, or the specified zone. + # + # source://activesupport//lib/active_support/time_with_zone.rb#77 + def in_time_zone(new_zone = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/time_with_zone.rb#174 + def init_with(coder); end + + # Returns a string of the object's date, time, zone, and offset from UTC. + # + # Time.zone.now.inspect # => "Thu, 04 Dec 2014 11:00:25.624541392 EST -05:00" + # + # source://activesupport//lib/active_support/time_with_zone.rb#140 + def inspect; end + + # Say we're a Time to thwart type checking. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#509 + def is_a?(klass); end + + # Returns true if the current time is within Daylight Savings \Time for the + # specified time zone. + # + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # Time.zone.parse("2012-5-30").dst? # => true + # Time.zone.parse("2012-11-30").dst? # => false + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#94 + def isdst; end + + # Returns a string of the object's date and time in the ISO 8601 standard + # format. + # + # Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00" + # + # source://activesupport//lib/active_support/time_with_zone.rb#148 + def iso8601(fraction_digits = T.unsafe(nil)); end + + # Say we're a Time to thwart type checking. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#509 + 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#83 + def localtime(utc_offset = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/time_with_zone.rb#529 + def marshal_dump; end + + # source://activesupport//lib/active_support/time_with_zone.rb#533 + def marshal_load(variables); end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + 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#553 + def method_missing(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + def min; end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + def mon; end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + 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#256 + def next_day?; end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + 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#244 + def past?; end + + # Returns the underlying +TZInfo::TimezonePeriod+. + # + # source://activesupport//lib/active_support/time_with_zone.rb#72 + def period; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#519 + def present?; end + + # Returns true if the current object's time falls within + # the previous day (yesterday). + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#263 + 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#539 + def respond_to?(sym, include_priv = T.unsafe(nil)); end + + # Returns a string of the object's date and time in the RFC 2822 standard + # format. + # + # Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000" + # + # source://activesupport//lib/active_support/time_with_zone.rb#194 + def rfc2822; end + + # Returns a string of the object's date and time in the ISO 8601 standard + # format. + # + # Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00" + # + # source://activesupport//lib/active_support/time_with_zone.rb#148 + def rfc3339(fraction_digits = T.unsafe(nil)); end + + # Returns a string of the object's date and time in the RFC 2822 standard + # format. + # + # Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000" + # + # source://activesupport//lib/active_support/time_with_zone.rb#194 + def rfc822; end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + 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#298 + 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#225 + def strftime(format); end + + # Returns a Time instance that represents the time in +time_zone+. + # + # source://activesupport//lib/active_support/time_with_zone.rb#58 + def time; end + + # Returns the value of attribute time_zone. + # + # source://activesupport//lib/active_support/time_with_zone.rb#49 + def time_zone; end + + # Returns Array of parts of Time in sequence of + # [seconds, minutes, hours, day, month, year, weekday, yearday, dst?, zone]. + # + # now = Time.zone.now # => Tue, 18 Aug 2015 02:29:27.485278555 UTC +00:00 + # now.to_a # => [27, 29, 2, 18, 8, 2015, 2, 230, false, "UTC"] + # + # source://activesupport//lib/active_support/time_with_zone.rb#453 + def to_a; end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + 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#486 + 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#461 + def to_f; end + + # Returns a string of the object's date and time. + # + # This method is aliased to to_formatted_s. + # + # Accepts an optional format: + # * :default - default value, mimics Ruby Time#to_s format. + # * :db - format outputs time in UTC :db time. See Time#to_fs(:db). + # * Any key in +Time::DATE_FORMATS+ can be used. See active_support/core_ext/time/conversions.rb. + # + # source://activesupport//lib/active_support/time_with_zone.rb#212 + def to_formatted_s(format = T.unsafe(nil)); end + + # Returns a string of the object's date and time. + # + # This method is aliased to to_formatted_s. + # + # Accepts an optional format: + # * :default - default value, mimics Ruby Time#to_s format. + # * :db - format outputs time in UTC :db time. See Time#to_fs(:db). + # * Any key in +Time::DATE_FORMATS+ can be used. See active_support/core_ext/time/conversions.rb. + # + # source://activesupport//lib/active_support/time_with_zone.rb#212 + def to_fs(format = T.unsafe(nil)); end + + # Returns the object's date and time as an integer number of seconds + # since the Epoch (January 1, 1970 00:00 UTC). + # + # Time.zone.now.to_i # => 1417709320 + # + # source://activesupport//lib/active_support/time_with_zone.rb#469 + 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#478 + def to_r; end + + # Returns a string of the object's date and time. + # + # source://activesupport//lib/active_support/time_with_zone.rb#200 + def to_s; end + + # Returns an instance of +Time+, either with the same timezone as +self+, + # 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#493 + 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#250 + 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#256 + 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#469 + def tv_sec; end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + def usec; end + + # Returns a Time instance of the simultaneous time in the UTC timezone. + # + # source://activesupport//lib/active_support/time_with_zone.rb#63 + def utc; end + + # Returns true if the current time zone is set to UTC. + # + # Time.zone = 'UTC' # => 'UTC' + # Time.zone.now.utc? # => true + # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' + # Time.zone.now.utc? # => false + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#105 + def utc?; end + + # Returns the offset from current time to UTC time in seconds. + # + # source://activesupport//lib/active_support/time_with_zone.rb#111 + def utc_offset; end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + def wday; end + + # Returns a string of the object's date and time in the ISO 8601 standard + # format. + # + # Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00" + # + # source://activesupport//lib/active_support/time_with_zone.rb#148 + def xmlschema(fraction_digits = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + def yday; end + + # source://activesupport//lib/active_support/time_with_zone.rb#442 + 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#263 + def yesterday?; end + + # Returns the time zone abbreviation. + # + # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)" + # Time.zone.now.zone # => "EST" + # + # source://activesupport//lib/active_support/time_with_zone.rb#133 + def zone; end + + private + + # @return [Boolean] + # + # source://activesupport//lib/active_support/time_with_zone.rb#589 + def duration_of_variable_length?(obj); end + + # source://activesupport//lib/active_support/time_with_zone.rb#570 + def get_period_and_ensure_valid_local_time(period); end + + # source://activesupport//lib/active_support/time_with_zone.rb#562 + 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#547 + def respond_to_missing?(sym, include_priv); end + + # source://activesupport//lib/active_support/time_with_zone.rb#583 + def transfer_time_values_to_utc_constructor(time); end + + # source://activesupport//lib/active_support/time_with_zone.rb#593 + def wrap_with_time_zone(time); end +end + +# source://activesupport//lib/active_support/time_with_zone.rb#45 +ActiveSupport::TimeWithZone::PRECISIONS = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/time_with_zone.rb#560 +ActiveSupport::TimeWithZone::SECONDS_PER_DAY = T.let(T.unsafe(nil), Integer) + +# = Active Support \Time Zone +# +# The TimeZone class serves as a wrapper around +TZInfo::Timezone+ instances. +# It allows us to do the following: +# +# * Limit the set of zones provided by TZInfo to a meaningful subset of 134 +# zones. +# * Retrieve and display zones with a friendlier name +# (e.g., "Eastern \Time (US & Canada)" instead of "America/New_York"). +# * Lazily load +TZInfo::Timezone+ instances only when they're needed. +# * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+, +# +parse+, +at+, and +now+ methods. +# +# If you set 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#31 +class ActiveSupport::TimeZone + include ::Comparable + + # :stopdoc: + # + # @return [TimeZone] a new instance of TimeZone + # + # source://activesupport//lib/active_support/values/time_zone.rb#309 + 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#333 + 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#342 + def =~(re); end + + # source://activesupport//lib/active_support/values/time_zone.rb#567 + def abbr(time); 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#379 + def at(*args); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/values/time_zone.rb#571 + def dst?(time); end + + # source://activesupport//lib/active_support/values/time_zone.rb#579 + 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#327 + def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/values/time_zone.rb#575 + def init_with(coder); end + + # \Method for creating new ActiveSupport::TimeWithZone instance in time zone + # of +self+ from an ISO 8601 string. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.zone.iso8601('1999-12-31T14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00 + # + # If the time components are missing then they will be set to zero. + # + # Time.zone = 'Hawaii' # => "Hawaii" + # Time.zone.iso8601('1999-12-31') # => Fri, 31 Dec 1999 00:00:00 HST -10:00 + # + # If the string is invalid then an +ArgumentError+ will be raised unlike +parse+ + # which usually returns +nil+ when given an invalid date string. + # + # source://activesupport//lib/active_support/values/time_zone.rb#396 + 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#363 + 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#551 + 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#348 + def match?(re); end + + # Returns the value of attribute name. + # + # source://activesupport//lib/active_support/values/time_zone.rb#296 + 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#516 + 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#453 + def parse(str, now = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/values/time_zone.rb#559 + def period_for_local(time, dst = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/values/time_zone.rb#555 + def period_for_utc(time); end + + # source://activesupport//lib/active_support/values/time_zone.rb#563 + 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#469 + 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#507 + 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#354 + def to_s; end + + # Returns the current date in this time zone. + # + # source://activesupport//lib/active_support/values/time_zone.rb#521 + def today; end + + # Returns the next date in this time zone. + # + # source://activesupport//lib/active_support/values/time_zone.rb#526 + def tomorrow; end + + # Returns the value of attribute tzinfo. + # + # source://activesupport//lib/active_support/values/time_zone.rb#297 + def tzinfo; end + + # Returns the offset of this time zone from UTC in seconds. + # + # source://activesupport//lib/active_support/values/time_zone.rb#317 + 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#542 + def utc_to_local(time); end + + # Returns the previous date in this time zone. + # + # source://activesupport//lib/active_support/values/time_zone.rb#531 + def yesterday; end + + private + + # @raise [ArgumentError] + # + # source://activesupport//lib/active_support/values/time_zone.rb#585 + def parts_to_time(parts, now); end + + # source://activesupport//lib/active_support/values/time_zone.rb#610 + 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#232 + 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#223 + def all; end + + # source://activesupport//lib/active_support/values/time_zone.rb#265 + 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#260 + def country_zones(country_code); end + + def create(*_arg0); end + + # source://activesupport//lib/active_support/values/time_zone.rb#207 + def find_tzinfo(name); end + + # Returns a TimeZone instance with the given name, or +nil+ if no + # such TimeZone instance exists. (This exists to support the use of + # this class with the +composed_of+ macro.) + # + # source://activesupport//lib/active_support/values/time_zone.rb#216 + def new(name); end + + # Assumes self represents an offset from UTC in seconds (as returned from + # Time#utc_offset) and turns this into an +HH:MM formatted string. + # + # ActiveSupport::TimeZone.seconds_to_utc_offset(-21_600) # => "-06:00" + # + # source://activesupport//lib/active_support/values/time_zone.rb#199 + def seconds_to_utc_offset(seconds, colon = T.unsafe(nil)); end + + # A convenience method for returning a collection of TimeZone objects + # for time zones in the USA. + # + # source://activesupport//lib/active_support/values/time_zone.rb#254 + def us_zones; end + + private + + # source://activesupport//lib/active_support/values/time_zone.rb#273 + def load_country_zones(code); end + + # source://activesupport//lib/active_support/values/time_zone.rb#287 + def zones_map; end + end +end + +# Keys are \Rails TimeZone names, values are TZInfo identifiers. +# +# source://activesupport//lib/active_support/values/time_zone.rb#33 +ActiveSupport::TimeZone::MAPPING = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/values/time_zone.rb#188 +ActiveSupport::TimeZone::UTC_OFFSET_WITHOUT_COLON = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/values/time_zone.rb#187 +ActiveSupport::TimeZone::UTC_OFFSET_WITH_COLON = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/core_ext/object/json.rb#35 +module ActiveSupport::ToJsonWithActiveSupportEncoder + # source://activesupport//lib/active_support/core_ext/object/json.rb#36 + def to_json(options = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/core_ext/object/try.rb#6 +module ActiveSupport::Tryable + # source://activesupport//lib/active_support/core_ext/object/try.rb#7 + def try(*args, **_arg1, &block); end + + # source://activesupport//lib/active_support/core_ext/object/try.rb#20 + def try!(*args, **_arg1, &block); end +end + +# source://activesupport//lib/active_support/gem_version.rb#9 +module ActiveSupport::VERSION; end + +# source://activesupport//lib/active_support/gem_version.rb#10 +ActiveSupport::VERSION::MAJOR = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/gem_version.rb#11 +ActiveSupport::VERSION::MINOR = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/gem_version.rb#13 +ActiveSupport::VERSION::PRE = T.let(T.unsafe(nil), T.untyped) + +# source://activesupport//lib/active_support/gem_version.rb#15 +ActiveSupport::VERSION::STRING = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/gem_version.rb#12 +ActiveSupport::VERSION::TINY = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/core_ext/hash/conversions.rb#140 +class ActiveSupport::XMLConverter + # @return [XMLConverter] a new instance of XMLConverter + # + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#151 + def initialize(xml, disallowed_types = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#156 + def to_h; end + + private + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#222 + def become_array?(value); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#218 + def become_content?(value); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#226 + def become_empty_string?(value); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#232 + def become_hash?(value); end + + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#172 + def deep_to_h(value); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#241 + def garbage?(value); end + + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#161 + def normalize_keys(params); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#236 + def nothing?(value); end + + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#257 + def process_array(value); end + + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#248 + def process_content(value); end + + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#185 + def process_hash(value); end +end + +# source://activesupport//lib/active_support/core_ext/hash/conversions.rb#149 +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#143 +class ActiveSupport::XMLConverter::DisallowedType < ::StandardError + # @return [DisallowedType] a new instance of DisallowedType + # + # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#144 + def initialize(type); end +end + +# = \XmlMini +# +# To use the much faster libxml parser: +# gem "libxml-ruby" +# XmlMini.backend = 'LibXML' +# +# source://activesupport//lib/active_support/xml_mini.rb#17 +module ActiveSupport::XmlMini + extend ::ActiveSupport::XmlMini + + # source://activesupport//lib/active_support/xml_mini.rb#101 + def backend; end + + # source://activesupport//lib/active_support/xml_mini.rb#105 + def backend=(name); end + + # Returns the value of attribute depth. + # + # source://activesupport//lib/active_support/xml_mini.rb#96 + def depth; end + + # Sets the attribute depth + # + # @param value the value to set the attribute depth to. + # + # source://activesupport//lib/active_support/xml_mini.rb#96 + def depth=(_arg0); end + + # source://activesupport//lib/active_support/xml_mini.rb#99 + def parse(*_arg0, **_arg1, &_arg2); end + + # source://activesupport//lib/active_support/xml_mini.rb#152 + def rename_key(key, options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/xml_mini.rb#119 + def to_tag(key, value, options); end + + # source://activesupport//lib/active_support/xml_mini.rb#111 + def with_backend(name); end + + private + + # source://activesupport//lib/active_support/xml_mini.rb#163 + def _dasherize(key); end + + # source://activesupport//lib/active_support/xml_mini.rb#169 + def _parse_binary(bin, entity); end + + # source://activesupport//lib/active_support/xml_mini.rb#180 + def _parse_file(file, entity); end + + # source://activesupport//lib/active_support/xml_mini.rb#188 + def _parse_hex_binary(bin); end + + # source://activesupport//lib/active_support/xml_mini.rb#200 + def cast_backend_name_to_module(name); end + + # source://activesupport//lib/active_support/xml_mini.rb#192 + def current_thread_backend; end + + # source://activesupport//lib/active_support/xml_mini.rb#196 + def current_thread_backend=(name); end +end + +# source://activesupport//lib/active_support/xml_mini.rb#34 +ActiveSupport::XmlMini::DEFAULT_ENCODINGS = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/xml_mini.rb#56 +ActiveSupport::XmlMini::FORMATTING = T.let(T.unsafe(nil), Hash) + +# This module decorates files deserialized using Hash.from_xml with +# the 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#67 +ActiveSupport::XmlMini::PARSING = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/xml_mini.rb#39 +ActiveSupport::XmlMini::TYPE_NAMES = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/xml_mini/rexml.rb#8 +module ActiveSupport::XmlMini_REXML + extend ::ActiveSupport::XmlMini_REXML + + # Parse an XML Document string or IO into a simple hash. + # + # Same as XmlSimple::xml_in but doesn't shoot itself in the foot, + # and uses the defaults from Active Support. + # + # data:: + # XML Document string or IO to parse + # + # source://activesupport//lib/active_support/xml_mini/rexml.rb#20 + def parse(data); end + + private + + # Actually converts an XML document element into a data structure. + # + # element:: + # The document element to be collapsed. + # + # source://activesupport//lib/active_support/xml_mini/rexml.rb#63 + def collapse(element, depth); end + + # Determines if a document element has text content + # + # element:: + # XML element to be checked. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/xml_mini/rexml.rb#133 + def empty_content?(element); end + + # Converts the attributes array of an XML element into a hash. + # Returns an empty Hash if node has no attributes. + # + # element:: + # XML element to extract attributes from. + # + # source://activesupport//lib/active_support/xml_mini/rexml.rb#123 + def get_attributes(element); end + + # Adds a new key/value pair to an existing Hash. If the key to be added + # already exists and the existing value associated with key is not + # an Array, it will be wrapped in an Array. Then the new value is + # appended to that Array. + # + # hash:: + # Hash to add key/value pair to. + # key:: + # Key to be added. + # value:: + # Value to be associated with key. + # + # source://activesupport//lib/active_support/xml_mini/rexml.rb#103 + def merge!(hash, key, value); end + + # Convert an XML element and merge into the hash + # + # hash:: + # Hash to merge the converted element into. + # element:: + # XML element to merge into hash + # + # @raise [REXML::ParseException] + # + # source://activesupport//lib/active_support/xml_mini/rexml.rb#54 + def merge_element!(hash, element, depth); end + + # Merge all the texts of an element into the hash + # + # hash:: + # Hash to add the converted element to. + # element:: + # XML element whose texts are to me merged into the hash + # + # source://activesupport//lib/active_support/xml_mini/rexml.rb#81 + def merge_texts!(hash, element); end + + # source://activesupport//lib/active_support/xml_mini/rexml.rb#41 + def require_rexml; end +end + +# source://activesupport//lib/active_support/xml_mini/rexml.rb#11 +ActiveSupport::XmlMini_REXML::CONTENT_KEY = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/core_ext/object/to_query.rb#39 +class Array + include ::Enumerable + + # source://activesupport//lib/active_support/core_ext/object/json.rb#164 + 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#263 + 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#76 + 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#83 + 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#69 + 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), &block); 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), &block); 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 ActiveSupport::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 + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#104 + def present?; end + + # Equal to self[1]. + # + # %w( a b c d e ).second # => "b" + # + # source://activesupport//lib/active_support/core_ext/array/access.rb#55 + 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#97 + 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), &block); end + + # Equal to self[2]. + # + # %w( a b c d e ).third # => "c" + # + # source://activesupport//lib/active_support/core_ext/array/access.rb#62 + 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#90 + 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. + # + # This method is aliased to to_formatted_s. + # + # Blog.all.to_fs(:db) # => "1,2,3" + # Blog.none.to_fs(:db) # => "null" + # [1,2].to_fs # => "[1, 2]" + # + # source://activesupport//lib/active_support/core_ext/array/conversions.rb#94 + def to_formatted_s(format = T.unsafe(nil)); end + + # Extends Array#to_s to convert a collection of elements into a + # comma separated id list if :db argument is given as the format. + # + # This method is aliased to to_formatted_s. + # + # Blog.all.to_fs(:db) # => "1,2,3" + # Blog.none.to_fs(:db) # => "null" + # [1,2].to_fs # => "[1, 2]" + # + # source://activesupport//lib/active_support/core_ext/array/conversions.rb#94 + def to_fs(format = T.unsafe(nil)); end + + # Calls 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 + + # 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 all but the last + # element in arrays with three or more elements (default: ", "). + # * :last_word_connector - The sign or word used to join the last element + # in arrays with three or more elements (default: ", and "). + # * :two_words_connector - The sign or word used to join the elements + # in arrays with two 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#60 + def to_sentence(options = T.unsafe(nil)); end + + # Returns a string that represents the array in XML by invoking +to_xml+ + # on each element. Active Record collections delegate their representation + # in XML to this method. + # + # All elements are expected to respond to +to_xml+, if any of them does + # not then an exception is raised. + # + # The root node reflects the class name of the first element in plural + # if all elements belong to the same type and that's not Hash: + # + # customer.projects.to_xml + # + # + # + # + # 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 + + # 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 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#124 +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#134 + def as_json(options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/core_ext/big_decimal/conversions.rb#8 + def to_s(format = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/core_ext/class/attribute.rb#6 +class Class < ::Module + include ::ActiveSupport::DescendantsTracker::ReloadedClassesFiltering + + # 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#86 + 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/descendants_tracker.rb#63 + def descendants; end + + # source://activesupport//lib/active_support/descendants_tracker.rb#59 + def subclasses; end +end + +# source://activesupport//lib/active_support/core_ext/object/json.rb#68 +class Data + # source://activesupport//lib/active_support/core_ext/object/json.rb#69 + def as_json(options = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/core_ext/date/zones.rb#6 +class Date + include ::Comparable + include ::DateAndTime::Zones + include ::DateAndTime::Calculations + + # source://activesupport//lib/active_support/core_ext/date/calculations.rb#90 + def +(other); end + + # source://activesupport//lib/active_support/core_ext/date/calculations.rb#100 + def -(other); end + + # Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there. + # + # source://activesupport//lib/active_support/core_ext/date/calculations.rb#152 + def <=>(other); end + + # Duck-types as a Date-like class. See Object#acts_like?. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date/acts_like.rb#7 + def acts_like_date?; end + + # Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with + # any of these keys: :years, :months, :weeks, :days. + # + # The increments are applied in order of time units from largest to smallest. + # In other words, the date is incremented first by +:years+, then by + # +:months+, then by +:weeks+, then by +:days+. This order can affect the + # result around the end of a month. For example, incrementing first by months + # then by days: + # + # Date.new(2004, 9, 30).advance(months: 1, days: 1) + # # => Sun, 31 Oct 2004 + # + # Whereas incrementing first by days then by months yields a different result: + # + # Date.new(2004, 9, 30).advance(days: 1).advance(months: 1) + # # => Mon, 01 Nov 2004 + # + # source://activesupport//lib/active_support/core_ext/date/calculations.rb#127 + def advance(options); end + + # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) + # and then subtracts the specified number of seconds. + # + # source://activesupport//lib/active_support/core_ext/date/calculations.rb#55 + def ago(seconds); end + + # source://activesupport//lib/active_support/core_ext/object/json.rb#211 + 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#143 + def change(options); end + + # Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there. + # + # source://activesupport//lib/active_support/core_ext/date/calculations.rb#152 + def compare_with_coercion(other); end + + # Converts Date to a Time (or DateTime if necessary) with the time portion set to the end of the day (23:59:59) + # + # source://activesupport//lib/active_support/core_ext/date/calculations.rb#85 + def end_of_day; end + + # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00) + # and then adds the specified number of seconds + # + # source://activesupport//lib/active_support/core_ext/date/calculations.rb#61 + def in(seconds); end + + # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005" + # + # source://activesupport//lib/active_support/core_ext/date/conversions.rb#63 + 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 + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date/blank.rb#15 + def present?; 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#63 + 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_formatted_s. + # + # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 + # + # date.to_fs(:db) # => "2007-11-10" + # date.to_formatted_s(:db) # => "2007-11-10" + # + # date.to_fs(:short) # => "10 Nov" + # date.to_fs(:number) # => "20071110" + # date.to_fs(:long) # => "November 10, 2007" + # date.to_fs(:long_ordinal) # => "November 10th, 2007" + # date.to_fs(:rfc822) # => "10 Nov 2007" + # date.to_fs(:rfc2822) # => "10 Nov 2007" + # date.to_fs(:iso8601) # => "2007-11-10" + # + # == Adding your own date formats to to_fs + # You can add your own formats to the Date::DATE_FORMATS hash. + # Use the format name as the hash key and either a strftime string + # or Proc instance that takes a date argument as the value. + # + # # config/initializers/date_formats.rb + # Date::DATE_FORMATS[:month_and_year] = '%B %Y' + # Date::DATE_FORMATS[:short_ordinal] = ->(date) { date.strftime("%B #{date.day.ordinalize}") } + # + # source://activesupport//lib/active_support/core_ext/date/conversions.rb#49 + 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_formatted_s. + # + # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 + # + # date.to_fs(:db) # => "2007-11-10" + # date.to_formatted_s(:db) # => "2007-11-10" + # + # date.to_fs(:short) # => "10 Nov" + # date.to_fs(:number) # => "20071110" + # date.to_fs(:long) # => "November 10, 2007" + # date.to_fs(:long_ordinal) # => "November 10th, 2007" + # date.to_fs(:rfc822) # => "10 Nov 2007" + # date.to_fs(:rfc2822) # => "10 Nov 2007" + # date.to_fs(:iso8601) # => "2007-11-10" + # + # == Adding your own date formats to to_fs + # You can add your own formats to the Date::DATE_FORMATS hash. + # Use the format name as the hash key and either a strftime string + # or Proc instance that takes a date argument as the value. + # + # # config/initializers/date_formats.rb + # Date::DATE_FORMATS[:month_and_year] = '%B %Y' + # Date::DATE_FORMATS[:short_ordinal] = ->(date) { date.strftime("%B #{date.day.ordinalize}") } + # + # source://activesupport//lib/active_support/core_ext/date/conversions.rb#49 + def to_fs(format = T.unsafe(nil)); end + + # Converts a Date instance to a Time, where the time is set to the beginning of the day. + # The timezone can be either +:local+ or +:utc+ (default +:local+). + # + # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007 + # + # date.to_time # => 2007-11-10 00:00:00 0800 + # date.to_time(:local) # => 2007-11-10 00:00:00 0800 + # + # date.to_time(:utc) # => 2007-11-10 00:00:00 UTC + # + # NOTE: The +:local+ timezone is Ruby's *process* timezone, i.e. 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#83 + 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#95 + 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#6 +module DateAndTime; end + +# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#7 +module DateAndTime::Calculations + # Returns true if the date/time falls after 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#310 + def all_day; end + + # Returns a Range representing the whole month of the current date/time. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#321 + def all_month; end + + # Returns a Range representing the whole quarter of the current date/time. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#326 + def all_quarter; end + + # Returns a Range representing the whole week of the current date/time. + # Week starts on start_day, default is Date.beginning_of_week or config.beginning_of_week when set. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#316 + def all_week(start_day = T.unsafe(nil)); end + + # Returns a Range representing the whole year of the current date/time. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#331 + def all_year; end + + # Returns a new date/time at the start of the month. + # + # today = Date.today # => Thu, 18 Jun 2015 + # today.beginning_of_month # => Mon, 01 Jun 2015 + # + # +DateTime+ objects will have a time set to 0:00. + # + # now = DateTime.current # => Thu, 18 Jun 2015 15:23:13 +0000 + # now.beginning_of_month # => Mon, 01 Jun 2015 00:00:00 +0000 + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#125 + def at_beginning_of_month; end + + # Returns a new date/time at the start of the quarter. + # + # today = Date.today # => Fri, 10 Jul 2015 + # today.beginning_of_quarter # => Wed, 01 Jul 2015 + # + # +DateTime+ objects will have a time set to 0:00. + # + # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 + # now.beginning_of_quarter # => Wed, 01 Jul 2015 00:00:00 +0000 + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#139 + def at_beginning_of_quarter; end + + # Returns a new date/time representing the start of this week on the given day. + # Week is assumed to start on +start_day+, default is + # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. + # +DateTime+ objects have their time set to 0:00. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#267 + def at_beginning_of_week(start_day = T.unsafe(nil)); end + + # Returns a new date/time at the beginning of the year. + # + # today = Date.today # => Fri, 10 Jul 2015 + # today.beginning_of_year # => Thu, 01 Jan 2015 + # + # +DateTime+ objects will have a time set to 0:00. + # + # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 + # now.beginning_of_year # => Thu, 01 Jan 2015 00:00:00 +0000 + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#179 + def at_beginning_of_year; end + + # Returns a new date/time representing the end of the month. + # DateTime objects will have a time set to 23:59:59. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#296 + def at_end_of_month; end + + # Returns a new date/time at the end of the quarter. + # + # today = Date.today # => Fri, 10 Jul 2015 + # today.end_of_quarter # => Wed, 30 Sep 2015 + # + # +DateTime+ objects will have a time set to 23:59:59. + # + # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 + # now.end_of_quarter # => Wed, 30 Sep 2015 23:59:59 +0000 + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#154 + def at_end_of_quarter; end + + # Returns a new date/time representing the end of this week on the given day. + # Week is assumed to start on +start_day+, default is + # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. + # DateTime objects have their time set to 23:59:59. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#283 + def at_end_of_week(start_day = T.unsafe(nil)); end + + # Returns a new date/time representing the end of the year. + # DateTime objects will have a time set to 23:59:59. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#304 + def at_end_of_year; end + + # Returns true if the date/time falls before 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#267 + def beginning_of_week(start_day = T.unsafe(nil)); end + + # Returns a new date/time at the beginning of the year. + # + # today = Date.today # => Fri, 10 Jul 2015 + # today.beginning_of_year # => Thu, 01 Jan 2015 + # + # +DateTime+ objects will have a time set to 0:00. + # + # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 + # now.beginning_of_year # => Thu, 01 Jan 2015 00:00:00 +0000 + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#179 + def beginning_of_year; end + + # Returns a new date/time the specified number of days ago. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#77 + def days_ago(days); end + + # Returns a new date/time the specified number of days in the future. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#82 + def days_since(days); end + + # Returns the number of days to the start of the week on the given day. + # Week is assumed to start on +start_day+, default is + # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#258 + def days_to_week_start(start_day = T.unsafe(nil)); end + + # Returns a new date/time representing the end of the month. + # DateTime objects will have a time set to 23:59:59. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#296 + def end_of_month; end + + # Returns a new date/time at the end of the quarter. + # + # today = Date.today # => Fri, 10 Jul 2015 + # today.end_of_quarter # => Wed, 30 Sep 2015 + # + # +DateTime+ objects will have a time set to 23:59:59. + # + # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000 + # now.end_of_quarter # => Wed, 30 Sep 2015 23:59:59 +0000 + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#154 + def end_of_quarter; end + + # Returns a new date/time representing the end of this week on the given day. + # Week is assumed to start on +start_day+, default is + # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. + # DateTime objects have their time set to 23:59:59. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#283 + def end_of_week(start_day = T.unsafe(nil)); end + + # Returns a new date/time representing the end of the year. + # DateTime objects will have a time set to 23:59:59. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#304 + def end_of_year; end + + # Returns true if the date/time is in the future. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#52 + def future?; end + + # Short-hand for months_ago(1). + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#240 + def last_month; end + + # Short-hand for months_ago(3). + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#245 + def last_quarter; end + + # Returns a new date/time representing the given day in the previous week. + # Week is assumed to start on +start_day+, default is + # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. + # DateTime objects have their time set to 0:00 unless +same_time+ is true. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#223 + def last_week(start_day = T.unsafe(nil), same_time: T.unsafe(nil)); end + + # Returns a new date/time representing the previous weekday. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#230 + def last_weekday; end + + # Short-hand for years_ago(1). + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#251 + def last_year; end + + # Returns Monday of this week assuming that week starts on Monday. + # +DateTime+ objects have their time set to 0:00. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#275 + def monday; end + + # Returns a new date/time the specified number of months ago. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#97 + def months_ago(months); end + + # Returns a new date/time the specified number of months in the future. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#102 + def months_since(months); end + + # Returns true if the date/time is tomorrow. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#35 + def next_day?; end + + # Returns a new date/time representing the next occurrence of the specified day of week. + # + # today = Date.today # => Thu, 14 Dec 2017 + # today.next_occurring(:monday) # => Mon, 18 Dec 2017 + # today.next_occurring(:thursday) # => Thu, 21 Dec 2017 + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#340 + def next_occurring(day_of_week); end + + # Short-hand for months_since(3). + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#215 + def next_quarter; end + + # Returns a new date/time representing the given day in the next week. + # + # today = Date.today # => Thu, 07 May 2015 + # today.next_week # => Mon, 11 May 2015 + # + # The +given_day_in_next_week+ defaults to the beginning of the week + # which is determined by +Date.beginning_of_week+ or +config.beginning_of_week+ + # when set. + # + # today = Date.today # => Thu, 07 May 2015 + # today.next_week(:friday) # => Fri, 15 May 2015 + # + # +DateTime+ objects have their time set to 0:00 unless +same_time+ is true. + # + # now = DateTime.current # => Thu, 07 May 2015 13:31:16 +0000 + # now.next_week # => Mon, 11 May 2015 00:00:00 +0000 + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#200 + def next_week(given_day_in_next_week = T.unsafe(nil), same_time: T.unsafe(nil)); end + + # Returns a new date/time representing the next weekday. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#206 + def next_weekday; end + + # Returns true if the date/time does not fall on a Saturday or Sunday. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#62 + def on_weekday?; end + + # Returns true if the date/time falls on a Saturday or Sunday. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#57 + def on_weekend?; end + + # Returns true if the date/time is in the past. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#47 + def past?; end + + # Returns true if the date/time is yesterday. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#41 + def prev_day?; end + + # Returns a new date/time representing the previous occurrence of the specified day of week. + # + # today = Date.today # => Thu, 14 Dec 2017 + # today.prev_occurring(:monday) # => Mon, 11 Dec 2017 + # today.prev_occurring(:thursday) # => Thu, 07 Dec 2017 + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#351 + def prev_occurring(day_of_week); end + + # Short-hand for months_ago(3). + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#245 + def prev_quarter; end + + # Returns a new date/time representing the given day in the previous week. + # Week is assumed to start on +start_day+, default is + # +Date.beginning_of_week+ or +config.beginning_of_week+ when set. + # DateTime objects have their time set to 0:00 unless +same_time+ is true. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#223 + def prev_week(start_day = T.unsafe(nil), same_time: T.unsafe(nil)); end + + # Returns a new date/time representing the previous weekday. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#230 + def prev_weekday; end + + # Returns the quarter for a date/time. + # + # Date.new(2010, 1, 31).quarter # => 1 + # Date.new(2010, 4, 12).quarter # => 2 + # Date.new(2010, 9, 15).quarter # => 3 + # Date.new(2010, 12, 25).quarter # => 4 + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#166 + def quarter; end + + # Returns Sunday of this week assuming that week starts on Monday. + # +DateTime+ objects have their time set to 23:59:59. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#290 + def sunday; end + + # Returns true if the date/time is today. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#30 + def today?; end + + # Returns a new date/time representing tomorrow. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#25 + def tomorrow; end + + # Returns true if the date/time is tomorrow. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#35 + def tomorrow?; end + + # Returns a new date/time the specified number of weeks ago. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#87 + def weeks_ago(weeks); end + + # Returns a new date/time the specified number of weeks in the future. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#92 + def weeks_since(weeks); end + + # Returns a new date/time the specified number of years ago. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#107 + def years_ago(years); end + + # Returns a new date/time the specified number of years in the future. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#112 + def years_since(years); end + + # Returns a new date/time representing yesterday. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#20 + def yesterday; end + + # Returns true if the date/time is yesterday. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#41 + def yesterday?; end + + private + + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#370 + def copy_time_to(other); end + + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#366 + def days_span(day); end + + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#358 + def first_hour(date_or_time); end + + # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#362 + def last_hour(date_or_time); end +end + +# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#8 +DateAndTime::Calculations::DAYS_INTO_WEEK = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#17 +DateAndTime::Calculations::WEEKEND_DAYS = T.let(T.unsafe(nil), Array) + +# source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#7 +module DateAndTime::Compatibility + # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#39 + def preserve_timezone; end + + # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#56 + def utc_to_local_returns_utc_offset_times; end + + class << self + # -- + # This re-implements the behaviour of the mattr_reader, instead + # of prepending on to it, to avoid overcomplicating a module that + # is in turn included in several places. This will all go away in + # Rails 8.0 anyway. + # + # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#24 + def preserve_timezone; end + + # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#15 + def preserve_timezone=(val); end + + # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#56 + def utc_to_local_returns_utc_offset_times; end + + # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#56 + def utc_to_local_returns_utc_offset_times=(val); end + end +end + +# source://activesupport//lib/active_support/core_ext/date_and_time/zones.rb#4 +module DateAndTime::Zones + # Returns the simultaneous time in 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#208 + 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. + # + # Just like Date#advance, increments are applied in order of time units from + # largest to smallest. This order can affect the result around the end of a + # month. + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#82 + def advance(options); end + + # Returns a new DateTime representing the time a number of seconds ago. + # Do not use this method in combination with x.months, use months_ago instead! + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#109 + def ago(seconds); end + + # source://activesupport//lib/active_support/core_ext/object/json.rb#221 + def as_json(options = T.unsafe(nil)); end + + # Returns a new DateTime representing the start of the day (0:00). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#122 + def at_beginning_of_day; end + + # Returns a new DateTime representing the start of the hour (hh:00:00). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#146 + def at_beginning_of_hour; end + + # Returns a new DateTime representing the start of the minute (hh:mm:00). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#158 + def at_beginning_of_minute; end + + # Returns a new DateTime representing the end of the day (23:59:59). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#140 + def at_end_of_day; end + + # Returns a new DateTime representing the end of the hour (hh:59:59). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#152 + def at_end_of_hour; end + + # Returns a new DateTime representing the end of the minute (hh:mm:59). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#164 + def at_end_of_minute; end + + # Returns a new DateTime representing the middle of the day (12:00) + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130 + def at_midday; end + + # Returns a new DateTime representing the middle of the day (12:00) + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130 + def at_middle_of_day; end + + # Returns a new DateTime representing the start of the day (0:00). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#122 + def at_midnight; end + + # Returns a new DateTime representing the middle of the day (12:00) + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130 + def at_noon; end + + # Returns a new DateTime representing the start of the day (0:00). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#122 + def beginning_of_day; end + + # Returns a new DateTime representing the start of the hour (hh:00:00). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#146 + def beginning_of_hour; end + + # Returns a new DateTime representing the start of the minute (hh:mm:00). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#158 + def beginning_of_minute; end + + # 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#140 + def end_of_day; end + + # Returns a new DateTime representing the end of the hour (hh:59:59). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#152 + def end_of_hour; end + + # Returns a new DateTime representing the end of the minute (hh:mm:59). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#164 + def end_of_minute; end + + # Returns a formatted string of the offset from UTC, or an alternative + # string if the time zone is already UTC. + # + # datetime = DateTime.civil(2000, 1, 1, 0, 0, 0, Rational(-6, 24)) + # datetime.formatted_offset # => "-06:00" + # datetime.formatted_offset(false) # => "-0600" + # + # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#51 + def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end + + # Returns a 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#184 + 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#170 + 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#184 + 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#184 + def gmtime; end + + # Returns a new DateTime representing the time a number of seconds since the + # instance time. Do not use this method in combination with x.months, use + # months_since instead! + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#116 + def in(seconds); end + + # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000". + # + # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#56 + def inspect; end + + # Returns a Time instance of the simultaneous time in the system timezone. + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#170 + def localtime(utc_offset = T.unsafe(nil)); end + + # Returns a new DateTime representing the middle of the day (12:00) + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130 + def midday; end + + # Returns a new DateTime representing the middle of the day (12:00) + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130 + def middle_of_day; end + + # Returns a new DateTime representing the start of the day (0:00). + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#122 + def midnight; end + + # Returns a new DateTime representing the middle of the day (12:00) + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#130 + def noon; end + + # Returns the fraction of a second as nanoseconds + # + # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#94 + def nsec; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date_time/blank.rb#15 + def present?; end + + # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000". + # + # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#56 + def readable_inspect; end + + # Returns the number of seconds since 00:00:00. + # + # DateTime.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0 + # DateTime.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296 + # DateTime.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399 + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#20 + def seconds_since_midnight; end + + # Returns the number of seconds until 23:59:59. + # + # DateTime.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399 + # DateTime.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103 + # DateTime.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0 + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#29 + def seconds_until_end_of_day; end + + # Returns a new DateTime representing the time a number of seconds since the + # instance time. Do not use this method in combination with x.months, use + # months_since instead! + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#116 + def since(seconds); end + + # Returns the fraction of a second as a +Rational+ + # + # DateTime.new(2012, 8, 29, 0, 0, 0.5).subsec # => (1/2) + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#36 + def subsec; end + + # Converts +self+ to a floating-point number of seconds, including fractional microseconds, since the Unix epoch. + # + # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#79 + def to_f; end + + # Convert to a formatted string. See Time::DATE_FORMATS for predefined formats. + # + # This method is aliased to to_formatted_s. + # + # === Examples + # datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000 + # + # datetime.to_fs(:db) # => "2007-12-04 00:00:00" + # datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00" + # datetime.to_fs(:number) # => "20071204000000" + # datetime.to_fs(:short) # => "04 Dec 00:00" + # datetime.to_fs(:long) # => "December 04, 2007 00:00" + # datetime.to_fs(:long_ordinal) # => "December 4th, 2007 00:00" + # datetime.to_fs(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000" + # datetime.to_fs(:iso8601) # => "2007-12-04T00:00:00+00:00" + # + # == Adding your own datetime formats to to_fs + # DateTime formats are shared with Time. You can add your own to the + # Time::DATE_FORMATS hash. Use the format name as the hash key and + # either a strftime string or Proc instance that takes a time or + # datetime argument as the value. + # + # # config/initializers/time_formats.rb + # Time::DATE_FORMATS[:month_and_year] = '%B %Y' + # Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") } + # + # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#35 + def to_formatted_s(format = T.unsafe(nil)); end + + # Convert to a formatted string. See Time::DATE_FORMATS for predefined formats. + # + # This method is aliased to to_formatted_s. + # + # === Examples + # datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000 + # + # datetime.to_fs(:db) # => "2007-12-04 00:00:00" + # datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00" + # datetime.to_fs(:number) # => "20071204000000" + # datetime.to_fs(:short) # => "04 Dec 00:00" + # datetime.to_fs(:long) # => "December 04, 2007 00:00" + # datetime.to_fs(:long_ordinal) # => "December 4th, 2007 00:00" + # datetime.to_fs(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000" + # datetime.to_fs(:iso8601) # => "2007-12-04T00:00:00+00:00" + # + # == Adding your own datetime formats to to_fs + # DateTime formats are shared with Time. You can add your own to the + # Time::DATE_FORMATS hash. Use the format name as the hash key and + # either a strftime string or Proc instance that takes a time or + # datetime argument as the value. + # + # # config/initializers/time_formats.rb + # Time::DATE_FORMATS[:month_and_year] = '%B %Y' + # Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") } + # + # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#35 + def to_fs(format = T.unsafe(nil)); end + + # Converts +self+ to an integer number of seconds since the Unix epoch. + # + # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#84 + def to_i; end + + # 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#184 + def utc; end + + # Returns +true+ if offset == 0. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#197 + def utc?; end + + # Returns the offset value in seconds. + # + # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#202 + def utc_offset; end + + private + + # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#99 + def offset_in_seconds; end + + # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#103 + def seconds_since_unix_epoch; end + + class << self + # Returns DateTime with local offset for given year if format is local else + # offset is zero. + # + # DateTime.civil_from_format :local, 2012 + # # => Sun, 01 Jan 2012 00:00:00 +0300 + # DateTime.civil_from_format :local, 2012, 12, 17 + # # => Mon, 17 Dec 2012 00:00:00 +0000 + # + # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#69 + def civil_from_format(utc_or_local, year, month = T.unsafe(nil), day = T.unsafe(nil), hour = T.unsafe(nil), min = T.unsafe(nil), sec = T.unsafe(nil)); end + + # Returns 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 + # Returns the nil UUID. This is a special form of UUID that is specified to + # have all 128 bits set to zero. + # + # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#58 + def nil_uuid; end + + # Generates a v5 non-random UUID (Universally Unique IDentifier). + # + # Using OpenSSL::Digest::MD5 generates version 3 UUIDs; OpenSSL::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, namespace, name); end + + # Convenience method for uuid_from_hash using OpenSSL::Digest::MD5. + # + # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#42 + def uuid_v3(uuid_namespace, name); end + + # Convenience method for SecureRandom.uuid. + # + # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#52 + def uuid_v4; end + + # Convenience method for uuid_from_hash using OpenSSL::Digest::SHA1. + # + # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#47 + def uuid_v5(uuid_namespace, name); end + + private + + # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#62 + def pack_uuid_namespace(namespace); 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/erb/util.rb#39 +module ERB::Util + include ::ActiveSupport::CoreExt::ERBUtil + include ::ActiveSupport::CoreExt::ERBUtilPrivate + extend ::ActiveSupport::CoreExt::ERBUtil + + private + + # A utility method for escaping HTML without affecting existing escaped entities. + # + # html_escape_once('1 < 2 & 3') + # # => "1 < 2 & 3" + # + # html_escape_once('<< Accept & Checkout') + # # => "<< Accept & Checkout" + # + # source://activesupport//lib/active_support/core_ext/erb/util.rb#63 + def html_escape_once(s); end + + # A utility method for escaping HTML entities in JSON strings. Specifically, the + # &, > and < characters are replaced with their equivalent unicode escaped form - + # \u0026, \u003e, and \u003c. The Unicode sequences \u2028 and \u2029 are also + # escaped as they are treated as newline characters in some JavaScript engines. + # These sequences have identical meaning as the original characters inside the + # context of a JSON string, so assuming the input is a valid and well-formed + # JSON value, the output will have equivalent meaning when parsed: + # + # json = JSON.generate({ name: ""}) + # # => "{\"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/erb/util.rb#124 + def json_escape(s); end + + # A utility method for escaping XML names of tags and names of attributes. + # + # xml_name_escape('1 < 2 & 3') + # # => "1___2___3" + # + # It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name + # + # source://activesupport//lib/active_support/core_ext/erb/util.rb#142 + def xml_name_escape(name); end + + class << self + # source://activesupport//lib/active_support/core_ext/erb/util.rb#25 + def h(s); end + + # source://activesupport//lib/active_support/core_ext/erb/util.rb#25 + def html_escape(s); end + + # A utility method for escaping HTML without affecting existing escaped entities. + # + # html_escape_once('1 < 2 & 3') + # # => "1 < 2 & 3" + # + # html_escape_once('<< Accept & Checkout') + # # => "<< Accept & Checkout" + # + # source://activesupport//lib/active_support/core_ext/erb/util.rb#63 + def html_escape_once(s); end + + # A utility method for escaping HTML entities in JSON strings. Specifically, the + # &, > and < characters are replaced with their equivalent unicode escaped form - + # \u0026, \u003e, and \u003c. The Unicode sequences \u2028 and \u2029 are also + # escaped as they are treated as newline characters in some JavaScript engines. + # These sequences have identical meaning as the original characters inside the + # context of a JSON string, so assuming the input is a valid and well-formed + # JSON value, the output will have equivalent meaning when parsed: + # + # json = JSON.generate({ name: ""}) + # # => "{\"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/erb/util.rb#124 + def json_escape(s); end + + # Tokenizes a line of ERB. This is really just for error reporting and + # nobody should use it. + # + # source://activesupport//lib/active_support/core_ext/erb/util.rb#161 + def tokenize(source); end + + # source://activesupport//lib/active_support/core_ext/erb/util.rb#10 + def unwrapped_html_escape(s); end + + # A utility method for escaping XML names of tags and names of attributes. + # + # xml_name_escape('1 < 2 & 3') + # # => "1___2___3" + # + # It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name + # + # source://activesupport//lib/active_support/core_ext/erb/util.rb#142 + def xml_name_escape(name); end + end +end + +# source://activesupport//lib/active_support/core_ext/erb/util.rb#40 +ERB::Util::HTML_ESCAPE = T.let(T.unsafe(nil), Hash) + +# source://activesupport//lib/active_support/core_ext/erb/util.rb#41 +ERB::Util::HTML_ESCAPE_ONCE_REGEXP = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/core_ext/erb/util.rb#49 +ERB::Util::INVALID_TAG_NAME_FOLLOWING_REGEXP = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/core_ext/erb/util.rb#47 +ERB::Util::INVALID_TAG_NAME_START_REGEXP = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/core_ext/erb/util.rb#50 +ERB::Util::SAFE_XML_TAG_NAME_REGEXP = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/core_ext/erb/util.rb#48 +ERB::Util::TAG_NAME_FOLLOWING_CODEPOINTS = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/core_ext/erb/util.rb#51 +ERB::Util::TAG_NAME_REPLACEMENT_CHAR = T.let(T.unsafe(nil), String) + +# Following XML requirements: https://www.w3.org/TR/REC-xml/#NT-Name +# +# source://activesupport//lib/active_support/core_ext/erb/util.rb#44 +ERB::Util::TAG_NAME_START_CODEPOINTS = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/core_ext/enumerable.rb#18 +module Enumerable + include ::ActiveSupport::ToJsonWithActiveSupportEncoder + extend ::ActiveSupport::EnumerableCoreExt::Constants + + # source://activesupport//lib/active_support/core_ext/object/json.rb#146 + def as_json(options = T.unsafe(nil)); end + + # Returns a new +Array+ without the blank items. + # Uses Object#blank? for determining if an item is blank. + # + # [1, "", nil, 2, " ", [], {}, false, true].compact_blank + # # => [1, 2, true] + # + # Set.new([nil, "", 1, false]).compact_blank + # # => [1] + # + # When called on a +Hash+, returns a new +Hash+ without the blank values. + # + # { a: "", b: 1, c: nil, d: [], e: false, f: true }.compact_blank + # # => { b: 1, f: true } + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#184 + def compact_blank; end + + # The negative of the Enumerable#include?. Returns +true+ if the + # collection does not include the object. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#118 + def exclude?(object); end + + # Returns a copy of the enumerable excluding the specified elements. + # + # ["David", "Rafael", "Aaron", "Todd"].excluding "Aaron", "Todd" + # # => ["David", "Rafael"] + # + # ["David", "Rafael", "Aaron", "Todd"].excluding %w[ Aaron Todd ] + # # => ["David", "Rafael"] + # + # {foo: 1, bar: 2, baz: 3}.excluding :bar + # # => {foo: 1, baz: 3} + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#132 + def excluding(*elements); end + + # Returns a new +Array+ where the order has been set to that provided in the +series+, based on the +key+ of the + # objects in the original enumerable. + # + # [ Person.find(5), Person.find(3), Person.find(1) ].in_order_of(:id, [ 1, 5, 3 ]) + # # => [ Person.find(1), Person.find(5), Person.find(3) ] + # + # If the +series+ include keys that have no corresponding element in the Enumerable, these are ignored. + # If the Enumerable has additional elements that aren't named in the +series+, these are not included in the result, unless + # the +filter+ option is set to +false+. + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#197 + def in_order_of(key, series, filter: T.unsafe(nil)); end + + # Returns a new array that includes the passed elements. + # + # [ 1, 2, 3 ].including(4, 5) + # # => [ 1, 2, 3, 4, 5 ] + # + # ["David", "Rafael"].including %w[ Aaron Todd ] + # # => ["David", "Rafael", "Aaron", "Todd"] + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#112 + def including(*elements); end + + # Convert an enumerable to a hash, using the block result as the key and the + # element as the value. + # + # people.index_by(&:login) + # # => { "nextangle" => , "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#52 + def index_by; end + + # Convert an enumerable to a hash, using the element as the key and the block + # result as the value. + # + # post = Post.new(title: "hey there", body: "what's up?") + # + # %i( title body ).index_with { |attr_name| post.public_send(attr_name) } + # # => { title: "hey there", body: "what's up?" } + # + # If an argument is passed instead of a block, it will be used as the value + # for all elements: + # + # %i( created_at updated_at ).index_with(Time.now) + # # => { created_at: 2020-03-09 22:31:47, updated_at: 2020-03-09 22:31:47 } + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#75 + def index_with(default = T.unsafe(nil)); end + + # Returns +true+ if the enumerable has more than 1 element. Functionally + # equivalent to 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#93 + def many?; end + + # Calculates the maximum from the extracted elements. + # + # payments = [Payment.new(5), Payment.new(15), Payment.new(10)] + # payments.maximum(:price) # => 15 + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#40 + def maximum(key); end + + # Calculates the minimum from the extracted elements. + # + # payments = [Payment.new(5), Payment.new(15), Payment.new(10)] + # payments.minimum(:price) # => 5 + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#32 + def minimum(key); end + + # Extract the given key from the first element in the enumerable. + # + # [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pick(:name) + # # => "David" + # + # [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pick(:id, :name) + # # => [1, "David"] + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#161 + def pick(*keys); end + + # Extract the given key from each element in the enumerable. + # + # [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pluck(:name) + # # => ["David", "Rafael", "Aaron"] + # + # [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pluck(:id, :name) + # # => [[1, "David"], [2, "Rafael"]] + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#145 + def pluck(*keys); end + + # Returns the sole item in the enumerable. If there are no items, or more + # than one item, raises +Enumerable::SoleItemExpectedError+. + # + # ["x"].sole # => "x" + # Set.new.sole # => Enumerable::SoleItemExpectedError: no item found + # { a: 1, b: 2 }.sole # => Enumerable::SoleItemExpectedError: multiple items found + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#211 + def sole; end + + # Returns a copy of the enumerable excluding the specified elements. + # + # ["David", "Rafael", "Aaron", "Todd"].excluding "Aaron", "Todd" + # # => ["David", "Rafael"] + # + # ["David", "Rafael", "Aaron", "Todd"].excluding %w[ Aaron Todd ] + # # => ["David", "Rafael"] + # + # {foo: 1, bar: 2, baz: 3}.excluding :bar + # # => {foo: 1, baz: 3} + # + # source://activesupport//lib/active_support/core_ext/enumerable.rb#132 + def without(*elements); end +end + +# Error generated by +sole+ when called on an enumerable that doesn't have +# exactly one item. +# +# source://activesupport//lib/active_support/core_ext/enumerable.rb#21 +class Enumerable::SoleItemExpectedError < ::StandardError; end + +# source://activesupport//lib/active_support/core_ext/object/json.rb#256 +class Exception + # source://activesupport//lib/active_support/core_ext/object/json.rb#257 + def as_json(options = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/core_ext/object/to_query.rb#32 +class FalseClass + # source://activesupport//lib/active_support/core_ext/object/json.rb#87 + def as_json(options = T.unsafe(nil)); end + + # +false+ is blank: + # + # false.blank? # => true + # + # @return [true] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#71 + def blank?; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#75 + def present?; end + + # Returns +self+. + # + # source://activesupport//lib/active_support/core_ext/object/to_query.rb#34 + def to_param; end +end + +# source://activesupport//lib/active_support/core_ext/file/atomic.rb#5 +class File < ::IO + class << self + # Write to a file atomically. Useful for situations where you don't + # want other processes or threads to see half-written files. + # + # File.atomic_write('important.file') do |file| + # file.write('hello') + # end + # + # This method needs to create a temporary file. By default it will create it + # in the same directory as the destination file. If you don't like this + # behavior you can provide a different directory but it must be on the + # same physical filesystem as the file you're trying to write. + # + # File.atomic_write('/data/something.important', '/data/tmp') do |file| + # file.write('hello') + # end + # + # source://activesupport//lib/active_support/core_ext/file/atomic.rb#21 + def atomic_write(file_name, temp_dir = T.unsafe(nil)); end + + # Private utility method. + # + # source://activesupport//lib/active_support/core_ext/file/atomic.rb#56 + def probe_stat_in(dir); end + end +end + +# source://activesupport//lib/active_support/core_ext/object/json.rb#116 +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#119 + def as_json(options = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/core_ext/hash/deep_merge.rb#5 +class Hash + include ::Enumerable + include ::ActiveSupport::DeepMergeable + + # source://activesupport//lib/active_support/core_ext/object/json.rb#175 + 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#222 + 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#232 + 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 + + # :method: deep_merge! + # :call-seq: deep_merge!(other_hash, &block) + # + # Same as #deep_merge, but modifies +self+. + # + # -- + # Implemented by ActiveSupport::DeepMergeable#deep_merge!. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/hash/deep_merge.rb#39 + def deep_merge?(other); end + + # Returns a new hash with all keys converted to strings. + # This includes the keys from the root hash and from all + # nested hashes and arrays. + # + # hash = { person: { name: 'Rob', age: '28' } } + # + # hash.deep_stringify_keys + # # => {"person"=>{"name"=>"Rob", "age"=>"28"}} + # + # source://activesupport//lib/active_support/core_ext/hash/keys.rb#84 + def deep_stringify_keys; end + + # Destructively converts all keys to strings. + # This includes the keys from the root hash and from all + # nested hashes and arrays. + # + # source://activesupport//lib/active_support/core_ext/hash/keys.rb#91 + def deep_stringify_keys!; end + + # Returns a new hash with all keys converted to symbols, as long as + # they respond to +to_sym+. This includes the keys from the root hash + # and from all nested hashes and arrays. + # + # hash = { 'person' => { 'name' => 'Rob', 'age' => '28' } } + # + # hash.deep_symbolize_keys + # # => {:person=>{:name=>"Rob", :age=>"28"}} + # + # source://activesupport//lib/active_support/core_ext/hash/keys.rb#103 + def deep_symbolize_keys; end + + # Destructively converts all keys to symbols, as long as they respond + # to +to_sym+. This includes the keys from the root hash and from all + # nested hashes and arrays. + # + # source://activesupport//lib/active_support/core_ext/hash/keys.rb#110 + def deep_symbolize_keys!; end + + # Returns a new hash with all keys converted by the block operation. + # This includes the keys from the root hash and from all + # nested hashes and arrays. + # + # hash = { person: { name: 'Rob', age: '28' } } + # + # hash.deep_transform_keys{ |key| key.to_s.upcase } + # # => {"PERSON"=>{"NAME"=>"Rob", "AGE"=>"28"}} + # + # source://activesupport//lib/active_support/core_ext/hash/keys.rb#65 + def deep_transform_keys(&block); end + + # Destructively converts all keys by using the block operation. + # This includes the keys from the root hash and from all + # nested hashes and arrays. + # + # source://activesupport//lib/active_support/core_ext/hash/keys.rb#72 + def deep_transform_keys!(&block); end + + # 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#8 + 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 override 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 + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#118 + def present?; 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. + # + # source://activesupport//lib/active_support/core_ext/object/to_query.rb#75 + def to_param(namespace = T.unsafe(nil)); end + + # Returns a string representation of the receiver suitable for use as a URL + # query string: + # + # {name: 'David', nationality: 'Danish'}.to_query + # # => "name=David&nationality=Danish" + # + # An optional namespace can be passed to enclose key names: + # + # {name: 'David', nationality: 'Danish'}.to_query('user') + # # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish" + # + # The string pairs "key=value" that conform the query string + # are sorted lexicographically in ascending order. + # + # source://activesupport//lib/active_support/core_ext/object/to_query.rb#75 + def to_query(namespace = T.unsafe(nil)); end + + # 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#74 + 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#133 + 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#128 + def from_xml(xml, disallowed_types = T.unsafe(nil)); end + end +end + +# :stopdoc: +# +# source://activesupport//lib/active_support/hash_with_indifferent_access.rb#441 +HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess + +# source://activesupport//lib/active_support/core_ext/object/json.rb#151 +class IO + include ::Enumerable + include ::File::Constants + + # source://activesupport//lib/active_support/core_ext/object/json.rb#152 + def as_json(options = T.unsafe(nil)); end +end + +class IO::Buffer + include ::Comparable + + def initialize(*_arg0); end + + def &(_arg0); end + def <=>(_arg0); end + def ^(_arg0); end + def and!(_arg0); end + def clear(*_arg0); end + def copy(*_arg0); end + def each(*_arg0); end + def each_byte(*_arg0); end + def empty?; end + def external?; end + def free; end + def get_string(*_arg0); end + def get_value(_arg0, _arg1); end + def get_values(_arg0, _arg1); end + def hexdump(*_arg0); end + def inspect; end + def internal?; end + def locked; end + def locked?; end + def mapped?; end + def not!; end + def null?; end + def or!(_arg0); end + def pread(*_arg0); end + def private?; end + def pwrite(*_arg0); end + def read(*_arg0); end + def readonly?; end + def resize(_arg0); end + def set_string(*_arg0); end + def set_value(_arg0, _arg1, _arg2); end + def set_values(_arg0, _arg1, _arg2); end + def shared?; end + def size; end + def slice(*_arg0); end + def to_s; end + def transfer; end + def valid?; end + def values(*_arg0); end + def write(*_arg0); end + def xor!(_arg0); end + def |(_arg0); end + def ~; end + + private + + def initialize_copy(_arg0); end + + class << self + def for(_arg0); end + def map(*_arg0); end + def size_of(_arg0); end + def string(_arg0); end + end +end + +class IO::Buffer::AccessError < ::RuntimeError; end +class IO::Buffer::AllocationError < ::RuntimeError; end +IO::Buffer::BIG_ENDIAN = T.let(T.unsafe(nil), Integer) +IO::Buffer::DEFAULT_SIZE = T.let(T.unsafe(nil), Integer) +IO::Buffer::EXTERNAL = T.let(T.unsafe(nil), Integer) +IO::Buffer::HOST_ENDIAN = T.let(T.unsafe(nil), Integer) +IO::Buffer::INTERNAL = T.let(T.unsafe(nil), Integer) +class IO::Buffer::InvalidatedError < ::RuntimeError; end +IO::Buffer::LITTLE_ENDIAN = T.let(T.unsafe(nil), Integer) +IO::Buffer::LOCKED = T.let(T.unsafe(nil), Integer) +class IO::Buffer::LockedError < ::RuntimeError; end +IO::Buffer::MAPPED = T.let(T.unsafe(nil), Integer) +class IO::Buffer::MaskError < ::ArgumentError; end +IO::Buffer::NETWORK_ENDIAN = T.let(T.unsafe(nil), Integer) +IO::Buffer::PAGE_SIZE = T.let(T.unsafe(nil), Integer) +IO::Buffer::PRIVATE = T.let(T.unsafe(nil), Integer) +IO::Buffer::READONLY = T.let(T.unsafe(nil), Integer) +IO::Buffer::SHARED = T.let(T.unsafe(nil), Integer) + +class IO::ConsoleMode + def echo=(_arg0); end + def raw(*_arg0); end + def raw!(*_arg0); end + + private + + def initialize_copy(_arg0); end +end + +class IO::EAGAINWaitReadable < ::Errno::EAGAIN + include ::IO::WaitReadable +end + +class IO::EAGAINWaitWritable < ::Errno::EAGAIN + include ::IO::WaitWritable +end + +class IO::EINPROGRESSWaitReadable < ::Errno::EINPROGRESS + include ::IO::WaitReadable +end + +class IO::EINPROGRESSWaitWritable < ::Errno::EINPROGRESS + include ::IO::WaitWritable +end + +IO::EWOULDBLOCKWaitReadable = IO::EAGAINWaitReadable +IO::EWOULDBLOCKWaitWritable = IO::EAGAINWaitWritable +IO::PRIORITY = T.let(T.unsafe(nil), Integer) +IO::READABLE = T.let(T.unsafe(nil), Integer) +class IO::TimeoutError < ::IOError; end +IO::WRITABLE = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/core_ext/object/json.rb#243 +class IPAddr + # source://activesupport//lib/active_support/core_ext/object/json.rb#244 + 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 + + # 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 + +Integer::GMP_VERSION = T.let(T.unsafe(nil), String) + +# source://activesupport//lib/active_support/core_ext/kernel/concern.rb#5 +module Kernel + # 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(&block); end + + # Sets $VERBOSE to +nil+ for the duration of the block and back to its original + # value afterwards. + # + # silence_warnings do + # value = noisy_call # no warning voiced + # end + # + # noisy_call # warning voiced + # + # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#14 + def silence_warnings(&block); end + + # Blocks and ignores any exception passed as argument if raised within the block. + # + # suppress(ZeroDivisionError) do + # 1/0 + # puts 'This code is NOT reached' + # end + # + # puts 'This code gets executed and nothing related to ZeroDivisionError was seen' + # + # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#41 + def suppress(*exception_classes); end + + # Sets $VERBOSE for the duration of the block and back to its original + # value afterwards. + # + # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#26 + def with_warnings(flag); end + + class << self + # 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(&block); end + + # Sets $VERBOSE to +nil+ for the duration of the block and back to its original + # value afterwards. + # + # silence_warnings do + # value = noisy_call # no warning voiced + # end + # + # noisy_call # warning voiced + # + # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#14 + def silence_warnings(&block); end + + # Blocks and ignores any exception passed as argument if raised within the block. + # + # suppress(ZeroDivisionError) do + # 1/0 + # puts 'This code is NOT reached' + # end + # + # puts 'This code gets executed and nothing related to ZeroDivisionError was seen' + # + # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#41 + def suppress(*exception_classes); end + + # Sets $VERBOSE for the duration of the block and back to its original + # value afterwards. + # + # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#26 + def with_warnings(flag); end + end +end + +# 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 + +# == Attribute Accessors per Thread +# +# Extends the module object with class/module and instance accessors for +# class/module attributes, just like the native attr* accessors for instance +# attributes, but does so on a per-thread basis. +# +# So the values are scoped within the Thread.current space under the class name +# of the module. +# +# Note that it can also be scoped per-fiber if +Rails.application.config.active_support.isolation_level+ +# is set to +:fiber+. +# +# source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#8 +class Module + include ::Module::Concerning + + # 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 + + # source://activesupport//lib/active_support/core_ext/object/json.rb#53 + def as_json(options = T.unsafe(nil)); 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] + # mattr_accessor(:hair_styles) { [:long, :short] } + # end + # + # class Person + # include HairColors + # end + # + # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] + # Person.class_variable_get("@@hair_styles") # => [:long, :short] + # + # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#208 + def cattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), &blk); end + + # Defines a class attribute and creates a class and instance reader methods. + # The underlying class variable is set to +nil+, if it is not previously + # defined. All class and instance methods created will be public, even if + # this method is called with a private or protected access modifier. + # + # module HairColors + # mattr_reader :hair_colors + # end + # + # HairColors.hair_colors # => nil + # HairColors.class_variable_set("@@hair_colors", [:brown, :black]) + # HairColors.hair_colors # => [:brown, :black] + # + # The attribute name must be a valid method name in Ruby. + # + # module Foo + # mattr_reader :"1_Badname" + # end + # # => NameError: invalid attribute name: 1_Badname + # + # To omit the instance reader method, pass + # 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] + # mattr_reader(:hair_styles) { [:long, :short] } + # end + # + # class Person + # include HairColors + # end + # + # Person.new.hair_colors # => [:brown, :black, :blonde, :red] + # Person.new.hair_styles # => [:long, :short] + # + # @raise [TypeError] + # + # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#55 + def cattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end + + # Defines a class attribute and creates a class and instance writer methods to + # allow assignment to the attribute. All class and instance methods created + # will be public, even if this method is called with a private or protected + # access modifier. + # + # module HairColors + # mattr_writer :hair_colors + # end + # + # class Person + # include HairColors + # end + # + # HairColors.hair_colors = [:brown, :black] + # Person.class_variable_get("@@hair_colors") # => [:brown, :black] + # Person.new.hair_colors = [:blonde, :red] + # HairColors.class_variable_get("@@hair_colors") # => [:blonde, :red] + # + # To omit the instance writer method, pass + # 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] + # mattr_writer(:hair_styles) { [:long, :short] } + # end + # + # class Person + # include HairColors + # end + # + # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] + # Person.class_variable_get("@@hair_styles") # => [:long, :short] + # + # @raise [TypeError] + # + # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#121 + def cattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end + + # Returns a copy of module or class if it's anonymous. If it's + # named, returns +self+. + # + # Object.deep_dup == Object # => true + # klass = Class.new + # klass.deep_dup == klass # => false + # + # source://activesupport//lib/active_support/core_ext/object/deep_dup.rb#64 + def deep_dup; 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 +ActiveSupport::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 + # +ActiveSupport::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 + # # => ActiveSupport::DelegationError: User#age delegated to profile.age, but profile is nil + # + # But if not having a profile yet is fine and should not be an error + # condition: + # + # class User < ActiveRecord::Base + # has_one :profile + # delegate :age, to: :profile, allow_nil: true + # end + # + # User.new.age # nil + # + # Note that if the target is not +nil+ then the call is attempted regardless of the + # :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#160 + def delegate(*methods, to: T.unsafe(nil), prefix: T.unsafe(nil), allow_nil: T.unsafe(nil), private: T.unsafe(nil)); end + + # When building decorators, a common pattern may emerge: + # + # class Partition + # def initialize(event) + # @event = event + # end + # + # def person + # detail.person || creator + # end + # + # private + # def respond_to_missing?(name, include_private = false) + # @event.respond_to?(name, include_private) + # end + # + # def method_missing(method, *args, &block) + # @event.send(method, *args, &block) + # end + # end + # + # With 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 +ActiveSupport::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#218 + def delegate_missing_to(target, allow_nil: T.unsafe(nil)); end + + # deprecate :foo, deprecator: MyLib.deprecator + # deprecate :foo, bar: "warning!", deprecator: MyLib.deprecator + # + # A deprecator is typically an instance of ActiveSupport::Deprecation, but you can also pass any object that responds + # to deprecation_warning(deprecated_method_name, message, caller_backtrace) where you can implement your + # custom warning behavior. + # + # class MyLib::Deprecator + # def deprecation_warning(deprecated_method_name, message, caller_backtrace = nil) + # message = "#{deprecated_method_name} is deprecated and will be removed from MyLibrary | #{message}" + # Kernel.warn message + # end + # end + # + # source://activesupport//lib/active_support/core_ext/module/deprecation.rb#17 + def deprecate(*method_names, deprecator:, **options); end + + # Defines both class and instance accessors for class attributes. + # All class and instance methods created will be public, even if + # this method is called with a private or protected access modifier. + # + # module HairColors + # mattr_accessor :hair_colors + # end + # + # class Person + # include HairColors + # end + # + # HairColors.hair_colors = [:brown, :black, :blonde, :red] + # HairColors.hair_colors # => [:brown, :black, :blonde, :red] + # Person.new.hair_colors # => [:brown, :black, :blonde, :red] + # + # If a subclass changes the value then that would also change the value for + # parent class. Similarly if parent class changes the value then that would + # change the value of subclasses too. + # + # class Citizen < Person + # end + # + # Citizen.new.hair_colors << :blue + # Person.new.hair_colors # => [:brown, :black, :blonde, :red, :blue] + # + # To omit the instance writer method, pass 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] + # mattr_accessor(:hair_styles) { [:long, :short] } + # end + # + # class Person + # include HairColors + # end + # + # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] + # Person.class_variable_get("@@hair_styles") # => [:long, :short] + # + # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#208 + def mattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), &blk); end + + # Defines a class attribute and creates a class and instance reader methods. + # The underlying class variable is set to +nil+, if it is not previously + # defined. All class and instance methods created will be public, even if + # this method is called with a private or protected access modifier. + # + # module HairColors + # mattr_reader :hair_colors + # end + # + # HairColors.hair_colors # => nil + # HairColors.class_variable_set("@@hair_colors", [:brown, :black]) + # HairColors.hair_colors # => [:brown, :black] + # + # The attribute name must be a valid method name in Ruby. + # + # module Foo + # mattr_reader :"1_Badname" + # end + # # => NameError: invalid attribute name: 1_Badname + # + # To omit the instance reader method, pass + # 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] + # mattr_reader(:hair_styles) { [:long, :short] } + # end + # + # class Person + # include HairColors + # end + # + # Person.new.hair_colors # => [:brown, :black, :blonde, :red] + # Person.new.hair_styles # => [:long, :short] + # + # @raise [TypeError] + # + # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#55 + def mattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end + + # Defines a class attribute and creates a class and instance writer methods to + # allow assignment to the attribute. All class and instance methods created + # will be public, even if this method is called with a private or protected + # access modifier. + # + # module HairColors + # mattr_writer :hair_colors + # end + # + # class Person + # include HairColors + # end + # + # HairColors.hair_colors = [:brown, :black] + # Person.class_variable_get("@@hair_colors") # => [:brown, :black] + # Person.new.hair_colors = [:blonde, :red] + # HairColors.class_variable_get("@@hair_colors") # => [:blonde, :red] + # + # To omit the instance writer method, pass + # 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] + # mattr_writer(:hair_styles) { [:long, :short] } + # end + # + # class Person + # include HairColors + # end + # + # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] + # Person.class_variable_get("@@hair_styles") # => [:long, :short] + # + # @raise [TypeError] + # + # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#121 + def mattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end + + # source://activesupport//lib/active_support/core_ext/module/redefine_method.rb#30 + def method_visibility(method); end + + # 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#34 + 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#9 + 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#50 + 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" + # + # Unlike +mattr_accessor+, values are *not* shared with subclasses or parent classes. + # If a subclass changes the value, the parent class' value is not changed. + # If the parent class changes the value, the value of subclasses is not changed. + # + # class Customer < Account + # end + # + # Account.user # => "DHH" + # Customer.user # => nil + # 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 + # + # A default value may be specified using the +:default+ option. Because + # multiple threads can access the default value, non-frozen default values + # will be duped and frozen. + # + # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#170 + 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 = "DHH" + # Current.user # => "DHH" + # Thread.new { Current.user }.value # => nil + # + # 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#41 + 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#101 + def thread_cattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: 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" + # + # Unlike +mattr_accessor+, values are *not* shared with subclasses or parent classes. + # If a subclass changes the value, the parent class' value is not changed. + # If the parent class changes the value, the value of subclasses is not changed. + # + # class Customer < Account + # end + # + # Account.user # => "DHH" + # Customer.user # => nil + # 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 + # + # A default value may be specified using the +:default+ option. Because + # multiple threads can access the default value, non-frozen default values + # will be duped and frozen. + # + # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#170 + 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 = "DHH" + # Current.user # => "DHH" + # Thread.new { Current.user }.value # => nil + # + # 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#41 + 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#101 + def thread_mattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil)); end + + private + + # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#40 + def attr_internal_define(attr_name, type); end + + class << self + # Returns the value of attribute attr_internal_naming_format. + # + # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#23 + def attr_internal_naming_format; end + + # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#25 + def attr_internal_naming_format=(format); 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#5 +Module::DelegationError = ActiveSupport::DelegationError + +# 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#56 + 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/to_query.rb#18 +class NilClass + # source://activesupport//lib/active_support/core_ext/object/json.rb#93 + def as_json(options = T.unsafe(nil)); end + + # +nil+ is blank: + # + # nil.blank? # => true + # + # @return [true] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#56 + def blank?; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#60 + def present?; end + + # Returns +self+. + # + # source://activesupport//lib/active_support/core_ext/object/to_query.rb#20 + def to_param; end + + # Calling +try+ on +nil+ always returns +nil+. + # It becomes especially helpful when navigating through associations that may return +nil+. + # + # nil.try(:name) # => nil + # + # Without +try+ + # @person && @person.children.any? && @person.children.first.name + # + # With +try+ + # @person.try(:children).try(:first).try(:name) + # + # source://activesupport//lib/active_support/core_ext/object/try.rb#148 + def try(*_arg0); end + + # Calling +try!+ on +nil+ always returns +nil+. + # + # nil.try!(:name) # => nil + # + # source://activesupport//lib/active_support/core_ext/object/try.rb#155 + def try!(*_arg0); end +end + +# source://activesupport//lib/active_support/core_ext/numeric/time.rb#9 +class Numeric + include ::Comparable + + # source://activesupport//lib/active_support/core_ext/object/json.rb#111 + def as_json(options = T.unsafe(nil)); end + + # No number is blank: + # + # 1.blank? # => false + # 0.blank? # => false + # + # @return [false] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#177 + def blank?; end + + # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes + # + # 2.bytes # => 2 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#15 + def byte; end + + # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes + # + # 2.bytes # => 2 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#15 + def bytes; end + + # Returns a Duration instance matching the number of days provided. + # + # 2.days # => 2 days + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#37 + def day; end + + # Returns a Duration instance matching the number of days provided. + # + # 2.days # => 2 days + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#37 + def days; end + + # Returns the number of bytes equivalent to the exabytes provided. + # + # 2.exabytes # => 2_305_843_009_213_693_952 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#63 + def exabyte; end + + # Returns the number of bytes equivalent to the exabytes provided. + # + # 2.exabytes # => 2_305_843_009_213_693_952 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#63 + def exabytes; end + + # Returns a Duration instance matching the number of fortnights provided. + # + # 2.fortnights # => 4 weeks + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#53 + def fortnight; end + + # Returns a Duration instance matching the number of fortnights provided. + # + # 2.fortnights # => 4 weeks + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#53 + def fortnights; end + + # Returns the number of bytes equivalent to the gigabytes provided. + # + # 2.gigabytes # => 2_147_483_648 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#39 + def gigabyte; end + + # Returns the number of bytes equivalent to the gigabytes provided. + # + # 2.gigabytes # => 2_147_483_648 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#39 + def gigabytes; end + + # Returns a Duration instance matching the number of hours provided. + # + # 2.hours # => 2 hours + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#29 + def hour; end + + # Returns a Duration instance matching the number of hours provided. + # + # 2.hours # => 2 hours + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#29 + def hours; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#13 + def html_safe?; end + + # Returns the number of milliseconds equivalent to the seconds provided. + # Used with the standard time durations. + # + # 2.in_milliseconds # => 2000 + # 1.hour.in_milliseconds # => 3600000 + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#63 + def in_milliseconds; end + + # Returns the number of bytes equivalent to the kilobytes provided. + # + # 2.kilobytes # => 2048 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#23 + def kilobyte; end + + # Returns the number of bytes equivalent to the kilobytes provided. + # + # 2.kilobytes # => 2048 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#23 + def kilobytes; end + + # Returns the number of bytes equivalent to the megabytes provided. + # + # 2.megabytes # => 2_097_152 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#31 + def megabyte; end + + # Returns the number of bytes equivalent to the megabytes provided. + # + # 2.megabytes # => 2_097_152 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#31 + def megabytes; end + + # Returns a Duration instance matching the number of minutes provided. + # + # 2.minutes # => 2 minutes + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#21 + def minute; end + + # Returns a Duration instance matching the number of minutes provided. + # + # 2.minutes # => 2 minutes + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#21 + def minutes; end + + # Returns the number of bytes equivalent to the petabytes provided. + # + # 2.petabytes # => 2_251_799_813_685_248 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#55 + def petabyte; end + + # Returns the number of bytes equivalent to the petabytes provided. + # + # 2.petabytes # => 2_251_799_813_685_248 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#55 + def petabytes; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#181 + def present?; end + + # Returns a Duration instance matching the number of seconds provided. + # + # 2.seconds # => 2 seconds + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#13 + def second; end + + # Returns a Duration instance matching the number of seconds provided. + # + # 2.seconds # => 2 seconds + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#13 + def seconds; end + + # Returns the number of bytes equivalent to the terabytes provided. + # + # 2.terabytes # => 2_199_023_255_552 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#47 + def terabyte; end + + # Returns the number of bytes equivalent to the terabytes provided. + # + # 2.terabytes # => 2_199_023_255_552 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#47 + def terabytes; end + + # Returns a Duration instance matching the number of weeks provided. + # + # 2.weeks # => 2 weeks + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#45 + def week; end + + # Returns a Duration instance matching the number of weeks provided. + # + # 2.weeks # => 2 weeks + # + # source://activesupport//lib/active_support/core_ext/numeric/time.rb#45 + def weeks; end + + # Returns the number of bytes equivalent to the zettabytes provided. + # + # 2.zettabytes # => 2_361_183_241_434_822_606_848 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#71 + def zettabyte; end + + # Returns the number of bytes equivalent to the zettabytes provided. + # + # 2.zettabytes # => 2_361_183_241_434_822_606_848 + # + # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#71 + def zettabytes; end +end + +# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#9 +Numeric::EXABYTE = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#6 +Numeric::GIGABYTE = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#4 +Numeric::KILOBYTE = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#5 +Numeric::MEGABYTE = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#8 +Numeric::PETABYTE = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#7 +Numeric::TERABYTE = T.let(T.unsafe(nil), Integer) + +# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#10 +Numeric::ZETTABYTE = T.let(T.unsafe(nil), Integer) + +# -- +# Most objects are cloneable, but not all. For example you can't dup methods: +# +# method(:puts).dup # => TypeError: allocator undefined for Method +# +# Classes may signal their instances are not duplicable removing +dup+/+clone+ +# or raising exceptions from them. So, to dup an arbitrary object you normally +# use an optimistic approach and are ready to catch an exception, say: +# +# arbitrary_object.dup rescue object +# +# Rails dups objects in a few critical spots where they are not that arbitrary. +# That rescue is very expensive (like 40 times slower than a predicate), and it +# is often triggered. +# +# That's why we hardcode the following cases and check duplicable? instead of +# using that rescue idiom. +# ++ +# +# source://activesupport//lib/active_support/core_ext/object/acts_like.rb#3 +class Object < ::BasicObject + include ::ActiveSupport::Dependencies::RequireDependency + include ::Kernel + include ::PP::ObjectMixin + include ::ActiveSupport::Tryable + include ::ActiveSupport::ToJsonWithActiveSupportEncoder + + # Provides a way to check whether some class acts like some other class based on the existence of + # an appropriately-named marker method. + # + # A class that provides the same interface as SomeClass may define a marker method named + # acts_like_some_class? to signal its compatibility to callers of + # acts_like?(:some_class). + # + # For example, Active Support extends Date to define an acts_like_date? method, + # and extends Time to define acts_like_time?. As a result, developers can call + # x.acts_like?(:time) and x.acts_like?(:date) to test duck-type compatibility, + # and classes that are able to act like Time can also define an acts_like_time? + # method to interoperate. + # + # Note that the marker method is only expected to exist. It isn't called, so its body or return + # value are irrelevant. + # + # ==== Example: A class that provides the same interface as String + # + # This class may define: + # + # class Stringish + # def acts_like_string? + # end + # end + # + # Then client code can query for duck-type-safeness this way: + # + # Stringish.new.acts_like?(:string) # => true + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/acts_like.rb#33 + def acts_like?(duck); end + + # source://activesupport//lib/active_support/core_ext/object/json.rb#59 + def as_json(options = T.unsafe(nil)); end + + # An object is blank if it's false, empty, or a whitespace string. + # For example, +nil+, '', ' ', [], {}, and +false+ are all blank. + # + # This simplifies + # + # !address || address.empty? + # + # to + # + # address.blank? + # + # @return [true, false] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#18 + def blank?; end + + # 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#7 + def html_safe?; end + + # Returns true if this object is included in the argument. + # + # When argument is a +Range+, +#cover?+ is used to properly handle inclusion + # check within open ranges. Otherwise, argument must be any object which responds + # to +#include?+. Usage: + # + # characters = ["Konata", "Kagami", "Tsukasa"] + # "Konata".in?(characters) # => true + # + # For non +Range+ arguments, this will throw an +ArgumentError+ if the argument + # doesn't respond to +#include?+. + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/inclusion.rb#15 + def in?(another_object); end + + # Returns a hash with string keys that maps instance variable names without "@" to their + # corresponding values. + # + # class C + # def initialize(x, y) + # @x, @y = x, y + # end + # end + # + # C.new(0, 1).instance_values # => {"x" => 0, "y" => 1} + # + # source://activesupport//lib/active_support/core_ext/object/instance_variables.rb#14 + def instance_values; end + + # Returns an array of instance variable names as strings including "@". + # + # class C + # def initialize(x, y) + # @x, @y = x, y + # end + # end + # + # C.new(0, 1).instance_variable_names # => ["@y", "@x"] + # + # source://activesupport//lib/active_support/core_ext/object/instance_variables.rb#29 + def instance_variable_names; end + + # Returns the receiver if it's present otherwise returns +nil+. + # 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#34 + def presence_in(another_object); end + + # An object is present if it's not blank. + # + # @return [true, false] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#25 + def present?; end + + # Alias of 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 + + # Set and restore public attributes around a block. + # + # client.timeout # => 5 + # client.with(timeout: 1) do |c| + # c.timeout # => 1 + # end + # client.timeout # => 5 + # + # The receiver is yielded to the provided block. + # + # This method is a shorthand for the common begin/ensure pattern: + # + # old_value = object.attribute + # begin + # object.attribute = new_value + # # do things + # ensure + # object.attribute = old_value + # end + # + # It can be used on any object as long as both the reader and writer methods + # are public. + # + # source://activesupport//lib/active_support/core_ext/object/with.rb#26 + def with(**attributes); end + + # 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 or Hash-like object 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 + # + # When the block argument is omitted, the decorated Object instance is returned: + # + # module MyStyledHelpers + # def styled + # with_options style: "color: red;" + # end + # end + # + # styled.link_to "I'm red", "/" + # # => I'm red + # + # styled.button_tag "I'm red too!" + # # => + # + # source://activesupport//lib/active_support/core_ext/object/with_options.rb#92 + def with_options(options, &block); end +end + +# source://activesupport//lib/active_support/core_ext/object/json.rb#236 +class Pathname + # source://activesupport//lib/active_support/core_ext/object/json.rb#237 + def as_json(options = T.unsafe(nil)); end + + # An Pathname is blank if it's empty: + # + # Pathname.new("").blank? # => true + # Pathname.new(" ").blank? # => false + # Pathname.new("test").blank? # => false + # + # @return [true, false] + # + # source://activesupport//lib/active_support/core_ext/pathname/blank.rb#13 + def blank?; end + + # Returns the receiver if the named file exists otherwise returns +nil+. + # pathname.existence is equivalent to + # + # pathname.exist? ? pathname : nil + # + # For example, something like + # + # content = pathname.read if pathname.exist? + # + # becomes + # + # content = pathname.existence&.read + # + # @return [Pathname] + # + # source://activesupport//lib/active_support/core_ext/pathname/existence.rb#20 + def existence; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/pathname/blank.rb#17 + def present?; end +end + +module Process + extend ::ActiveSupport::ForkTracker::CoreExt + + class << self + # source://activesupport//lib/active_support/fork_tracker.rb#6 + def _fork; end + end +end + +# source://activesupport//lib/active_support/core_ext/object/json.rb#250 +class Process::Status + # source://activesupport//lib/active_support/core_ext/object/json.rb#251 + def as_json(options = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/core_ext/enumerable.rb#238 +class Range + include ::ActiveSupport::RangeWithFormat + include ::ActiveSupport::CompareWithRange + 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#158 + def as_json(options = T.unsafe(nil)); end + + # source://activesupport//lib/active_support/core_ext/range/each.rb#7 + def each(&block); end + + # source://activesupport//lib/active_support/core_ext/range/compare_range.rb#41 + def include?(value); 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#241 + def sum(initial_value = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/core_ext/object/json.rb#139 +class Regexp + # source://activesupport//lib/active_support/core_ext/object/json.rb#140 + 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#34 + 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) + +# source://activesupport//lib/active_support/core_ext/object/duplicable.rb#62 +module Singleton + mixes_in_class_methods ::Singleton::SingletonClassMethods + + # Singleton instances are not duplicable: + # + # Class.new.include(Singleton).instance.dup # TypeError (can't dup instance of singleton + # + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/duplicable.rb#66 + def duplicable?; end +end + +# String inflections define new methods on the String class to transform names for different purposes. +# For instance, you can figure out the name of a table from the name of a class. +# +# 'ScaleScore'.tableize # => "scale_scores" +# +# source://activesupport//lib/active_support/core_ext/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#99 + def as_json(options = T.unsafe(nil)); end + + # If you pass a single integer, returns a substring of one character at that + # position. The first character of the string is at position 0, the next at + # position 1, and so on. If a range is supplied, a substring containing + # characters at offsets given by the range is returned. In both cases, if an + # offset is negative, it is counted from the end of the string. Returns +nil+ + # if the initial offset falls outside the string. Returns an empty string if + # the beginning of the range is greater than the end of the string. + # + # str = "hello" + # str.at(0) # => "h" + # str.at(1..3) # => "ell" + # str.at(-2) # => "l" + # str.at(-2..-1) # => "lo" + # str.at(5) # => nil + # str.at(5..-1) # => "" + # + # If a Regexp is given, the matching portion of the string is returned. + # If a String is given, that given string is returned if it occurs in + # the string. In both cases, +nil+ is returned if there is no match. + # + # str = "hello" + # str.at(/lo/) # => "lo" + # str.at(/ol/) # => nil + # str.at("lo") # => "lo" + # str.at("ol") # => nil + # + # source://activesupport//lib/active_support/core_ext/string/access.rb#29 + def at(position); end + + # A string is blank if it's empty or contains whitespaces only: + # + # ''.blank? # => true + # ' '.blank? # => true + # "\t\n\r".blank? # => true + # ' blah '.blank? # => false + # + # Unicode whitespace is supported: + # + # "\u00a0".blank? # => true + # + # @return [true, false] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#153 + def blank?; end + + # By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize + # is set to :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" + # + # See ActiveSupport::Inflector.camelize. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#101 + def camelcase(first_letter = T.unsafe(nil)); end + + # By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize + # is set to :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" + # + # See ActiveSupport::Inflector.camelize. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#101 + def camelize(first_letter = T.unsafe(nil)); end + + # Creates a class name from a plural table name like \Rails does for table names to models. + # Note that this returns a string and not a class. (To convert to an actual class + # follow +classify+ with +constantize+.) + # + # 'ham_and_eggs'.classify # => "HamAndEgg" + # 'posts'.classify # => "Post" + # + # See ActiveSupport::Inflector.classify. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#239 + def classify; end + + # +constantize+ tries to find a declared constant with the name specified + # in the string. It raises a NameError when the name is not in CamelCase + # or is not initialized. + # + # 'Module'.constantize # => Module + # 'Class'.constantize # => Class + # 'blargle'.constantize # => NameError: wrong constant name blargle + # + # See ActiveSupport::Inflector.constantize. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#73 + def constantize; end + + # Replaces underscores with dashes in the string. + # + # 'puni_puni'.dasherize # => "puni-puni" + # + # See ActiveSupport::Inflector.dasherize. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#148 + def dasherize; end + + # Removes the rightmost segment from the constant expression in the string. + # + # 'Net::HTTP'.deconstantize # => "Net" + # '::Net::HTTP'.deconstantize # => "::Net" + # 'String'.deconstantize # => "" + # '::String'.deconstantize # => "" + # ''.deconstantize # => "" + # + # See ActiveSupport::Inflector.deconstantize. + # + # See also +demodulize+. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#177 + def deconstantize; end + + # Removes the module part from the constant expression in the string. + # + # 'ActiveSupport::Inflector::Inflections'.demodulize # => "Inflections" + # 'Inflections'.demodulize # => "Inflections" + # '::Inflections'.demodulize # => "Inflections" + # ''.demodulize # => '' + # + # See ActiveSupport::Inflector.demodulize. + # + # See also +deconstantize+. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#162 + def demodulize; end + + # Converts the first character to lowercase. + # + # 'If they enjoyed The Matrix'.downcase_first # => "if they enjoyed The Matrix" + # 'I'.downcase_first # => "i" + # ''.downcase_first # => "" + # + # See ActiveSupport::Inflector.downcase_first. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#284 + def downcase_first; end + + # 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#297 + def foreign_key(separate_class_name_and_id_with_underscore = T.unsafe(nil)); end + + # Returns a substring from the given position to the end of the string. + # If the position is negative, it is counted from the end of the string. + # + # str = "hello" + # str.from(0) # => "hello" + # str.from(3) # => "lo" + # str.from(-2) # => "lo" + # + # You can mix it with +to+ method and do fun things like: + # + # str = "hello" + # str.from(0).to(-1) # => "hello" + # str.from(1).to(-2) # => "ell" + # + # source://activesupport//lib/active_support/core_ext/string/access.rb#46 + def from(position); end + + # Marks a string as trusted safe. It will be inserted into HTML with no + # additional escaping performed. It is your responsibility to ensure that the + # string contains no malicious content. This method is equivalent to the + # +raw+ helper in views. It is recommended that you use +sanitize+ instead of + # this method. It should never be called on user input. + # + # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#225 + def html_safe; end + + # Capitalizes the first word, turns underscores into spaces, and (by default) strips a + # trailing '_id' if present. + # Like +titleize+, this is meant for creating pretty output. + # + # The capitalization of the first word can be turned off by setting the + # optional parameter +capitalize+ to false. + # By default, this parameter is true. + # + # The trailing '_id' can be kept and capitalized by setting the + # optional parameter +keep_id_suffix+ to true. + # By default, this parameter is false. + # + # 'employee_salary'.humanize # => "Employee salary" + # 'author_id'.humanize # => "Author" + # 'author_id'.humanize(capitalize: false) # => "author" + # '_id'.humanize # => "Id" + # 'author_id'.humanize(keep_id_suffix: true) # => "Author id" + # + # See ActiveSupport::Inflector.humanize. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#262 + def humanize(capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end + + # 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 fall back 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#215 + def parameterize(separator: T.unsafe(nil), preserve_case: T.unsafe(nil), locale: T.unsafe(nil)); end + + # Returns the plural form of the word in the string. + # + # If the optional parameter +count+ is specified, + # the singular form will be returned if 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 + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#165 + def present?; end + + # Returns a new string with all occurrences of the patterns removed. + # str = "foo bar test" + # str.remove(" test") # => "foo bar" + # str.remove(" test", /bar/) # => "foo " + # str # => "foo bar test" + # + # source://activesupport//lib/active_support/core_ext/string/filters.rb#32 + def remove(*patterns); end + + # Alters the string by removing all occurrences of the patterns. + # str = "foo bar test" + # str.remove!(" test", /bar/) # => "foo " + # str # => "foo " + # + # source://activesupport//lib/active_support/core_ext/string/filters.rb#40 + def remove!(*patterns); end + + # +safe_constantize+ tries to find a declared constant with the name specified + # in the string. It returns +nil+ when the name is not in CamelCase + # or is not initialized. + # + # 'Module'.safe_constantize # => Module + # 'Class'.safe_constantize # => Class + # 'blargle'.safe_constantize # => nil + # + # See ActiveSupport::Inflector.safe_constantize. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#86 + def safe_constantize; end + + # The reverse of +pluralize+, returns the singular form of a word in a string. + # + # If the optional parameter +locale+ is specified, + # the word will be singularized as a word of that language. + # By default, this parameter is set to :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#227 + def tableize; end + + # Capitalizes all the words and replaces some characters in the string to create + # a nicer looking title. +titleize+ is meant for creating pretty output. It is not + # used in the \Rails internals. + # + # The trailing '_id','Id'.. can be kept and capitalized by setting the + # optional parameter +keep_id_suffix+ to true. + # By default, this parameter is false. + # + # 'man from the boondocks'.titleize # => "Man From The Boondocks" + # 'x-men: the last stand'.titleize # => "X Men: The Last Stand" + # 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id" + # + # See ActiveSupport::Inflector.titleize. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#126 + def titlecase(keep_id_suffix: T.unsafe(nil)); end + + # Capitalizes all the words and replaces some characters in the string to create + # a nicer looking title. +titleize+ is meant for creating pretty output. It is not + # used in the \Rails internals. + # + # The trailing '_id','Id'.. can be kept and capitalized by setting the + # optional parameter +keep_id_suffix+ to true. + # By default, this parameter is false. + # + # 'man from the boondocks'.titleize # => "Man From The Boondocks" + # 'x-men: the last stand'.titleize # => "X Men: The Last Stand" + # 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id" + # + # See ActiveSupport::Inflector.titleize. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#126 + def titleize(keep_id_suffix: T.unsafe(nil)); end + + # Returns a substring from the beginning of the string to the given position. + # If the position is negative, it is counted from the end of the string. + # + # str = "hello" + # str.to(0) # => "h" + # str.to(3) # => "hell" + # str.to(-2) # => "hell" + # + # You can mix it with +from+ method and do fun things like: + # + # str = "hello" + # str.from(0).to(-1) # => "hello" + # str.from(1).to(-2) # => "ell" + # + # source://activesupport//lib/active_support/core_ext/string/access.rb#63 + def to(position); end + + # Converts a string to a Date value. + # + # "1-1-2012".to_date # => Sun, 01 Jan 2012 + # "01/01/2012".to_date # => Sun, 01 Jan 2012 + # "2012-12-13".to_date # => Thu, 13 Dec 2012 + # "12/13/2012".to_date # => ArgumentError: invalid date + # + # source://activesupport//lib/active_support/core_ext/string/conversions.rb#47 + def to_date; end + + # Converts a string to a DateTime value. + # + # "1-1-2012".to_datetime # => Sun, 01 Jan 2012 00:00:00 +0000 + # "01/01/2012 23:59:59".to_datetime # => Sun, 01 Jan 2012 23:59:59 +0000 + # "2012-12-13 12:50".to_datetime # => Thu, 13 Dec 2012 12:50:00 +0000 + # "12/13/2012".to_datetime # => ArgumentError: invalid date + # + # source://activesupport//lib/active_support/core_ext/string/conversions.rb#57 + def to_datetime; end + + # Converts a string to a Time value. + # The +form+ can be either +:utc+ or +:local+ (default +:local+). + # + # The time is parsed using Time.parse method. + # If +form+ is +:local+, then the time is in the system timezone. + # If the date part is missing then the current date is used and if + # the time part is missing then it is assumed to be 00:00:00. + # + # "13-12-2012".to_time # => 2012-12-13 00:00:00 +0100 + # "06:12".to_time # => 2012-12-13 06:12:00 +0100 + # "2012-12-13 06:12".to_time # => 2012-12-13 06:12:00 +0100 + # "2012-12-13T06:12".to_time # => 2012-12-13 06:12:00 +0100 + # "2012-12-13T06:12".to_time(:utc) # => 2012-12-13 06:12:00 UTC + # "12/13/2012".to_time # => ArgumentError: argument out of range + # "1604326192".to_time # => ArgumentError: argument out of range + # + # source://activesupport//lib/active_support/core_ext/string/conversions.rb#22 + def to_time(form = T.unsafe(nil)); end + + # Truncates a given +text+ to length truncate_to if +text+ is longer than truncate_to: + # + # '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 "..."). + # The total length will not exceed truncate_to unless both +text+ and :omission + # are longer than truncate_to: + # + # 'And they found that many people were sleeping better.'.truncate(25, omission: '... (continued)') + # # => "And they f... (continued)" + # + # 'And they found that many people were sleeping better.'.truncate(4, omission: '... (continued)') + # # => "... (continued)" + # + # source://activesupport//lib/active_support/core_ext/string/filters.rb#70 + def truncate(truncate_to, options = T.unsafe(nil)); end + + # Truncates +text+ to at most truncate_to 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 truncate_to. + # + # Raises +ArgumentError+ when the bytesize of :omission exceeds truncate_to. + # + # source://activesupport//lib/active_support/core_ext/string/filters.rb#101 + def truncate_bytes(truncate_to, omission: T.unsafe(nil)); end + + # Truncates a given +text+ after a given number of words (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#142 + def truncate_words(words_count, options = T.unsafe(nil)); end + + # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string. + # + # +underscore+ will also change '::' to '/' to convert namespaces to paths. + # + # 'ActiveModel'.underscore # => "active_model" + # 'ActiveModel::Errors'.underscore # => "active_model/errors" + # + # See ActiveSupport::Inflector.underscore. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#139 + def underscore; end + + # Converts the first character to uppercase. + # + # 'what a Lovely Day'.upcase_first # => "What a Lovely Day" + # 'w'.upcase_first # => "W" + # ''.upcase_first # => "" + # + # See ActiveSupport::Inflector.upcase_first. + # + # source://activesupport//lib/active_support/core_ext/string/inflections.rb#273 + def upcase_first; end +end + +# source://activesupport//lib/active_support/core_ext/object/blank.rb#136 +String::BLANK_RE = T.let(T.unsafe(nil), Regexp) + +# source://activesupport//lib/active_support/core_ext/object/blank.rb#137 +String::ENCODED_BLANKS = T.let(T.unsafe(nil), Concurrent::Map) + +# source://activesupport//lib/active_support/core_ext/object/json.rb#74 +class Struct + include ::Enumerable + + # source://activesupport//lib/active_support/core_ext/object/json.rb#75 + def as_json(options = T.unsafe(nil)); end +end + +# source://activesupport//lib/active_support/core_ext/object/blank.rb#123 +class Symbol + include ::Comparable + + # source://activesupport//lib/active_support/core_ext/object/json.rb#105 + def as_json(options = T.unsafe(nil)); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#130 + def present?; end +end + +class Thread + # source://activesupport//lib/active_support/isolated_execution_state.rb#7 + def active_support_execution_state; end + + # source://activesupport//lib/active_support/isolated_execution_state.rb#7 + def active_support_execution_state=(_arg0); end +end + +# source://activesupport//lib/active_support/core_ext/time/acts_like.rb#5 +class Time + include ::Comparable + include ::DateAndTime::Zones + include ::DateAndTime::Calculations + include ::DateAndTime::Compatibility + + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#297 + 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#320 + 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#329 + 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 + # + # Just like Date#advance, increments are applied in order of time units from + # largest to smallest. This order can affect the result around the end of a + # month. + # + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#194 + 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#220 + def ago(seconds); end + + # source://activesupport//lib/active_support/core_ext/object/json.rb#201 + 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#238 + 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#267 + 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#283 + 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#256 + 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#273 + 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#289 + 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#246 + 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#246 + 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#238 + 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#246 + 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#238 + 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#267 + 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#283 + def beginning_of_minute; end + + # No Time is blank: + # + # Time.now.blank? # => false + # + # @return [false] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#192 + def blank?; end + + # Returns a new Time where one or more of the elements have been changed according + # to the +options+ parameter. The time options (: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#123 + def change(options); end + + # Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances + # can be chronologically compared with a Time + # + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#329 + 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#256 + 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#273 + 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#289 + 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#349 + 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#349 + 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#69 + 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#225 + 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#246 + 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#246 + 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#238 + 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#320 + def minus_with_coercion(other); end + + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#307 + def minus_with_duration(other); end + + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#307 + 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#363 + 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#373 + 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#383 + 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#246 + def noon; end + + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#297 + def plus_with_duration(other); end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#196 + def present?; end + + # source://activesupport//lib/active_support/core_ext/time/compatibility.rb#17 + def preserve_timezone; end + + # Returns a new time the specified number of days ago. + # + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#358 + 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#368 + 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#378 + def prev_year(years = T.unsafe(nil)); end + + # Returns the fraction of a second as a +Rational+ + # + # Time.new(2012, 8, 29, 0, 0, 0.5).sec_fraction # => (1/2) + # + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#107 + def sec_fraction; end + + # Returns the number of seconds since 00:00:00. + # + # Time.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0.0 + # Time.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296.0 + # Time.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399.0 + # + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#91 + def seconds_since_midnight; end + + # Returns the number of seconds until 23:59:59. + # + # Time.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399 + # Time.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103 + # Time.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0 + # + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#100 + def seconds_until_end_of_day; end + + # Returns a new Time representing the time a number of seconds since the instance time + # + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#225 + def since(seconds); end + + # Converts to a formatted string. See DATE_FORMATS for built-in formats. + # + # This method is aliased to to_formatted_s. + # + # time = Time.now # => 2007-01-18 06:10:17 -06:00 + # + # time.to_fs(:time) # => "06:10" + # time.to_formatted_s(:time) # => "06:10" + # + # time.to_fs(:db) # => "2007-01-18 06:10:17" + # time.to_fs(:number) # => "20070118061017" + # time.to_fs(:short) # => "18 Jan 06:10" + # time.to_fs(:long) # => "January 18, 2007 06:10" + # time.to_fs(:long_ordinal) # => "January 18th, 2007 06:10" + # time.to_fs(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600" + # time.to_fs(:rfc2822) # => "Thu, 18 Jan 2007 06:10:17 -0600" + # time.to_fs(:iso8601) # => "2007-01-18T06:10:17-06:00" + # + # == Adding your own time formats to +to_fs+ + # You can add your own formats to the Time::DATE_FORMATS hash. + # Use the format name as the hash key and either a strftime string + # or Proc instance that takes a time argument as the value. + # + # # config/initializers/time_formats.rb + # Time::DATE_FORMATS[:month_and_year] = '%B %Y' + # Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") } + # + # source://activesupport//lib/active_support/core_ext/time/conversions.rb#55 + 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_formatted_s. + # + # time = Time.now # => 2007-01-18 06:10:17 -06:00 + # + # time.to_fs(:time) # => "06:10" + # time.to_formatted_s(:time) # => "06:10" + # + # time.to_fs(:db) # => "2007-01-18 06:10:17" + # time.to_fs(:number) # => "20070118061017" + # time.to_fs(:short) # => "18 Jan 06:10" + # time.to_fs(:long) # => "January 18, 2007 06:10" + # time.to_fs(:long_ordinal) # => "January 18th, 2007 06:10" + # time.to_fs(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600" + # time.to_fs(:rfc2822) # => "Thu, 18 Jan 2007 06:10:17 -0600" + # time.to_fs(:iso8601) # => "2007-01-18T06:10:17-06:00" + # + # == Adding your own time formats to +to_fs+ + # You can add your own formats to the Time::DATE_FORMATS hash. + # Use the format name as the hash key and either a strftime string + # or Proc instance that takes a time argument as the value. + # + # # config/initializers/time_formats.rb + # Time::DATE_FORMATS[:month_and_year] = '%B %Y' + # Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") } + # + # source://activesupport//lib/active_support/core_ext/time/conversions.rb#55 + def to_fs(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 + + private + + # source://activesupport//lib/active_support/core_ext/time/compatibility.rb#32 + def active_support_local_zone; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/time/compatibility.rb#22 + def system_local_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(time_or_number, *args, **_arg2); end + + # Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime + # instances can be used when called with a single argument + # + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#45 + def at_with_coercion(time_or_number, *args, **_arg2); end + + # Returns 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#93 + def find_zone(time_zone); end + + # Returns a TimeZone instance matching the time zone provided. + # Accepts the time zone in any format supported by 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#81 + def find_zone!(time_zone); end + + # Creates a +Time+ instance from an RFC 3339 string. + # + # Time.rfc3339('1999-12-31T14:00:00-10:00') # => 2000-01-01 00:00:00 -1000 + # + # If the time or offset components are missing then an +ArgumentError+ will be raised. + # + # Time.rfc3339('1999-12-31') # => ArgumentError: invalid date + # + # @raise [ArgumentError] + # + # source://activesupport//lib/active_support/core_ext/time/calculations.rb#69 + def rfc3339(str); end + + # Allows override of 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#61 + 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/to_query.rb#25 +class TrueClass + # source://activesupport//lib/active_support/core_ext/object/json.rb#81 + def as_json(options = T.unsafe(nil)); end + + # +true+ is not blank: + # + # true.blank? # => false + # + # @return [false] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#86 + def blank?; end + + # @return [Boolean] + # + # source://activesupport//lib/active_support/core_ext/object/blank.rb#90 + def present?; end + + # Returns +self+. + # + # source://activesupport//lib/active_support/core_ext/object/to_query.rb#27 + def to_param; end +end + +# source://activesupport//lib/active_support/core_ext/object/json.rb#230 +class URI::Generic + # source://activesupport//lib/active_support/core_ext/object/json.rb#231 + def as_json(options = T.unsafe(nil)); end +end diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/gems/benchmark@0.4.0.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/benchmark@0.4.0.rbi new file mode 100644 index 0000000..b1d8e20 --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/benchmark@0.4.0.rbi @@ -0,0 +1,618 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `benchmark` gem. +# Please instead update this file by running `bin/tapioca gem benchmark`. + + +# The Benchmark module provides methods to measure and report the time +# used to execute Ruby code. +# +# * Measure the time to construct the string given by the expression +# "a"*1_000_000_000: +# +# require 'benchmark' +# +# puts Benchmark.measure { "a"*1_000_000_000 } +# +# On my machine (OSX 10.8.3 on i5 1.7 GHz) this generates: +# +# 0.350000 0.400000 0.750000 ( 0.835234) +# +# This report shows the user CPU time, system CPU time, the sum of +# the user and system CPU times, and the elapsed real time. The unit +# of time is seconds. +# +# * Do some experiments sequentially using the #bm method: +# +# require 'benchmark' +# +# n = 5000000 +# Benchmark.bm do |x| +# x.report { for i in 1..n; a = "1"; end } +# x.report { n.times do ; a = "1"; end } +# x.report { 1.upto(n) do ; a = "1"; end } +# end +# +# The result: +# +# user system total real +# 1.010000 0.000000 1.010000 ( 1.014479) +# 1.000000 0.000000 1.000000 ( 0.998261) +# 0.980000 0.000000 0.980000 ( 0.981335) +# +# * Continuing the previous example, put a label in each report: +# +# require 'benchmark' +# +# n = 5000000 +# Benchmark.bm(7) do |x| +# x.report("for:") { for i in 1..n; a = "1"; end } +# x.report("times:") { n.times do ; a = "1"; end } +# x.report("upto:") { 1.upto(n) do ; a = "1"; end } +# end +# +# The result: +# +# user system total real +# for: 1.010000 0.000000 1.010000 ( 1.015688) +# times: 1.000000 0.000000 1.000000 ( 1.003611) +# upto: 1.030000 0.000000 1.030000 ( 1.028098) +# +# * The times for some benchmarks depend on the order in which items +# are run. These differences are due to the cost of memory +# allocation and garbage collection. To avoid these discrepancies, +# the #bmbm method is provided. For example, to compare ways to +# sort an array of floats: +# +# require 'benchmark' +# +# array = (1..1000000).map { rand } +# +# Benchmark.bmbm do |x| +# x.report("sort!") { array.dup.sort! } +# x.report("sort") { array.dup.sort } +# end +# +# The result: +# +# Rehearsal ----------------------------------------- +# sort! 1.490000 0.010000 1.500000 ( 1.490520) +# sort 1.460000 0.000000 1.460000 ( 1.463025) +# -------------------------------- total: 2.960000sec +# +# user system total real +# sort! 1.460000 0.000000 1.460000 ( 1.460465) +# sort 1.450000 0.010000 1.460000 ( 1.448327) +# +# * Report statistics of sequential experiments with unique labels, +# using the #benchmark method: +# +# require 'benchmark' +# include Benchmark # we need the CAPTION and FORMAT constants +# +# n = 5000000 +# Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x| +# tf = x.report("for:") { for i in 1..n; a = "1"; end } +# tt = x.report("times:") { n.times do ; a = "1"; end } +# tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } +# [tf+tt+tu, (tf+tt+tu)/3] +# end +# +# The result: +# +# user system total real +# for: 0.950000 0.000000 0.950000 ( 0.952039) +# times: 0.980000 0.000000 0.980000 ( 0.984938) +# upto: 0.950000 0.000000 0.950000 ( 0.946787) +# >total: 2.880000 0.000000 2.880000 ( 2.883764) +# >avg: 0.960000 0.000000 0.960000 ( 0.961255) +# +# source://benchmark//lib/benchmark.rb#122 +module Benchmark + private + + # Invokes the block with a Benchmark::Report object, which + # may be used to collect and report on the results of individual + # benchmark tests. Reserves +label_width+ leading spaces for + # labels on each line. Prints +caption+ at the top of the + # report, and uses +format+ to format each line. + # (Note: +caption+ must contain a terminating newline character, + # see the default Benchmark::Tms::CAPTION for an example.) + # + # Returns an array of Benchmark::Tms objects. + # + # If the block returns an array of + # Benchmark::Tms objects, these will be used to format + # additional lines of output. If +labels+ parameter are + # given, these are used to label these extra lines. + # + # _Note_: Other methods provide a simpler interface to this one, and are + # suitable for nearly all benchmarking requirements. See the examples in + # Benchmark, and the #bm and #bmbm methods. + # + # Example: + # + # require 'benchmark' + # include Benchmark # we need the CAPTION and FORMAT constants + # + # n = 5000000 + # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x| + # tf = x.report("for:") { for i in 1..n; a = "1"; end } + # tt = x.report("times:") { n.times do ; a = "1"; end } + # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } + # [tf+tt+tu, (tf+tt+tu)/3] + # end + # + # Generates: + # + # user system total real + # for: 0.970000 0.000000 0.970000 ( 0.970493) + # times: 0.990000 0.000000 0.990000 ( 0.989542) + # upto: 0.970000 0.000000 0.970000 ( 0.972854) + # >total: 2.930000 0.000000 2.930000 ( 2.932889) + # >avg: 0.976667 0.000000 0.976667 ( 0.977630) + # + # source://benchmark//lib/benchmark.rb#170 + def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end + + # A simple interface to the #benchmark method, #bm generates sequential + # reports with labels. +label_width+ and +labels+ parameters have the same + # meaning as for #benchmark. + # + # require 'benchmark' + # + # n = 5000000 + # Benchmark.bm(7) do |x| + # x.report("for:") { for i in 1..n; a = "1"; end } + # x.report("times:") { n.times do ; a = "1"; end } + # x.report("upto:") { 1.upto(n) do ; a = "1"; end } + # end + # + # Generates: + # + # user system total real + # for: 0.960000 0.000000 0.960000 ( 0.957966) + # times: 0.960000 0.000000 0.960000 ( 0.960423) + # upto: 0.950000 0.000000 0.950000 ( 0.954864) + # + # source://benchmark//lib/benchmark.rb#215 + def bm(label_width = T.unsafe(nil), *labels, &blk); end + + # Sometimes benchmark results are skewed because code executed + # earlier encounters different garbage collection overheads than + # that run later. #bmbm attempts to minimize this effect by running + # the tests twice, the first time as a rehearsal in order to get the + # runtime environment stable, the second time for + # real. GC.start is executed before the start of each of + # the real timings; the cost of this is not included in the + # timings. In reality, though, there's only so much that #bmbm can + # do, and the results are not guaranteed to be isolated from garbage + # collection and other effects. + # + # Because #bmbm takes two passes through the tests, it can + # calculate the required label width. + # + # require 'benchmark' + # + # array = (1..1000000).map { rand } + # + # Benchmark.bmbm do |x| + # x.report("sort!") { array.dup.sort! } + # x.report("sort") { array.dup.sort } + # end + # + # Generates: + # + # Rehearsal ----------------------------------------- + # sort! 1.440000 0.010000 1.450000 ( 1.446833) + # sort 1.440000 0.000000 1.440000 ( 1.448257) + # -------------------------------- total: 2.890000sec + # + # user system total real + # sort! 1.460000 0.000000 1.460000 ( 1.458065) + # sort 1.450000 0.000000 1.450000 ( 1.455963) + # + # #bmbm yields a Benchmark::Job object and returns an array of + # Benchmark::Tms objects. + # + # source://benchmark//lib/benchmark.rb#257 + def bmbm(width = T.unsafe(nil)); end + + # Returns the time used to execute the given block as a + # Benchmark::Tms object. Takes +label+ option. + # + # require 'benchmark' + # + # n = 1000000 + # + # time = Benchmark.measure do + # n.times { a = "1" } + # end + # puts time + # + # Generates: + # + # 0.220000 0.000000 0.220000 ( 0.227313) + # + # source://benchmark//lib/benchmark.rb#302 + def measure(label = T.unsafe(nil)); end + + # Returns the elapsed real time used to execute the given block. + # The unit of time is seconds. + # + # Benchmark.realtime { "a" * 1_000_000_000 } + # #=> 0.5098029999935534 + # + # source://benchmark//lib/benchmark.rb#321 + def realtime; end + + class << self + # Invokes the block with a Benchmark::Report object, which + # may be used to collect and report on the results of individual + # benchmark tests. Reserves +label_width+ leading spaces for + # labels on each line. Prints +caption+ at the top of the + # report, and uses +format+ to format each line. + # (Note: +caption+ must contain a terminating newline character, + # see the default Benchmark::Tms::CAPTION for an example.) + # + # Returns an array of Benchmark::Tms objects. + # + # If the block returns an array of + # Benchmark::Tms objects, these will be used to format + # additional lines of output. If +labels+ parameter are + # given, these are used to label these extra lines. + # + # _Note_: Other methods provide a simpler interface to this one, and are + # suitable for nearly all benchmarking requirements. See the examples in + # Benchmark, and the #bm and #bmbm methods. + # + # Example: + # + # require 'benchmark' + # include Benchmark # we need the CAPTION and FORMAT constants + # + # n = 5000000 + # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x| + # tf = x.report("for:") { for i in 1..n; a = "1"; end } + # tt = x.report("times:") { n.times do ; a = "1"; end } + # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end } + # [tf+tt+tu, (tf+tt+tu)/3] + # end + # + # Generates: + # + # user system total real + # for: 0.970000 0.000000 0.970000 ( 0.970493) + # times: 0.990000 0.000000 0.990000 ( 0.989542) + # upto: 0.970000 0.000000 0.970000 ( 0.972854) + # >total: 2.930000 0.000000 2.930000 ( 2.932889) + # >avg: 0.976667 0.000000 0.976667 ( 0.977630) + # + # source://benchmark//lib/benchmark.rb#170 + def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end + + # A simple interface to the #benchmark method, #bm generates sequential + # reports with labels. +label_width+ and +labels+ parameters have the same + # meaning as for #benchmark. + # + # require 'benchmark' + # + # n = 5000000 + # Benchmark.bm(7) do |x| + # x.report("for:") { for i in 1..n; a = "1"; end } + # x.report("times:") { n.times do ; a = "1"; end } + # x.report("upto:") { 1.upto(n) do ; a = "1"; end } + # end + # + # Generates: + # + # user system total real + # for: 0.960000 0.000000 0.960000 ( 0.957966) + # times: 0.960000 0.000000 0.960000 ( 0.960423) + # upto: 0.950000 0.000000 0.950000 ( 0.954864) + # + # source://benchmark//lib/benchmark.rb#215 + def bm(label_width = T.unsafe(nil), *labels, &blk); end + + # Sometimes benchmark results are skewed because code executed + # earlier encounters different garbage collection overheads than + # that run later. #bmbm attempts to minimize this effect by running + # the tests twice, the first time as a rehearsal in order to get the + # runtime environment stable, the second time for + # real. GC.start is executed before the start of each of + # the real timings; the cost of this is not included in the + # timings. In reality, though, there's only so much that #bmbm can + # do, and the results are not guaranteed to be isolated from garbage + # collection and other effects. + # + # Because #bmbm takes two passes through the tests, it can + # calculate the required label width. + # + # require 'benchmark' + # + # array = (1..1000000).map { rand } + # + # Benchmark.bmbm do |x| + # x.report("sort!") { array.dup.sort! } + # x.report("sort") { array.dup.sort } + # end + # + # Generates: + # + # Rehearsal ----------------------------------------- + # sort! 1.440000 0.010000 1.450000 ( 1.446833) + # sort 1.440000 0.000000 1.440000 ( 1.448257) + # -------------------------------- total: 2.890000sec + # + # user system total real + # sort! 1.460000 0.000000 1.460000 ( 1.458065) + # sort 1.450000 0.000000 1.450000 ( 1.455963) + # + # #bmbm yields a Benchmark::Job object and returns an array of + # Benchmark::Tms objects. + # + # source://benchmark//lib/benchmark.rb#257 + def bmbm(width = T.unsafe(nil)); end + + # Returns the time used to execute the given block as a + # Benchmark::Tms object. Takes +label+ option. + # + # require 'benchmark' + # + # n = 1000000 + # + # time = Benchmark.measure do + # n.times { a = "1" } + # end + # puts time + # + # Generates: + # + # 0.220000 0.000000 0.220000 ( 0.227313) + # + # source://benchmark//lib/benchmark.rb#302 + def measure(label = T.unsafe(nil)); end + + # Returns the elapsed real time used to execute the given block. + # The unit of time is seconds. + # + # Benchmark.realtime { "a" * 1_000_000_000 } + # #=> 0.5098029999935534 + # + # source://benchmark//lib/benchmark.rb#321 + def realtime; end + end +end + +# A Job is a sequence of labelled blocks to be processed by the +# Benchmark.bmbm method. It is of little direct interest to the user. +# +# source://benchmark//lib/benchmark.rb#333 +class Benchmark::Job + # Returns an initialized Job instance. + # Usually, one doesn't call this method directly, as new + # Job objects are created by the #bmbm method. + # +width+ is a initial value for the label offset used in formatting; + # the #bmbm method passes its +width+ argument to this constructor. + # + # @return [Job] a new instance of Job + # + # source://benchmark//lib/benchmark.rb#341 + def initialize(width); end + + # Registers the given label and block pair in the job list. + # + # @raise [ArgumentError] + # + # source://benchmark//lib/benchmark.rb#349 + def item(label = T.unsafe(nil), &blk); end + + # An array of 2-element arrays, consisting of label and block pairs. + # + # source://benchmark//lib/benchmark.rb#361 + def list; end + + # Registers the given label and block pair in the job list. + # + # @raise [ArgumentError] + # + # source://benchmark//lib/benchmark.rb#349 + def report(label = T.unsafe(nil), &blk); end + + # Length of the widest label in the #list. + # + # source://benchmark//lib/benchmark.rb#364 + def width; end +end + +# This class is used by the Benchmark.benchmark and Benchmark.bm methods. +# It is of little direct interest to the user. +# +# source://benchmark//lib/benchmark.rb#371 +class Benchmark::Report + # Returns an initialized Report instance. + # Usually, one doesn't call this method directly, as new + # Report objects are created by the #benchmark and #bm methods. + # +width+ and +format+ are the label offset and + # format string used by Tms#format. + # + # @return [Report] a new instance of Report + # + # source://benchmark//lib/benchmark.rb#379 + def initialize(width = T.unsafe(nil), format = T.unsafe(nil)); end + + # An array of Benchmark::Tms objects representing each item. + # + # source://benchmark//lib/benchmark.rb#398 + def format; end + + # Prints the +label+ and measured time for the block, + # formatted by +format+. See Tms#format for the + # formatting rules. + # + # source://benchmark//lib/benchmark.rb#388 + def item(label = T.unsafe(nil), *format, &blk); end + + # An array of Benchmark::Tms objects representing each item. + # + # source://benchmark//lib/benchmark.rb#398 + def list; end + + # Prints the +label+ and measured time for the block, + # formatted by +format+. See Tms#format for the + # formatting rules. + # + # source://benchmark//lib/benchmark.rb#388 + def report(label = T.unsafe(nil), *format, &blk); end + + # An array of Benchmark::Tms objects representing each item. + # + # source://benchmark//lib/benchmark.rb#398 + def width; end +end + +# A data object, representing the times associated with a benchmark +# measurement. +# +# source://benchmark//lib/benchmark.rb#407 +class Benchmark::Tms + # Returns an initialized Tms object which has + # +utime+ as the user CPU time, +stime+ as the system CPU time, + # +cutime+ as the children's user CPU time, +cstime+ as the children's + # system CPU time, +real+ as the elapsed real time and +label+ as the label. + # + # @return [Tms] a new instance of Tms + # + # source://benchmark//lib/benchmark.rb#442 + def initialize(utime = T.unsafe(nil), stime = T.unsafe(nil), cutime = T.unsafe(nil), cstime = T.unsafe(nil), real = T.unsafe(nil), label = T.unsafe(nil)); end + + # Returns a new Tms object obtained by memberwise multiplication + # of the individual times for this Tms object by +x+. + # + # source://benchmark//lib/benchmark.rb#490 + def *(x); end + + # Returns a new Tms object obtained by memberwise summation + # of the individual times for this Tms object with those of the +other+ + # Tms object. + # This method and #/() are useful for taking statistics. + # + # source://benchmark//lib/benchmark.rb#477 + def +(other); end + + # Returns a new Tms object obtained by memberwise subtraction + # of the individual times for the +other+ Tms object from those of this + # Tms object. + # + # source://benchmark//lib/benchmark.rb#484 + def -(other); end + + # Returns a new Tms object obtained by memberwise division + # of the individual times for this Tms object by +x+. + # This method and #+() are useful for taking statistics. + # + # source://benchmark//lib/benchmark.rb#497 + def /(x); end + + # Returns a new Tms object whose times are the sum of the times for this + # Tms object, plus the time required to execute the code block (+blk+). + # + # source://benchmark//lib/benchmark.rb#451 + def add(&blk); end + + # An in-place version of #add. + # Changes the times of this Tms object by making it the sum of the times + # for this Tms object, plus the time required to execute + # the code block (+blk+). + # + # source://benchmark//lib/benchmark.rb#461 + def add!(&blk); end + + # System CPU time of children + # + # source://benchmark//lib/benchmark.rb#425 + def cstime; end + + # User CPU time of children + # + # source://benchmark//lib/benchmark.rb#422 + def cutime; end + + # Returns the contents of this Tms object as + # a formatted string, according to a +format+ string + # like that passed to Kernel.format. In addition, #format + # accepts the following extensions: + # + # %u:: Replaced by the user CPU time, as reported by Tms#utime. + # %y:: Replaced by the system CPU time, as reported by #stime (Mnemonic: y of "s*y*stem") + # %U:: Replaced by the children's user CPU time, as reported by Tms#cutime + # %Y:: Replaced by the children's system CPU time, as reported by Tms#cstime + # %t:: Replaced by the total CPU time, as reported by Tms#total + # %r:: Replaced by the elapsed real time, as reported by Tms#real + # %n:: Replaced by the label string, as reported by Tms#label (Mnemonic: n of "*n*ame") + # + # If +format+ is not given, FORMAT is used as default value, detailing the + # user, system and real elapsed time. + # + # source://benchmark//lib/benchmark.rb#516 + def format(format = T.unsafe(nil), *args); end + + # Label + # + # source://benchmark//lib/benchmark.rb#434 + def label; end + + # Elapsed real time + # + # source://benchmark//lib/benchmark.rb#428 + def real; end + + # System CPU time + # + # source://benchmark//lib/benchmark.rb#419 + def stime; end + + # Returns a new 6-element array, consisting of the + # label, user CPU time, system CPU time, children's + # user CPU time, children's system CPU time and elapsed + # real time. + # + # source://benchmark//lib/benchmark.rb#541 + def to_a; end + + # Returns a hash containing the same data as `to_a`. + # + # source://benchmark//lib/benchmark.rb#548 + def to_h; end + + # Same as #format. + # + # source://benchmark//lib/benchmark.rb#531 + def to_s; end + + # Total time, that is +utime+ + +stime+ + +cutime+ + +cstime+ + # + # source://benchmark//lib/benchmark.rb#431 + def total; end + + # User CPU time + # + # source://benchmark//lib/benchmark.rb#416 + def utime; end + + protected + + # Returns a new Tms object obtained by memberwise operation +op+ + # of the individual times for this Tms object with those of the other + # Tms object (+x+). + # + # +op+ can be a mathematical operation such as +, -, + # *, / + # + # source://benchmark//lib/benchmark.rb#569 + def memberwise(op, x); end +end + +# source://benchmark//lib/benchmark.rb#124 +Benchmark::VERSION = T.let(T.unsafe(nil), String) diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/gems/bigdecimal@3.1.8.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/bigdecimal@3.1.8.rbi new file mode 100644 index 0000000..c275b2f --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/bigdecimal@3.1.8.rbi @@ -0,0 +1,78 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `bigdecimal` gem. +# Please instead update this file by running `bin/tapioca gem bigdecimal`. + + +# source://bigdecimal//lib/bigdecimal/util.rb#78 +class BigDecimal < ::Numeric + # call-seq: + # a.to_d -> bigdecimal + # + # Returns self. + # + # require 'bigdecimal/util' + # + # d = BigDecimal("3.14") + # d.to_d # => 0.314e1 + # + # source://bigdecimal//lib/bigdecimal/util.rb#110 + def to_d; end + + # call-seq: + # a.to_digits -> string + # + # Converts a BigDecimal to a String of the form "nnnnnn.mmm". + # This method is deprecated; use BigDecimal#to_s("F") instead. + # + # require 'bigdecimal/util' + # + # d = BigDecimal("3.14") + # d.to_digits # => "3.14" + # + # source://bigdecimal//lib/bigdecimal/util.rb#90 + def to_digits; end +end + +BigDecimal::VERSION = T.let(T.unsafe(nil), String) + +# source://bigdecimal//lib/bigdecimal/util.rb#138 +class Complex < ::Numeric + # call-seq: + # cmp.to_d -> bigdecimal + # cmp.to_d(precision) -> bigdecimal + # + # Returns the value as a BigDecimal. + # + # The +precision+ parameter is required for a rational complex number. + # This parameter is used to determine the number of significant digits + # for the result. + # + # require 'bigdecimal' + # require 'bigdecimal/util' + # + # Complex(0.1234567, 0).to_d(4) # => 0.1235e0 + # Complex(Rational(22, 7), 0).to_d(3) # => 0.314e1 + # + # See also Kernel.BigDecimal. + # + # source://bigdecimal//lib/bigdecimal/util.rb#157 + def to_d(*args); end +end + +# source://bigdecimal//lib/bigdecimal/util.rb#171 +class NilClass + # call-seq: + # nil.to_d -> bigdecimal + # + # Returns nil represented as a BigDecimal. + # + # require 'bigdecimal' + # require 'bigdecimal/util' + # + # nil.to_d # => 0.0 + # + # source://bigdecimal//lib/bigdecimal/util.rb#182 + def to_d; end +end diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/gems/concurrent-ruby@1.3.4.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/concurrent-ruby@1.3.4.rbi new file mode 100644 index 0000000..e6a82d0 --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/concurrent-ruby@1.3.4.rbi @@ -0,0 +1,11645 @@ +# 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 + + # Number of processors cores available for process scheduling. + # This method takes in account the CPU quota if the process is inside a cgroup with a + # dedicated CPU quota (typically Docker). + # Otherwise it returns the same value as #processor_count but as a Float. + # + # For performance reasons the calculated value will be memoized on the first + # call. + # + # @return [Float] number of available processors + # + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#194 + def available_processor_count; end + + # @raise [ArgumentError] + # + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#56 + def call_dataflow(method, executor, *inputs, &block); end + + # The maximum number of processors cores available for process scheduling. + # Returns `nil` if there is no enforced limit, or a `Float` if the + # process is inside a cgroup with a dedicated CPU quota (typically Docker). + # + # Note that nothing prevents setting a CPU quota higher than the actual number of + # cores on the system. + # + # For performance reasons the calculated value will be memoized on the first + # call. + # + # @return [nil, Float] Maximum number of available processors as set by a cgroup CPU quota, or nil if none set + # + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#209 + def cpu_quota; end + + # The CPU shares requested by the process. For performance reasons the calculated + # value will be memoized on the first call. + # + # @return [Float, nil] CPU shares requested by the process, or nil if not set + # + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#217 + def cpu_shares; 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#181 + 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." We still memoize this value once 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#160 + def processor_count; end + + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#142 + 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#119 +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#136 +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#70 +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#19 +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#129 +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#8 +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#26 + def available_processor_count; end + + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#41 + def cpu_quota; end + + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#45 + def cpu_shares; end + + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#22 + def physical_processor_count; end + + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#18 + def processor_count; end + + private + + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#104 + def compute_cpu_quota; end + + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#124 + def compute_cpu_shares; end + + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#59 + def compute_physical_processor_count; end + + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#51 + def compute_processor_count; end + + # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#99 + def run(command); end +end + +# source://concurrent-ruby//lib/concurrent-ruby/concurrent/version.rb#2 +Concurrent::VERSION = T.let(T.unsafe(nil), String) diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/gems/connection_pool@2.4.1.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/connection_pool@2.4.1.rbi new file mode 100644 index 0000000..3d9f595 --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/connection_pool@2.4.1.rbi @@ -0,0 +1,9 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `connection_pool` gem. +# Please instead update this file by running `bin/tapioca gem connection_pool`. + + +# THIS IS AN EMPTY RBI FILE. +# see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/gems/drb@2.2.1.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/drb@2.2.1.rbi new file mode 100644 index 0000000..d97695d --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/drb@2.2.1.rbi @@ -0,0 +1,1347 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `drb` gem. +# Please instead update this file by running `bin/tapioca gem drb`. + + +# for ruby-1.8.0 +# +# source://drb//lib/drb/eq.rb#2 +module DRb + private + + # Get the configuration of the current server. + # + # If there is no current server, this returns the default configuration. + # See #current_server and DRbServer::make_config. + # + # source://drb//lib/drb/drb.rb#1832 + def config; end + + # Get the 'current' server. + # + # In the context of execution taking place within the main + # thread of a dRuby server (typically, as a result of a remote + # call on the server or one of its objects), the current + # server is that server. Otherwise, the current server is + # the primary server. + # + # If the above rule fails to find a server, a DRbServerNotFound + # error is raised. + # + # @raise [DRbServerNotFound] + # + # source://drb//lib/drb/drb.rb#1789 + def current_server; end + + # Retrieves the server with the given +uri+. + # + # See also regist_server and remove_server. + # + # source://drb//lib/drb/drb.rb#1934 + def fetch_server(uri); end + + # Get the front object of the current server. + # + # This raises a DRbServerNotFound error if there is no current server. + # See #current_server. + # + # source://drb//lib/drb/drb.rb#1843 + def front; end + + # Is +uri+ the URI for the current local server? + # + # @return [Boolean] + # + # source://drb//lib/drb/drb.rb#1822 + def here?(uri); end + + # Set the default ACL to +acl+. + # + # See DRb::DRbServer.default_acl. + # + # source://drb//lib/drb/drb.rb#1888 + def install_acl(acl); end + + # Set the default id conversion object. + # + # This is expected to be an instance such as DRb::DRbIdConv that responds to + # #to_id and #to_obj that can convert objects to and from DRb references. + # + # See DRbServer#default_id_conv. + # + # source://drb//lib/drb/drb.rb#1880 + def install_id_conv(idconv); end + + # source://drb//lib/drb/drb.rb#1894 + def mutex; end + + # The primary local dRuby server. + # + # This is the server created by the #start_service call. + # + # source://drb//lib/drb/drb.rb#1776 + def primary_server; end + + # The primary local dRuby server. + # + # This is the server created by the #start_service call. + # + # source://drb//lib/drb/drb.rb#1776 + def primary_server=(_arg0); end + + # Registers +server+ with DRb. + # + # This is called when a new DRb::DRbServer is created. + # + # If there is no primary server then +server+ becomes the primary server. + # + # Example: + # + # require 'drb' + # + # s = DRb::DRbServer.new # automatically calls regist_server + # DRb.fetch_server s.uri #=> # + # + # source://drb//lib/drb/drb.rb#1912 + def regist_server(server); end + + # Removes +server+ from the list of registered servers. + # + # source://drb//lib/drb/drb.rb#1921 + def remove_server(server); end + + # Start a dRuby server locally. + # + # The new dRuby server will become the primary server, even + # if another server is currently the primary server. + # + # +uri+ is the URI for the server to bind to. If nil, + # the server will bind to random port on the default local host + # name and use the default dRuby protocol. + # + # +front+ is the server's front object. This may be nil. + # + # +config+ is the configuration for the new server. This may + # be nil. + # + # See DRbServer::new. + # + # source://drb//lib/drb/drb.rb#1768 + def start_service(uri = T.unsafe(nil), front = T.unsafe(nil), config = T.unsafe(nil)); end + + # Stop the local dRuby server. + # + # This operates on the primary server. If there is no primary + # server currently running, it is a noop. + # + # source://drb//lib/drb/drb.rb#1801 + def stop_service; end + + # Get the thread of the primary server. + # + # This returns nil if there is no primary server. See #primary_server. + # + # source://drb//lib/drb/drb.rb#1869 + def thread; end + + # Get a reference id for an object using the current server. + # + # This raises a DRbServerNotFound error if there is no current server. + # See #current_server. + # + # source://drb//lib/drb/drb.rb#1860 + def to_id(obj); end + + # Convert a reference into an object using the current server. + # + # This raises a DRbServerNotFound error if there is no current server. + # See #current_server. + # + # source://drb//lib/drb/drb.rb#1852 + def to_obj(ref); end + + # Get the URI defining the local dRuby space. + # + # This is the URI of the current server. See #current_server. + # + # source://drb//lib/drb/drb.rb#1810 + def uri; end + + class << self + # Get the configuration of the current server. + # + # If there is no current server, this returns the default configuration. + # See #current_server and DRbServer::make_config. + # + # source://drb//lib/drb/drb.rb#1832 + def config; end + + # Get the 'current' server. + # + # In the context of execution taking place within the main + # thread of a dRuby server (typically, as a result of a remote + # call on the server or one of its objects), the current + # server is that server. Otherwise, the current server is + # the primary server. + # + # If the above rule fails to find a server, a DRbServerNotFound + # error is raised. + # + # @raise [DRbServerNotFound] + # + # source://drb//lib/drb/drb.rb#1789 + def current_server; end + + # Retrieves the server with the given +uri+. + # + # See also regist_server and remove_server. + # + # source://drb//lib/drb/drb.rb#1934 + def fetch_server(uri); end + + # Get the front object of the current server. + # + # This raises a DRbServerNotFound error if there is no current server. + # See #current_server. + # + # source://drb//lib/drb/drb.rb#1843 + def front; end + + # Is +uri+ the URI for the current local server? + # + # @return [Boolean] + # + # source://drb//lib/drb/drb.rb#1822 + def here?(uri); end + + # Set the default ACL to +acl+. + # + # See DRb::DRbServer.default_acl. + # + # source://drb//lib/drb/drb.rb#1888 + def install_acl(acl); end + + # Set the default id conversion object. + # + # This is expected to be an instance such as DRb::DRbIdConv that responds to + # #to_id and #to_obj that can convert objects to and from DRb references. + # + # See DRbServer#default_id_conv. + # + # source://drb//lib/drb/drb.rb#1880 + def install_id_conv(idconv); end + + # source://drb//lib/drb/drb.rb#1894 + def mutex; end + + # The primary local dRuby server. + # + # This is the server created by the #start_service call. + # + # source://drb//lib/drb/drb.rb#1776 + def primary_server; end + + # The primary local dRuby server. + # + # This is the server created by the #start_service call. + # + # source://drb//lib/drb/drb.rb#1776 + def primary_server=(_arg0); end + + # Registers +server+ with DRb. + # + # This is called when a new DRb::DRbServer is created. + # + # If there is no primary server then +server+ becomes the primary server. + # + # Example: + # + # require 'drb' + # + # s = DRb::DRbServer.new # automatically calls regist_server + # DRb.fetch_server s.uri #=> # + # + # source://drb//lib/drb/drb.rb#1912 + def regist_server(server); end + + # Removes +server+ from the list of registered servers. + # + # source://drb//lib/drb/drb.rb#1921 + def remove_server(server); end + + # Start a dRuby server locally. + # + # The new dRuby server will become the primary server, even + # if another server is currently the primary server. + # + # +uri+ is the URI for the server to bind to. If nil, + # the server will bind to random port on the default local host + # name and use the default dRuby protocol. + # + # +front+ is the server's front object. This may be nil. + # + # +config+ is the configuration for the new server. This may + # be nil. + # + # See DRbServer::new. + # + # source://drb//lib/drb/drb.rb#1768 + def start_service(uri = T.unsafe(nil), front = T.unsafe(nil), config = T.unsafe(nil)); end + + # Stop the local dRuby server. + # + # This operates on the primary server. If there is no primary + # server currently running, it is a noop. + # + # source://drb//lib/drb/drb.rb#1801 + def stop_service; end + + # Get the thread of the primary server. + # + # This returns nil if there is no primary server. See #primary_server. + # + # source://drb//lib/drb/drb.rb#1869 + def thread; end + + # Get a reference id for an object using the current server. + # + # This raises a DRbServerNotFound error if there is no current server. + # See #current_server. + # + # source://drb//lib/drb/drb.rb#1860 + def to_id(obj); end + + # Convert a reference into an object using the current server. + # + # This raises a DRbServerNotFound error if there is no current server. + # See #current_server. + # + # source://drb//lib/drb/drb.rb#1852 + def to_obj(ref); end + + # Get the URI defining the local dRuby space. + # + # This is the URI of the current server. See #current_server. + # + # source://drb//lib/drb/drb.rb#1810 + def uri; end + end +end + +# An Array wrapper that can be sent to another server via DRb. +# +# All entries in the array will be dumped or be references that point to +# the local server. +# +# source://drb//lib/drb/drb.rb#518 +class DRb::DRbArray + # Creates a new DRbArray that either dumps or wraps all the items in the + # Array +ary+ so they can be loaded by a remote DRb server. + # + # @return [DRbArray] a new instance of DRbArray + # + # source://drb//lib/drb/drb.rb#523 + def initialize(ary); end + + # source://drb//lib/drb/drb.rb#542 + def _dump(lv); end + + class << self + # source://drb//lib/drb/drb.rb#538 + def _load(s); end + end +end + +# Class handling the connection between a DRbObject and the +# server the real object lives on. +# +# This class maintains a pool of connections, to reduce the +# overhead of starting and closing down connections for each +# method call. +# +# This class is used internally by DRbObject. The user does +# not normally need to deal with it directly. +# +# source://drb//lib/drb/drb.rb#1256 +class DRb::DRbConn + # @return [DRbConn] a new instance of DRbConn + # + # source://drb//lib/drb/drb.rb#1317 + def initialize(remote_uri); end + + # @return [Boolean] + # + # source://drb//lib/drb/drb.rb#1333 + def alive?; end + + # source://drb//lib/drb/drb.rb#1328 + def close; end + + # source://drb//lib/drb/drb.rb#1323 + def send_message(ref, msg_id, arg, block); end + + # source://drb//lib/drb/drb.rb#1321 + def uri; end + + class << self + # source://drb//lib/drb/drb.rb#1259 + def make_pool; end + + # source://drb//lib/drb/drb.rb#1297 + def open(remote_uri); end + + # source://drb//lib/drb/drb.rb#1292 + def stop_pool; end + end +end + +# Class responsible for converting between an object and its id. +# +# This, the default implementation, uses an object's local ObjectSpace +# __id__ as its id. This means that an object's identification over +# drb remains valid only while that object instance remains alive +# within the server runtime. +# +# For alternative mechanisms, see DRb::TimerIdConv in drb/timeridconv.rb +# and DRbNameIdConv in sample/name.rb in the full drb distribution. +# +# source://drb//lib/drb/drb.rb#360 +class DRb::DRbIdConv + # Convert an object into a reference id. + # + # This implementation returns the object's __id__ in the local + # object space. + # + # source://drb//lib/drb/drb.rb#374 + def to_id(obj); end + + # Convert an object reference id to an object. + # + # This implementation looks up the reference id in the local object + # space and returns the object it refers to. + # + # source://drb//lib/drb/drb.rb#366 + def to_obj(ref); end +end + +# Handler for sending and receiving drb messages. +# +# This takes care of the low-level marshalling and unmarshalling +# of drb requests and responses sent over the wire between server +# and client. This relieves the implementor of a new drb +# protocol layer with having to deal with these details. +# +# The user does not have to directly deal with this object in +# normal use. +# +# source://drb//lib/drb/drb.rb#556 +class DRb::DRbMessage + # @return [DRbMessage] a new instance of DRbMessage + # + # source://drb//lib/drb/drb.rb#557 + def initialize(config); end + + # source://drb//lib/drb/drb.rb#562 + def dump(obj, error = T.unsafe(nil)); end + + # @raise [DRbConnError] + # + # source://drb//lib/drb/drb.rb#579 + def load(soc); end + + # source://drb//lib/drb/drb.rb#639 + def recv_reply(stream); end + + # @raise [DRbConnError] + # + # source://drb//lib/drb/drb.rb#619 + def recv_request(stream); end + + # source://drb//lib/drb/drb.rb#633 + def send_reply(stream, succ, result); end + + # source://drb//lib/drb/drb.rb#605 + def send_request(stream, ref, msg_id, arg, b); end + + private + + # source://drb//lib/drb/drb.rb#646 + def make_proxy(obj, error = T.unsafe(nil)); end +end + +# source://drb//lib/drb/eq.rb#3 +class DRb::DRbObject + # Create a new remote object stub. + # + # +obj+ is the (local) object we want to create a stub for. Normally + # this is +nil+. +uri+ is the URI of the remote object that this + # will be a stub for. + # + # @return [DRbObject] a new instance of DRbObject + # + # source://drb//lib/drb/drb.rb#1089 + def initialize(obj, uri = T.unsafe(nil)); end + + # source://drb//lib/drb/eq.rb#4 + def ==(other); end + + # Get the reference of the object, if local. + # + # source://drb//lib/drb/drb.rb#1115 + def __drbref; end + + # Get the URI of the remote object. + # + # source://drb//lib/drb/drb.rb#1110 + def __drburi; end + + # Marshall this object. + # + # The URI and ref of the object are marshalled. + # + # source://drb//lib/drb/drb.rb#1080 + def _dump(lv); end + + # source://drb//lib/drb/eq.rb#4 + def eql?(other); end + + # source://drb//lib/drb/eq.rb#9 + def hash; end + + # source://drb//lib/drb/drb.rb#1135 + def method_missing(msg_id, *a, **_arg2, &b); end + + # source://drb//lib/drb/drb.rb#1187 + def pretty_print(q); end + + # source://drb//lib/drb/drb.rb#1191 + def pretty_print_cycle(q); end + + # Routes respond_to? to the referenced remote object. + # + # @return [Boolean] + # + # source://drb//lib/drb/drb.rb#1123 + def respond_to?(msg_id, priv = T.unsafe(nil)); end + + class << self + # Unmarshall a marshalled DRbObject. + # + # If the referenced object is located within the local server, then + # the object itself is returned. Otherwise, a new DRbObject is + # created to act as a stub for the remote referenced object. + # + # source://drb//lib/drb/drb.rb#1051 + def _load(s); end + + # Creates a DRb::DRbObject given the reference information to the remote + # host +uri+ and object +ref+. + # + # source://drb//lib/drb/drb.rb#1065 + def new_with(uri, ref); end + + # Create a new DRbObject from a URI alone. + # + # source://drb//lib/drb/drb.rb#1073 + def new_with_uri(uri); end + + # Returns a modified backtrace from +result+ with the +uri+ where each call + # in the backtrace came from. + # + # source://drb//lib/drb/drb.rb#1173 + def prepare_backtrace(uri, result); end + + # Given the +uri+ of another host executes the block provided. + # + # source://drb//lib/drb/drb.rb#1160 + def with_friend(uri); end + end +end + +# Module managing the underlying network protocol(s) used by drb. +# +# By default, drb uses the DRbTCPSocket protocol. Other protocols +# can be defined. A protocol must define the following class methods: +# +# [open(uri, config)] Open a client connection to the server at +uri+, +# using configuration +config+. Return a protocol +# instance for this connection. +# [open_server(uri, config)] Open a server listening at +uri+, +# using configuration +config+. Return a +# protocol instance for this listener. +# [uri_option(uri, config)] Take a URI, possibly containing an option +# component (e.g. a trailing '?param=val'), +# and return a [uri, option] tuple. +# +# All of these methods should raise a DRbBadScheme error if the URI +# does not identify the protocol they support (e.g. "druby:" for +# the standard Ruby protocol). This is how the DRbProtocol module, +# given a URI, determines which protocol implementation serves that +# protocol. +# +# The protocol instance returned by #open_server must have the +# following methods: +# +# [accept] Accept a new connection to the server. Returns a protocol +# instance capable of communicating with the client. +# [close] Close the server connection. +# [uri] Get the URI for this server. +# +# The protocol instance returned by #open must have the following methods: +# +# [send_request (ref, msg_id, arg, b)] +# Send a request to +ref+ with the given message id and arguments. +# This is most easily implemented by calling DRbMessage.send_request, +# providing a stream that sits on top of the current protocol. +# [recv_reply] +# Receive a reply from the server and return it as a [success-boolean, +# reply-value] pair. This is most easily implemented by calling +# DRb.recv_reply, providing a stream that sits on top of the +# current protocol. +# [alive?] +# Is this connection still alive? +# [close] +# Close this connection. +# +# The protocol instance returned by #open_server().accept() must have +# the following methods: +# +# [recv_request] +# Receive a request from the client and return a [object, message, +# args, block] tuple. This is most easily implemented by calling +# DRbMessage.recv_request, providing a stream that sits on top of +# the current protocol. +# [send_reply(succ, result)] +# Send a reply to the client. This is most easily implemented +# by calling DRbMessage.send_reply, providing a stream that sits +# on top of the current protocol. +# [close] +# Close this connection. +# +# A new protocol is registered with the DRbProtocol module using +# the add_protocol method. +# +# For examples of other protocols, see DRbUNIXSocket in drb/unix.rb, +# and HTTP0 in sample/http0.rb and sample/http0serv.rb in the full +# drb distribution. +# +# source://drb//lib/drb/drb.rb#721 +module DRb::DRbProtocol + private + + # Add a new protocol to the DRbProtocol module. + # + # source://drb//lib/drb/drb.rb#724 + def add_protocol(prot); end + + # source://drb//lib/drb/drb.rb#802 + def auto_load(uri); end + + # Open a client connection to +uri+ with the configuration +config+. + # + # The DRbProtocol module asks each registered protocol in turn to + # try to open the URI. Each protocol signals that it does not handle that + # URI by raising a DRbBadScheme error. If no protocol recognises the + # URI, then a DRbBadURI error is raised. If a protocol accepts the + # URI, but an error occurs in opening it, a DRbConnError is raised. + # + # @raise [DRbBadURI] + # + # source://drb//lib/drb/drb.rb#736 + def open(uri, config, first = T.unsafe(nil)); end + + # Open a server listening for connections at +uri+ with + # configuration +config+. + # + # The DRbProtocol module asks each registered protocol in turn to + # try to open a server at the URI. Each protocol signals that it does + # not handle that URI by raising a DRbBadScheme error. If no protocol + # recognises the URI, then a DRbBadURI error is raised. If a protocol + # accepts the URI, but an error occurs in opening it, the underlying + # error is passed on to the caller. + # + # @raise [DRbBadURI] + # + # source://drb//lib/drb/drb.rb#764 + def open_server(uri, config, first = T.unsafe(nil)); end + + # Parse +uri+ into a [uri, option] pair. + # + # The DRbProtocol module asks each registered protocol in turn to + # try to parse the URI. Each protocol signals that it does not handle that + # URI by raising a DRbBadScheme error. If no protocol recognises the + # URI, then a DRbBadURI error is raised. + # + # @raise [DRbBadURI] + # + # source://drb//lib/drb/drb.rb#785 + def uri_option(uri, config, first = T.unsafe(nil)); end + + class << self + # Add a new protocol to the DRbProtocol module. + # + # source://drb//lib/drb/drb.rb#724 + def add_protocol(prot); end + + # source://drb//lib/drb/drb.rb#802 + def auto_load(uri); end + + # Open a client connection to +uri+ with the configuration +config+. + # + # The DRbProtocol module asks each registered protocol in turn to + # try to open the URI. Each protocol signals that it does not handle that + # URI by raising a DRbBadScheme error. If no protocol recognises the + # URI, then a DRbBadURI error is raised. If a protocol accepts the + # URI, but an error occurs in opening it, a DRbConnError is raised. + # + # @raise [DRbBadURI] + # + # source://drb//lib/drb/drb.rb#736 + def open(uri, config, first = T.unsafe(nil)); end + + # Open a server listening for connections at +uri+ with + # configuration +config+. + # + # The DRbProtocol module asks each registered protocol in turn to + # try to open a server at the URI. Each protocol signals that it does + # not handle that URI by raising a DRbBadScheme error. If no protocol + # recognises the URI, then a DRbBadURI error is raised. If a protocol + # accepts the URI, but an error occurs in opening it, the underlying + # error is passed on to the caller. + # + # @raise [DRbBadURI] + # + # source://drb//lib/drb/drb.rb#764 + def open_server(uri, config, first = T.unsafe(nil)); end + + # Parse +uri+ into a [uri, option] pair. + # + # The DRbProtocol module asks each registered protocol in turn to + # try to parse the URI. Each protocol signals that it does not handle that + # URI by raising a DRbBadScheme error. If no protocol recognises the + # URI, then a DRbBadURI error is raised. + # + # @raise [DRbBadURI] + # + # source://drb//lib/drb/drb.rb#785 + def uri_option(uri, config, first = T.unsafe(nil)); end + end +end + +# An exception wrapping an error object +# +# source://drb//lib/drb/drb.rb#431 +class DRb::DRbRemoteError < ::DRb::DRbError + # Creates a new remote error that wraps the Exception +error+ + # + # @return [DRbRemoteError] a new instance of DRbRemoteError + # + # source://drb//lib/drb/drb.rb#434 + def initialize(error); end + + # the class of the error, as a string. + # + # source://drb//lib/drb/drb.rb#441 + def reason; end +end + +# source://drb//lib/drb/drb.rb#1350 +class DRb::DRbServer + # Create a new DRbServer instance. + # + # +uri+ is the URI to bind to. This is normally of the form + # 'druby://:' where is a hostname of + # the local machine. If nil, then the system's default hostname + # will be bound to, on a port selected by the system; these value + # can be retrieved from the +uri+ attribute. 'druby:' specifies + # the default dRuby transport protocol: another protocol, such + # as 'drbunix:', can be specified instead. + # + # +front+ is the front object for the server, that is, the object + # to which remote method calls on the server will be passed. If + # nil, then the server will not accept remote method calls. + # + # If +config_or_acl+ is a hash, it is the configuration to + # use for this server. The following options are recognised: + # + # :idconv :: an id-to-object conversion object. This defaults + # to an instance of the class DRb::DRbIdConv. + # :verbose :: if true, all unsuccessful remote calls on objects + # in the server will be logged to $stdout. false + # by default. + # :tcp_acl :: the access control list for this server. See + # the ACL class from the main dRuby distribution. + # :load_limit :: the maximum message size in bytes accepted by + # the server. Defaults to 25 MB (26214400). + # :argc_limit :: the maximum number of arguments to a remote + # method accepted by the server. Defaults to + # 256. + # The default values of these options can be modified on + # a class-wide basis by the class methods #default_argc_limit, + # #default_load_limit, #default_acl, #default_id_conv, + # and #verbose= + # + # If +config_or_acl+ is not a hash, but is not nil, it is + # assumed to be the access control list for this server. + # See the :tcp_acl option for more details. + # + # If no other server is currently set as the primary server, + # this will become the primary server. + # + # The server will immediately start running in its own thread. + # + # @return [DRbServer] a new instance of DRbServer + # + # source://drb//lib/drb/drb.rb#1451 + def initialize(uri = T.unsafe(nil), front = T.unsafe(nil), config_or_acl = T.unsafe(nil)); end + + # Is this server alive? + # + # @return [Boolean] + # + # source://drb//lib/drb/drb.rb#1506 + def alive?; end + + # Check that a method is callable via dRuby. + # + # +obj+ is the object we want to invoke the method on. +msg_id+ is the + # method name, as a Symbol. + # + # If the method is an insecure method (see #insecure_method?) a + # SecurityError is thrown. If the method is private or undefined, + # a NameError is thrown. + # + # @raise [ArgumentError] + # + # source://drb//lib/drb/drb.rb#1594 + def check_insecure_method(obj, msg_id); end + + # The configuration of this DRbServer + # + # source://drb//lib/drb/drb.rb#1493 + def config; end + + # The front object of the DRbServer. + # + # This object receives remote method calls made on the server's + # URI alone, with an object id. + # + # source://drb//lib/drb/drb.rb#1490 + def front; end + + # Is +uri+ the URI for this server? + # + # @return [Boolean] + # + # source://drb//lib/drb/drb.rb#1511 + def here?(uri); end + + # Stop this server. + # + # source://drb//lib/drb/drb.rb#1516 + def stop_service; end + + # The main thread of this DRbServer. + # + # This is the thread that listens for and accepts connections + # from clients, not that handles each client's request-response + # session. + # + # source://drb//lib/drb/drb.rb#1484 + def thread; end + + # Convert a local object to a dRuby reference. + # + # source://drb//lib/drb/drb.rb#1533 + def to_id(obj); end + + # Convert a dRuby reference to the local object it refers to. + # + # source://drb//lib/drb/drb.rb#1526 + def to_obj(ref); end + + # The URI of this DRbServer. + # + # source://drb//lib/drb/drb.rb#1477 + def uri; end + + # Get whether the server is in verbose mode. + # + # In verbose mode, failed calls are logged to stdout. + # + # source://drb//lib/drb/drb.rb#1503 + def verbose; end + + # Set whether to operate in verbose mode. + # + # In verbose mode, failed calls are logged to stdout. + # + # source://drb//lib/drb/drb.rb#1498 + def verbose=(v); end + + private + + # Coerce an object to a string, providing our own representation if + # to_s is not defined for the object. + # + # source://drb//lib/drb/drb.rb#1580 + def any_to_s(obj); end + + # source://drb//lib/drb/drb.rb#1696 + def error_print(exception); end + + # Has a method been included in the list of insecure methods? + # + # @return [Boolean] + # + # source://drb//lib/drb/drb.rb#1574 + def insecure_method?(msg_id); end + + # The main loop performed by a DRbServer's internal thread. + # + # Accepts a connection from a client, and starts up its own + # thread to handle it. This thread loops, receiving requests + # from the client, invoking them on a local object, and + # returning responses, until the client closes the connection + # or a local method call fails. + # + # source://drb//lib/drb/drb.rb#1714 + def main_loop; end + + # Starts the DRb main loop in a new thread. + # + # source://drb//lib/drb/drb.rb#1555 + def run; end + + # source://drb//lib/drb/drb.rb#1540 + def shutdown; end + + class << self + # Set the default access control list to +acl+. The default ACL is +nil+. + # + # See also DRb::ACL and #new() + # + # source://drb//lib/drb/drb.rb#1375 + def default_acl(acl); end + + # Set the default value for the :argc_limit option. + # + # See #new(). The initial default value is 256. + # + # source://drb//lib/drb/drb.rb#1361 + def default_argc_limit(argc); end + + # Set the default value for the :id_conv option. + # + # See #new(). The initial default value is a DRbIdConv instance. + # + # source://drb//lib/drb/drb.rb#1382 + def default_id_conv(idconv); end + + # Set the default value for the :load_limit option. + # + # See #new(). The initial default value is 25 MB. + # + # source://drb//lib/drb/drb.rb#1368 + def default_load_limit(sz); end + + # source://drb//lib/drb/drb.rb#1398 + def make_config(hash = T.unsafe(nil)); end + + # Get the default value of the :verbose option. + # + # source://drb//lib/drb/drb.rb#1394 + def verbose; end + + # Set the default value of the :verbose option. + # + # See #new(). The initial default value is false. + # + # source://drb//lib/drb/drb.rb#1389 + def verbose=(on); end + end +end + +# source://drb//lib/drb/drb.rb#1624 +class DRb::DRbServer::InvokeMethod + include ::DRb::DRbServer::InvokeMethod18Mixin + + # @return [InvokeMethod] a new instance of InvokeMethod + # + # source://drb//lib/drb/drb.rb#1625 + def initialize(drb_server, client); end + + # source://drb//lib/drb/drb.rb#1630 + def perform; end + + private + + # source://drb//lib/drb/drb.rb#1667 + def check_insecure_method; end + + # source://drb//lib/drb/drb.rb#1659 + def init_with_client; end + + # source://drb//lib/drb/drb.rb#1676 + def perform_without_block; end + + # source://drb//lib/drb/drb.rb#1671 + def setup_message; end +end + +# source://drb//lib/drb/invokemethod.rb#6 +module DRb::DRbServer::InvokeMethod18Mixin + # source://drb//lib/drb/invokemethod.rb#7 + def block_yield(x); end + + # source://drb//lib/drb/invokemethod.rb#14 + def perform_with_block; end +end + +# The default drb protocol which communicates over a TCP socket. +# +# The DRb TCP protocol URI looks like: +# druby://:?. The option is optional. +# +# source://drb//lib/drb/drb.rb#815 +class DRb::DRbTCPSocket + # Create a new DRbTCPSocket instance. + # + # +uri+ is the URI we are connected to. + # +soc+ is the tcp socket we are bound to. +config+ is our + # configuration. + # + # @return [DRbTCPSocket] a new instance of DRbTCPSocket + # + # source://drb//lib/drb/drb.rb#903 + def initialize(uri, soc, config = T.unsafe(nil)); end + + # On the server side, for an instance returned by #open_server, + # accept a client connection and return a new instance to handle + # the server's side of this client-server session. + # + # source://drb//lib/drb/drb.rb#971 + def accept; end + + # Check to see if this connection is alive. + # + # @return [Boolean] + # + # source://drb//lib/drb/drb.rb#1001 + def alive?; end + + # Close the connection. + # + # If this is an instance returned by #open_server, then this stops + # listening for new connections altogether. If this is an instance + # returned by #open or by #accept, then it closes this particular + # client-server session. + # + # source://drb//lib/drb/drb.rb#953 + def close; end + + # Get the address of our TCP peer (the other end of the socket + # we are bound to. + # + # source://drb//lib/drb/drb.rb#918 + def peeraddr; end + + # On the client side, receive a reply from the server. + # + # source://drb//lib/drb/drb.rb#941 + def recv_reply; end + + # On the server side, receive a request from the client. + # + # source://drb//lib/drb/drb.rb#931 + def recv_request; end + + # On the server side, send a reply to the client. + # + # source://drb//lib/drb/drb.rb#936 + def send_reply(succ, result); end + + # On the client side, send a request to the server. + # + # source://drb//lib/drb/drb.rb#926 + def send_request(ref, msg_id, arg, b); end + + # source://drb//lib/drb/drb.rb#1010 + def set_sockopt(soc); end + + # Graceful shutdown + # + # source://drb//lib/drb/drb.rb#996 + def shutdown; end + + # Get the socket. + # + # source://drb//lib/drb/drb.rb#923 + def stream; end + + # Get the URI that we are connected to. + # + # source://drb//lib/drb/drb.rb#914 + def uri; end + + private + + # source://drb//lib/drb/drb.rb#986 + def accept_or_shutdown; end + + # source://drb//lib/drb/drb.rb#962 + def close_shutdown_pipe; end + + class << self + # Returns the hostname of this server + # + # source://drb//lib/drb/drb.rb#845 + def getservername; end + + # Open a client connection to +uri+ (DRb URI string) using configuration + # +config+. + # + # This can raise DRb::DRbBadScheme or DRb::DRbBadURI if +uri+ is not for a + # recognized protocol. See DRb::DRbServer.new for information on built-in + # URI protocols. + # + # source://drb//lib/drb/drb.rb#838 + def open(uri, config); end + + # Open a server listening for connections at +uri+ using + # configuration +config+. + # + # source://drb//lib/drb/drb.rb#876 + def open_server(uri, config); end + + # For the families available for +host+, returns a TCPServer on +port+. + # If +port+ is 0 the first available port is used. IPv4 servers are + # preferred over IPv6 servers. + # + # source://drb//lib/drb/drb.rb#861 + def open_server_inaddr_any(host, port); end + + # source://drb//lib/drb/drb.rb#818 + def parse_uri(uri); end + + # Parse +uri+ into a [uri, option] pair. + # + # source://drb//lib/drb/drb.rb#893 + def uri_option(uri, config); end + end +end + +# Implements DRb over a UNIX socket +# +# DRb UNIX socket URIs look like drbunix:?. The +# option is optional. +# +# source://drb//lib/drb/unix.rb#15 +class DRb::DRbUNIXSocket < ::DRb::DRbTCPSocket + # @return [DRbUNIXSocket] a new instance of DRbUNIXSocket + # + # source://drb//lib/drb/unix.rb#62 + def initialize(uri, soc, config = T.unsafe(nil), server_mode = T.unsafe(nil)); end + + # source://drb//lib/drb/unix.rb#105 + def accept; end + + # source://drb//lib/drb/unix.rb#95 + def close; end + + # source://drb//lib/drb/unix.rb#111 + def set_sockopt(soc); end + + class << self + # source://drb//lib/drb/unix.rb#28 + def open(uri, config); end + + # source://drb//lib/drb/unix.rb#34 + def open_server(uri, config); end + + # :stopdoc: + # + # source://drb//lib/drb/unix.rb#17 + def parse_uri(uri); end + + # source://drb//lib/drb/unix.rb#72 + def temp_server; end + + # source://drb//lib/drb/unix.rb#57 + def uri_option(uri, config); end + end +end + +# import from tempfile.rb +# +# source://drb//lib/drb/unix.rb#70 +DRb::DRbUNIXSocket::Max_try = T.let(T.unsafe(nil), Integer) + +# source://drb//lib/drb/drb.rb#1021 +class DRb::DRbURIOption + # @return [DRbURIOption] a new instance of DRbURIOption + # + # source://drb//lib/drb/drb.rb#1022 + def initialize(option); end + + # source://drb//lib/drb/drb.rb#1028 + def ==(other); end + + # source://drb//lib/drb/drb.rb#1028 + def eql?(other); end + + # source://drb//lib/drb/drb.rb#1033 + def hash; end + + # Returns the value of attribute option. + # + # source://drb//lib/drb/drb.rb#1025 + def option; end + + # source://drb//lib/drb/drb.rb#1026 + def to_s; end +end + +# Mixin module making an object undumpable or unmarshallable. +# +# If an object which includes this module is returned by method +# called over drb, then the object remains in the server space +# and a reference to the object is returned, rather than the +# object being marshalled and moved into the client space. +# +# source://drb//lib/drb/drb.rb#390 +module DRb::DRbUndumped + # @raise [TypeError] + # + # source://drb//lib/drb/drb.rb#391 + def _dump(dummy); end +end + +# Class wrapping a marshalled object whose type is unknown locally. +# +# If an object is returned by a method invoked over drb, but the +# class of the object is unknown in the client namespace, or +# the object is a constant unknown in the client namespace, then +# the still-marshalled object is returned wrapped in a DRbUnknown instance. +# +# If this object is passed as an argument to a method invoked over +# drb, then the wrapped object is passed instead. +# +# The class or constant name of the object can be read from the +# +name+ attribute. The marshalled object is held in the +buf+ +# attribute. +# +# source://drb//lib/drb/drb.rb#457 +class DRb::DRbUnknown + # Create a new DRbUnknown object. + # + # +buf+ is a string containing a marshalled object that could not + # be unmarshalled. +err+ is the error message that was raised + # when the unmarshalling failed. It is used to determine the + # name of the unmarshalled object. + # + # @return [DRbUnknown] a new instance of DRbUnknown + # + # source://drb//lib/drb/drb.rb#465 + def initialize(err, buf); end + + # source://drb//lib/drb/drb.rb#494 + def _dump(lv); end + + # Buffer contained the marshalled, unknown object. + # + # source://drb//lib/drb/drb.rb#484 + def buf; end + + # Create a DRbUnknownError exception containing this object. + # + # source://drb//lib/drb/drb.rb#508 + def exception; end + + # The name of the unknown thing. + # + # Class name for unknown objects; variable name for unknown + # constants. + # + # source://drb//lib/drb/drb.rb#481 + def name; end + + # Attempt to load the wrapped marshalled object again. + # + # If the class of the object is now known locally, the object + # will be unmarshalled and returned. Otherwise, a new + # but identical DRbUnknown object will be returned. + # + # source://drb//lib/drb/drb.rb#503 + def reload; end + + class << self + # source://drb//lib/drb/drb.rb#486 + def _load(s); end + end +end + +# An exception wrapping a DRb::DRbUnknown object +# +# source://drb//lib/drb/drb.rb#410 +class DRb::DRbUnknownError < ::DRb::DRbError + # Create a new DRbUnknownError for the DRb::DRbUnknown object +unknown+ + # + # @return [DRbUnknownError] a new instance of DRbUnknownError + # + # source://drb//lib/drb/drb.rb#413 + def initialize(unknown); end + + # source://drb//lib/drb/drb.rb#425 + def _dump(lv); end + + # Get the wrapped DRb::DRbUnknown object. + # + # source://drb//lib/drb/drb.rb#419 + def unknown; end + + class << self + # source://drb//lib/drb/drb.rb#421 + def _load(s); end + end +end + +# source://drb//lib/drb/drb.rb#1199 +class DRb::ThreadObject + include ::MonitorMixin + + # @return [ThreadObject] a new instance of ThreadObject + # + # source://drb//lib/drb/drb.rb#1202 + def initialize(&blk); end + + # source://drb//lib/drb/drb.rb#1237 + def _execute; end + + # @return [Boolean] + # + # source://drb//lib/drb/drb.rb#1213 + def alive?; end + + # source://drb//lib/drb/drb.rb#1217 + def kill; end + + # source://drb//lib/drb/drb.rb#1222 + def method_missing(msg, *arg, &blk); end +end + +# source://drb//lib/drb/version.rb#2 +DRb::VERSION = T.let(T.unsafe(nil), String) + +# source://drb//lib/drb/drb.rb#1943 +DRbIdConv = DRb::DRbIdConv + +# :stopdoc: +# +# source://drb//lib/drb/drb.rb#1941 +DRbObject = DRb::DRbObject + +# source://drb//lib/drb/drb.rb#1942 +DRbUndumped = DRb::DRbUndumped diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/gems/dry-inflector@1.1.0.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/dry-inflector@1.1.0.rbi deleted file mode 100644 index 5efec73..0000000 --- a/examples/sinatra-pet-shelter/sorbet/rbi/gems/dry-inflector@1.1.0.rbi +++ /dev/null @@ -1,648 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `dry-inflector` gem. -# Please instead update this file by running `bin/tapioca gem dry-inflector`. - - -# source://dry-inflector//lib/dry/inflector.rb#3 -module Dry; end - -# dry-inflector -# -# @since 0.1.0 -# -# source://dry-inflector//lib/dry/inflector.rb#7 -class Dry::Inflector - # Instantiate the inflector - # - # @example Basic usage - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # @example Custom inflection rules - # require "dry/inflector" - # - # inflector = Dry::Inflector.new do |inflections| - # inflections.plural "virus", "viruses" # specify a rule for #pluralize - # inflections.singular "thieves", "thief" # specify a rule for #singularize - # inflections.uncountable "dry-inflector" # add an exception for an uncountable word - # end - # @param blk [Proc] an optional block to specify custom inflection rules - # @return [Dry::Inflector] the inflector - # @since 0.1.0 - # @yieldparam the [Dry::Inflector::Inflections] inflection rules - # - # source://dry-inflector//lib/dry/inflector.rb#33 - def initialize(&blk); end - - # Upper camelize a string - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.camelize_upper("data_mapper") # => "DataMapper" - # inflector.camelize_upper("dry/inflector") # => "Dry::Inflector" - # @param input [String, Symbol] the input - # @return [String] the upper camelized string - # @since 0.1.3 - # - # source://dry-inflector//lib/dry/inflector.rb#66 - def camelize(input); end - - # Lower camelize a string - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.camelize_lower("data_mapper") # => "dataMapper" - # @param input [String, Symbol] the input - # @return [String] the lower camelized string - # @since 0.1.3 - # - # source://dry-inflector//lib/dry/inflector.rb#49 - def camelize_lower(input); end - - # Upper camelize a string - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.camelize_upper("data_mapper") # => "DataMapper" - # inflector.camelize_upper("dry/inflector") # => "Dry::Inflector" - # @param input [String, Symbol] the input - # @return [String] the upper camelized string - # @since 0.1.3 - # - # source://dry-inflector//lib/dry/inflector.rb#66 - def camelize_upper(input); end - - # Classify a string - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.classify("books") # => "Book" - # @param input [String, Symbol] the input - # @return [String] the classified string - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#104 - def classify(input); end - - # Find a constant with the name specified in the argument string - # - # The name is assumed to be the one of a top-level constant, - # constant scope of caller is ignored - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.constantize("Module") # => Module - # inflector.constantize("Dry::Inflector") # => Dry::Inflector - # @param input [String, Symbol] the input - # @return [Class, Module] the class or module - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#88 - def constantize(input); end - - # Dasherize a string - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.dasherize("dry_inflector") # => "dry-inflector" - # @param input [String, Symbol] the input - # @return [String] the dasherized string - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#120 - def dasherize(input); end - - # Demodulize a string - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.demodulize("Dry::Inflector") # => "Inflector" - # @param input [String, Symbol] the input - # @return [String] the demodulized string - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#136 - def demodulize(input); end - - # Creates a foreign key name - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.foreign_key("Message") => "message_id" - # @param input [String, Symbol] the input - # @return [String] foreign key - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#175 - def foreign_key(input); end - - # Humanize a string - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.humanize("dry_inflector") # => "Dry inflector" - # inflector.humanize("author_id") # => "Author" - # @param input [String, Symbol] the input - # @return [String] the humanized string - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#153 - def humanize(input); end - - # @api public - # @return [String] - # @since 0.2.0 - # - # source://dry-inflector//lib/dry/inflector.rb#310 - def inspect; end - - # Ordinalize a number - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.ordinalize(1) # => "1st" - # inflector.ordinalize(2) # => "2nd" - # inflector.ordinalize(3) # => "3rd" - # inflector.ordinalize(10) # => "10th" - # inflector.ordinalize(23) # => "23rd" - # @param number [Integer] the input - # @return [String] the ordinalized number - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#195 - def ordinalize(number); end - - # Pluralize a string - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.pluralize("book") # => "books" - # inflector.pluralize("money") # => "money" - # @param input [String, Symbol] the input - # @return [String] the pluralized string - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#223 - def pluralize(input); end - - # Singularize a string - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.singularize("books") # => "book" - # inflector.singularize("money") # => "money" - # @param input [String] the input - # @return [String] the singularized string - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#243 - def singularize(input); end - - # Tableize a string - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.tableize("Book") # => "books" - # @param input [String, Symbol] the input - # @return [String] the tableized string - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#262 - def tableize(input); end - - # @api public - # @return [String] - # @since 0.2.0 - # - # source://dry-inflector//lib/dry/inflector.rb#310 - def to_s; end - - # Check if the input is an uncountable word - # - # @api private - # @param input [String] the input - # @return [TrueClass, FalseClass] the result of the check - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#300 - def uncountable?(input); end - - # Underscore a string - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new - # inflector.underscore("dry-inflector") # => "dry_inflector" - # @param input [String, Symbol] the input - # @return [String] the underscored string - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#279 - def underscore(input); end - - private - - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector.rb#325 - def inflections; end - - # @api private - # @since 0.1.3 - # - # source://dry-inflector//lib/dry/inflector.rb#329 - def internal_camelize(input, upper); end -end - -# A set of acronyms -# -# @api private -# @since 0.1.2 -# -# source://dry-inflector//lib/dry/inflector/acronyms.rb#9 -class Dry::Inflector::Acronyms - # @api private - # @return [Acronyms] a new instance of Acronyms - # @since 0.1.2 - # - # source://dry-inflector//lib/dry/inflector/acronyms.rb#14 - def initialize; end - - # @api private - # @since 0.1.2 - # - # source://dry-inflector//lib/dry/inflector/acronyms.rb#27 - def add(rule, replacement); end - - # @api private - # @since 0.1.2 - # - # source://dry-inflector//lib/dry/inflector/acronyms.rb#21 - def apply_to(word, capitalize: T.unsafe(nil)); end - - # @api private - # @since 0.1.2 - # - # source://dry-inflector//lib/dry/inflector/acronyms.rb#10 - def regex; end - - private - - # @api private - # @since 0.1.2 - # - # source://dry-inflector//lib/dry/inflector/acronyms.rb#36 - def define_regex_patterns; end -end - -# @api private -# @since 0.1.2 -# -# source://dry-inflector//lib/dry/inflector.rb#323 -Dry::Inflector::DEFAULT_SEPARATOR = T.let(T.unsafe(nil), String) - -# Inflections -# -# @since 0.1.0 -# -# source://dry-inflector//lib/dry/inflector/inflections.rb#12 -class Dry::Inflector::Inflections - # Instantiate the rules - # - # @api private - # @return [Dry::Inflector::Inflections] - # @since 0.1.0 - # @yieldparam [self] - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#76 - def initialize; end - - # Add one or more acronyms - # - # Acronyms affect how basic operations are performed, such - # as camelize/underscore. - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new do |inflections| - # inflections.acronym "HTML" - # end - # - # inflector.camelize("html") # => "HTML" - # inflector.underscore("HTMLIsFun") # => "html_is_fun" - # @param words [Array] a list of acronyms - # @since 0.1.2 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#197 - def acronym(*words); end - - # Acronyms - # - # @api private - # @return [Dry::Inflector::Acronyms] - # @since 0.1.2 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#67 - def acronyms; end - - # Add a custom humanize rule - # - # 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"`) - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new do |inflections| - # inflections.human(/_cnt$/i, '\1_count') - # inflections.human("legacy_col_person_name", "Name") - # end - # @param rule [String, Regexp] the rule - # @param replacement [String] the replacement - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#224 - def human(rule, replacement); end - - # Human rules - # - # @api private - # @return [Dry::Inflector::Rules] - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#59 - def humans; end - - # Add a custom pluralization rule - # - # 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. - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new do |inflections| - # inflections.singular "octopus", "octopi" - # end - # @param singular [String] the singular - # @param plural [String] the plural - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#151 - def irregular(singular, plural); end - - # Add a custom pluralization rule - # - # 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. - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new do |inflections| - # inflections.plural "virus", "viruses" - # end - # @param rule [String, Regexp] the rule - # @param replacement [String] the replacement - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#105 - def plural(rule, replacement); end - - # Pluralization rules - # - # @api private - # @return [Dry::Inflector::Rules] - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#35 - def plurals; end - - # Add a custom singularization rule - # - # 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. - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new do |inflections| - # inflections.singular "thieves", "thief" - # end - # @param rule [String, Regexp] the rule - # @param replacement [String] the replacement - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#128 - def singular(rule, replacement); end - - # Singularization rules - # - # @api private - # @return [Dry::Inflector::Rules] - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#43 - def singulars; end - - # Add a custom rule for uncountable words - # - # Uncountable will not be inflected - # - # @example - # require "dry/inflector" - # - # inflector = Dry::Inflector.new do |inflections| - # inflections.uncountable "money" - # inflections.uncountable "money", "information" - # inflections.uncountable %w(money information rice) - # end - # @param words [Enumerable] - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#175 - def uncountable(*words); end - - # Uncountable rules - # - # @api private - # @return [Set] - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#51 - def uncountables; end - - private - - # Add irregular inflection - # - # @api private - # @param rule [String] the rule - # @param replacement [String] the replacement - # @return [undefined] - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#239 - def add_irregular(rule, replacement, target); end - - # Add a new rule - # - # @api private - # @param rule [String, Regexp] the rule - # @param replacement [String, Regexp] the replacement - # @param target [Dry::Inflector::Rules] the target - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#252 - def rule(rule, replacement, target); end - - class << self - # Instantiate a set of inflection rules. - # It adds the default rules and the optional customizations, passed as a block. - # - # @api private - # @param blk [Proc] the optional, custom rules - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections.rb#22 - def build(&blk); end - end -end - -# Default inflections -# -# -# @api private -# @since 0.1.0 -# -# source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#12 -module Dry::Inflector::Inflections::Defaults - class << self - # @api private - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#15 - def call(inflect); end - - private - - # @api private - # @since 0.1.2 - # - # source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#112 - def acronyms(inflect); end - - # @api private - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#87 - def irregular(inflect); end - - # @api private - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#25 - def plural(inflect); end - - # @api private - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#55 - def singular(inflect); end - - # @api private - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#105 - def uncountable(inflect); end - end -end - -# @api private -# @since 0.1.0 -# -# source://dry-inflector//lib/dry/inflector.rb#319 -Dry::Inflector::ORDINALIZE_TH = T.let(T.unsafe(nil), Hash) - -# A set of inflection rules -# -# @api private -# @since 0.1.0 -# -# source://dry-inflector//lib/dry/inflector/rules.rb#9 -class Dry::Inflector::Rules - # @api private - # @return [Rules] a new instance of Rules - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/rules.rb#12 - def initialize; end - - # @api private - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/rules.rb#18 - def apply_to(word); end - - # @api private - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/rules.rb#32 - def each(&blk); end - - # @api private - # @since 0.1.0 - # - # source://dry-inflector//lib/dry/inflector/rules.rb#26 - def insert(index, array); end -end - -# @since 0.1.0 -# -# source://dry-inflector//lib/dry/inflector/version.rb#6 -Dry::Inflector::VERSION = T.let(T.unsafe(nil), String) diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/gems/i18n@1.14.6.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/i18n@1.14.6.rbi new file mode 100644 index 0000000..013b065 --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/i18n@1.14.6.rbi @@ -0,0 +1,2275 @@ +# 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`. + + +# 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#38 + 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#46 + def reserve_key(key); end + + # source://i18n//lib/i18n.rb#51 + 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#97 + def available_locales; end + + # source://i18n//lib/i18n/backend/base.rb#105 + def eager_load!; end + + # @return [Boolean] + # + # source://i18n//lib/i18n/backend/base.rb#71 + 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#78 + def localize(locale, object, format = T.unsafe(nil), options = T.unsafe(nil)); end + + # source://i18n//lib/i18n/backend/base.rb#101 + 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#217 + 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#128 + def default(locale, object, subject, options = T.unsafe(nil)); end + + # @return [Boolean] + # + # source://i18n//lib/i18n/backend/base.rb#111 + 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#201 + 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#240 + 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#276 + 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#254 + 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#261 + 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#261 + 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#116 + def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end + + # source://i18n//lib/i18n/backend/base.rb#308 + 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#182 + 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#150 + 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#150 + def resolve_entry(locale, object, subject, options = T.unsafe(nil)); end + + # @return [Boolean] + # + # source://i18n//lib/i18n/backend/base.rb#120 + def subtrees?; end + + # source://i18n//lib/i18n/backend/base.rb#289 + 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#98 + def exists?(locale, key, options = T.unsafe(nil)); end + + # source://i18n//lib/i18n/backend/fallbacks.rb#89 + 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#114 + 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) + +# source://i18n//lib/i18n/backend/interpolation_compiler.rb#20 +module I18n::Backend::InterpolationCompiler + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#97 + def interpolate(locale, string, values); end + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#107 + def store_translations(locale, data, options = T.unsafe(nil)); end + + protected + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#113 + 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#26 + def compile_if_an_interpolation(string); end + + # @return [Boolean] + # + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#38 + def interpolated_str?(str); end + + protected + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#58 + def compile_interpolation_token(key); end + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#48 + def compiled_interpolation_body(str); end + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#71 + def direct_key(key); end + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#91 + def escape_key_sym(key); end + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#87 + def escape_plain_str(str); end + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#54 + def handle_interpolation_token(token); end + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#67 + def interpolate_key(key); end + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#62 + def interpolate_or_raise_missing(key); end + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#79 + def missing_key(key); end + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#75 + def nil_key(key); end + + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#83 + def reserved_key(key); end + + # tokenize("foo %{bar} baz %%{buz}") # => ["foo ", "%{bar}", " baz ", "%%{buz}"] + # + # source://i18n//lib/i18n/backend/interpolation_compiler.rb#44 + def tokenize(str); end +end + +# 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#55 +module I18n::Base + # source://i18n//lib/i18n.rb#70 + def available_locales; end + + # source://i18n//lib/i18n.rb#74 + def available_locales=(value); end + + # @return [Boolean] + # + # source://i18n//lib/i18n.rb#386 + def available_locales_initialized?; end + + # source://i18n//lib/i18n.rb#70 + def backend; end + + # source://i18n//lib/i18n.rb#74 + def backend=(value); end + + # Gets I18n configuration object. + # + # source://i18n//lib/i18n.rb#57 + def config; end + + # Sets I18n configuration object. + # + # source://i18n//lib/i18n.rb#62 + def config=(value); end + + # source://i18n//lib/i18n.rb#70 + def default_locale; end + + # source://i18n//lib/i18n.rb#74 + def default_locale=(value); end + + # source://i18n//lib/i18n.rb#70 + def default_separator; end + + # source://i18n//lib/i18n.rb#74 + 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#91 + def eager_load!; end + + # source://i18n//lib/i18n.rb#70 + def enforce_available_locales; end + + # Raises an InvalidLocale exception when the passed locale is not available. + # + # source://i18n//lib/i18n.rb#380 + def enforce_available_locales!(locale); end + + # source://i18n//lib/i18n.rb#74 + def enforce_available_locales=(value); end + + # source://i18n//lib/i18n.rb#70 + def exception_handler; end + + # source://i18n//lib/i18n.rb#74 + 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#265 + def exists?(key, _locale = T.unsafe(nil), locale: T.unsafe(nil), **options); end + + # Returns an array of interpolation keys for the given translation key + # + # *Examples* + # + # Suppose we have the following: + # I18n.t 'example.zero' == 'Zero interpolations' + # I18n.t 'example.one' == 'One interpolation %{foo}' + # I18n.t 'example.two' == 'Two interpolations %{foo} %{bar}' + # I18n.t 'example.three' == ['One %{foo}', 'Two %{bar}', 'Three %{baz}'] + # I18n.t 'example.one', locale: :other == 'One interpolation %{baz}' + # + # Then we can expect the following results: + # I18n.interpolation_keys('example.zero') #=> [] + # I18n.interpolation_keys('example.one') #=> ['foo'] + # I18n.interpolation_keys('example.two') #=> ['foo', 'bar'] + # I18n.interpolation_keys('example.three') #=> ['foo', 'bar', 'baz'] + # I18n.interpolation_keys('one', scope: 'example', locale: :other) #=> ['baz'] + # I18n.interpolation_keys('does-not-exist') #=> [] + # I18n.interpolation_keys('example') #=> [] + # + # @raise [I18n::ArgumentError] + # + # source://i18n//lib/i18n.rb#254 + def interpolation_keys(key, **options); end + + # Localizes certain objects, such as dates and numbers to local formatting. + # + # @raise [Disabled] + # + # source://i18n//lib/i18n.rb#335 + def l(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end + + # source://i18n//lib/i18n.rb#70 + def load_path; end + + # source://i18n//lib/i18n.rb#74 + def load_path=(value); end + + # source://i18n//lib/i18n.rb#70 + def locale; end + + # source://i18n//lib/i18n.rb#74 + 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#375 + def locale_available?(locale); end + + # Localizes certain objects, such as dates and numbers to local formatting. + # + # @raise [Disabled] + # + # source://i18n//lib/i18n.rb#335 + 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#363 + 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#83 + 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#211 + 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#230 + 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#211 + 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#230 + 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#324 + 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#346 + 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#422 + def handle_exception(handling, exception, locale, key, options); end + + # source://i18n//lib/i18n.rb#464 + def interpolation_keys_from_translation(translation); end + + # source://i18n//lib/i18n.rb#440 + def normalize_key(key, separator); end + + # source://i18n//lib/i18n.rb#392 + 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#36 +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 + + # @return [Boolean] + # + # source://i18n//lib/i18n/locale/fallbacks.rb#82 + def empty?; end + + # source://i18n//lib/i18n/locale/fallbacks.rb#86 + def inspect; end + + # source://i18n//lib/i18n/locale/fallbacks.rb#67 + def map(*args, &block); end + + protected + + # source://i18n//lib/i18n/locale/fallbacks.rb#92 + 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/examples/sinatra-pet-shelter/sorbet/rbi/gems/logger@1.6.1.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/logger@1.6.1.rbi new file mode 100644 index 0000000..4e9ceac --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/logger@1.6.1.rbi @@ -0,0 +1,920 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `logger` gem. +# Please instead update this file by running `bin/tapioca gem logger`. + + +# \Class \Logger provides a simple but sophisticated logging utility that +# you can use to create one or more +# {event logs}[https://en.wikipedia.org/wiki/Logging_(software)#Event_logs] +# for your program. +# Each such log contains a chronological sequence of entries +# that provides a record of the program's activities. +# +# == About the Examples +# +# All examples on this page assume that \Logger has been required: +# +# require 'logger' +# +# == Synopsis +# +# Create a log with Logger.new: +# +# # Single log file. +# logger = Logger.new('t.log') +# # Size-based rotated logging: 3 10-megabyte files. +# logger = Logger.new('t.log', 3, 10485760) +# # Period-based rotated logging: daily (also allowed: 'weekly', 'monthly'). +# logger = Logger.new('t.log', 'daily') +# # Log to an IO stream. +# logger = Logger.new($stdout) +# +# Add entries (level, message) with Logger#add: +# +# logger.add(Logger::DEBUG, 'Maximal debugging info') +# logger.add(Logger::INFO, 'Non-error information') +# logger.add(Logger::WARN, 'Non-error warning') +# logger.add(Logger::ERROR, 'Non-fatal error') +# logger.add(Logger::FATAL, 'Fatal error') +# logger.add(Logger::UNKNOWN, 'Most severe') +# +# Close the log with Logger#close: +# +# logger.close +# +# == Entries +# +# You can add entries with method Logger#add: +# +# logger.add(Logger::DEBUG, 'Maximal debugging info') +# logger.add(Logger::INFO, 'Non-error information') +# logger.add(Logger::WARN, 'Non-error warning') +# logger.add(Logger::ERROR, 'Non-fatal error') +# logger.add(Logger::FATAL, 'Fatal error') +# logger.add(Logger::UNKNOWN, 'Most severe') +# +# These shorthand methods also add entries: +# +# logger.debug('Maximal debugging info') +# logger.info('Non-error information') +# logger.warn('Non-error warning') +# logger.error('Non-fatal error') +# logger.fatal('Fatal error') +# logger.unknown('Most severe') +# +# When you call any of these methods, +# the entry may or may not be written to the log, +# depending on the entry's severity and on the log level; +# see {Log Level}[rdoc-ref:Logger@Log+Level] +# +# An entry always has: +# +# - A severity (the required argument to #add). +# - An automatically created timestamp. +# +# And may also have: +# +# - A message. +# - A program name. +# +# Example: +# +# logger = Logger.new($stdout) +# logger.add(Logger::INFO, 'My message.', 'mung') +# # => I, [2022-05-07T17:21:46.536234 #20536] INFO -- mung: My message. +# +# The default format for an entry is: +# +# "%s, [%s #%d] %5s -- %s: %s\n" +# +# where the values to be formatted are: +# +# - \Severity (one letter). +# - Timestamp. +# - Process id. +# - \Severity (word). +# - Program name. +# - Message. +# +# You can use a different entry format by: +# +# - Setting a custom format proc (affects following entries); +# see {formatter=}[Logger.html#attribute-i-formatter]. +# - Calling any of the methods above with a block +# (affects only the one entry). +# Doing so can have two benefits: +# +# - Context: the block can evaluate the entire program context +# and create a context-dependent message. +# - Performance: the block is not evaluated unless the log level +# permits the entry actually to be written: +# +# logger.error { my_slow_message_generator } +# +# Contrast this with the string form, where the string is +# always evaluated, regardless of the log level: +# +# logger.error("#{my_slow_message_generator}") +# +# === \Severity +# +# The severity of a log entry has two effects: +# +# - Determines whether the entry is selected for inclusion in the log; +# see {Log Level}[rdoc-ref:Logger@Log+Level]. +# - Indicates to any log reader (whether a person or a program) +# the relative importance of the entry. +# +# === Timestamp +# +# The timestamp for a log entry is generated automatically +# when the entry is created. +# +# The logged timestamp is formatted by method +# {Time#strftime}[https://docs.ruby-lang.org/en/master/Time.html#method-i-strftime] +# using this format string: +# +# '%Y-%m-%dT%H:%M:%S.%6N' +# +# Example: +# +# logger = Logger.new($stdout) +# logger.add(Logger::INFO) +# # => I, [2022-05-07T17:04:32.318331 #20536] INFO -- : nil +# +# You can set a different format using method #datetime_format=. +# +# === Message +# +# The message is an optional argument to an entry method: +# +# logger = Logger.new($stdout) +# logger.add(Logger::INFO, 'My message') +# # => I, [2022-05-07T18:15:37.647581 #20536] INFO -- : My message +# +# For the default entry formatter, Logger::Formatter, +# the message object may be: +# +# - A string: used as-is. +# - An Exception: message.message is used. +# - Anything else: message.inspect is used. +# +# *Note*: Logger::Formatter does not escape or sanitize +# the message passed to it. +# Developers should be aware that malicious data (user input) +# may be in the message, and should explicitly escape untrusted data. +# +# You can use a custom formatter to escape message data; +# see the example at {formatter=}[Logger.html#attribute-i-formatter]. +# +# === Program Name +# +# The program name is an optional argument to an entry method: +# +# logger = Logger.new($stdout) +# logger.add(Logger::INFO, 'My message', 'mung') +# # => I, [2022-05-07T18:17:38.084716 #20536] INFO -- mung: My message +# +# The default program name for a new logger may be set in the call to +# Logger.new via optional keyword argument +progname+: +# +# logger = Logger.new('t.log', progname: 'mung') +# +# The default program name for an existing logger may be set +# by a call to method #progname=: +# +# logger.progname = 'mung' +# +# The current program name may be retrieved with method +# {progname}[Logger.html#attribute-i-progname]: +# +# logger.progname # => "mung" +# +# == Log Level +# +# The log level setting determines whether an entry is actually +# written to the log, based on the entry's severity. +# +# These are the defined severities (least severe to most severe): +# +# logger = Logger.new($stdout) +# logger.add(Logger::DEBUG, 'Maximal debugging info') +# # => D, [2022-05-07T17:57:41.776220 #20536] DEBUG -- : Maximal debugging info +# logger.add(Logger::INFO, 'Non-error information') +# # => I, [2022-05-07T17:59:14.349167 #20536] INFO -- : Non-error information +# logger.add(Logger::WARN, 'Non-error warning') +# # => W, [2022-05-07T18:00:45.337538 #20536] WARN -- : Non-error warning +# logger.add(Logger::ERROR, 'Non-fatal error') +# # => E, [2022-05-07T18:02:41.592912 #20536] ERROR -- : Non-fatal error +# logger.add(Logger::FATAL, 'Fatal error') +# # => F, [2022-05-07T18:05:24.703931 #20536] FATAL -- : Fatal error +# logger.add(Logger::UNKNOWN, 'Most severe') +# # => A, [2022-05-07T18:07:54.657491 #20536] ANY -- : Most severe +# +# The default initial level setting is Logger::DEBUG, the lowest level, +# which means that all entries are to be written, regardless of severity: +# +# logger = Logger.new($stdout) +# logger.level # => 0 +# logger.add(0, "My message") +# # => D, [2022-05-11T15:10:59.773668 #20536] DEBUG -- : My message +# +# You can specify a different setting in a new logger +# using keyword argument +level+ with an appropriate value: +# +# logger = Logger.new($stdout, level: Logger::ERROR) +# logger = Logger.new($stdout, level: 'error') +# logger = Logger.new($stdout, level: :error) +# logger.level # => 3 +# +# With this level, entries with severity Logger::ERROR and higher +# are written, while those with lower severities are not written: +# +# logger = Logger.new($stdout, level: Logger::ERROR) +# logger.add(3) +# # => E, [2022-05-11T15:17:20.933362 #20536] ERROR -- : nil +# logger.add(2) # Silent. +# +# You can set the log level for an existing logger +# with method #level=: +# +# logger.level = Logger::ERROR +# +# These shorthand methods also set the level: +# +# logger.debug! # => 0 +# logger.info! # => 1 +# logger.warn! # => 2 +# logger.error! # => 3 +# logger.fatal! # => 4 +# +# You can retrieve the log level with method #level. +# +# logger.level = Logger::ERROR +# logger.level # => 3 +# +# These methods return whether a given +# level is to be written: +# +# logger.level = Logger::ERROR +# logger.debug? # => false +# logger.info? # => false +# logger.warn? # => false +# logger.error? # => true +# logger.fatal? # => true +# +# == Log File Rotation +# +# By default, a log file is a single file that grows indefinitely +# (until explicitly closed); there is no file rotation. +# +# To keep log files to a manageable size, +# you can use _log_ _file_ _rotation_, which uses multiple log files: +# +# - Each log file has entries for a non-overlapping +# time interval. +# - Only the most recent log file is open and active; +# the others are closed and inactive. +# +# === Size-Based Rotation +# +# For size-based log file rotation, call Logger.new with: +# +# - Argument +logdev+ as a file path. +# - Argument +shift_age+ with a positive integer: +# the number of log files to be in the rotation. +# - Argument +shift_size+ as a positive integer: +# the maximum size (in bytes) of each log file; +# defaults to 1048576 (1 megabyte). +# +# Examples: +# +# logger = Logger.new('t.log', 3) # Three 1-megabyte files. +# logger = Logger.new('t.log', 5, 10485760) # Five 10-megabyte files. +# +# For these examples, suppose: +# +# logger = Logger.new('t.log', 3) +# +# Logging begins in the new log file, +t.log+; +# the log file is "full" and ready for rotation +# when a new entry would cause its size to exceed +shift_size+. +# +# The first time +t.log+ is full: +# +# - +t.log+ is closed and renamed to +t.log.0+. +# - A new file +t.log+ is opened. +# +# The second time +t.log+ is full: +# +# - +t.log.0 is renamed as +t.log.1+. +# - +t.log+ is closed and renamed to +t.log.0+. +# - A new file +t.log+ is opened. +# +# Each subsequent time that +t.log+ is full, +# the log files are rotated: +# +# - +t.log.1+ is removed. +# - +t.log.0 is renamed as +t.log.1+. +# - +t.log+ is closed and renamed to +t.log.0+. +# - A new file +t.log+ is opened. +# +# === Periodic Rotation +# +# For periodic rotation, call Logger.new with: +# +# - Argument +logdev+ as a file path. +# - Argument +shift_age+ as a string period indicator. +# +# Examples: +# +# logger = Logger.new('t.log', 'daily') # Rotate log files daily. +# logger = Logger.new('t.log', 'weekly') # Rotate log files weekly. +# logger = Logger.new('t.log', 'monthly') # Rotate log files monthly. +# +# Example: +# +# logger = Logger.new('t.log', 'daily') +# +# When the given period expires: +# +# - The base log file, +t.log+ is closed and renamed +# with a date-based suffix such as +t.log.20220509+. +# - A new log file +t.log+ is opened. +# - Nothing is removed. +# +# The default format for the suffix is '%Y%m%d', +# which produces a suffix similar to the one above. +# You can set a different format using create-time option +# +shift_period_suffix+; +# see details and suggestions at +# {Time#strftime}[https://docs.ruby-lang.org/en/master/Time.html#method-i-strftime]. +# +# source://logger//lib/logger/version.rb#3 +class Logger + include ::Logger::Severity + + # :call-seq: + # Logger.new(logdev, shift_age = 0, shift_size = 1048576, **options) + # + # With the single argument +logdev+, + # returns a new logger with all default options: + # + # Logger.new('t.log') # => # + # + # Argument +logdev+ must be one of: + # + # - A string filepath: entries are to be written + # to the file at that path; if the file at that path exists, + # new entries are appended. + # - An IO stream (typically +$stdout+, +$stderr+. or an open file): + # entries are to be written to the given stream. + # - +nil+ or +File::NULL+: no entries are to be written. + # + # Examples: + # + # Logger.new('t.log') + # Logger.new($stdout) + # + # The keyword options are: + # + # - +level+: sets the log level; default value is Logger::DEBUG. + # See {Log Level}[rdoc-ref:Logger@Log+Level]: + # + # Logger.new('t.log', level: Logger::ERROR) + # + # - +progname+: sets the default program name; default is +nil+. + # See {Program Name}[rdoc-ref:Logger@Program+Name]: + # + # Logger.new('t.log', progname: 'mung') + # + # - +formatter+: sets the entry formatter; default is +nil+. + # See {formatter=}[Logger.html#attribute-i-formatter]. + # - +datetime_format+: sets the format for entry timestamp; + # default is +nil+. + # See #datetime_format=. + # - +binmode+: sets whether the logger writes in binary mode; + # default is +false+. + # - +shift_period_suffix+: sets the format for the filename suffix + # for periodic log file rotation; default is '%Y%m%d'. + # See {Periodic Rotation}[rdoc-ref:Logger@Periodic+Rotation]. + # - +reraise_write_errors+: An array of exception classes, which will + # be reraised if there is an error when writing to the log device. + # The default is to swallow all exceptions raised. + # + # @return [Logger] a new instance of Logger + # + # source://logger//lib/logger.rb#581 + def initialize(logdev, shift_age = T.unsafe(nil), shift_size = T.unsafe(nil), level: T.unsafe(nil), progname: T.unsafe(nil), formatter: T.unsafe(nil), datetime_format: T.unsafe(nil), binmode: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), reraise_write_errors: T.unsafe(nil)); end + + # Writes the given +msg+ to the log with no formatting; + # returns the number of characters written, + # or +nil+ if no log device exists: + # + # logger = Logger.new($stdout) + # logger << 'My message.' # => 10 + # + # Output: + # + # My message. + # + # source://logger//lib/logger.rb#689 + def <<(msg); end + + # Creates a log entry, which may or may not be written to the log, + # depending on the entry's severity and on the log level. + # See {Log Level}[rdoc-ref:Logger@Log+Level] + # and {Entries}[rdoc-ref:Logger@Entries] for details. + # + # Examples: + # + # logger = Logger.new($stdout, progname: 'mung') + # logger.add(Logger::INFO) + # logger.add(Logger::ERROR, 'No good') + # logger.add(Logger::ERROR, 'No good', 'gnum') + # + # Output: + # + # I, [2022-05-12T16:25:31.469726 #36328] INFO -- mung: mung + # E, [2022-05-12T16:25:55.349414 #36328] ERROR -- mung: No good + # E, [2022-05-12T16:26:35.841134 #36328] ERROR -- gnum: No good + # + # These convenience methods have implicit severity: + # + # - #debug. + # - #info. + # - #warn. + # - #error. + # - #fatal. + # - #unknown. + # + # source://logger//lib/logger.rb#656 + def add(severity, message = T.unsafe(nil), progname = T.unsafe(nil)); end + + # Closes the logger; returns +nil+: + # + # logger = Logger.new('t.log') + # logger.close # => nil + # logger.info('foo') # Prints "log writing failed. closed stream" + # + # Related: Logger#reopen. + # + # source://logger//lib/logger.rb#736 + def close; end + + # Returns the date-time format; see #datetime_format=. + # + # source://logger//lib/logger.rb#438 + def datetime_format; end + + # Sets the date-time format. + # + # Argument +datetime_format+ should be either of these: + # + # - A string suitable for use as a format for method + # {Time#strftime}[https://docs.ruby-lang.org/en/master/Time.html#method-i-strftime]. + # - +nil+: the logger uses '%Y-%m-%dT%H:%M:%S.%6N'. + # + # source://logger//lib/logger.rb#432 + def datetime_format=(datetime_format); end + + # Equivalent to calling #add with severity Logger::DEBUG. + # + # source://logger//lib/logger.rb#695 + def debug(progname = T.unsafe(nil), &block); end + + # Sets the log level to Logger::DEBUG. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # source://logger//lib/logger.rb#487 + def debug!; end + + # Returns +true+ if the log level allows entries with severity + # Logger::DEBUG to be written, +false+ otherwise. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # @return [Boolean] + # + # source://logger//lib/logger.rb#482 + def debug?; end + + # Equivalent to calling #add with severity Logger::ERROR. + # + # source://logger//lib/logger.rb#713 + def error(progname = T.unsafe(nil), &block); end + + # Sets the log level to Logger::ERROR. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # source://logger//lib/logger.rb#520 + def error!; end + + # Returns +true+ if the log level allows entries with severity + # Logger::ERROR to be written, +false+ otherwise. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # @return [Boolean] + # + # source://logger//lib/logger.rb#515 + def error?; end + + # Equivalent to calling #add with severity Logger::FATAL. + # + # source://logger//lib/logger.rb#719 + def fatal(progname = T.unsafe(nil), &block); end + + # Sets the log level to Logger::FATAL. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # source://logger//lib/logger.rb#531 + def fatal!; end + + # Returns +true+ if the log level allows entries with severity + # Logger::FATAL to be written, +false+ otherwise. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # @return [Boolean] + # + # source://logger//lib/logger.rb#526 + def fatal?; end + + # Sets or retrieves the logger entry formatter proc. + # + # When +formatter+ is +nil+, the logger uses Logger::Formatter. + # + # When +formatter+ is a proc, a new entry is formatted by the proc, + # which is called with four arguments: + # + # - +severity+: The severity of the entry. + # - +time+: A Time object representing the entry's timestamp. + # - +progname+: The program name for the entry. + # - +msg+: The message for the entry (string or string-convertible object). + # + # The proc should return a string containing the formatted entry. + # + # This custom formatter uses + # {String#dump}[https://docs.ruby-lang.org/en/master/String.html#method-i-dump] + # to escape the message string: + # + # logger = Logger.new($stdout, progname: 'mung') + # original_formatter = logger.formatter || Logger::Formatter.new + # logger.formatter = proc { |severity, time, progname, msg| + # original_formatter.call(severity, time, progname, msg.dump) + # } + # logger.add(Logger::INFO, "hello \n ''") + # logger.add(Logger::INFO, "\f\x00\xff\\\"") + # + # Output: + # + # I, [2022-05-13T13:16:29.637488 #8492] INFO -- mung: "hello \n ''" + # I, [2022-05-13T13:16:29.637610 #8492] INFO -- mung: "\f\x00\xFF\\\"" + # + # source://logger//lib/logger.rb#473 + def formatter; end + + # Sets or retrieves the logger entry formatter proc. + # + # When +formatter+ is +nil+, the logger uses Logger::Formatter. + # + # When +formatter+ is a proc, a new entry is formatted by the proc, + # which is called with four arguments: + # + # - +severity+: The severity of the entry. + # - +time+: A Time object representing the entry's timestamp. + # - +progname+: The program name for the entry. + # - +msg+: The message for the entry (string or string-convertible object). + # + # The proc should return a string containing the formatted entry. + # + # This custom formatter uses + # {String#dump}[https://docs.ruby-lang.org/en/master/String.html#method-i-dump] + # to escape the message string: + # + # logger = Logger.new($stdout, progname: 'mung') + # original_formatter = logger.formatter || Logger::Formatter.new + # logger.formatter = proc { |severity, time, progname, msg| + # original_formatter.call(severity, time, progname, msg.dump) + # } + # logger.add(Logger::INFO, "hello \n ''") + # logger.add(Logger::INFO, "\f\x00\xff\\\"") + # + # Output: + # + # I, [2022-05-13T13:16:29.637488 #8492] INFO -- mung: "hello \n ''" + # I, [2022-05-13T13:16:29.637610 #8492] INFO -- mung: "\f\x00\xFF\\\"" + # + # source://logger//lib/logger.rb#473 + def formatter=(_arg0); end + + # Equivalent to calling #add with severity Logger::INFO. + # + # source://logger//lib/logger.rb#701 + def info(progname = T.unsafe(nil), &block); end + + # Sets the log level to Logger::INFO. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # source://logger//lib/logger.rb#498 + def info!; end + + # Returns +true+ if the log level allows entries with severity + # Logger::INFO to be written, +false+ otherwise. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # @return [Boolean] + # + # source://logger//lib/logger.rb#493 + def info?; end + + # Logging severity threshold (e.g. Logger::INFO). + # + # source://logger//lib/logger.rb#383 + def level; end + + # Sets the log level; returns +severity+. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # Argument +severity+ may be an integer, a string, or a symbol: + # + # logger.level = Logger::ERROR # => 3 + # logger.level = 3 # => 3 + # logger.level = 'error' # => "error" + # logger.level = :error # => :error + # + # Logger#sev_threshold= is an alias for Logger#level=. + # + # source://logger//lib/logger.rb#399 + def level=(severity); end + + # Creates a log entry, which may or may not be written to the log, + # depending on the entry's severity and on the log level. + # See {Log Level}[rdoc-ref:Logger@Log+Level] + # and {Entries}[rdoc-ref:Logger@Entries] for details. + # + # Examples: + # + # logger = Logger.new($stdout, progname: 'mung') + # logger.add(Logger::INFO) + # logger.add(Logger::ERROR, 'No good') + # logger.add(Logger::ERROR, 'No good', 'gnum') + # + # Output: + # + # I, [2022-05-12T16:25:31.469726 #36328] INFO -- mung: mung + # E, [2022-05-12T16:25:55.349414 #36328] ERROR -- mung: No good + # E, [2022-05-12T16:26:35.841134 #36328] ERROR -- gnum: No good + # + # These convenience methods have implicit severity: + # + # - #debug. + # - #info. + # - #warn. + # - #error. + # - #fatal. + # - #unknown. + # + # source://logger//lib/logger.rb#656 + def log(severity, message = T.unsafe(nil), progname = T.unsafe(nil)); end + + # Program name to include in log messages. + # + # source://logger//lib/logger.rb#422 + def progname; end + + # Program name to include in log messages. + # + # source://logger//lib/logger.rb#422 + def progname=(_arg0); end + + # Sets the logger's output stream: + # + # - If +logdev+ is +nil+, reopens the current output stream. + # - If +logdev+ is a filepath, opens the indicated file for append. + # - If +logdev+ is an IO stream + # (usually $stdout, $stderr, or an open File object), + # opens the stream for append. + # + # Example: + # + # logger = Logger.new('t.log') + # logger.add(Logger::ERROR, 'one') + # logger.close + # logger.add(Logger::ERROR, 'two') # Prints 'log writing failed. closed stream' + # logger.reopen + # logger.add(Logger::ERROR, 'three') + # logger.close + # File.readlines('t.log') + # # => + # # ["# Logfile created on 2022-05-12 14:21:19 -0500 by logger.rb/v1.5.0\n", + # # "E, [2022-05-12T14:21:27.596726 #22428] ERROR -- : one\n", + # # "E, [2022-05-12T14:23:05.847241 #22428] ERROR -- : three\n"] + # + # source://logger//lib/logger.rb#624 + def reopen(logdev = T.unsafe(nil)); end + + # Logging severity threshold (e.g. Logger::INFO). + # + # source://logger//lib/logger.rb#383 + def sev_threshold; end + + # Sets the log level; returns +severity+. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # Argument +severity+ may be an integer, a string, or a symbol: + # + # logger.level = Logger::ERROR # => 3 + # logger.level = 3 # => 3 + # logger.level = 'error' # => "error" + # logger.level = :error # => :error + # + # Logger#sev_threshold= is an alias for Logger#level=. + # + # source://logger//lib/logger.rb#399 + def sev_threshold=(severity); end + + # Equivalent to calling #add with severity Logger::UNKNOWN. + # + # source://logger//lib/logger.rb#725 + def unknown(progname = T.unsafe(nil), &block); end + + # Equivalent to calling #add with severity Logger::WARN. + # + # source://logger//lib/logger.rb#707 + def warn(progname = T.unsafe(nil), &block); end + + # Sets the log level to Logger::WARN. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # source://logger//lib/logger.rb#509 + def warn!; end + + # Returns +true+ if the log level allows entries with severity + # Logger::WARN to be written, +false+ otherwise. + # See {Log Level}[rdoc-ref:Logger@Log+Level]. + # + # @return [Boolean] + # + # source://logger//lib/logger.rb#504 + def warn?; end + + # Adjust the log level during the block execution for the current Fiber only + # + # logger.with_level(:debug) do + # logger.debug { "Hello" } + # end + # + # source://logger//lib/logger.rb#408 + def with_level(severity); end + + private + + # source://logger//lib/logger.rb#754 + def format_message(severity, datetime, progname, msg); end + + # source://logger//lib/logger.rb#745 + def format_severity(severity); end + + # Guarantee the existence of this ivar even when subclasses don't call the superclass constructor. + # + # source://logger//lib/logger.rb#750 + def level_override; end +end + +# Default formatter for log messages. +# +# source://logger//lib/logger/formatter.rb#5 +class Logger::Formatter + # @return [Formatter] a new instance of Formatter + # + # source://logger//lib/logger/formatter.rb#11 + def initialize; end + + # source://logger//lib/logger/formatter.rb#15 + def call(severity, time, progname, msg); end + + # Returns the value of attribute datetime_format. + # + # source://logger//lib/logger/formatter.rb#9 + def datetime_format; end + + # Sets the attribute datetime_format + # + # @param value the value to set the attribute datetime_format to. + # + # source://logger//lib/logger/formatter.rb#9 + def datetime_format=(_arg0); end + + private + + # source://logger//lib/logger/formatter.rb#21 + def format_datetime(time); end + + # source://logger//lib/logger/formatter.rb#25 + def msg2str(msg); end +end + +# source://logger//lib/logger/formatter.rb#7 +Logger::Formatter::DatetimeFormat = T.let(T.unsafe(nil), String) + +# source://logger//lib/logger/formatter.rb#6 +Logger::Formatter::Format = T.let(T.unsafe(nil), String) + +# Device used for logging messages. +# +# source://logger//lib/logger/log_device.rb#7 +class Logger::LogDevice + include ::Logger::Period + include ::MonitorMixin + + # @return [LogDevice] a new instance of LogDevice + # + # source://logger//lib/logger/log_device.rb#14 + def initialize(log = T.unsafe(nil), shift_age: T.unsafe(nil), shift_size: T.unsafe(nil), shift_period_suffix: T.unsafe(nil), binmode: T.unsafe(nil), reraise_write_errors: T.unsafe(nil)); end + + # source://logger//lib/logger/log_device.rb#59 + def close; end + + # Returns the value of attribute dev. + # + # source://logger//lib/logger/log_device.rb#10 + def dev; end + + # Returns the value of attribute filename. + # + # source://logger//lib/logger/log_device.rb#11 + def filename; end + + # source://logger//lib/logger/log_device.rb#69 + def reopen(log = T.unsafe(nil)); end + + # source://logger//lib/logger/log_device.rb#32 + def write(message); end + + private + + # source://logger//lib/logger/log_device.rb#126 + def add_log_header(file); end + + # source://logger//lib/logger/log_device.rb#132 + def check_shift_log; end + + # source://logger//lib/logger/log_device.rb#110 + def create_logfile(filename); end + + # source://logger//lib/logger/log_device.rb#152 + def lock_shift_log; end + + # source://logger//lib/logger/log_device.rb#102 + def open_logfile(filename); end + + # source://logger//lib/logger/log_device.rb#86 + def set_dev(log); end + + # source://logger//lib/logger/log_device.rb#183 + def shift_log_age; end + + # source://logger//lib/logger/log_device.rb#195 + def shift_log_period(period_end); end +end + +# source://logger//lib/logger/period.rb#4 +module Logger::Period + private + + # source://logger//lib/logger/period.rb#9 + def next_rotate_time(now, shift_age); end + + # source://logger//lib/logger/period.rb#31 + def previous_period_end(now, shift_age); end + + class << self + # source://logger//lib/logger/period.rb#9 + def next_rotate_time(now, shift_age); end + + # source://logger//lib/logger/period.rb#31 + def previous_period_end(now, shift_age); end + end +end + +# source://logger//lib/logger/period.rb#7 +Logger::Period::SiD = T.let(T.unsafe(nil), Integer) + +# \Severity label for logging (max 5 chars). +# +# source://logger//lib/logger.rb#743 +Logger::SEV_LABEL = T.let(T.unsafe(nil), Array) + +# Logging severity. +# +# source://logger//lib/logger/severity.rb#5 +module Logger::Severity + class << self + # source://logger//lib/logger/severity.rb#29 + def coerce(severity); end + end +end + +# source://logger//lib/logger/severity.rb#19 +Logger::Severity::LEVELS = T.let(T.unsafe(nil), Hash) diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/gems/minitest@5.25.2.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/minitest@5.25.2.rbi new file mode 100644 index 0000000..429fb36 --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/minitest@5.25.2.rbi @@ -0,0 +1,1547 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `minitest` gem. +# Please instead update this file by running `bin/tapioca gem minitest`. + + +# The top-level namespace for Minitest. Also the location of the main +# runtime. See +Minitest.run+ for more information. +# +# source://minitest//lib/minitest/parallel.rb#1 +module Minitest + class << self + # Internal run method. Responsible for telling all Runnable + # sub-classes to run. + # + # source://minitest//lib/minitest.rb#323 + def __run(reporter, options); end + + # A simple hook allowing you to run a block of code after everything + # is done running. Eg: + # + # Minitest.after_run { p $debugging_info } + # + # source://minitest//lib/minitest.rb#97 + def after_run(&block); end + + # source://minitest//lib/minitest.rb#20 + def allow_fork; end + + # source://minitest//lib/minitest.rb#20 + def allow_fork=(_arg0); end + + # Registers Minitest to run at process exit + # + # source://minitest//lib/minitest.rb#70 + def autorun; end + + # source://minitest//lib/minitest.rb#20 + def backtrace_filter; end + + # source://minitest//lib/minitest.rb#20 + def backtrace_filter=(_arg0); end + + # source://minitest//lib/minitest.rb#19 + def cattr_accessor(name); end + + # source://minitest//lib/minitest.rb#1216 + def clock_time; end + + # source://minitest//lib/minitest.rb#303 + def empty_run!(options); end + + # source://minitest//lib/minitest.rb#20 + def extensions; end + + # source://minitest//lib/minitest.rb#20 + def extensions=(_arg0); end + + # source://minitest//lib/minitest.rb#336 + def filter_backtrace(bt); end + + # source://minitest//lib/minitest.rb#20 + def info_signal; end + + # source://minitest//lib/minitest.rb#20 + def info_signal=(_arg0); end + + # source://minitest//lib/minitest.rb#125 + def init_plugins(options); end + + # source://minitest//lib/minitest.rb#109 + def load_plugins; end + + # source://minitest//lib/minitest.rb#20 + def parallel_executor; end + + # source://minitest//lib/minitest.rb#20 + def parallel_executor=(_arg0); end + + # source://minitest//lib/minitest.rb#143 + def process_args(args = T.unsafe(nil)); end + + # Register a plugin to be used. Does NOT require / load it. + # + # source://minitest//lib/minitest.rb#104 + def register_plugin(name_or_mod); end + + # source://minitest//lib/minitest.rb#20 + def reporter; end + + # source://minitest//lib/minitest.rb#20 + def reporter=(_arg0); end + + # This is the top-level run method. Everything starts from here. It + # tells each Runnable sub-class to run, and each of those are + # responsible for doing whatever they do. + # + # The overall structure of a run looks like this: + # + # Minitest.autorun + # Minitest.run(args) + # Minitest.load_plugins + # Minitest.process_args + # Minitest.init_plugins + # Minitest.__run(reporter, options) + # Runnable.runnables.each + # runnable_klass.run(reporter, options) + # self.runnable_methods.each + # self.run_one_method(self, runnable_method, reporter) + # Minitest.run_one_method(klass, runnable_method) + # klass.new(runnable_method).run + # + # source://minitest//lib/minitest.rb#269 + def run(args = T.unsafe(nil)); end + + # source://minitest//lib/minitest.rb#1207 + def run_one_method(klass, method_name); end + + # source://minitest//lib/minitest.rb#20 + def seed; end + + # source://minitest//lib/minitest.rb#20 + def seed=(_arg0); end + end +end + +# Defines the API for Reporters. Subclass this and override whatever +# you want. Go nuts. +# +# source://minitest//lib/minitest.rb#687 +class Minitest::AbstractReporter + # @return [AbstractReporter] a new instance of AbstractReporter + # + # source://minitest//lib/minitest.rb#689 + def initialize; end + + # Did this run pass? + # + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#724 + def passed?; end + + # About to start running a test. This allows a reporter to show + # that it is starting or that we are in the middle of a test run. + # + # source://minitest//lib/minitest.rb#703 + def prerecord(klass, name); end + + # Output and record the result of the test. Call + # {result#result_code}[rdoc-ref:Runnable#result_code] to get the + # result character string. Stores the result of the run if the run + # did not pass. + # + # source://minitest//lib/minitest.rb#712 + def record(result); end + + # Outputs the summary of the run. + # + # source://minitest//lib/minitest.rb#718 + def report; end + + # Starts reporting on the run. + # + # source://minitest//lib/minitest.rb#696 + def start; end + + # source://minitest//lib/minitest.rb#728 + def synchronize(&block); end +end + +# Represents run failures. +# +# source://minitest//lib/minitest.rb#1020 +class Minitest::Assertion < ::Exception + # source://minitest//lib/minitest.rb#1023 + def error; end + + # Where was this run before an assertion was raised? + # + # source://minitest//lib/minitest.rb#1030 + def location; end + + # source://minitest//lib/minitest.rb#1038 + def result_code; end + + # source://minitest//lib/minitest.rb#1042 + def result_label; end +end + +# source://minitest//lib/minitest.rb#1021 +Minitest::Assertion::RE = T.let(T.unsafe(nil), Regexp) + +# Minitest Assertions. All assertion methods accept a +msg+ which is +# printed if the assertion fails. +# +# Protocol: Nearly everything here boils up to +assert+, which +# expects to be able to increment an instance accessor named +# +assertions+. This is not provided by Assertions and must be +# provided by the thing including Assertions. See Minitest::Runnable +# for an example. +# +# source://minitest//lib/minitest/assertions.rb#16 +module Minitest::Assertions + # source://minitest//lib/minitest/assertions.rb#181 + def _synchronize; end + + # source://minitest//lib/minitest/assertions.rb#194 + def _where; end + + # Fails unless +test+ is truthy. + # + # source://minitest//lib/minitest/assertions.rb#171 + def assert(test, msg = T.unsafe(nil)); end + + # Fails unless +obj+ is empty. + # + # source://minitest//lib/minitest/assertions.rb#188 + def assert_empty(obj, msg = T.unsafe(nil)); end + + # Fails unless exp == act printing the difference between + # the two, if possible. + # + # If there is no visible difference but the assertion fails, you + # should suspect that your #== is buggy, or your inspect output is + # missing crucial details. For nicer structural diffing, set + # Minitest::Test.make_my_diffs_pretty! + # + # For floats use assert_in_delta. + # + # See also: Minitest::Assertions.diff + # + # source://minitest//lib/minitest/assertions.rb#214 + def assert_equal(exp, act, msg = T.unsafe(nil)); end + + # For comparing Floats. Fails unless +exp+ and +act+ are within +delta+ + # of each other. + # + # assert_in_delta Math::PI, (22.0 / 7.0), 0.01 + # + # source://minitest//lib/minitest/assertions.rb#235 + def assert_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end + + # For comparing Floats. Fails unless +exp+ and +act+ have a relative + # error less than +epsilon+. + # + # source://minitest//lib/minitest/assertions.rb#247 + def assert_in_epsilon(exp, act, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end + + # Fails unless +collection+ includes +obj+. + # + # source://minitest//lib/minitest/assertions.rb#254 + def assert_includes(collection, obj, msg = T.unsafe(nil)); end + + # Fails unless +obj+ is an instance of +cls+. + # + # source://minitest//lib/minitest/assertions.rb#265 + def assert_instance_of(cls, obj, msg = T.unsafe(nil)); end + + # Fails unless +obj+ is a kind of +cls+. + # + # source://minitest//lib/minitest/assertions.rb#276 + def assert_kind_of(cls, obj, msg = T.unsafe(nil)); end + + # Fails unless +matcher+ =~ +obj+. + # + # source://minitest//lib/minitest/assertions.rb#287 + def assert_match(matcher, obj, msg = T.unsafe(nil)); end + + # Fails unless +obj+ is nil + # + # source://minitest//lib/minitest/assertions.rb#299 + def assert_nil(obj, msg = T.unsafe(nil)); end + + # For testing with binary operators. Eg: + # + # assert_operator 5, :<=, 4 + # + # source://minitest//lib/minitest/assertions.rb#309 + def assert_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end + + # Fails if stdout or stderr do not output the expected results. + # Pass in nil if you don't care about that streams output. Pass in + # "" if you require it to be silent. Pass in a regexp if you want + # to pattern match. + # + # assert_output(/hey/) { method_with_output } + # + # NOTE: this uses #capture_io, not #capture_subprocess_io. + # + # See also: #assert_silent + # + # source://minitest//lib/minitest/assertions.rb#327 + def assert_output(stdout = T.unsafe(nil), stderr = T.unsafe(nil)); end + + # Fails unless +path+ exists. + # + # source://minitest//lib/minitest/assertions.rb#351 + def assert_path_exists(path, msg = T.unsafe(nil)); end + + # For testing with pattern matching (only supported with Ruby 3.0 and later) + # + # # pass + # assert_pattern { [1,2,3] => [Integer, Integer, Integer] } + # + # # fail "length mismatch (given 3, expected 1)" + # assert_pattern { [1,2,3] => [Integer] } + # + # The bare => pattern will raise a NoMatchingPatternError on failure, which would + # normally be counted as a test error. This assertion rescues NoMatchingPatternError and + # generates a test failure. Any other exception will be raised as normal and generate a test + # error. + # + # @raise [NotImplementedError] + # + # source://minitest//lib/minitest/assertions.rb#370 + def assert_pattern; end + + # For testing with predicates. Eg: + # + # assert_predicate str, :empty? + # + # This is really meant for specs and is front-ended by assert_operator: + # + # str.must_be :empty? + # + # source://minitest//lib/minitest/assertions.rb#391 + def assert_predicate(o1, op, msg = T.unsafe(nil)); end + + # Fails unless the block raises one of +exp+. Returns the + # exception matched so you can check the message, attributes, etc. + # + # +exp+ takes an optional message on the end to help explain + # failures and defaults to StandardError if no exception class is + # passed. Eg: + # + # assert_raises(CustomError) { method_with_custom_error } + # + # With custom error message: + # + # assert_raises(CustomError, 'This should have raised CustomError') { method_with_custom_error } + # + # Using the returned object: + # + # error = assert_raises(CustomError) do + # raise CustomError, 'This is really bad' + # end + # + # assert_equal 'This is really bad', error.message + # + # source://minitest//lib/minitest/assertions.rb#418 + def assert_raises(*exp); end + + # Fails unless +obj+ responds to +meth+. + # include_all defaults to false to match Object#respond_to? + # + # source://minitest//lib/minitest/assertions.rb#450 + def assert_respond_to(obj, meth, msg = T.unsafe(nil), include_all: T.unsafe(nil)); end + + # Fails unless +exp+ and +act+ are #equal? + # + # source://minitest//lib/minitest/assertions.rb#460 + def assert_same(exp, act, msg = T.unsafe(nil)); end + + # +send_ary+ is a receiver, message and arguments. + # + # Fails unless the call returns a true value + # + # source://minitest//lib/minitest/assertions.rb#473 + def assert_send(send_ary, m = T.unsafe(nil)); end + + # Fails if the block outputs anything to stderr or stdout. + # + # See also: #assert_output + # + # source://minitest//lib/minitest/assertions.rb#488 + def assert_silent; end + + # Fails unless the block throws +sym+ + # + # source://minitest//lib/minitest/assertions.rb#497 + def assert_throws(sym, msg = T.unsafe(nil)); end + + # Captures $stdout and $stderr into strings: + # + # out, err = capture_io do + # puts "Some info" + # warn "You did a bad thing" + # end + # + # assert_match %r%info%, out + # assert_match %r%bad%, err + # + # NOTE: For efficiency, this method uses StringIO and does not + # capture IO for subprocesses. Use #capture_subprocess_io for + # that. + # + # source://minitest//lib/minitest/assertions.rb#538 + def capture_io; end + + # Captures $stdout and $stderr into strings, using Tempfile to + # ensure that subprocess IO is captured as well. + # + # out, err = capture_subprocess_io do + # system "echo Some info" + # system "echo You did a bad thing 1>&2" + # end + # + # assert_match %r%info%, out + # assert_match %r%bad%, err + # + # NOTE: This method is approximately 10x slower than #capture_io so + # only use it when you need to test the output of a subprocess. + # + # source://minitest//lib/minitest/assertions.rb#571 + def capture_subprocess_io; end + + # Returns a diff between +exp+ and +act+. If there is no known + # diff command or if it doesn't make sense to diff the output + # (single line, short output), then it simply returns a basic + # comparison between the two. + # + # See +things_to_diff+ for more info. + # + # source://minitest//lib/minitest/assertions.rb#57 + def diff(exp, act); end + + # Returns details for exception +e+ + # + # source://minitest//lib/minitest/assertions.rb#603 + def exception_details(e, msg); end + + # Fails after a given date (in the local time zone). This allows + # you to put time-bombs in your tests if you need to keep + # something around until a later date lest you forget about it. + # + # source://minitest//lib/minitest/assertions.rb#619 + def fail_after(y, m, d, msg); end + + # Fails with +msg+. + # + # source://minitest//lib/minitest/assertions.rb#626 + def flunk(msg = T.unsafe(nil)); end + + # Returns a proc that will output +msg+ along with the default message. + # + # source://minitest//lib/minitest/assertions.rb#634 + def message(msg = T.unsafe(nil), ending = T.unsafe(nil), &default); end + + # This returns a human-readable version of +obj+. By default + # #inspect is called. You can override this to use #pretty_inspect + # if you want. + # + # See Minitest::Test.make_my_diffs_pretty! + # + # source://minitest//lib/minitest/assertions.rb#127 + def mu_pp(obj); end + + # This returns a diff-able more human-readable version of +obj+. + # This differs from the regular mu_pp because it expands escaped + # newlines and makes hex-values (like object_ids) generic. This + # uses mu_pp to do the first pass and then cleans it up. + # + # source://minitest//lib/minitest/assertions.rb#145 + def mu_pp_for_diff(obj); end + + # used for counting assertions + # + # source://minitest//lib/minitest/assertions.rb#645 + def pass(_msg = T.unsafe(nil)); end + + # Fails if +test+ is truthy. + # + # source://minitest//lib/minitest/assertions.rb#652 + def refute(test, msg = T.unsafe(nil)); end + + # Fails if +obj+ is empty. + # + # source://minitest//lib/minitest/assertions.rb#660 + def refute_empty(obj, msg = T.unsafe(nil)); end + + # Fails if exp == act. + # + # For floats use refute_in_delta. + # + # source://minitest//lib/minitest/assertions.rb#671 + def refute_equal(exp, act, msg = T.unsafe(nil)); end + + # For comparing Floats. Fails if +exp+ is within +delta+ of +act+. + # + # refute_in_delta Math::PI, (22.0 / 7.0) + # + # source://minitest//lib/minitest/assertions.rb#683 + def refute_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end + + # For comparing Floats. Fails if +exp+ and +act+ have a relative error + # less than +epsilon+. + # + # source://minitest//lib/minitest/assertions.rb#695 + def refute_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end + + # Fails if +collection+ includes +obj+. + # + # source://minitest//lib/minitest/assertions.rb#702 + def refute_includes(collection, obj, msg = T.unsafe(nil)); end + + # Fails if +obj+ is an instance of +cls+. + # + # source://minitest//lib/minitest/assertions.rb#713 + def refute_instance_of(cls, obj, msg = T.unsafe(nil)); end + + # Fails if +obj+ is a kind of +cls+. + # + # source://minitest//lib/minitest/assertions.rb#723 + def refute_kind_of(cls, obj, msg = T.unsafe(nil)); end + + # Fails if +matcher+ =~ +obj+. + # + # source://minitest//lib/minitest/assertions.rb#731 + def refute_match(matcher, obj, msg = T.unsafe(nil)); end + + # Fails if +obj+ is nil. + # + # source://minitest//lib/minitest/assertions.rb#741 + def refute_nil(obj, msg = T.unsafe(nil)); end + + # Fails if +o1+ is not +op+ +o2+. Eg: + # + # refute_operator 1, :>, 2 #=> pass + # refute_operator 1, :<, 2 #=> fail + # + # source://minitest//lib/minitest/assertions.rb#776 + def refute_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end + + # Fails if +path+ exists. + # + # source://minitest//lib/minitest/assertions.rb#785 + def refute_path_exists(path, msg = T.unsafe(nil)); end + + # For testing with pattern matching (only supported with Ruby 3.0 and later) + # + # # pass + # refute_pattern { [1,2,3] => [String] } + # + # # fail "NoMatchingPatternError expected, but nothing was raised." + # refute_pattern { [1,2,3] => [Integer, Integer, Integer] } + # + # This assertion expects a NoMatchingPatternError exception, and will fail if none is raised. Any + # other exceptions will be raised as normal and generate a test error. + # + # @raise [NotImplementedError] + # + # source://minitest//lib/minitest/assertions.rb#758 + def refute_pattern; end + + # For testing with predicates. + # + # refute_predicate str, :empty? + # + # This is really meant for specs and is front-ended by refute_operator: + # + # str.wont_be :empty? + # + # source://minitest//lib/minitest/assertions.rb#799 + def refute_predicate(o1, op, msg = T.unsafe(nil)); end + + # Fails if +obj+ responds to the message +meth+. + # include_all defaults to false to match Object#respond_to? + # + # source://minitest//lib/minitest/assertions.rb#808 + def refute_respond_to(obj, meth, msg = T.unsafe(nil), include_all: T.unsafe(nil)); end + + # Fails if +exp+ is the same (by object identity) as +act+. + # + # source://minitest//lib/minitest/assertions.rb#817 + def refute_same(exp, act, msg = T.unsafe(nil)); end + + # Skips the current run. If run in verbose-mode, the skipped run + # gets listed at the end of the run but doesn't cause a failure + # exit code. + # + # @raise [Minitest::Skip] + # + # source://minitest//lib/minitest/assertions.rb#830 + def skip(msg = T.unsafe(nil), _ignored = T.unsafe(nil)); end + + # Skips the current run until a given date (in the local time + # zone). This allows you to put some fixes on hold until a later + # date, but still holds you accountable and prevents you from + # forgetting it. + # + # source://minitest//lib/minitest/assertions.rb#842 + def skip_until(y, m, d, msg); end + + # Was this testcase skipped? Meant for #teardown. + # + # @return [Boolean] + # + # source://minitest//lib/minitest/assertions.rb#851 + def skipped?; end + + # Returns things to diff [expect, butwas], or [nil, nil] if nothing to diff. + # + # Criterion: + # + # 1. Strings include newlines or escaped newlines, but not both. + # 2. or: String lengths are > 30 characters. + # 3. or: Strings are equal to each other (but maybe different encodings?). + # 4. and: we found a diff executable. + # + # source://minitest//lib/minitest/assertions.rb#102 + def things_to_diff(exp, act); end + + class << self + # Returns the diff command to use in #diff. Tries to intelligently + # figure out what diff to use. + # + # source://minitest//lib/minitest/assertions.rb#27 + def diff; end + + # Set the diff command to use in #diff. + # + # source://minitest//lib/minitest/assertions.rb#45 + def diff=(o); end + end +end + +# source://minitest//lib/minitest/assertions.rb#199 +Minitest::Assertions::E = T.let(T.unsafe(nil), String) + +# source://minitest//lib/minitest/assertions.rb#17 +Minitest::Assertions::UNDEFINED = T.let(T.unsafe(nil), Object) + +# The standard backtrace filter for minitest. +# +# See Minitest.backtrace_filter=. +# +# source://minitest//lib/minitest.rb#1175 +class Minitest::BacktraceFilter + # @return [BacktraceFilter] a new instance of BacktraceFilter + # + # source://minitest//lib/minitest.rb#1184 + def initialize(regexp = T.unsafe(nil)); end + + # Filter +bt+ to something useful. Returns the whole thing if + # $DEBUG (ruby) or $MT_DEBUG (env). + # + # source://minitest//lib/minitest.rb#1192 + def filter(bt); end + + # The regular expression to use to filter backtraces. Defaults to +MT_RE+. + # + # source://minitest//lib/minitest.rb#1182 + def regexp; end + + # The regular expression to use to filter backtraces. Defaults to +MT_RE+. + # + # source://minitest//lib/minitest.rb#1182 + def regexp=(_arg0); end +end + +# source://minitest//lib/minitest.rb#1177 +Minitest::BacktraceFilter::MT_RE = T.let(T.unsafe(nil), Regexp) + +# Dispatch to multiple reporters as one. +# +# source://minitest//lib/minitest.rb#969 +class Minitest::CompositeReporter < ::Minitest::AbstractReporter + # @return [CompositeReporter] a new instance of CompositeReporter + # + # source://minitest//lib/minitest.rb#975 + def initialize(*reporters); end + + # Add another reporter to the mix. + # + # source://minitest//lib/minitest.rb#987 + def <<(reporter); end + + # source://minitest//lib/minitest.rb#980 + def io; end + + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#991 + def passed?; end + + # source://minitest//lib/minitest.rb#999 + def prerecord(klass, name); end + + # source://minitest//lib/minitest.rb#1006 + def record(result); end + + # source://minitest//lib/minitest.rb#1012 + def report; end + + # The list of reporters to dispatch to. + # + # source://minitest//lib/minitest.rb#973 + def reporters; end + + # The list of reporters to dispatch to. + # + # source://minitest//lib/minitest.rb#973 + def reporters=(_arg0); end + + # source://minitest//lib/minitest.rb#995 + def start; end +end + +# Compresses backtraces. +# +# source://minitest//lib/minitest/compress.rb#5 +module Minitest::Compress + # Takes a backtrace (array of strings) and compresses repeating + # cycles in it to make it more readable. + # + # source://minitest//lib/minitest/compress.rb#11 + def compress(orig); end +end + +# Provides a simple set of guards that you can use in your tests +# to skip execution if it is not applicable. These methods are +# mixed into Test as both instance and class methods so you +# can use them inside or outside of the test methods. +# +# def test_something_for_mri +# skip "bug 1234" if jruby? +# # ... +# end +# +# if windows? then +# # ... lots of test methods ... +# end +# +# source://minitest//lib/minitest.rb#1119 +module Minitest::Guard + # Is this running on jruby? + # + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#1124 + def jruby?(platform = T.unsafe(nil)); end + + # Is this running on maglev? + # + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#1131 + def maglev?(platform = T.unsafe(nil)); end + + # Is this running on mri? + # + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#1141 + def mri?(platform = T.unsafe(nil)); end + + # Is this running on macOS? + # + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#1148 + def osx?(platform = T.unsafe(nil)); end + + # Is this running on rubinius? + # + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#1155 + def rubinius?(platform = T.unsafe(nil)); end + + # Is this running on windows? + # + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#1165 + def windows?(platform = T.unsafe(nil)); end +end + +# source://minitest//lib/minitest/parallel.rb#2 +module Minitest::Parallel; end + +# The engine used to run multiple tests in parallel. +# +# source://minitest//lib/minitest/parallel.rb#7 +class Minitest::Parallel::Executor + # Create a parallel test executor of with +size+ workers. + # + # @return [Executor] a new instance of Executor + # + # source://minitest//lib/minitest/parallel.rb#17 + def initialize(size); end + + # Add a job to the queue + # + # source://minitest//lib/minitest/parallel.rb#43 + def <<(work); end + + # Shuts down the pool of workers by signalling them to quit and + # waiting for them all to finish what they're currently working + # on. + # + # source://minitest//lib/minitest/parallel.rb#50 + def shutdown; end + + # The size of the pool of workers. + # + # source://minitest//lib/minitest/parallel.rb#12 + def size; end + + # Start the executor + # + # source://minitest//lib/minitest/parallel.rb#26 + def start; end +end + +# source://minitest//lib/minitest/parallel.rb#56 +module Minitest::Parallel::Test + # source://minitest//lib/minitest/parallel.rb#57 + def _synchronize; end +end + +# source://minitest//lib/minitest/parallel.rb#59 +module Minitest::Parallel::Test::ClassMethods + # source://minitest//lib/minitest/parallel.rb#60 + def run_one_method(klass, method_name, reporter); end + + # source://minitest//lib/minitest/parallel.rb#64 + def test_order; end +end + +# A very simple reporter that prints the "dots" during the run. +# +# This is added to the top-level CompositeReporter at the start of +# the run. If you want to change the output of minitest via a +# plugin, pull this out of the composite and replace it with your +# own. +# +# source://minitest//lib/minitest.rb#759 +class Minitest::ProgressReporter < ::Minitest::Reporter + # source://minitest//lib/minitest.rb#760 + def prerecord(klass, name); end + + # source://minitest//lib/minitest.rb#767 + def record(result); end +end + +# Shared code for anything that can get passed to a Reporter. See +# Minitest::Test & Minitest::Result. +# +# source://minitest//lib/minitest.rb#581 +module Minitest::Reportable + # @raise [NotImplementedError] + # + # source://minitest//lib/minitest.rb#603 + def class_name; end + + # Did this run error? + # + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#624 + def error?; end + + # The location identifier of this test. Depends on a method + # existing called class_name. + # + # source://minitest//lib/minitest.rb#598 + def location; end + + # Did this run pass? + # + # Note: skipped runs are not considered passing, but they don't + # cause the process to exit non-zero. + # + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#588 + def passed?; end + + # Returns ".", "F", or "E" based on the result of the run. + # + # source://minitest//lib/minitest.rb#610 + def result_code; end + + # Was this run skipped? + # + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#617 + def skipped?; end +end + +# source://minitest//lib/minitest.rb#592 +Minitest::Reportable::BASE_DIR = T.let(T.unsafe(nil), String) + +# source://minitest//lib/minitest.rb#735 +class Minitest::Reporter < ::Minitest::AbstractReporter + # @return [Reporter] a new instance of Reporter + # + # source://minitest//lib/minitest.rb#744 + def initialize(io = T.unsafe(nil), options = T.unsafe(nil)); end + + # The IO used to report. + # + # source://minitest//lib/minitest.rb#737 + def io; end + + # The IO used to report. + # + # source://minitest//lib/minitest.rb#737 + def io=(_arg0); end + + # Command-line options for this run. + # + # source://minitest//lib/minitest.rb#742 + def options; end + + # Command-line options for this run. + # + # source://minitest//lib/minitest.rb#742 + def options=(_arg0); end +end + +# This represents a test result in a clean way that can be +# marshalled over a wire. Tests can do anything they want to the +# test instance and can create conditions that cause Marshal.dump to +# blow up. By using Result.from(a_test) you can be reasonably sure +# that the test result can be marshalled. +# +# source://minitest//lib/minitest.rb#636 +class Minitest::Result < ::Minitest::Runnable + include ::Minitest::Reportable + + # source://minitest//lib/minitest.rb#670 + def class_name; end + + # The class name of the test result. + # + # source://minitest//lib/minitest.rb#645 + def klass; end + + # The class name of the test result. + # + # source://minitest//lib/minitest.rb#645 + def klass=(_arg0); end + + # The location of the test method. + # + # source://minitest//lib/minitest.rb#650 + def source_location; end + + # The location of the test method. + # + # source://minitest//lib/minitest.rb#650 + def source_location=(_arg0); end + + # source://minitest//lib/minitest.rb#674 + def to_s; end + + class << self + # Create a new test result from a Runnable instance. + # + # source://minitest//lib/minitest.rb#655 + def from(runnable); end + end +end + +# re-open +# +# source://minitest//lib/minitest.rb#349 +class Minitest::Runnable + # @return [Runnable] a new instance of Runnable + # + # source://minitest//lib/minitest.rb#512 + def initialize(name); end + + # Number of assertions executed in this run. + # + # source://minitest//lib/minitest.rb#353 + def assertions; end + + # Number of assertions executed in this run. + # + # source://minitest//lib/minitest.rb#353 + def assertions=(_arg0); end + + # source://minitest//lib/minitest.rb#508 + def failure; end + + # An assertion raised during the run, if any. + # + # source://minitest//lib/minitest.rb#358 + def failures; end + + # An assertion raised during the run, if any. + # + # source://minitest//lib/minitest.rb#358 + def failures=(_arg0); end + + # source://minitest//lib/minitest.rb#494 + def marshal_dump; end + + # source://minitest//lib/minitest.rb#504 + def marshal_load(ary); end + + # Metadata you attach to the test results that get sent to the reporter. + # + # Lazily initializes to a hash, to keep memory down. + # + # NOTE: this data *must* be plain (read: marshal-able) data! + # Hashes! Arrays! Strings! + # + # source://minitest//lib/minitest.rb#527 + def metadata; end + + # Sets metadata, mainly used for +Result.from+. + # + # source://minitest//lib/minitest.rb#534 + def metadata=(_arg0); end + + # Returns true if metadata exists. + # + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#539 + def metadata?; end + + # Name of the run. + # + # source://minitest//lib/minitest.rb#376 + def name; end + + # Set the name of the run. + # + # source://minitest//lib/minitest.rb#383 + def name=(o); end + + # Did this run pass? + # + # Note: skipped runs are not considered passing, but they don't + # cause the process to exit non-zero. + # + # @raise [NotImplementedError] + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#556 + def passed?; end + + # Returns a single character string to print based on the result + # of the run. One of ".", "F", + # "E" or "S". + # + # @raise [NotImplementedError] + # + # source://minitest//lib/minitest.rb#565 + def result_code; end + + # Runs a single method. Needs to return self. + # + # @raise [NotImplementedError] + # + # source://minitest//lib/minitest.rb#546 + def run; end + + # Was this run skipped? See #passed? for more information. + # + # @raise [NotImplementedError] + # @return [Boolean] + # + # source://minitest//lib/minitest.rb#572 + def skipped?; end + + # The time it took to run. + # + # source://minitest//lib/minitest.rb#363 + def time; end + + # The time it took to run. + # + # source://minitest//lib/minitest.rb#363 + def time=(_arg0); end + + # source://minitest//lib/minitest.rb#365 + def time_it; end + + class << self + # source://minitest//lib/minitest.rb#1226 + def inherited(klass); end + + # Returns all instance methods matching the pattern +re+. + # + # source://minitest//lib/minitest.rb#390 + def methods_matching(re); end + + # source://minitest//lib/minitest.rb#464 + def on_signal(name, action); end + + # source://minitest//lib/minitest.rb#394 + def reset; end + + # Responsible for running all runnable methods in a given class, + # each in its own instance. Each instance is passed to the + # reporter to record. + # + # source://minitest//lib/minitest.rb#405 + def run(reporter, options = T.unsafe(nil)); end + + # Runs a single method and has the reporter record the result. + # This was considered internal API but is factored out of run so + # that subclasses can specialize the running of an individual + # test. See Minitest::ParallelTest::ClassMethods for an example. + # + # source://minitest//lib/minitest.rb#445 + def run_one_method(klass, method_name, reporter); end + + # Each subclass of Runnable is responsible for overriding this + # method to return all runnable methods. See #methods_matching. + # + # @raise [NotImplementedError] + # + # source://minitest//lib/minitest.rb#481 + def runnable_methods; end + + # Returns all subclasses of Runnable. + # + # source://minitest//lib/minitest.rb#488 + def runnables; end + + # Defines the order to run tests (:random by default). Override + # this or use a convenience method to change it for your tests. + # + # source://minitest//lib/minitest.rb#454 + def test_order; end + + # source://minitest//lib/minitest.rb#458 + def with_info_handler(reporter, &block); end + end +end + +# source://minitest//lib/minitest.rb#462 +Minitest::Runnable::SIGNALS = T.let(T.unsafe(nil), Hash) + +# Assertion raised when skipping a run. +# +# source://minitest//lib/minitest.rb#1050 +class Minitest::Skip < ::Minitest::Assertion + # source://minitest//lib/minitest.rb#1051 + def result_label; end +end + +# A reporter that gathers statistics about a test run. Does not do +# any IO because meant to be used as a parent class for a reporter +# that does. +# +# If you want to create an entirely different type of output (eg, +# CI, HTML, etc), this is the place to start. +# +# Example: +# +# class JenkinsCIReporter < StatisticsReporter +# def report +# super # Needed to calculate some statistics +# +# print " Resource}] # - # source://resource_registry//lib/public/registry.rb#85 + # source://resource_registry//lib/public/registry.rb#86 def resources=(_arg0); end end -# source://resource_registry//lib/public/registry.rb#27 +# source://resource_registry//lib/public/registry.rb#14 class ResourceRegistry::Registry::DuplicatedIdentifierError < ::StandardError; end -# source://resource_registry//lib/public/registry.rb#24 +# source://resource_registry//lib/public/registry.rb#11 class ResourceRegistry::Registry::UnableToFindResourceError < ::StandardError; end # source://resource_registry//lib/public/relationship.rb#8 @@ -642,7 +515,7 @@ class ResourceRegistry::Relationship < ::T::Struct def should_skip_argument?(argument); end class << self - # source://sorbet-runtime/0.5.11609/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11670/lib/types/struct.rb#13 def inherited(s); end # source://resource_registry//lib/public/relationship.rb#39 @@ -659,45 +532,45 @@ module ResourceRegistry::RelationshipType abstract! - # source://resource_registry//lib/public/relationship_type.rb#19 + # source://resource_registry//lib/public/relationship_type.rb#26 sig { params(spec: T::Hash[::String, T.untyped]).void } def initialize(spec); end # @abstract # - # source://resource_registry//lib/public/relationship_type.rb#48 + # source://resource_registry//lib/public/relationship_type.rb#64 sig { abstract.returns(::Integer) } def complexity; end - # source://resource_registry//lib/public/relationship_type.rb#89 + # source://resource_registry//lib/public/relationship_type.rb#107 sig { returns(::Symbol) } def field; end - # source://resource_registry//lib/public/relationship_type.rb#51 + # source://resource_registry//lib/public/relationship_type.rb#68 sig { returns(T::Boolean) } def forward_entities?; end - # source://resource_registry//lib/public/relationship_type.rb#57 + # source://resource_registry//lib/public/relationship_type.rb#74 sig { returns(T::Boolean) } def forward_selected_fields?; end # @abstract # - # source://resource_registry//lib/public/relationship_type.rb#30 + # source://resource_registry//lib/public/relationship_type.rb#43 sig { abstract.returns(T::Boolean) } def many_cardinality?; end - # source://resource_registry//lib/public/relationship_type.rb#79 + # source://resource_registry//lib/public/relationship_type.rb#97 sig { returns(::String) } def name; end - # source://resource_registry//lib/public/relationship_type.rb#74 + # source://resource_registry//lib/public/relationship_type.rb#92 sig { returns(T::Array[T::Hash[::String, T.untyped]]) } def nested_fields; end # @abstract # - # source://resource_registry//lib/public/relationship_type.rb#71 + # source://resource_registry//lib/public/relationship_type.rb#88 sig do abstract .params( @@ -709,7 +582,7 @@ module ResourceRegistry::RelationshipType end def prepare_dto(dto, ids, rel, parent_resource); end - # source://resource_registry//lib/public/relationship_type.rb#94 + # source://resource_registry//lib/public/relationship_type.rb#112 sig { returns(::Symbol) } def primary_key; end @@ -717,27 +590,27 @@ module ResourceRegistry::RelationshipType # # @abstract # - # source://resource_registry//lib/public/relationship_type.rb#34 + # source://resource_registry//lib/public/relationship_type.rb#48 sig { abstract.params(relationship: ::ResourceRegistry::Relationship).returns(::Symbol) } def reference_id(relationship); end - # source://resource_registry//lib/public/relationship_type.rb#106 + # source://resource_registry//lib/public/relationship_type.rb#128 sig { overridable.returns(T.nilable(::Symbol)) } def relationship_field_name; end - # source://resource_registry//lib/public/relationship_type.rb#84 + # source://resource_registry//lib/public/relationship_type.rb#102 sig { returns(::Symbol) } def resource_id; end # @abstract # - # source://resource_registry//lib/public/relationship_type.rb#24 + # source://resource_registry//lib/public/relationship_type.rb#31 sig { abstract.returns(::String) } def serialize; end # @abstract # - # source://resource_registry//lib/public/relationship_type.rb#45 + # source://resource_registry//lib/public/relationship_type.rb#60 sig do abstract .params( @@ -750,11 +623,11 @@ module ResourceRegistry::RelationshipType # @abstract # - # source://resource_registry//lib/public/relationship_type.rb#27 + # source://resource_registry//lib/public/relationship_type.rb#39 sig { abstract.params(argument: ::String, relationship: ::ResourceRegistry::Relationship).returns(T::Boolean) } def should_skip_argument?(argument, relationship); end - # source://resource_registry//lib/public/relationship_type.rb#99 + # source://resource_registry//lib/public/relationship_type.rb#121 sig { overridable.params(read_dto: T.nilable(T.class_of(T::Struct))).returns(T::Boolean) } def valid_relationship_field?(read_dto); end end @@ -780,15 +653,15 @@ module ResourceRegistry::RelationshipTypes; end class ResourceRegistry::RelationshipTypes::BelongsTo include ::ResourceRegistry::RelationshipType - # source://resource_registry//lib/public/relationship_types/belongs_to.rb#52 + # source://resource_registry//lib/public/relationship_types/belongs_to.rb#64 sig { override.returns(::Integer) } def complexity; end - # source://resource_registry//lib/public/relationship_types/belongs_to.rb#24 + # source://resource_registry//lib/public/relationship_types/belongs_to.rb#28 sig { override.returns(T::Boolean) } def many_cardinality?; end - # source://resource_registry//lib/public/relationship_types/belongs_to.rb#66 + # source://resource_registry//lib/public/relationship_types/belongs_to.rb#78 sig do override .params( @@ -800,11 +673,11 @@ class ResourceRegistry::RelationshipTypes::BelongsTo end def prepare_dto(dto, ids, rel, _parent_resource); end - # source://resource_registry//lib/public/relationship_types/belongs_to.rb#29 + # source://resource_registry//lib/public/relationship_types/belongs_to.rb#33 sig { override.params(relationship: ::ResourceRegistry::Relationship).returns(::Symbol) } def reference_id(relationship); end - # source://resource_registry//lib/public/relationship_types/belongs_to.rb#72 + # source://resource_registry//lib/public/relationship_types/belongs_to.rb#84 sig { override.returns(::Symbol) } def relationship_field_name; end @@ -812,7 +685,7 @@ class ResourceRegistry::RelationshipTypes::BelongsTo sig { override.returns(::String) } def serialize; end - # source://resource_registry//lib/public/relationship_types/belongs_to.rb#46 + # source://resource_registry//lib/public/relationship_types/belongs_to.rb#55 sig do override .params( @@ -823,7 +696,7 @@ class ResourceRegistry::RelationshipTypes::BelongsTo end def shape_result(loaded_data, ids, relationship); end - # source://resource_registry//lib/public/relationship_types/belongs_to.rb#19 + # source://resource_registry//lib/public/relationship_types/belongs_to.rb#23 sig { override.params(argument: ::String, relationship: ::ResourceRegistry::Relationship).returns(T::Boolean) } def should_skip_argument?(argument, relationship); end end @@ -832,15 +705,15 @@ end class ResourceRegistry::RelationshipTypes::HasMany include ::ResourceRegistry::RelationshipType - # source://resource_registry//lib/public/relationship_types/has_many.rb#52 + # source://resource_registry//lib/public/relationship_types/has_many.rb#61 sig { override.returns(::Integer) } def complexity; end - # source://resource_registry//lib/public/relationship_types/has_many.rb#24 + # source://resource_registry//lib/public/relationship_types/has_many.rb#28 sig { override.returns(T::Boolean) } def many_cardinality?; end - # source://resource_registry//lib/public/relationship_types/has_many.rb#66 + # source://resource_registry//lib/public/relationship_types/has_many.rb#75 sig do override .params( @@ -852,11 +725,11 @@ class ResourceRegistry::RelationshipTypes::HasMany end def prepare_dto(dto, ids, rel, _parent_resource); end - # source://resource_registry//lib/public/relationship_types/has_many.rb#29 + # source://resource_registry//lib/public/relationship_types/has_many.rb#33 sig { override.params(relationship: ::ResourceRegistry::Relationship).returns(::Symbol) } def reference_id(relationship); end - # source://resource_registry//lib/public/relationship_types/has_many.rb#72 + # source://resource_registry//lib/public/relationship_types/has_many.rb#81 sig { override.returns(::Symbol) } def relationship_field_name; end @@ -864,7 +737,7 @@ class ResourceRegistry::RelationshipTypes::HasMany sig { override.returns(::String) } def serialize; end - # source://resource_registry//lib/public/relationship_types/has_many.rb#46 + # source://resource_registry//lib/public/relationship_types/has_many.rb#55 sig do override .params( @@ -875,7 +748,7 @@ class ResourceRegistry::RelationshipTypes::HasMany end def shape_result(loaded_data, ids, relationship); end - # source://resource_registry//lib/public/relationship_types/has_many.rb#19 + # source://resource_registry//lib/public/relationship_types/has_many.rb#23 sig { override.params(argument: ::String, relationship: ::ResourceRegistry::Relationship).returns(T::Boolean) } def should_skip_argument?(argument, relationship); end end @@ -884,15 +757,15 @@ end class ResourceRegistry::RelationshipTypes::HasManyThrough include ::ResourceRegistry::RelationshipType - # source://resource_registry//lib/public/relationship_types/has_many_through.rb#51 + # source://resource_registry//lib/public/relationship_types/has_many_through.rb#62 sig { override.returns(::Integer) } def complexity; end - # source://resource_registry//lib/public/relationship_types/has_many_through.rb#24 + # source://resource_registry//lib/public/relationship_types/has_many_through.rb#28 sig { override.returns(T::Boolean) } def many_cardinality?; end - # source://resource_registry//lib/public/relationship_types/has_many_through.rb#65 + # source://resource_registry//lib/public/relationship_types/has_many_through.rb#76 sig do override .params( @@ -904,11 +777,11 @@ class ResourceRegistry::RelationshipTypes::HasManyThrough end def prepare_dto(dto, ids, _rel, _parent_resource); end - # source://resource_registry//lib/public/relationship_types/has_many_through.rb#29 + # source://resource_registry//lib/public/relationship_types/has_many_through.rb#33 sig { override.params(relationship: ::ResourceRegistry::Relationship).returns(::Symbol) } def reference_id(relationship); end - # source://resource_registry//lib/public/relationship_types/has_many_through.rb#71 + # source://resource_registry//lib/public/relationship_types/has_many_through.rb#82 sig { override.returns(::Symbol) } def relationship_field_name; end @@ -916,7 +789,7 @@ class ResourceRegistry::RelationshipTypes::HasManyThrough sig { override.returns(::String) } def serialize; end - # source://resource_registry//lib/public/relationship_types/has_many_through.rb#46 + # source://resource_registry//lib/public/relationship_types/has_many_through.rb#55 sig do override .params( @@ -927,7 +800,7 @@ class ResourceRegistry::RelationshipTypes::HasManyThrough end def shape_result(loaded_data, ids, _relationship); end - # source://resource_registry//lib/public/relationship_types/has_many_through.rb#19 + # source://resource_registry//lib/public/relationship_types/has_many_through.rb#23 sig { override.params(argument: ::String, relationship: ::ResourceRegistry::Relationship).returns(T::Boolean) } def should_skip_argument?(argument, relationship); end end @@ -936,15 +809,15 @@ end class ResourceRegistry::RelationshipTypes::HasOne include ::ResourceRegistry::RelationshipType - # source://resource_registry//lib/public/relationship_types/has_one.rb#53 + # source://resource_registry//lib/public/relationship_types/has_one.rb#63 sig { override.returns(::Integer) } def complexity; end - # source://resource_registry//lib/public/relationship_types/has_one.rb#24 + # source://resource_registry//lib/public/relationship_types/has_one.rb#28 sig { override.returns(T::Boolean) } def many_cardinality?; end - # source://resource_registry//lib/public/relationship_types/has_one.rb#67 + # source://resource_registry//lib/public/relationship_types/has_one.rb#77 sig do override .params( @@ -958,11 +831,11 @@ class ResourceRegistry::RelationshipTypes::HasOne # FIXME: Review if this is actually reference_id # - # source://resource_registry//lib/public/relationship_types/has_one.rb#30 + # source://resource_registry//lib/public/relationship_types/has_one.rb#34 sig { override.params(relationship: ::ResourceRegistry::Relationship).returns(::Symbol) } def reference_id(relationship); end - # source://resource_registry//lib/public/relationship_types/has_one.rb#73 + # source://resource_registry//lib/public/relationship_types/has_one.rb#83 sig { override.returns(::Symbol) } def relationship_field_name; end @@ -970,7 +843,7 @@ class ResourceRegistry::RelationshipTypes::HasOne sig { override.returns(::String) } def serialize; end - # source://resource_registry//lib/public/relationship_types/has_one.rb#47 + # source://resource_registry//lib/public/relationship_types/has_one.rb#56 sig do override .params( @@ -981,17 +854,17 @@ class ResourceRegistry::RelationshipTypes::HasOne end def shape_result(loaded_data, ids, relationship); end - # source://resource_registry//lib/public/relationship_types/has_one.rb#19 + # source://resource_registry//lib/public/relationship_types/has_one.rb#23 sig { override.params(argument: ::String, relationship: ::ResourceRegistry::Relationship).returns(T::Boolean) } def should_skip_argument?(argument, relationship); end end -# source://resource_registry//lib/public/repositories/output_contexts/page_info_dto.rb#4 +# source://resource_registry//lib/public/repositories/base.rb#8 module ResourceRegistry::Repositories; end # @abstract Subclasses must implement the `abstract` methods below. # -# source://resource_registry//lib/public/repositories/base.rb#10 +# source://resource_registry//lib/public/repositories/base.rb#9 module ResourceRegistry::Repositories::Base extend T::Generic include ::Kernel @@ -1001,11 +874,11 @@ module ResourceRegistry::Repositories::Base Entity = type_member { { upper: T::Struct } } - # source://resource_registry//lib/public/repositories/base.rb#36 + # source://resource_registry//lib/public/repositories/base.rb#33 sig { overridable.params(dto: T.untyped, context: T.untyped).returns(T.untyped) } def read(dto:, context:); end - # source://resource_registry//lib/public/repositories/base.rb#41 + # source://resource_registry//lib/public/repositories/base.rb#42 sig { overridable.params(entity: Entity, tags: T::Set[T.untyped]).returns(T::Hash[::Symbol, T.untyped]) } def serialize(entity:, tags: T.unsafe(nil)); end @@ -1013,83 +886,32 @@ module ResourceRegistry::Repositories::Base # @raise [NotImplementedError] # - # source://resource_registry//lib/public/repositories/base.rb#70 + # source://resource_registry//lib/public/repositories/base.rb#73 sig { params(method: T.nilable(::Symbol)).returns(T.noreturn) } def raise_error(method); end - # source://resource_registry//lib/public/repositories/base.rb#61 + # source://resource_registry//lib/public/repositories/base.rb#62 sig { returns(::ResourceRegistry::Serializer) } def serializer; end class << self - # source://resource_registry//lib/public/repositories/base.rb#25 + # source://resource_registry//lib/public/repositories/base.rb#24 sig { returns(T.untyped) } def entity; end - # source://resource_registry//lib/public/repositories/base.rb#46 + # source://resource_registry//lib/public/repositories/base.rb#47 sig(:final) { returns(::String) } def namespace; end - # source://resource_registry//lib/public/repositories/base.rb#54 + # source://resource_registry//lib/public/repositories/base.rb#55 sig(:final) { returns(::String) } def resource_name; end end end -# source://resource_registry//lib/public/repositories/output_contexts/page_info_dto.rb#5 -module ResourceRegistry::Repositories::OutputContexts; end - -# source://resource_registry//lib/public/repositories/output_contexts/page_info_dto.rb#6 -class ResourceRegistry::Repositories::OutputContexts::PageInfoDto < ::T::Struct - const :has_next_page, T::Boolean, default: T.unsafe(nil) - const :has_previous_page, T::Boolean, default: T.unsafe(nil) - const :start_cursor, T.nilable(::String), default: T.unsafe(nil) - const :end_cursor, T.nilable(::String), default: T.unsafe(nil) - - class << self - # source://sorbet-runtime/0.5.11609/lib/types/struct.rb#13 - def inherited(s); end - end -end - -# @abstract Subclasses must implement the `abstract` methods below. -# -# source://resource_registry//lib/public/repositories/read_result.rb#7 -module ResourceRegistry::Repositories::ReadResult - extend T::Generic - - interface! - - Entity = type_member { { upper: T::Struct } } - - # @abstract - # - # source://resource_registry//lib/public/repositories/read_result.rb#17 - sig { abstract.returns(T.untyped) } - def entities; end - - # @abstract - # - # source://resource_registry//lib/public/repositories/read_result.rb#23 - sig { abstract.returns(::ResourceRegistry::Repositories::OutputContexts::PageInfoDto) } - def page_info; end - - # @abstract - # - # source://resource_registry//lib/public/repositories/read_result.rb#20 - sig { abstract.returns(T.untyped) } - def projections; end - - # @abstract - # - # source://resource_registry//lib/public/repositories/read_result.rb#26 - sig { abstract.returns(T.nilable(::Integer)) } - def total_count; end -end - # The main class that represents a resource in the system. # -# source://resource_registry//lib/public/resource.rb#20 +# source://resource_registry//lib/public/resource.rb#12 class ResourceRegistry::Resource < ::T::Struct const :repository_raw, ::String const :description, ::String, default: T.unsafe(nil) @@ -1099,13 +921,11 @@ class ResourceRegistry::Resource < ::T::Struct const :verbs, T::Hash[::Symbol, ::ResourceRegistry::Verb] const :paginateable, T::Boolean, default: T.unsafe(nil) - # @raise [VerbNotFound] - # - # source://resource_registry//lib/public/resource.rb#108 + # source://resource_registry//lib/public/resource.rb#111 sig { params(verb: ::Symbol, parameters: T.untyped).returns(::T::Struct) } def build_dto(verb, **parameters); end - # source://resource_registry//lib/public/resource.rb#97 + # source://resource_registry//lib/public/resource.rb#100 sig { returns(::String) } def camelize; end @@ -1124,7 +944,7 @@ class ResourceRegistry::Resource < ::T::Struct # # and Sorbet will know that `capability` is an instance of `Comments::Capabilities::Commentable` # - # source://resource_registry//lib/public/resource.rb#144 + # source://resource_registry//lib/public/resource.rb#149 sig do type_parameters(:CapabilityConfig) .params( @@ -1133,7 +953,7 @@ class ResourceRegistry::Resource < ::T::Struct end def capability(capability); end - # source://resource_registry//lib/public/resource.rb#180 + # source://resource_registry//lib/public/resource.rb#187 sig do type_parameters(:CapabilityConfig) .params( @@ -1142,7 +962,7 @@ class ResourceRegistry::Resource < ::T::Struct end def capability!(feature); end - # source://resource_registry//lib/public/resource.rb#162 + # source://resource_registry//lib/public/resource.rb#169 sig do params( feature: T.all(::ResourceRegistry::Capabilities::CapabilityConfig::ClassMethods, T::Class[::ResourceRegistry::Capabilities::CapabilityConfig]) @@ -1150,44 +970,42 @@ class ResourceRegistry::Resource < ::T::Struct end def capability?(feature); end - # source://resource_registry//lib/public/resource.rb#149 + # source://resource_registry//lib/public/resource.rb#156 sig { params(key: ::Symbol).returns(T.nilable(::ResourceRegistry::Capabilities::CapabilityConfig)) } def capability_by_key(key); end - # source://resource_registry//lib/public/resource.rb#61 + # source://resource_registry//lib/public/resource.rb#60 sig { returns(::String) } def collection_name; end - # source://resource_registry//lib/public/resource.rb#202 + # source://resource_registry//lib/public/resource.rb#210 sig { returns(T::Hash[::String, T.untyped]) } def dump; end - # source://resource_registry//lib/public/resource.rb#102 + # source://resource_registry//lib/public/resource.rb#105 sig { returns(::String) } def humanize; end - # source://resource_registry//lib/public/resource.rb#56 + # source://resource_registry//lib/public/resource.rb#51 sig { returns(::Symbol) } def identifier; end - # source://resource_registry//lib/public/resource.rb#192 + # source://resource_registry//lib/public/resource.rb#200 sig { returns(T::Array[::ResourceRegistry::Verb]) } def mutation_verbs; end - # source://resource_registry//lib/public/resource.rb#66 + # source://resource_registry//lib/public/resource.rb#65 sig { returns(::Symbol) } def name; end - # source://resource_registry//lib/public/resource.rb#84 + # source://resource_registry//lib/public/resource.rb#87 sig(:final) { returns(::String) } def namespace; end - # source://resource_registry//lib/public/resource.rb#45 + # source://resource_registry//lib/public/resource.rb#40 sig { returns(::String) } def path; end - # @raise [ArgumentError] - # # source://resource_registry//lib/public/resource.rb#76 sig { returns(T::Class[ResourceRegistry::Repositories::Base[T.untyped]]) } def repository; end @@ -1196,33 +1014,27 @@ class ResourceRegistry::Resource < ::T::Struct sig { returns(::String) } def resource_name; end - # source://resource_registry//lib/public/resource.rb#187 + # source://resource_registry//lib/public/resource.rb#195 sig { returns(T::Array[::ResourceRegistry::Verb]) } def rpc_verbs; end - # source://resource_registry//lib/public/resource.rb#51 + # source://resource_registry//lib/public/resource.rb#46 sig { returns(::String) } def slug; end - # source://resource_registry//lib/public/resource.rb#92 + # source://resource_registry//lib/public/resource.rb#95 sig { returns(::String) } def underscore; end - # source://resource_registry//lib/public/resource.rb#197 + # source://resource_registry//lib/public/resource.rb#205 sig { params(except: T::Array[::Symbol]).returns(T::Array[::ResourceRegistry::Verb]) } def verbs_except(except); end - private - - # source://resource_registry//lib/public/resource.rb#251 - sig { returns(::Dry::Inflector) } - def inflector; end - class << self - # source://sorbet-runtime/0.5.11609/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11670/lib/types/struct.rb#13 def inherited(s); end - # source://resource_registry//lib/public/resource.rb#220 + # source://resource_registry//lib/public/resource.rb#234 sig do params( spec: T::Hash[::String, T.untyped], @@ -1233,31 +1045,82 @@ class ResourceRegistry::Resource < ::T::Struct end end -# source://resource_registry//lib/public/resource.rb#26 +# source://resource_registry//lib/public/resource.rb#18 class ResourceRegistry::Resource::SchemaNotFound < ::StandardError; end -# source://resource_registry//lib/public/resource.rb#23 +# source://resource_registry//lib/public/resource.rb#15 class ResourceRegistry::Resource::VerbNotFound < ::StandardError; end -# source://resource_registry//lib/schema_generator.rb#6 -class ResourceRegistry::SchemaGenerator - # source://resource_registry//lib/schema_generator.rb#12 - sig do - params( - repository: T.class_of(ResourceRegistry::Repositories::Base) - ).returns(T.nilable(::SchemaRegistry::Schema)) - end - def generate(repository:); end +# Constructs a resource struct (like Dtos and Entities) from a hash of arguments +# It's different from the usual T::Struct::new in that it can handle +# the particular cases of our resource objects, such as: +# - nested Dtos +# - arrays of Dtos +# - `Maybe[T]` values +# +# source://resource_registry//lib/public/resource_struct_builder.rb#13 +class ResourceRegistry::ResourceStructBuilder + # source://resource_registry//lib/public/resource_struct_builder.rb#20 + sig { params(resource_type: T.untyped).void } + def initialize(resource_type); end + + # source://resource_registry//lib/public/resource_struct_builder.rb#25 + sig { params(value: T.untyped).returns(T.untyped) } + def build(value); end private - # source://resource_registry//lib/schema_generator.rb#26 - sig { params(repo: T.class_of(ResourceRegistry::Repositories::Base)).returns(::Symbol) } - def identifier_from_repo(repo); end + # source://resource_registry//lib/public/resource_struct_builder.rb#64 + sig { returns(T::Boolean) } + def array?; end + + # source://resource_registry//lib/public/resource_struct_builder.rb#145 + sig { params(args: T.nilable(T.all(::Object, T::Enumerable[T.untyped]))).returns(T.untyped) } + def build_enumerable(args); end + + # source://resource_registry//lib/public/resource_struct_builder.rb#153 + sig { params(value: T.untyped).returns(T.untyped) } + def build_generic(value); end + + # source://resource_registry//lib/public/resource_struct_builder.rb#159 + sig { params(value: T.untyped).returns(T.untyped) } + def build_other(value); end + + # source://resource_registry//lib/public/resource_struct_builder.rb#116 + sig { params(args: T::Hash[T.untyped, T.untyped]).returns(::T::Struct) } + def build_struct(args); end + + # source://resource_registry//lib/public/resource_struct_builder.rb#130 + sig { params(key: ::Symbol, value: T.untyped).returns(T.nilable([::Symbol, T.untyped])) } + def build_struct_property(key, value); end + + # source://resource_registry//lib/public/resource_struct_builder.rb#48 + sig { returns(T::Boolean) } + def generic?; end + + # source://resource_registry//lib/public/resource_struct_builder.rb#96 + sig { params(outer_type: T.untyped).returns(T.untyped) } + def inner_type(outer_type); end + + # source://resource_registry//lib/public/resource_struct_builder.rb#166 + sig { returns(T.untyped) } + def resource_type; end + + # source://resource_registry//lib/public/resource_struct_builder.rb#73 + sig { returns(T::Boolean) } + def set?; end + + # source://resource_registry//lib/public/resource_struct_builder.rb#53 + sig { returns(T::Boolean) } + def struct?; end + + # source://resource_registry//lib/public/resource_struct_builder.rb#85 + sig { returns(T.untyped) } + def type; end end -# source://resource_registry//lib/schema_generator.rb#9 -ResourceRegistry::SchemaGenerator::Repository = T.type_alias { T.class_of(ResourceRegistry::Repositories::Base) } +# source://resource_registry//lib/public/resource_struct_builder.rb#16 +class ResourceRegistry::ResourceStructBuilder::ParseInputError < ::StandardError; end # source://resource_registry//lib/public/serializer.rb#4 class ResourceRegistry::Serializer @@ -1267,17 +1130,17 @@ class ResourceRegistry::Serializer sig { params(resource: ::ResourceRegistry::Resource).void } def initialize(resource:); end - # source://resource_registry//lib/public/serializer.rb#14 + # source://resource_registry//lib/public/serializer.rb#18 sig { params(entity: ::T::Struct, tags: T::Set[::Symbol]).returns(T::Hash[::Symbol, T.untyped]) } def serialize(entity:, tags:); end private - # source://resource_registry//lib/public/serializer.rb#40 + # source://resource_registry//lib/public/serializer.rb#51 sig { params(property_value: T.untyped).returns(T.untyped) } def recursive_serialization(property_value); end - # source://resource_registry//lib/public/serializer.rb#47 + # source://resource_registry//lib/public/serializer.rb#64 sig { returns(::SchemaRegistry::Schema) } def resource_schema; end end @@ -1296,33 +1159,31 @@ class ResourceRegistry::Verb < ::T::Struct const :schema, ::SchemaRegistry::Schema const :return_many, T::Boolean, default: T.unsafe(nil) - # source://resource_registry//lib/public/verb.rb#56 + # source://resource_registry//lib/public/verb.rb#57 sig { returns(T::Boolean) } def create?; end - # source://resource_registry//lib/public/verb.rb#29 + # source://resource_registry//lib/public/verb.rb#30 sig { returns(T::Boolean) } def deprecated?; end - # source://resource_registry//lib/public/verb.rb#46 + # source://resource_registry//lib/public/verb.rb#47 sig { returns(T::Boolean) } def destroy?; end - # @raise [DtoClassNotFound] - # - # source://resource_registry//lib/public/verb.rb#61 + # source://resource_registry//lib/public/verb.rb#62 sig { returns(T.class_of(T::Struct)) } def dto; end - # source://resource_registry//lib/public/verb.rb#70 + # source://resource_registry//lib/public/verb.rb#73 sig { returns(T::Hash[::Symbol, T.untyped]) } def dump; end - # source://resource_registry//lib/public/verb.rb#41 + # source://resource_registry//lib/public/verb.rb#42 sig { returns(T::Boolean) } def get?; end - # source://resource_registry//lib/public/verb.rb#36 + # source://resource_registry//lib/public/verb.rb#37 sig { returns(T::Boolean) } def mutation?; end @@ -1330,23 +1191,17 @@ class ResourceRegistry::Verb < ::T::Struct sig { returns(::Symbol) } def schema_identifier; end - # source://resource_registry//lib/public/verb.rb#51 + # source://resource_registry//lib/public/verb.rb#52 sig { returns(T::Boolean) } def update?; end - private - - # source://resource_registry//lib/public/verb.rb#101 - sig { returns(::Dry::Inflector) } - def inflector; end - class << self - # source://sorbet-runtime/0.5.11609/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11670/lib/types/struct.rb#13 def inherited(s); end # @raise [ArgumentError] # - # source://resource_registry//lib/public/verb.rb#80 + # source://resource_registry//lib/public/verb.rb#83 sig { params(spec: T.untyped).returns(::ResourceRegistry::Verb) } def load(spec); end end @@ -1388,42 +1243,42 @@ class ResourceRegistry::Versions private - # source://resource_registry//lib/public/versions.rb#52 + # source://resource_registry//lib/public/versions.rb#54 sig { returns(T::Array[::ResourceRegistry::Versions::Version]) } def versions; end end # source://resource_registry//lib/public/versions/version.rb#5 class ResourceRegistry::Versions::Version - # source://resource_registry//lib/public/versions/version.rb#9 + # source://resource_registry//lib/public/versions/version.rb#14 sig { params(name: ::String, aliases: T.nilable(T.any(::String, T::Array[::String]))).void } def initialize(name, aliases: T.unsafe(nil)); end - # source://resource_registry//lib/public/versions/version.rb#41 + # source://resource_registry//lib/public/versions/version.rb#46 sig { params(other: ::ResourceRegistry::Versions::Version).returns(T::Boolean) } def <=(other); end - # source://resource_registry//lib/public/versions/version.rb#31 + # source://resource_registry//lib/public/versions/version.rb#36 sig { params(other: ::ResourceRegistry::Versions::Version).returns(T.nilable(::Integer)) } def <=>(other); end - # source://resource_registry//lib/public/versions/version.rb#36 + # source://resource_registry//lib/public/versions/version.rb#41 sig { params(other: ::ResourceRegistry::Versions::Version).returns(T::Boolean) } def >=(other); end - # source://resource_registry//lib/public/versions/version.rb#18 + # source://resource_registry//lib/public/versions/version.rb#23 sig { returns(T::Array[::String]) } def aliases; end - # source://resource_registry//lib/public/versions/version.rb#26 + # source://resource_registry//lib/public/versions/version.rb#31 sig { params(str: ::String).returns(T::Boolean) } def matches?(str); end - # source://resource_registry//lib/public/versions/version.rb#15 + # source://resource_registry//lib/public/versions/version.rb#20 sig { returns(::String) } def name; end - # source://resource_registry//lib/public/versions/version.rb#21 + # source://resource_registry//lib/public/versions/version.rb#26 sig { returns(::String) } def to_s; end end @@ -1475,7 +1330,7 @@ class RuntimeGeneric::TypedGeneric < ::T::Types::Simple def name; end end -# source://resource_registry//lib/schema_registry/generate_from_struct.rb#3 +# source://resource_registry//lib/schema_registry/property_type.rb#3 module SchemaRegistry; end # source://resource_registry//lib/schema_registry/filter_field.rb#4 @@ -1486,7 +1341,7 @@ class SchemaRegistry::FilterField < ::T::Struct const :in_memory, T::Boolean, default: T.unsafe(nil) class << self - # source://sorbet-runtime/0.5.11609/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11670/lib/types/struct.rb#13 def inherited(s); end end end @@ -1503,15 +1358,15 @@ class SchemaRegistry::GenerateFromStruct private - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#74 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#81 sig { params(klass: T.untyped).returns(T.nilable(T::Array[::String])) } def calculate_required(klass); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#122 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#144 sig { params(typedef: T.untyped).returns(T::Boolean) } def can_resolve_type?(typedef); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#129 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#154 sig do params( prop: T.untyped @@ -1519,11 +1374,11 @@ class SchemaRegistry::GenerateFromStruct end def compute_default(prop); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#87 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#99 sig { params(typedef: T.untyped, prop: T.untyped).returns(T::Hash[T.untyped, T.untyped]) } def deep_generate_array(typedef, prop); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#107 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#122 sig do params( array_type: T.any(::String, T::Array[::String]), @@ -1532,15 +1387,15 @@ class SchemaRegistry::GenerateFromStruct end def deep_generate_items(array_type, typedef); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#40 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#42 sig { params(klass: T.class_of(T::Struct)).returns(T::Hash[::Symbol, T.untyped]) } def deep_generate_properties(klass); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#181 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#212 sig { params(type: T.untyped).returns(T::Boolean) } def enum?(type); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#167 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#197 sig do params( type: T.any(::Integer, ::T::Types::Union, T.untyped), @@ -1549,15 +1404,15 @@ class SchemaRegistry::GenerateFromStruct end def nilable_sorbet_type_to_json(type:, type_object: T.unsafe(nil)); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#174 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#204 sig { params(type: T.untyped).returns(T::Boolean) } def represented_as_string?(type); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#81 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#89 sig { params(definition: T.untyped).returns(T::Boolean) } def required?(definition); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#149 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#175 sig do params( type: T.any(::Integer, ::T::Types::Union, T.untyped), @@ -1567,7 +1422,7 @@ class SchemaRegistry::GenerateFromStruct end def sorbet_type_to_json(type:, type_object: T.unsafe(nil), nilable: T.unsafe(nil)); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#188 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#218 sig { params(type: T.untyped).returns(T.nilable(::String)) } def sorbet_type_to_json_format(type:); end @@ -1575,11 +1430,11 @@ class SchemaRegistry::GenerateFromStruct sig { returns(T.class_of(T::Struct)) } def struct_klass; end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#200 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#230 sig { params(definition: T.untyped, type_object: T.untyped).returns(T.untyped) } def type_definition(definition, type_object); end - # source://resource_registry//lib/schema_registry/generate_from_struct.rb#214 + # source://resource_registry//lib/schema_registry/generate_from_struct.rb#244 sig { params(type: T.untyped).returns(T.untyped) } def union_type_definition(type); end end @@ -1607,11 +1462,11 @@ class SchemaRegistry::JsonSchemaMapper private - # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#37 + # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#42 sig { returns(T.untyped) } def definition; end - # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#69 + # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#77 sig do params( input: T.nilable(T::Array[T::Hash[::String, T.untyped]]) @@ -1619,11 +1474,11 @@ class SchemaRegistry::JsonSchemaMapper end def handle_fields(input); end - # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#47 + # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#52 sig { params(items: T.nilable(T::Hash[T.untyped, T.untyped])).returns(T::Array[::SchemaRegistry::Property]) } def handle_items(items); end - # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#88 + # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#96 sig do params( properties: T.nilable(T::Hash[T.untyped, T.untyped]), @@ -1632,7 +1487,7 @@ class SchemaRegistry::JsonSchemaMapper end def handle_properties(properties, required); end - # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#148 + # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#161 sig do params( resolver: T.nilable(T.any(::String, T::Hash[::Symbol, ::String])) @@ -1640,11 +1495,11 @@ class SchemaRegistry::JsonSchemaMapper end def handle_resolver(resolver); end - # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#157 + # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#174 sig { params(serialization_groups: T.nilable(T::Array[::String])).returns(T::Set[::Symbol]) } def handle_serialization_groups(serialization_groups); end - # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#132 + # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#143 sig do params( prop_type: T.any(::String, T::Array[::String]), @@ -1653,19 +1508,19 @@ class SchemaRegistry::JsonSchemaMapper end def handle_types(prop_type, format); end - # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#40 + # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#45 sig { returns(::String) } def namespace; end - # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#137 + # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#150 sig { params(prop_type: T.any(::String, T::Array[::String])).returns(T::Boolean) } def nilable?(prop_type); end - # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#192 + # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#213 sig { params(format: T.nilable(::String)).returns(::SchemaRegistry::PropertyType) } def string_format_to_sorbet(format); end - # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#166 + # source://resource_registry//lib/schema_registry/json_schema_mapper.rb#186 sig do params( json_schema_type: T.nilable(::String), @@ -1724,7 +1579,7 @@ class SchemaRegistry::Property < ::T::Struct def value_object?; end class << self - # source://sorbet-runtime/0.5.11609/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11670/lib/types/struct.rb#13 def inherited(s); end end end @@ -1787,21 +1642,19 @@ class SchemaRegistry::Registry sig { void } def initialize; end - # source://resource_registry//lib/schema_registry/registry.rb#39 + # source://resource_registry//lib/schema_registry/registry.rb#45 sig { returns(::SchemaRegistry::Registry) } def cleanup; end - # source://resource_registry//lib/schema_registry/registry.rb#29 + # source://resource_registry//lib/schema_registry/registry.rb#35 sig { params(identifier: ::Symbol).returns(T.nilable(::SchemaRegistry::Schema)) } def fetch(identifier); end - # @raise [SchemaNotFound] - # - # source://resource_registry//lib/schema_registry/registry.rb#22 + # source://resource_registry//lib/schema_registry/registry.rb#24 sig { params(identifier: ::Symbol).returns(T.nilable(::SchemaRegistry::Schema)) } def fetch!(identifier); end - # source://resource_registry//lib/schema_registry/registry.rb#34 + # source://resource_registry//lib/schema_registry/registry.rb#40 sig { returns(T::Hash[::Symbol, ::SchemaRegistry::Schema]) } def fetch_all; end @@ -1821,7 +1674,7 @@ class SchemaRegistry::Schema < ::T::Struct const :raw_json_schema, T::Hash[::String, T.untyped], default: T.unsafe(nil) const :additional_filter_fields, T::Array[::SchemaRegistry::FilterField], default: T.unsafe(nil) - # source://resource_registry//lib/schema_registry/schema.rb#76 + # source://resource_registry//lib/schema_registry/schema.rb#78 sig { returns(T::Hash[::Symbol, T.untyped]) } def dump; end @@ -1857,39 +1710,12 @@ class SchemaRegistry::Schema < ::T::Struct sig { returns(::String) } def slug; end - private - - # source://resource_registry//lib/schema_registry/schema.rb#91 - sig { returns(::Dry::Inflector) } - def inflector; end - class << self - # source://sorbet-runtime/0.5.11609/lib/types/struct.rb#13 + # source://sorbet-runtime/0.5.11670/lib/types/struct.rb#13 def inherited(s); end - # source://resource_registry//lib/schema_registry/schema.rb#84 + # source://resource_registry//lib/schema_registry/schema.rb#86 sig { params(spec: T.untyped).returns(::SchemaRegistry::Schema) } def load(spec); end end end - -# source://resource_registry//lib/schema_registry/schema_loader.rb#4 -class SchemaRegistry::SchemaLoader - # source://resource_registry//lib/schema_registry/schema_loader.rb#8 - sig { params(schema_registry: ::SchemaRegistry::Registry).void } - def initialize(schema_registry:); end - - # source://resource_registry//lib/schema_registry/schema_loader.rb#13 - sig { params(paths: T::Array[[::String, ::String]]).void } - def load(paths); end - - private - - # source://resource_registry//lib/schema_registry/schema_loader.rb#29 - sig { params(namespace: ::String, path: ::String).returns(T::Array[::SchemaRegistry::Schema]) } - def load_path_files(namespace, path); end - - # source://resource_registry//lib/schema_registry/schema_loader.rb#26 - sig { returns(::SchemaRegistry::Registry) } - def schema_registry; end -end diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/gems/securerandom@0.3.2.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/securerandom@0.3.2.rbi new file mode 100644 index 0000000..3bd41bc --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/securerandom@0.3.2.rbi @@ -0,0 +1,395 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `securerandom` gem. +# Please instead update this file by running `bin/tapioca gem securerandom`. + + +class Random::Base + include ::Random::Formatter + extend ::Random::Formatter + + def initialize(*_arg0); end + + def bytes(_arg0); end + def rand(*_arg0); end + def seed; end +end + +# == \Random number formatter. +# +# Formats generated random numbers in many manners. When 'random/formatter' +# is required, several methods are added to empty core module Random::Formatter, +# making them available as Random's instance and module methods. +# +# Standard library SecureRandom is also extended with the module, and the methods +# described below are available as a module methods in it. +# +# === Examples +# +# Generate random hexadecimal strings: +# +# require 'random/formatter' +# +# prng = Random.new +# prng.hex(10) #=> "52750b30ffbc7de3b362" +# prng.hex(10) #=> "92b15d6c8dc4beb5f559" +# prng.hex(13) #=> "39b290146bea6ce975c37cfc23" +# # or just +# Random.hex #=> "1aed0c631e41be7f77365415541052ee" +# +# Generate random base64 strings: +# +# prng.base64(10) #=> "EcmTPZwWRAozdA==" +# prng.base64(10) #=> "KO1nIU+p9DKxGg==" +# prng.base64(12) #=> "7kJSM/MzBJI+75j8" +# Random.base64(4) #=> "bsQ3fQ==" +# +# Generate random binary strings: +# +# prng.random_bytes(10) #=> "\016\t{\370g\310pbr\301" +# prng.random_bytes(10) #=> "\323U\030TO\234\357\020\a\337" +# Random.random_bytes(6) #=> "\xA1\xE6Lr\xC43" +# +# Generate alphanumeric strings: +# +# prng.alphanumeric(10) #=> "S8baxMJnPl" +# prng.alphanumeric(10) #=> "aOxAg8BAJe" +# Random.alphanumeric #=> "TmP9OsJHJLtaZYhP" +# +# Generate UUIDs: +# +# prng.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594" +# prng.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab" +# Random.uuid #=> "f14e0271-de96-45cc-8911-8910292a42cd" +# +# All methods are available in the standard library SecureRandom, too: +# +# SecureRandom.hex #=> "05b45376a30c67238eb93b16499e50cf" +# +# source://securerandom//lib/random/formatter.rb#55 +module Random::Formatter + # Generate a random alphanumeric string. + # + # The argument _n_ specifies the length, in characters, of the alphanumeric + # string to be generated. + # The argument _chars_ specifies the character list which the result is + # consist of. + # + # If _n_ is not specified or is nil, 16 is assumed. + # It may be larger in the future. + # + # The result may contain A-Z, a-z and 0-9, unless _chars_ is specified. + # + # require 'random/formatter' + # + # Random.alphanumeric #=> "2BuBuLf3WfSKyQbR" + # # or + # prng = Random.new + # prng.alphanumeric(10) #=> "i6K93NdqiH" + # + # Random.alphanumeric(4, chars: [*"0".."9"]) #=> "2952" + # # or + # prng = Random.new + # prng.alphanumeric(10, chars: [*"!".."/"]) #=> ",.,++%/''." + # + # source://securerandom//lib/random/formatter.rb#368 + def alphanumeric(n = T.unsafe(nil), chars: T.unsafe(nil)); end + + # Generate a random base64 string. + # + # The argument _n_ specifies the length, in bytes, of the random number + # to be generated. The length of the result string is about 4/3 of _n_. + # + # If _n_ is not specified or is nil, 16 is assumed. + # It may be larger in the future. + # + # The result may contain A-Z, a-z, 0-9, "+", "/" and "=". + # + # require 'random/formatter' + # + # Random.base64 #=> "/2BuBuLf3+WfSKyQbRcc/A==" + # # or + # prng = Random.new + # prng.base64 #=> "6BbW0pxO0YENxn38HMUbcQ==" + # + # See RFC 3548 for the definition of base64. + # + # source://securerandom//lib/random/formatter.rb#115 + def base64(n = T.unsafe(nil)); end + + # Generate a random hexadecimal string. + # + # The argument _n_ specifies the length, in bytes, of the random number to be generated. + # The length of the resulting hexadecimal string is twice of _n_. + # + # If _n_ is not specified or is nil, 16 is assumed. + # It may be larger in the future. + # + # The result may contain 0-9 and a-f. + # + # require 'random/formatter' + # + # Random.hex #=> "eb693ec8252cd630102fd0d0fb7c3485" + # # or + # prng = Random.new + # prng.hex #=> "91dc3bfb4de5b11d029d376634589b61" + # + # source://securerandom//lib/random/formatter.rb#93 + def hex(n = T.unsafe(nil)); end + + # Generate a random binary string. + # + # The argument _n_ specifies the length of the result string. + # + # If _n_ is not specified or is nil, 16 is assumed. + # It may be larger in future. + # + # The result may contain any byte: "\x00" - "\xff". + # + # require 'random/formatter' + # + # Random.random_bytes #=> "\xD8\\\xE0\xF4\r\xB2\xFC*WM\xFF\x83\x18\xF45\xB6" + # # or + # prng = Random.new + # prng.random_bytes #=> "m\xDC\xFC/\a\x00Uf\xB2\xB2P\xBD\xFF6S\x97" + # + # source://securerandom//lib/random/formatter.rb#72 + def random_bytes(n = T.unsafe(nil)); end + + # Generate a random URL-safe base64 string. + # + # The argument _n_ specifies the length, in bytes, of the random number + # to be generated. The length of the result string is about 4/3 of _n_. + # + # If _n_ is not specified or is nil, 16 is assumed. + # It may be larger in the future. + # + # The boolean argument _padding_ specifies the padding. + # If it is false or nil, padding is not generated. + # Otherwise padding is generated. + # By default, padding is not generated because "=" may be used as a URL delimiter. + # + # The result may contain A-Z, a-z, 0-9, "-" and "_". + # "=" is also used if _padding_ is true. + # + # require 'random/formatter' + # + # Random.urlsafe_base64 #=> "b4GOKm4pOYU_-BOXcrUGDg" + # # or + # prng = Random.new + # prng.urlsafe_base64 #=> "UZLdOkzop70Ddx-IJR0ABg" + # + # prng.urlsafe_base64(nil, true) #=> "i0XQ-7gglIsHGV2_BNPrdQ==" + # prng.urlsafe_base64(nil, true) #=> "-M8rLhr7JEpJlqFGUMmOxg==" + # + # See RFC 3548 for the definition of URL-safe base64. + # + # source://securerandom//lib/random/formatter.rb#146 + def urlsafe_base64(n = T.unsafe(nil), padding = T.unsafe(nil)); end + + # Generate a random v4 UUID (Universally Unique IDentifier). + # + # require 'random/formatter' + # + # Random.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594" + # Random.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab" + # # or + # prng = Random.new + # prng.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b" + # + # The version 4 UUID is purely random (except the version). + # It doesn't contain meaningful information such as MAC addresses, timestamps, etc. + # + # The result contains 122 random bits (15.25 random bytes). + # + # See RFC9562[https://www.rfc-editor.org/rfc/rfc9562] for details of UUIDv4. + # + # source://securerandom//lib/random/formatter.rb#170 + def uuid; end + + # Generate a random v4 UUID (Universally Unique IDentifier). + # + # require 'random/formatter' + # + # Random.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594" + # Random.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab" + # # or + # prng = Random.new + # prng.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b" + # + # The version 4 UUID is purely random (except the version). + # It doesn't contain meaningful information such as MAC addresses, timestamps, etc. + # + # The result contains 122 random bits (15.25 random bytes). + # + # See RFC9562[https://www.rfc-editor.org/rfc/rfc9562] for details of UUIDv4. + # + # source://securerandom//lib/random/formatter.rb#170 + def uuid_v4; end + + # Generate a random v7 UUID (Universally Unique IDentifier). + # + # require 'random/formatter' + # + # Random.uuid_v7 # => "0188d4c3-1311-7f96-85c7-242a7aa58f1e" + # Random.uuid_v7 # => "0188d4c3-16fe-744f-86af-38fa04c62bb5" + # Random.uuid_v7 # => "0188d4c3-1af8-764f-b049-c204ce0afa23" + # Random.uuid_v7 # => "0188d4c3-1e74-7085-b14f-ef6415dc6f31" + # # |<--sorted-->| |<----- random ---->| + # + # # or + # prng = Random.new + # prng.uuid_v7 # => "0188ca51-5e72-7950-a11d-def7ff977c98" + # + # The version 7 UUID starts with the least significant 48 bits of a 64 bit + # Unix timestamp (milliseconds since the epoch) and fills the remaining bits + # with random data, excluding the version and variant bits. + # + # This allows version 7 UUIDs to be sorted by creation time. Time ordered + # UUIDs can be used for better database index locality of newly inserted + # records, which may have a significant performance benefit compared to random + # data inserts. + # + # The result contains 74 random bits (9.25 random bytes). + # + # Note that this method cannot be made reproducible because its output + # includes not only random bits but also timestamp. + # + # See RFC9562[https://www.rfc-editor.org/rfc/rfc9562] for details of UUIDv7. + # + # ==== Monotonicity + # + # UUIDv7 has millisecond precision by default, so multiple UUIDs created + # within the same millisecond are not issued in monotonically increasing + # order. To create UUIDs that are time-ordered with sub-millisecond + # precision, up to 12 bits of additional timestamp may added with + # +extra_timestamp_bits+. The extra timestamp precision comes at the expense + # of random bits. Setting extra_timestamp_bits: 12 provides ~244ns + # of precision, but only 62 random bits (7.75 random bytes). + # + # prng = Random.new + # Array.new(4) { prng.uuid_v7(extra_timestamp_bits: 12) } + # # => + # ["0188d4c7-13da-74f9-8b53-22a786ffdd5a", + # "0188d4c7-13da-753b-83a5-7fb9b2afaeea", + # "0188d4c7-13da-754a-88ea-ac0baeedd8db", + # "0188d4c7-13da-7557-83e1-7cad9cda0d8d"] + # # |<--- sorted --->| |<-- random --->| + # + # Array.new(4) { prng.uuid_v7(extra_timestamp_bits: 8) } + # # => + # ["0188d4c7-3333-7a95-850a-de6edb858f7e", + # "0188d4c7-3333-7ae8-842e-bc3a8b7d0cf9", # <- out of order + # "0188d4c7-3333-7ae2-995a-9f135dc44ead", # <- out of order + # "0188d4c7-3333-7af9-87c3-8f612edac82e"] + # # |<--- sorted -->||<---- random --->| + # + # Any rollbacks of the system clock will break monotonicity. UUIDv7 is based + # on UTC, which excludes leap seconds and can rollback the clock. To avoid + # this, the system clock can synchronize with an NTP server configured to use + # a "leap smear" approach. NTP or PTP will also be needed to synchronize + # across distributed nodes. + # + # Counters and other mechanisms for stronger guarantees of monotonicity are + # not implemented. Applications with stricter requirements should follow + # {Section 6.2}[https://www.rfc-editor.org/rfc/rfc9562.html#name-monotonicity-and-counters] + # of the specification. + # + # source://securerandom//lib/random/formatter.rb#247 + def uuid_v7(extra_timestamp_bits: T.unsafe(nil)); end + + private + + # Generate a string that randomly draws from a + # source array of characters. + # + # The argument _source_ specifies the array of characters from which + # to generate the string. + # The argument _n_ specifies the length, in characters, of the string to be + # generated. + # + # The result may contain whatever characters are in the source array. + # + # require 'random/formatter' + # + # prng.choose([*'l'..'r'], 16) #=> "lmrqpoonmmlqlron" + # prng.choose([*'0'..'9'], 5) #=> "27309" + # + # source://securerandom//lib/random/formatter.rb#313 + def choose(source, n); end + + # Internal interface to Random; Generate random data _n_ bytes. + # + # source://securerandom//lib/random/formatter.rb#295 + def gen_random(n); end +end + +# == Secure random number generator interface. +# +# This library is an interface to secure random number generators which are +# suitable for generating session keys in HTTP cookies, etc. +# +# You can use this library in your application by requiring it: +# +# require 'securerandom' +# +# It supports the following secure random number generators: +# +# * openssl +# * /dev/urandom +# * Win32 +# +# SecureRandom is extended by the Random::Formatter module which +# defines the following methods: +# +# * alphanumeric +# * base64 +# * choose +# * gen_random +# * hex +# * rand +# * random_bytes +# * random_number +# * urlsafe_base64 +# * uuid +# +# These methods are usable as class methods of SecureRandom such as +# +SecureRandom.hex+. +# +# If a secure random number generator is not available, +# +NotImplementedError+ is raised. +# +# source://securerandom//lib/securerandom.rb#41 +module SecureRandom + extend ::Random::Formatter + + class << self + # Returns a random binary string containing +size+ bytes. + # + # See Random.bytes + # + # source://securerandom//lib/securerandom.rb#50 + def bytes(n); end + + # source://securerandom//lib/securerandom.rb#64 + def gen_random(n); end + + private + + # Implementation using OpenSSL + # + # source://securerandom//lib/securerandom.rb#59 + def gen_random_openssl(n); end + + # Implementation using system random device + # + # source://securerandom//lib/securerandom.rb#64 + def gen_random_urandom(n); end + end +end + +# The version +# +# source://securerandom//lib/securerandom.rb#44 +SecureRandom::VERSION = T.let(T.unsafe(nil), String) diff --git a/examples/sinatra-pet-shelter/sorbet/rbi/gems/tzinfo@2.0.6.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/tzinfo@2.0.6.rbi new file mode 100644 index 0000000..f8f9c81 --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/tzinfo@2.0.6.rbi @@ -0,0 +1,5918 @@ +# 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#7 +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#11 +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#7 +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#20 +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#8 +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#68 +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#7 +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#8 +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#6 +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#6 +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#15 +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#8 +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/examples/sinatra-pet-shelter/sorbet/rbi/gems/uri@1.0.2.rbi b/examples/sinatra-pet-shelter/sorbet/rbi/gems/uri@1.0.2.rbi new file mode 100644 index 0000000..63b9a7f --- /dev/null +++ b/examples/sinatra-pet-shelter/sorbet/rbi/gems/uri@1.0.2.rbi @@ -0,0 +1,2377 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `uri` gem. +# Please instead update this file by running `bin/tapioca gem uri`. + + +# module URI +# +# source://uri//lib/uri/common.rb#852 +module Kernel + private + + # Returns a \URI object derived from the given +uri+, + # which may be a \URI string or an existing \URI object: + # + # # Returns a new URI. + # uri = URI('http://github.com/ruby/ruby') + # # => # + # # Returns the given URI. + # URI(uri) + # # => # + # + # source://uri//lib/uri/common.rb#865 + def URI(uri); end + + class << self + # Returns a \URI object derived from the given +uri+, + # which may be a \URI string or an existing \URI object: + # + # # Returns a new URI. + # uri = URI('http://github.com/ruby/ruby') + # # => # + # # Returns the given URI. + # URI(uri) + # # => # + # + # source://uri//lib/uri/common.rb#865 + def URI(uri); end + end +end + +# source://uri//lib/uri.rb#90 +module URI + class << self + # source://uri//lib/uri/common.rb#43 + def const_missing(const); end + + # Like URI.decode_www_form_component, except that '+' is preserved. + # + # source://uri//lib/uri/common.rb#402 + def decode_uri_component(str, enc = T.unsafe(nil)); end + + # Returns name/value pairs derived from the given string +str+, + # which must be an ASCII string. + # + # The method may be used to decode the body of Net::HTTPResponse object +res+ + # for which res['Content-Type'] is 'application/x-www-form-urlencoded'. + # + # The returned data is an array of 2-element subarrays; + # each subarray is a name/value pair (both are strings). + # Each returned string has encoding +enc+, + # and has had invalid characters removed via + # {String#scrub}[https://docs.ruby-lang.org/en/master/String.html#method-i-scrub]. + # + # A simple example: + # + # URI.decode_www_form('foo=0&bar=1&baz') + # # => [["foo", "0"], ["bar", "1"], ["baz", ""]] + # + # The returned strings have certain conversions, + # similar to those performed in URI.decode_www_form_component: + # + # URI.decode_www_form('f%23o=%2F&b-r=%24&b+z=%40') + # # => [["f#o", "/"], ["b-r", "$"], ["b z", "@"]] + # + # The given string may contain consecutive separators: + # + # URI.decode_www_form('foo=0&&bar=1&&baz=2') + # # => [["foo", "0"], ["", ""], ["bar", "1"], ["", ""], ["baz", "2"]] + # + # A different separator may be specified: + # + # URI.decode_www_form('foo=0--bar=1--baz', separator: '--') + # # => [["foo", "0"], ["bar", "1"], ["baz", ""]] + # + # @raise [ArgumentError] + # + # source://uri//lib/uri/common.rb#577 + def decode_www_form(str, enc = T.unsafe(nil), separator: T.unsafe(nil), use__charset_: T.unsafe(nil), isindex: T.unsafe(nil)); end + + # Returns a string decoded from the given \URL-encoded string +str+. + # + # The given string is first encoded as Encoding::ASCII-8BIT (using String#b), + # then decoded (as below), and finally force-encoded to the given encoding +enc+. + # + # The returned string: + # + # - Preserves: + # + # - Characters '*', '.', '-', and '_'. + # - Character in ranges 'a'..'z', 'A'..'Z', + # and '0'..'9'. + # + # Example: + # + # URI.decode_www_form_component('*.-_azAZ09') + # # => "*.-_azAZ09" + # + # - Converts: + # + # - Character '+' to character ' '. + # - Each "percent notation" to an ASCII character. + # + # Example: + # + # URI.decode_www_form_component('Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A') + # # => "Here are some punctuation characters: ,;?:" + # + # Related: URI.decode_uri_component (preserves '+'). + # + # source://uri//lib/uri/common.rb#391 + def decode_www_form_component(str, enc = T.unsafe(nil)); end + + # Like URI.encode_www_form_component, except that ' ' (space) + # is encoded as '%20' (instead of '+'). + # + # source://uri//lib/uri/common.rb#397 + def encode_uri_component(str, enc = T.unsafe(nil)); end + + # Returns a URL-encoded string derived from the given + # {Enumerable}[https://docs.ruby-lang.org/en/master/Enumerable.html#module-Enumerable-label-Enumerable+in+Ruby+Classes] + # +enum+. + # + # The result is suitable for use as form data + # for an \HTTP request whose Content-Type is + # 'application/x-www-form-urlencoded'. + # + # The returned string consists of the elements of +enum+, + # each converted to one or more URL-encoded strings, + # and all joined with character '&'. + # + # Simple examples: + # + # URI.encode_www_form([['foo', 0], ['bar', 1], ['baz', 2]]) + # # => "foo=0&bar=1&baz=2" + # URI.encode_www_form({foo: 0, bar: 1, baz: 2}) + # # => "foo=0&bar=1&baz=2" + # + # The returned string is formed using method URI.encode_www_form_component, + # which converts certain characters: + # + # URI.encode_www_form('f#o': '/', 'b-r': '$', 'b z': '@') + # # => "f%23o=%2F&b-r=%24&b+z=%40" + # + # When +enum+ is Array-like, each element +ele+ is converted to a field: + # + # - If +ele+ is an array of two or more elements, + # the field is formed from its first two elements + # (and any additional elements are ignored): + # + # name = URI.encode_www_form_component(ele[0], enc) + # value = URI.encode_www_form_component(ele[1], enc) + # "#{name}=#{value}" + # + # Examples: + # + # URI.encode_www_form([%w[foo bar], %w[baz bat bah]]) + # # => "foo=bar&baz=bat" + # URI.encode_www_form([['foo', 0], ['bar', :baz, 'bat']]) + # # => "foo=0&bar=baz" + # + # - If +ele+ is an array of one element, + # the field is formed from ele[0]: + # + # URI.encode_www_form_component(ele[0]) + # + # Example: + # + # URI.encode_www_form([['foo'], [:bar], [0]]) + # # => "foo&bar&0" + # + # - Otherwise the field is formed from +ele+: + # + # URI.encode_www_form_component(ele) + # + # Example: + # + # URI.encode_www_form(['foo', :bar, 0]) + # # => "foo&bar&0" + # + # The elements of an Array-like +enum+ may be mixture: + # + # URI.encode_www_form([['foo', 0], ['bar', 1, 2], ['baz'], :bat]) + # # => "foo=0&bar=1&baz&bat" + # + # When +enum+ is Hash-like, + # each +key+/+value+ pair is converted to one or more fields: + # + # - If +value+ is + # {Array-convertible}[https://docs.ruby-lang.org/en/master/implicit_conversion_rdoc.html#label-Array-Convertible+Objects], + # each element +ele+ in +value+ is paired with +key+ to form a field: + # + # name = URI.encode_www_form_component(key, enc) + # value = URI.encode_www_form_component(ele, enc) + # "#{name}=#{value}" + # + # Example: + # + # URI.encode_www_form({foo: [:bar, 1], baz: [:bat, :bam, 2]}) + # # => "foo=bar&foo=1&baz=bat&baz=bam&baz=2" + # + # - Otherwise, +key+ and +value+ are paired to form a field: + # + # name = URI.encode_www_form_component(key, enc) + # value = URI.encode_www_form_component(value, enc) + # "#{name}=#{value}" + # + # Example: + # + # URI.encode_www_form({foo: 0, bar: 1, baz: 2}) + # # => "foo=0&bar=1&baz=2" + # + # The elements of a Hash-like +enum+ may be mixture: + # + # URI.encode_www_form({foo: [0, 1], bar: 2}) + # # => "foo=0&foo=1&bar=2" + # + # source://uri//lib/uri/common.rb#524 + def encode_www_form(enum, enc = T.unsafe(nil)); end + + # Returns a URL-encoded string derived from the given string +str+. + # + # The returned string: + # + # - Preserves: + # + # - Characters '*', '.', '-', and '_'. + # - Character in ranges 'a'..'z', 'A'..'Z', + # and '0'..'9'. + # + # Example: + # + # URI.encode_www_form_component('*.-_azAZ09') + # # => "*.-_azAZ09" + # + # - Converts: + # + # - Character ' ' to character '+'. + # - Any other character to "percent notation"; + # the percent notation for character c is '%%%X' % c.ord. + # + # Example: + # + # URI.encode_www_form_component('Here are some punctuation characters: ,;?:') + # # => "Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A" + # + # Encoding: + # + # - If +str+ has encoding Encoding::ASCII_8BIT, argument +enc+ is ignored. + # - Otherwise +str+ is converted first to Encoding::UTF_8 + # (with suitable character replacements), + # and then to encoding +enc+. + # + # In either case, the returned string has forced encoding Encoding::US_ASCII. + # + # Related: URI.encode_uri_component (encodes ' ' as '%20'). + # + # source://uri//lib/uri/common.rb#358 + def encode_www_form_component(str, enc = T.unsafe(nil)); end + + # == Synopsis + # + # URI::extract(str[, schemes][,&blk]) + # + # == Args + # + # +str+:: + # String to extract URIs from. + # +schemes+:: + # Limit URI matching to specific schemes. + # + # == Description + # + # Extracts URIs from a string. If block given, iterates through all matched URIs. + # Returns nil if block given or array with matches. + # + # == Usage + # + # require "uri" + # + # URI.extract("text here http://foo.example.org/bla and here mailto:test@example.com and here also.") + # # => ["http://foo.example.com/bla", "mailto:test@example.com"] + # + # source://uri//lib/uri/common.rb#262 + def extract(str, schemes = T.unsafe(nil), &block); end + + # Returns a new object constructed from the given +scheme+, +arguments+, + # and +default+: + # + # - The new object is an instance of URI.scheme_list[scheme.upcase]. + # - The object is initialized by calling the class initializer + # using +scheme+ and +arguments+. + # See URI::Generic.new. + # + # Examples: + # + # values = ['john.doe', 'www.example.com', '123', nil, '/forum/questions/', nil, 'tag=networking&order=newest', 'top'] + # URI.for('https', *values) + # # => # + # URI.for('foo', *values, default: URI::HTTP) + # # => # + # + # source://uri//lib/uri/common.rb#146 + def for(scheme, *arguments, default: T.unsafe(nil)); end + + # return encoding or nil + # http://encoding.spec.whatwg.org/#concept-encoding-get + # + # source://uri//lib/uri/common.rb#847 + def get_encoding(label); end + + # Merges the given URI strings +str+ + # per {RFC 2396}[https://www.rfc-editor.org/rfc/rfc2396.html]. + # + # Each string in +str+ is converted to an + # {RFC3986 URI}[https://www.rfc-editor.org/rfc/rfc3986.html] before being merged. + # + # Examples: + # + # URI.join("http://example.com/","main.rbx") + # # => # + # + # URI.join('http://example.com', 'foo') + # # => # + # + # URI.join('http://example.com', '/foo', '/bar') + # # => # + # + # URI.join('http://example.com', '/foo', 'bar') + # # => # + # + # URI.join('http://example.com', '/foo/', 'bar') + # # => # + # + # source://uri//lib/uri/common.rb#234 + def join(*str); end + + # Returns a new \URI object constructed from the given string +uri+: + # + # URI.parse('https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top') + # # => # + # URI.parse('http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top') + # # => # + # + # It's recommended to first ::escape string +uri+ + # if it may contain invalid URI characters. + # + # source://uri//lib/uri/common.rb#207 + def parse(uri); end + + # source://uri//lib/uri/common.rb#25 + def parser=(parser = T.unsafe(nil)); end + + # == Synopsis + # + # URI::regexp([match_schemes]) + # + # == Args + # + # +match_schemes+:: + # Array of schemes. If given, resulting regexp matches to URIs + # whose scheme is one of the match_schemes. + # + # == Description + # + # Returns a Regexp object which matches to URI-like strings. + # The Regexp object returned by this method includes arbitrary + # number of capture group (parentheses). Never rely on its number. + # + # == Usage + # + # require 'uri' + # + # # extract first URI from html_string + # html_string.slice(URI.regexp) + # + # # remove ftp URIs + # html_string.sub(URI.regexp(['ftp']), '') + # + # # You should not rely on the number of parentheses + # html_string.scan(URI.regexp) do |*matches| + # p $& + # end + # + # source://uri//lib/uri/common.rb#299 + def regexp(schemes = T.unsafe(nil)); end + + # Registers the given +klass+ as the class to be instantiated + # when parsing a \URI with the given +scheme+: + # + # URI.register_scheme('MS_SEARCH', URI::Generic) # => URI::Generic + # URI.scheme_list['MS_SEARCH'] # => URI::Generic + # + # Note that after calling String#upcase on +scheme+, it must be a valid + # constant name. + # + # source://uri//lib/uri/common.rb#102 + def register_scheme(scheme, klass); end + + # Returns a hash of the defined schemes: + # + # URI.scheme_list + # # => + # {"MAILTO"=>URI::MailTo, + # "LDAPS"=>URI::LDAPS, + # "WS"=>URI::WS, + # "HTTP"=>URI::HTTP, + # "HTTPS"=>URI::HTTPS, + # "LDAP"=>URI::LDAP, + # "FILE"=>URI::File, + # "FTP"=>URI::FTP} + # + # Related: URI.register_scheme. + # + # source://uri//lib/uri/common.rb#120 + def scheme_list; end + + # Returns a 9-element array representing the parts of the \URI + # formed from the string +uri+; + # each array element is a string or +nil+: + # + # names = %w[scheme userinfo host port registry path opaque query fragment] + # values = URI.split('https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top') + # names.zip(values) + # # => + # [["scheme", "https"], + # ["userinfo", "john.doe"], + # ["host", "www.example.com"], + # ["port", "123"], + # ["registry", nil], + # ["path", "/forum/questions/"], + # ["opaque", nil], + # ["query", "tag=networking&order=newest"], + # ["fragment", "top"]] + # + # source://uri//lib/uri/common.rb#193 + def split(uri); end + + private + + # @raise [ArgumentError] + # + # source://uri//lib/uri/common.rb#420 + def _decode_uri_component(regexp, str, enc); end + + # source://uri//lib/uri/common.rb#406 + def _encode_uri_component(regexp, table, str, enc); end + end +end + +# FTP URI syntax is defined by RFC1738 section 3.2. +# +# This class will be redesigned because of difference of implementations; +# the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it +# is a good summary about the de facto spec. +# https://datatracker.ietf.org/doc/html/draft-hoffman-ftp-uri-04 +# +# source://uri//lib/uri/ftp.rb#22 +class URI::FTP < ::URI::Generic + # == Description + # + # Creates a new URI::FTP object from generic URL components with no + # syntax checking. + # + # Unlike build(), this method does not escape the path component as + # required by RFC1738; instead it is treated as per RFC2396. + # + # Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+, + # +opaque+, +query+, and +fragment+, in that order. + # + # @raise [InvalidURIError] + # @return [FTP] a new instance of FTP + # + # source://uri//lib/uri/ftp.rb#133 + def initialize(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = T.unsafe(nil), arg_check = T.unsafe(nil)); end + + # source://uri//lib/uri/ftp.rb#214 + def merge(oth); end + + # Returns the path from an FTP URI. + # + # RFC 1738 specifically states that the path for an FTP URI does not + # include the / which separates the URI path from the URI host. Example: + # + # ftp://ftp.example.com/pub/ruby + # + # The above URI indicates that the client should connect to + # ftp.example.com then cd to pub/ruby from the initial login directory. + # + # If you want to cd to an absolute directory, you must include an + # escaped / (%2F) in the path. Example: + # + # ftp://ftp.example.com/%2Fpub/ruby + # + # This method will then return "/pub/ruby". + # + # source://uri//lib/uri/ftp.rb#240 + def path; end + + # Returns a String representation of the URI::FTP. + # + # source://uri//lib/uri/ftp.rb#251 + def to_s; end + + # typecode accessor. + # + # See URI::FTP::COMPONENT. + # + # source://uri//lib/uri/ftp.rb#161 + def typecode; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the typecode +v+ + # (with validation). + # + # See also URI::FTP.check_typecode. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("ftp://john@ftp.example.com/my_file.img") + # #=> # + # uri.typecode = "i" + # uri + # #=> # + # + # source://uri//lib/uri/ftp.rb#208 + def typecode=(typecode); end + + protected + + # Private setter for the path of the URI::FTP. + # + # source://uri//lib/uri/ftp.rb#245 + def set_path(v); end + + # Private setter for the typecode +v+. + # + # See also URI::FTP.typecode=. + # + # source://uri//lib/uri/ftp.rb#180 + def set_typecode(v); end + + private + + # Validates typecode +v+, + # returns +true+ or +false+. + # + # source://uri//lib/uri/ftp.rb#166 + def check_typecode(v); end + + class << self + # == Description + # + # Creates a new URI::FTP object from components, with syntax checking. + # + # The components accepted are +userinfo+, +host+, +port+, +path+, and + # +typecode+. + # + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. + # + # If an Array is used, the components must be passed in the + # order [userinfo, host, port, path, typecode]. + # + # If the path supplied is absolute, it will be escaped in order to + # make it absolute in the URI. + # + # Examples: + # + # require 'uri' + # + # uri1 = URI::FTP.build(['user:password', 'ftp.example.com', nil, + # '/path/file.zip', 'i']) + # uri1.to_s # => "ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=i" + # + # uri2 = URI::FTP.build({:host => 'ftp.example.com', + # :path => 'ruby/src'}) + # uri2.to_s # => "ftp://ftp.example.com/ruby/src" + # + # source://uri//lib/uri/ftp.rb#96 + def build(args); end + + # source://uri//lib/uri/ftp.rb#47 + def new2(user, password, host, port, path, typecode = T.unsafe(nil), arg_check = T.unsafe(nil)); end + end +end + +# The "file" URI is defined by RFC8089. +# +# source://uri//lib/uri/file.rb#10 +class URI::File < ::URI::Generic + # raise InvalidURIError + # + # @raise [URI::InvalidURIError] + # + # source://uri//lib/uri/file.rb#82 + def check_password(user); end + + # raise InvalidURIError + # + # @raise [URI::InvalidURIError] + # + # source://uri//lib/uri/file.rb#77 + def check_user(user); end + + # raise InvalidURIError + # + # @raise [URI::InvalidURIError] + # + # source://uri//lib/uri/file.rb#72 + def check_userinfo(user); end + + # Protected setter for the host component +v+. + # + # See also URI::Generic.host=. + # + # source://uri//lib/uri/file.rb#62 + def set_host(v); end + + # do nothing + # + # source://uri//lib/uri/file.rb#95 + def set_password(v); end + + # do nothing + # + # source://uri//lib/uri/file.rb#68 + def set_port(v); end + + # do nothing + # + # source://uri//lib/uri/file.rb#91 + def set_user(v); end + + # do nothing + # + # source://uri//lib/uri/file.rb#87 + def set_userinfo(v); end + + class << self + # == Description + # + # Creates a new URI::File object from components, with syntax checking. + # + # The components accepted are +host+ and +path+. + # + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. + # + # If an Array is used, the components must be passed in the + # order [host, path]. + # + # A path from e.g. the File class should be escaped before + # being passed. + # + # Examples: + # + # require 'uri' + # + # uri1 = URI::File.build(['host.example.com', '/path/file.zip']) + # uri1.to_s # => "file://host.example.com/path/file.zip" + # + # uri2 = URI::File.build({:host => 'host.example.com', + # :path => '/ruby/src'}) + # uri2.to_s # => "file://host.example.com/ruby/src" + # + # uri3 = URI::File.build({:path => URI::escape('/path/my file.txt')}) + # uri3.to_s # => "file:///path/my%20file.txt" + # + # source://uri//lib/uri/file.rb#53 + def build(args); end + end +end + +# An Array of the available components for URI::File. +# +# source://uri//lib/uri/file.rb#17 +URI::File::COMPONENT = T.let(T.unsafe(nil), Array) + +# A Default port of nil for URI::File. +# +# source://uri//lib/uri/file.rb#12 +URI::File::DEFAULT_PORT = T.let(T.unsafe(nil), T.untyped) + +# Base class for all URI classes. +# Implements generic URI syntax as per RFC 2396. +# +# source://uri//lib/uri/generic.rb#21 +class URI::Generic + include ::URI + + # == Args + # + # +scheme+:: + # Protocol scheme, i.e. 'http','ftp','mailto' and so on. + # +userinfo+:: + # User name and password, i.e. 'sdmitry:bla'. + # +host+:: + # Server host name. + # +port+:: + # Server port. + # +registry+:: + # Registry of naming authorities. + # +path+:: + # Path on server. + # +opaque+:: + # Opaque part. + # +query+:: + # Query data. + # +fragment+:: + # Part of the URI after '#' character. + # +parser+:: + # Parser for internal use [URI::DEFAULT_PARSER by default]. + # +arg_check+:: + # Check arguments [false by default]. + # + # == Description + # + # Creates a new URI::Generic instance from ``generic'' components without check. + # + # @return [Generic] a new instance of Generic + # + # source://uri//lib/uri/generic.rb#169 + def initialize(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = T.unsafe(nil), arg_check = T.unsafe(nil)); end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Merges two URIs. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.merge("/main.rbx?page=1") + # # => "http://my.example.com/main.rbx?page=1" + # merge + # + # source://uri//lib/uri/generic.rb#1109 + def +(oth); end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Calculates relative path from oth to self. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse('http://my.example.com/main.rbx?page=1') + # uri.route_from('http://my.example.com') + # #=> # + # + # source://uri//lib/uri/generic.rb#1262 + def -(oth); end + + # Compares two URIs. + # + # source://uri//lib/uri/generic.rb#1387 + def ==(oth); end + + # Returns true if URI has a scheme (e.g. http:// or https://) specified. + # + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#972 + def absolute; end + + # Returns true if URI has a scheme (e.g. http:// or https://) specified. + # + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#972 + def absolute?; end + + # == Args + # + # +v+:: + # URI or String + # + # == Description + # + # Attempts to parse other URI +oth+, + # returns [parsed_oth, self]. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.coerce("http://foo.com") + # #=> [#, #] + # + # source://uri//lib/uri/generic.rb#1464 + def coerce(oth); end + + # Components of the URI in the order. + # + # source://uri//lib/uri/generic.rb#313 + def component; end + + # Returns the password component after URI decoding. + # + # source://uri//lib/uri/generic.rb#583 + def decoded_password; end + + # Returns the user component after URI decoding. + # + # source://uri//lib/uri/generic.rb#578 + def decoded_user; end + + # Returns default port. + # + # source://uri//lib/uri/generic.rb#39 + def default_port; end + + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#1399 + def eql?(oth); end + + # Returns a proxy URI. + # The proxy URI is obtained from environment variables such as http_proxy, + # ftp_proxy, no_proxy, etc. + # If there is no proper proxy, nil is returned. + # + # If the optional parameter +env+ is specified, it is used instead of ENV. + # + # Note that capitalized variables (HTTP_PROXY, FTP_PROXY, NO_PROXY, etc.) + # are examined, too. + # + # But http_proxy and HTTP_PROXY is treated specially under CGI environment. + # It's because HTTP_PROXY may be set by Proxy: header. + # So HTTP_PROXY is not used. + # http_proxy is not used too if the variable is case insensitive. + # CGI_HTTP_PROXY can be used instead. + # + # @raise [BadURIError] + # + # source://uri//lib/uri/generic.rb#1490 + def find_proxy(env = T.unsafe(nil)); end + + # Returns the fragment component of the URI. + # + # URI("http://foo/bar/baz?search=FooBar#ponies").fragment #=> "ponies" + # + # source://uri//lib/uri/generic.rb#283 + def fragment; end + + # Checks the fragment +v+ component against the URI::Parser Regexp for :FRAGMENT. + # + # + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the fragment component +v+ + # (with validation). + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com/?id=25#time=1305212049") + # uri.fragment = "time=1305212086" + # uri.to_s #=> "http://my.example.com/?id=25#time=1305212086" + # + # source://uri//lib/uri/generic.rb#929 + def fragment=(v); end + + # source://uri//lib/uri/generic.rb#1395 + def hash; end + + # Returns true if URI is hierarchical. + # + # == Description + # + # URI has components listed in order of decreasing significance from left to right, + # see RFC3986 https://www.rfc-editor.org/rfc/rfc3986 1.2.3. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com/") + # uri.hierarchical? + # #=> true + # uri = URI.parse("mailto:joe@example.com") + # uri.hierarchical? + # #=> false + # + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#961 + def hierarchical?; end + + # Returns the host component of the URI. + # + # URI("http://foo/bar/baz").host #=> "foo" + # + # It returns nil if no host component exists. + # + # URI("mailto:foo@example.org").host #=> nil + # + # The component does not contain the port number. + # + # URI("http://foo:8080/bar/baz").host #=> "foo" + # + # Since IPv6 addresses are wrapped with brackets in URIs, + # this method returns IPv6 addresses wrapped with brackets. + # This form is not appropriate to pass to socket methods such as TCPSocket.open. + # If unwrapped host names are required, use the #hostname method. + # + # URI("http://[::1]/bar/baz").host #=> "[::1]" + # URI("http://[::1]/bar/baz").hostname #=> "::1" + # + # source://uri//lib/uri/generic.rb#243 + def host; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the host component +v+ + # (with validation). + # + # See also URI::Generic.check_host. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.host = "foo.com" + # uri.to_s #=> "http://foo.com" + # + # source://uri//lib/uri/generic.rb#639 + def host=(v); end + + # Extract the host part of the URI and unwrap brackets for IPv6 addresses. + # + # This method is the same as URI::Generic#host except + # brackets for IPv6 (and future IP) addresses are removed. + # + # uri = URI("http://[::1]/bar") + # uri.hostname #=> "::1" + # uri.host #=> "[::1]" + # + # source://uri//lib/uri/generic.rb#654 + def hostname; end + + # Sets the host part of the URI as the argument with brackets for IPv6 addresses. + # + # This method is the same as URI::Generic#host= except + # the argument can be a bare IPv6 address. + # + # uri = URI("http://foo/bar") + # uri.hostname = "::1" + # uri.to_s #=> "http://[::1]/bar" + # + # If the argument seems to be an IPv6 address, + # it is wrapped with brackets. + # + # source://uri//lib/uri/generic.rb#671 + def hostname=(v); end + + # source://uri//lib/uri/generic.rb#1441 + def inspect; end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Merges two URIs. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.merge("/main.rbx?page=1") + # # => "http://my.example.com/main.rbx?page=1" + # + # source://uri//lib/uri/generic.rb#1109 + def merge(oth); end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Destructive form of #merge. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.merge!("/main.rbx?page=1") + # uri.to_s # => "http://my.example.com/main.rbx?page=1" + # + # source://uri//lib/uri/generic.rb#1081 + def merge!(oth); end + + # Returns normalized URI. + # + # require 'uri' + # + # URI("HTTP://my.EXAMPLE.com").normalize + # #=> # + # + # Normalization here means: + # + # * scheme and host are converted to lowercase, + # * an empty path component is set to "/". + # + # source://uri//lib/uri/generic.rb#1319 + def normalize; end + + # Destructive version of #normalize. + # + # source://uri//lib/uri/generic.rb#1328 + def normalize!; end + + # Returns the opaque part of the URI. + # + # URI("mailto:foo@example.org").opaque #=> "foo@example.org" + # URI("http://foo/bar/baz").opaque #=> nil + # + # The portion of the path that does not make use of the slash '/'. + # The path typically refers to an absolute path or an opaque part. + # (See RFC2396 Section 3 and 5.2.) + # + # source://uri//lib/uri/generic.rb#277 + def opaque; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the opaque component +v+ + # (with validation). + # + # See also URI::Generic.check_opaque. + # + # source://uri//lib/uri/generic.rb#901 + def opaque=(v); end + + # Returns the parser to be used. + # + # Unless a URI::Parser is defined, DEFAULT_PARSER is used. + # + # source://uri//lib/uri/generic.rb#289 + def parser; end + + # Returns the password component (without URI decoding). + # + # source://uri//lib/uri/generic.rb#573 + def password; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the +password+ component + # (with validation). + # + # See also URI::Generic.check_password. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://john:S3nsit1ve@my.example.com") + # uri.password = "V3ry_S3nsit1ve" + # uri.to_s #=> "http://john:V3ry_S3nsit1ve@my.example.com" + # + # source://uri//lib/uri/generic.rb#498 + def password=(password); end + + # Returns the path component of the URI. + # + # URI("http://foo/bar/baz").path #=> "/bar/baz" + # + # source://uri//lib/uri/generic.rb#260 + def path; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the path component +v+ + # (with validation). + # + # See also URI::Generic.check_path. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com/pub/files") + # uri.path = "/faq/" + # uri.to_s #=> "http://my.example.com/faq/" + # + # source://uri//lib/uri/generic.rb#815 + def path=(v); end + + # Returns the port component of the URI. + # + # URI("http://foo/bar/baz").port #=> 80 + # URI("http://foo:8080/bar/baz").port #=> 8080 + # + # source://uri//lib/uri/generic.rb#250 + def port; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the port component +v+ + # (with validation). + # + # See also URI::Generic.check_port. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.port = 8080 + # uri.to_s #=> "http://my.example.com:8080" + # + # source://uri//lib/uri/generic.rb#729 + def port=(v); end + + # Returns the query component of the URI. + # + # URI("http://foo/bar/baz?search=FooBar").query #=> "search=FooBar" + # + # source://uri//lib/uri/generic.rb#266 + def query; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the query component +v+. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com/?id=25") + # uri.query = "id=1" + # uri.to_s #=> "http://my.example.com/?id=1" + # + # @raise [InvalidURIError] + # + # source://uri//lib/uri/generic.rb#839 + def query=(v); end + + # source://uri//lib/uri/generic.rb#252 + def registry; end + + # @raise [InvalidURIError] + # + # source://uri//lib/uri/generic.rb#745 + def registry=(v); end + + # Returns true if URI does not have a scheme (e.g. http:// or https://) specified. + # + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#984 + def relative?; end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Calculates relative path from oth to self. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse('http://my.example.com/main.rbx?page=1') + # uri.route_from('http://my.example.com') + # #=> # + # + # source://uri//lib/uri/generic.rb#1262 + def route_from(oth); end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Calculates relative path to oth from self. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse('http://my.example.com') + # uri.route_to('http://my.example.com/main.rbx?page=1') + # #=> # + # + # source://uri//lib/uri/generic.rb#1302 + def route_to(oth); end + + # Returns the scheme component of the URI. + # + # URI("http://foo/bar/baz").scheme #=> "http" + # + # source://uri//lib/uri/generic.rb#221 + def scheme; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the scheme component +v+ + # (with validation). + # + # See also URI::Generic.check_scheme. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.scheme = "https" + # uri.to_s #=> "https://my.example.com" + # + # source://uri//lib/uri/generic.rb#360 + def scheme=(v); end + + # == Args + # + # +components+:: + # Multiple Symbol arguments defined in URI::HTTP. + # + # == Description + # + # Selects specified components from URI. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse('http://myuser:mypass@my.example.com/test.rbx') + # uri.select(:userinfo, :host, :path) + # # => ["myuser:mypass", "my.example.com", "/test.rbx"] + # + # source://uri//lib/uri/generic.rb#1430 + def select(*components); end + + # Constructs String from URI. + # + # source://uri//lib/uri/generic.rb#1343 + def to_s; end + + # Constructs String from URI. + # + # source://uri//lib/uri/generic.rb#1343 + def to_str; end + + # Returns the user component (without URI decoding). + # + # source://uri//lib/uri/generic.rb#568 + def user; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the +user+ component + # (with validation). + # + # See also URI::Generic.check_user. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://john:S3nsit1ve@my.example.com") + # uri.user = "sam" + # uri.to_s #=> "http://sam:V3ry_S3nsit1ve@my.example.com" + # + # source://uri//lib/uri/generic.rb#471 + def user=(user); end + + # Returns the userinfo, either as 'user' or 'user:password'. + # + # source://uri//lib/uri/generic.rb#557 + def userinfo; end + + # Sets userinfo, argument is string like 'name:pass'. + # + # source://uri//lib/uri/generic.rb#441 + def userinfo=(userinfo); end + + protected + + # Returns an Array of the components defined from the COMPONENT Array. + # + # source://uri//lib/uri/generic.rb#1406 + def component_ary; end + + # Protected setter for the host component +v+. + # + # See also URI::Generic.host=. + # + # source://uri//lib/uri/generic.rb#613 + def set_host(v); end + + # Protected setter for the opaque component +v+. + # + # See also URI::Generic.opaque=. + # + # source://uri//lib/uri/generic.rb#883 + def set_opaque(v); end + + # Protected setter for the password component +v+. + # + # See also URI::Generic.password=. + # + # source://uri//lib/uri/generic.rb#534 + def set_password(v); end + + # Protected setter for the path component +v+. + # + # See also URI::Generic.path=. + # + # source://uri//lib/uri/generic.rb#789 + def set_path(v); end + + # Protected setter for the port component +v+. + # + # See also URI::Generic.port=. + # + # source://uri//lib/uri/generic.rb#702 + def set_port(v); end + + # @raise [InvalidURIError] + # + # source://uri//lib/uri/generic.rb#740 + def set_registry(v); end + + # Protected setter for the scheme component +v+. + # + # See also URI::Generic.scheme=. + # + # source://uri//lib/uri/generic.rb#334 + def set_scheme(v); end + + # Protected setter for the user component +v+. + # + # See also URI::Generic.user=. + # + # source://uri//lib/uri/generic.rb#524 + def set_user(v); end + + # Protected setter for the +user+ component, and +password+ if available + # (with validation). + # + # See also URI::Generic.userinfo=. + # + # source://uri//lib/uri/generic.rb#509 + def set_userinfo(user, password = T.unsafe(nil)); end + + private + + # Checks the host +v+ component for RFC2396 compliance + # and against the URI::Parser Regexp for :HOST. + # + # Can not have a registry or opaque component defined, + # with a host component defined. + # + # source://uri//lib/uri/generic.rb#594 + def check_host(v); end + + # Checks the opaque +v+ component for RFC2396 compliance and + # against the URI::Parser Regexp for :OPAQUE. + # + # Can not have a host, port, user, or path component defined, + # with an opaque component defined. + # + # source://uri//lib/uri/generic.rb#861 + def check_opaque(v); end + + # Checks the password +v+ component for RFC2396 compliance + # and against the URI::Parser Regexp for :USERINFO. + # + # Can not have a registry or opaque component defined, + # with a user component defined. + # + # source://uri//lib/uri/generic.rb#417 + def check_password(v, user = T.unsafe(nil)); end + + # Checks the path +v+ component for RFC2396 compliance + # and against the URI::Parser Regexp + # for :ABS_PATH and :REL_PATH. + # + # Can not have a opaque component defined, + # with a path component defined. + # + # source://uri//lib/uri/generic.rb#757 + def check_path(v); end + + # Checks the port +v+ component for RFC2396 compliance + # and against the URI::Parser Regexp for :PORT. + # + # Can not have a registry or opaque component defined, + # with a port component defined. + # + # source://uri//lib/uri/generic.rb#683 + def check_port(v); end + + # @raise [InvalidURIError] + # + # source://uri//lib/uri/generic.rb#735 + def check_registry(v); end + + # Checks the scheme +v+ component against the URI::Parser Regexp for :SCHEME. + # + # source://uri//lib/uri/generic.rb#320 + def check_scheme(v); end + + # Checks the user +v+ component for RFC2396 compliance + # and against the URI::Parser Regexp for :USERINFO. + # + # Can not have a registry or opaque component defined, + # with a user component defined. + # + # source://uri//lib/uri/generic.rb#393 + def check_user(v); end + + # Checks the +user+ and +password+. + # + # If +password+ is not provided, then +user+ is + # split, using URI::Generic.split_userinfo, to + # pull +user+ and +password. + # + # See also URI::Generic.check_user, URI::Generic.check_password. + # + # source://uri//lib/uri/generic.rb#375 + def check_userinfo(user, password = T.unsafe(nil)); end + + # Escapes 'user:password' +v+ based on RFC 1738 section 3.1. + # + # source://uri//lib/uri/generic.rb#551 + def escape_userpass(v); end + + # Merges a base path +base+, with relative path +rel+, + # returns a modified base path. + # + # source://uri//lib/uri/generic.rb#1000 + def merge_path(base, rel); end + + # Replaces self by other URI object. + # + # source://uri//lib/uri/generic.rb#299 + def replace!(oth); end + + # :stopdoc: + # + # source://uri//lib/uri/generic.rb#1194 + def route_from0(oth); end + + # :stopdoc: + # + # source://uri//lib/uri/generic.rb#1155 + def route_from_path(src, dst); end + + # Returns an Array of the path split on '/'. + # + # source://uri//lib/uri/generic.rb#991 + def split_path(path); end + + # Returns the userinfo +ui+ as [user, password] + # if properly formatted as 'user:password'. + # + # source://uri//lib/uri/generic.rb#542 + def split_userinfo(ui); end + + class << self + # == Synopsis + # + # See ::new. + # + # == Description + # + # Creates a new URI::Generic instance from components of URI::Generic + # with check. Components are: scheme, userinfo, host, port, registry, path, + # opaque, query, and fragment. You can provide arguments either by an Array or a Hash. + # See ::new for hash keys to use or for order of array items. + # + # source://uri//lib/uri/generic.rb#116 + def build(args); end + + # == Synopsis + # + # See ::new. + # + # == Description + # + # At first, tries to create a new URI::Generic instance using + # URI::Generic::build. But, if exception URI::InvalidComponentError is raised, + # then it does URI::Escape.escape all URI components and tries again. + # + # source://uri//lib/uri/generic.rb#78 + def build2(args); end + + # Components of the URI in the order. + # + # source://uri//lib/uri/generic.rb#57 + def component; end + + # Returns default port. + # + # source://uri//lib/uri/generic.rb#32 + def default_port; end + + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#1556 + def use_proxy?(hostname, addr, port, no_proxy); end + + # source://uri//lib/uri/generic.rb#63 + def use_registry; end + end +end + +# The syntax of HTTP URIs is defined in RFC1738 section 3.3. +# +# Note that the Ruby URI library allows HTTP URLs containing usernames and +# passwords. This is not legal as per the RFC, but used to be +# supported in Internet Explorer 5 and 6, before the MS04-004 security +# update. See . +# +# source://uri//lib/uri/http.rb#22 +class URI::HTTP < ::URI::Generic + # == Description + # + # Returns the authority for an HTTP uri, as defined in + # https://www.rfc-editor.org/rfc/rfc3986#section-3.2. + # + # + # Example: + # + # URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').authority #=> "www.example.com" + # URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').authority #=> "www.example.com:8000" + # URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').authority #=> "www.example.com" + # + # source://uri//lib/uri/http.rb#97 + def authority; end + + # == Description + # + # Returns the origin for an HTTP uri, as defined in + # https://www.rfc-editor.org/rfc/rfc6454. + # + # + # Example: + # + # URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').origin #=> "http://www.example.com" + # URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').origin #=> "http://www.example.com:8000" + # URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').origin #=> "http://www.example.com" + # URI::HTTPS.build(host: 'www.example.com', path: '/foo/bar').origin #=> "https://www.example.com" + # + # source://uri//lib/uri/http.rb#119 + def origin; end + + # == Description + # + # Returns the full path for an HTTP request, as required by Net::HTTP::Get. + # + # If the URI contains a query, the full path is URI#path + '?' + URI#query. + # Otherwise, the path is simply URI#path. + # + # Example: + # + # uri = URI::HTTP.build(path: '/foo/bar', query: 'test=true') + # uri.request_uri # => "/foo/bar?test=true" + # + # source://uri//lib/uri/http.rb#77 + def request_uri; end + + class << self + # == Description + # + # Creates a new URI::HTTP object from components, with syntax checking. + # + # The components accepted are userinfo, host, port, path, query, and + # fragment. + # + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. + # + # If an Array is used, the components must be passed in the + # order [userinfo, host, port, path, query, fragment]. + # + # Example: + # + # uri = URI::HTTP.build(host: 'www.example.com', path: '/foo/bar') + # + # uri = URI::HTTP.build([nil, "www.example.com", nil, "/path", + # "query", 'fragment']) + # + # Currently, if passed userinfo components this method generates + # invalid HTTP URIs as per RFC 1738. + # + # source://uri//lib/uri/http.rb#59 + def build(args); end + end +end + +# source://uri//lib/uri/common.rb#126 +URI::INITIAL_SCHEMES = T.let(T.unsafe(nil), Hash) + +# LDAP URI SCHEMA (described in RFC2255). +# -- +# ldap:///[?[?[?[?]]]] +# ++ +# +# source://uri//lib/uri/ldap.rb#23 +class URI::LDAP < ::URI::Generic + # == Description + # + # Creates a new URI::LDAP object from generic URI components as per + # RFC 2396. No LDAP-specific syntax checking is performed. + # + # Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+, + # +opaque+, +query+, and +fragment+, in that order. + # + # Example: + # + # uri = URI::LDAP.new("ldap", nil, "ldap.example.com", nil, nil, + # "/dc=example;dc=com", nil, "query", nil) + # + # See also URI::Generic.new. + # + # @return [LDAP] a new instance of LDAP + # + # source://uri//lib/uri/ldap.rb#108 + def initialize(*arg); end + + # Returns attributes. + # + # source://uri//lib/uri/ldap.rb#178 + def attributes; end + + # Setter for attributes +val+. + # + # source://uri//lib/uri/ldap.rb#191 + def attributes=(val); end + + # Returns dn. + # + # source://uri//lib/uri/ldap.rb#159 + def dn; end + + # Setter for dn +val+. + # + # source://uri//lib/uri/ldap.rb#172 + def dn=(val); end + + # Returns extensions. + # + # source://uri//lib/uri/ldap.rb#235 + def extensions; end + + # Setter for extensions +val+. + # + # source://uri//lib/uri/ldap.rb#248 + def extensions=(val); end + + # Returns filter. + # + # source://uri//lib/uri/ldap.rb#216 + def filter; end + + # Setter for filter +val+. + # + # source://uri//lib/uri/ldap.rb#229 + def filter=(val); end + + # Checks if URI has a path. + # For URI::LDAP this will return +false+. + # + # @return [Boolean] + # + # source://uri//lib/uri/ldap.rb#255 + def hierarchical?; end + + # Returns scope. + # + # source://uri//lib/uri/ldap.rb#197 + def scope; end + + # Setter for scope +val+. + # + # source://uri//lib/uri/ldap.rb#210 + def scope=(val); end + + protected + + # Private setter for attributes +val+. + # + # source://uri//lib/uri/ldap.rb#183 + def set_attributes(val); end + + # Private setter for dn +val+. + # + # source://uri//lib/uri/ldap.rb#164 + def set_dn(val); end + + # Private setter for extensions +val+. + # + # source://uri//lib/uri/ldap.rb#240 + def set_extensions(val); end + + # Private setter for filter +val+. + # + # source://uri//lib/uri/ldap.rb#221 + def set_filter(val); end + + # Private setter for scope +val+. + # + # source://uri//lib/uri/ldap.rb#202 + def set_scope(val); end + + private + + # Private method to assemble +query+ from +attributes+, +scope+, +filter+, and +extensions+. + # + # source://uri//lib/uri/ldap.rb#146 + def build_path_query; end + + # Private method to cleanup +dn+ from using the +path+ component attribute. + # + # @raise [InvalidURIError] + # + # source://uri//lib/uri/ldap.rb#120 + def parse_dn; end + + # Private method to cleanup +attributes+, +scope+, +filter+, and +extensions+ + # from using the +query+ component attribute. + # + # source://uri//lib/uri/ldap.rb#128 + def parse_query; end + + class << self + # == Description + # + # Creates a new URI::LDAP object from components, with syntax checking. + # + # The components accepted are host, port, dn, attributes, + # scope, filter, and extensions. + # + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. + # + # If an Array is used, the components must be passed in the + # order [host, port, dn, attributes, scope, filter, extensions]. + # + # Example: + # + # uri = URI::LDAP.build({:host => 'ldap.example.com', + # :dn => '/dc=example'}) + # + # uri = URI::LDAP.build(["ldap.example.com", nil, + # "/dc=example;dc=com", "query", nil, nil, nil]) + # + # source://uri//lib/uri/ldap.rb#74 + def build(args); end + end +end + +# RFC6068, the mailto URL scheme. +# +# source://uri//lib/uri/mailto.rb#17 +class URI::MailTo < ::URI::Generic + include ::URI::RFC2396_REGEXP + + # == Description + # + # Creates a new URI::MailTo object from generic URL components with + # no syntax checking. + # + # This method is usually called from URI::parse, which checks + # the validity of each component. + # + # @return [MailTo] a new instance of MailTo + # + # source://uri//lib/uri/mailto.rb#132 + def initialize(*arg); end + + # E-mail headers set by the URL, as an Array of Arrays. + # + # source://uri//lib/uri/mailto.rb#166 + def headers; end + + # Setter for headers +v+. + # + # source://uri//lib/uri/mailto.rb#232 + def headers=(v); end + + # The primary e-mail address of the URL, as a String. + # + # source://uri//lib/uri/mailto.rb#163 + def to; end + + # Setter for to +v+. + # + # source://uri//lib/uri/mailto.rb#200 + def to=(v); end + + # Returns the RFC822 e-mail text equivalent of the URL, as a String. + # + # Example: + # + # require 'uri' + # + # uri = URI.parse("mailto:ruby-list@ruby-lang.org?Subject=subscribe&cc=myaddr") + # uri.to_mailtext + # # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n" + # + # source://uri//lib/uri/mailto.rb#268 + def to_mailtext; end + + # Returns the RFC822 e-mail text equivalent of the URL, as a String. + # + # Example: + # + # require 'uri' + # + # uri = URI.parse("mailto:ruby-list@ruby-lang.org?Subject=subscribe&cc=myaddr") + # uri.to_mailtext + # # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n" + # + # source://uri//lib/uri/mailto.rb#268 + def to_rfc822text; end + + # Constructs String from URI. + # + # source://uri//lib/uri/mailto.rb#239 + def to_s; end + + protected + + # Private setter for headers +v+. + # + # source://uri//lib/uri/mailto.rb#221 + def set_headers(v); end + + # Private setter for to +v+. + # + # source://uri//lib/uri/mailto.rb#194 + def set_to(v); end + + private + + # Checks the headers +v+ component against either + # * HEADER_REGEXP + # + # source://uri//lib/uri/mailto.rb#208 + def check_headers(v); end + + # Checks the to +v+ component. + # + # source://uri//lib/uri/mailto.rb#169 + def check_to(v); end + + class << self + # == Description + # + # Creates a new URI::MailTo object from components, with syntax checking. + # + # Components can be provided as an Array or Hash. If an Array is used, + # the components must be supplied as [to, headers]. + # + # If a Hash is used, the keys are the component names preceded by colons. + # + # The headers can be supplied as a pre-encoded string, such as + # "subject=subscribe&cc=address", or as an Array of Arrays + # like [['subject', 'subscribe'], ['cc', 'address']]. + # + # Examples: + # + # require 'uri' + # + # m1 = URI::MailTo.build(['joe@example.com', 'subject=Ruby']) + # m1.to_s # => "mailto:joe@example.com?subject=Ruby" + # + # m2 = URI::MailTo.build(['john@example.com', [['Subject', 'Ruby'], ['Cc', 'jack@example.com']]]) + # m2.to_s # => "mailto:john@example.com?Subject=Ruby&Cc=jack@example.com" + # + # m3 = URI::MailTo.build({:to => 'listman@example.com', :headers => [['subject', 'subscribe']]}) + # m3.to_s # => "mailto:listman@example.com?subject=subscribe" + # + # source://uri//lib/uri/mailto.rb#85 + def build(args); end + end +end + +# Class that parses String's into URI's. +# +# It contains a Hash set of patterns and Regexp's that match and validate. +# +# source://uri//lib/uri/rfc2396_parser.rb#64 +class URI::RFC2396_Parser + include ::URI::RFC2396_REGEXP + + # == Synopsis + # + # URI::Parser.new([opts]) + # + # == Args + # + # The constructor accepts a hash as options for parser. + # Keys of options are pattern names of URI components + # and values of options are pattern strings. + # The constructor generates set of regexps for parsing URIs. + # + # You can use the following keys: + # + # * :ESCAPED (URI::PATTERN::ESCAPED in default) + # * :UNRESERVED (URI::PATTERN::UNRESERVED in default) + # * :DOMLABEL (URI::PATTERN::DOMLABEL in default) + # * :TOPLABEL (URI::PATTERN::TOPLABEL in default) + # * :HOSTNAME (URI::PATTERN::HOSTNAME in default) + # + # == Examples + # + # p = URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})") + # u = p.parse("http://example.jp/%uABCD") #=> # + # URI.parse(u.to_s) #=> raises URI::InvalidURIError + # + # s = "http://example.com/ABCD" + # u1 = p.parse(s) #=> # + # u2 = URI.parse(s) #=> # + # u1 == u2 #=> true + # u1.eql?(u2) #=> false + # + # @return [RFC2396_Parser] a new instance of RFC2396_Parser + # + # source://uri//lib/uri/rfc2396_parser.rb#99 + def initialize(opts = T.unsafe(nil)); end + + # :call-seq: + # escape( str ) + # escape( str, unsafe ) + # + # == Args + # + # +str+:: + # String to make safe + # +unsafe+:: + # Regexp to apply. Defaults to +self.regexp[:UNSAFE]+ + # + # == Description + # + # Constructs a safe String from +str+, removing unsafe characters, + # replacing them with codes. + # + # source://uri//lib/uri/rfc2396_parser.rb#287 + def escape(str, unsafe = T.unsafe(nil)); end + + # :call-seq: + # extract( str ) + # extract( str, schemes ) + # extract( str, schemes ) {|item| block } + # + # == Args + # + # +str+:: + # String to search + # +schemes+:: + # Patterns to apply to +str+ + # + # == Description + # + # Attempts to parse and merge a set of URIs. + # If no +block+ given, then returns the result, + # else it calls +block+ for each element in result. + # + # See also URI::Parser.make_regexp. + # + # source://uri//lib/uri/rfc2396_parser.rb#249 + def extract(str, schemes = T.unsafe(nil)); end + + # source://uri//lib/uri/rfc2396_parser.rb#326 + def inspect; end + + # == Args + # + # +uris+:: + # an Array of Strings + # + # == Description + # + # Attempts to parse and merge a set of URIs. + # + # source://uri//lib/uri/rfc2396_parser.rb#223 + def join(*uris); end + + # Returns Regexp that is default +self.regexp[:ABS_URI_REF]+, + # unless +schemes+ is provided. Then it is a Regexp.union with +self.pattern[:X_ABS_URI]+. + # + # source://uri//lib/uri/rfc2396_parser.rb#262 + def make_regexp(schemes = T.unsafe(nil)); end + + # == Args + # + # +uri+:: + # String + # + # == Description + # + # Parses +uri+ and constructs either matching URI scheme object + # (File, FTP, HTTP, HTTPS, LDAP, LDAPS, or MailTo) or URI::Generic. + # + # == Usage + # + # p = URI::Parser.new + # p.parse("ldap://ldap.example.com/dc=example?user=john") + # #=> # + # + # source://uri//lib/uri/rfc2396_parser.rb#209 + def parse(uri); end + + # The Hash of patterns. + # + # See also URI::Parser.initialize_pattern. + # + # source://uri//lib/uri/rfc2396_parser.rb#112 + def pattern; end + + # The Hash of Regexp. + # + # See also URI::Parser.initialize_regexp. + # + # source://uri//lib/uri/rfc2396_parser.rb#117 + def regexp; end + + # Returns a split URI against +regexp[:ABS_URI]+. + # + # source://uri//lib/uri/rfc2396_parser.rb#120 + def split(uri); end + + # :call-seq: + # unescape( str ) + # unescape( str, escaped ) + # + # == Args + # + # +str+:: + # String to remove escapes from + # +escaped+:: + # Regexp to apply. Defaults to +self.regexp[:ESCAPED]+ + # + # == Description + # + # Removes escapes from +str+. + # + # source://uri//lib/uri/rfc2396_parser.rb#318 + def unescape(str, escaped = T.unsafe(nil)); end + + private + + # source://uri//lib/uri/rfc2396_parser.rb#527 + def convert_to_uri(uri); end + + # Constructs the default Hash of patterns. + # + # source://uri//lib/uri/rfc2396_parser.rb#338 + def initialize_pattern(opts = T.unsafe(nil)); end + + # Constructs the default Hash of Regexp's. + # + # source://uri//lib/uri/rfc2396_parser.rb#496 + def initialize_regexp(pattern); end +end + +# source://uri//lib/uri/rfc3986_parser.rb#3 +class URI::RFC3986_Parser + # @return [RFC3986_Parser] a new instance of RFC3986_Parser + # + # source://uri//lib/uri/rfc3986_parser.rb#73 + def initialize; end + + # Compatibility for RFC2396 parser + # + # source://uri//lib/uri/rfc3986_parser.rb#156 + def escape(str, unsafe = T.unsafe(nil)); end + + # Compatibility for RFC2396 parser + # + # source://uri//lib/uri/rfc3986_parser.rb#144 + def extract(str, schemes = T.unsafe(nil), &block); end + + # source://uri//lib/uri/rfc3986_parser.rb#169 + def inspect; end + + # source://uri//lib/uri/rfc3986_parser.rb#138 + def join(*uris); end + + # Compatibility for RFC2396 parser + # + # source://uri//lib/uri/rfc3986_parser.rb#150 + def make_regexp(schemes = T.unsafe(nil)); end + + # source://uri//lib/uri/rfc3986_parser.rb#134 + def parse(uri); end + + # Returns the value of attribute regexp. + # + # source://uri//lib/uri/rfc3986_parser.rb#71 + def regexp; end + + # source://uri//lib/uri/rfc3986_parser.rb#77 + def split(uri); end + + # Compatibility for RFC2396 parser + # + # source://uri//lib/uri/rfc3986_parser.rb#162 + def unescape(str, escaped = T.unsafe(nil)); end + + private + + # source://uri//lib/uri/rfc3986_parser.rb#194 + def convert_to_uri(uri); end + + # source://uri//lib/uri/rfc3986_parser.rb#180 + def default_regexp; end +end + +# source://uri//lib/uri/rfc3986_parser.rb#33 +URI::RFC3986_Parser::FRAGMENT = T.let(T.unsafe(nil), String) + +# URI defined in RFC3986 +# +# source://uri//lib/uri/rfc3986_parser.rb#5 +URI::RFC3986_Parser::HOST = T.let(T.unsafe(nil), Regexp) + +# source://uri//lib/uri/rfc3986_parser.rb#54 +URI::RFC3986_Parser::RFC3986_relative_ref = T.let(T.unsafe(nil), Regexp) + +# source://uri//lib/uri/rfc3986_parser.rb#30 +URI::RFC3986_Parser::SCHEME = T.let(T.unsafe(nil), String) + +# source://uri//lib/uri/rfc3986_parser.rb#31 +URI::RFC3986_Parser::SEG = T.let(T.unsafe(nil), String) + +# source://uri//lib/uri/rfc3986_parser.rb#32 +URI::RFC3986_Parser::SEG_NC = T.let(T.unsafe(nil), String) + +# source://uri//lib/uri/rfc3986_parser.rb#28 +URI::RFC3986_Parser::USERINFO = T.let(T.unsafe(nil), Regexp) + +# source://uri//lib/uri/common.rb#90 +module URI::Schemes; end + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::FILE = URI::File + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::FTP = URI::FTP + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::HTTP = URI::HTTP + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::HTTPS = URI::HTTPS + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::LDAP = URI::LDAP + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::LDAPS = URI::LDAPS + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::MAILTO = URI::MailTo + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::SOURCE = URI::Source + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::WS = URI::WS + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::WSS = URI::WSS + +class URI::Source < ::URI::File + # source://tapioca/0.15.1/lib/tapioca/helpers/source_uri.rb#58 + sig { params(v: T.nilable(::String)).returns(T::Boolean) } + def check_host(v); end + + # source://uri//lib/uri/generic.rb#243 + def gem_name; end + + # source://tapioca/0.15.1/lib/tapioca/helpers/source_uri.rb#25 + sig { returns(T.nilable(::String)) } + def gem_version; end + + # source://uri//lib/uri/generic.rb#283 + def line_number; end + + # source://tapioca/0.15.1/lib/tapioca/helpers/source_uri.rb#51 + sig { params(v: T.nilable(::String)).void } + def set_path(v); end + + # source://tapioca/0.15.1/lib/tapioca/helpers/source_uri.rb#70 + sig { returns(::String) } + def to_s; end + + class << self + # source://tapioca/0.15.1/lib/tapioca/helpers/source_uri.rb#38 + sig do + params( + gem_name: ::String, + gem_version: T.nilable(::String), + path: ::String, + line_number: T.nilable(::String) + ).returns(::URI::Source) + end + def build(gem_name:, gem_version:, path:, line_number:); end + end +end + +# source://uri//lib/uri/common.rb#308 +URI::TBLENCURICOMP_ = T.let(T.unsafe(nil), Hash) + +# source://uri//lib/uri/common.rb#58 +module URI::Util + private + + # source://uri//lib/uri/common.rb#59 + def make_components_hash(klass, array_hash); end + + class << self + # source://uri//lib/uri/common.rb#59 + def make_components_hash(klass, array_hash); end + end +end + +# The syntax of WS URIs is defined in RFC6455 section 3. +# +# Note that the Ruby URI library allows WS URLs containing usernames and +# passwords. This is not legal as per the RFC, but used to be +# supported in Internet Explorer 5 and 6, before the MS04-004 security +# update. See . +# +# source://uri//lib/uri/ws.rb#22 +class URI::WS < ::URI::Generic + # == Description + # + # Returns the full path for a WS URI, as required by Net::HTTP::Get. + # + # If the URI contains a query, the full path is URI#path + '?' + URI#query. + # Otherwise, the path is simply URI#path. + # + # Example: + # + # uri = URI::WS.build(path: '/foo/bar', query: 'test=true') + # uri.request_uri # => "/foo/bar?test=true" + # + # source://uri//lib/uri/ws.rb#74 + def request_uri; end + + class << self + # == Description + # + # Creates a new URI::WS object from components, with syntax checking. + # + # The components accepted are userinfo, host, port, path, and query. + # + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. + # + # If an Array is used, the components must be passed in the + # order [userinfo, host, port, path, query]. + # + # Example: + # + # uri = URI::WS.build(host: 'www.example.com', path: '/foo/bar') + # + # uri = URI::WS.build([nil, "www.example.com", nil, "/path", "query"]) + # + # Currently, if passed userinfo components this method generates + # invalid WS URIs as per RFC 1738. + # + # source://uri//lib/uri/ws.rb#56 + def build(args); end + end +end + +# The default port for WSS URIs is 443, and the scheme is 'wss:' rather +# than 'ws:'. Other than that, WSS URIs are identical to WS URIs; +# see URI::WS. +# +# source://uri//lib/uri/wss.rb#17 +class URI::WSS < ::URI::WS; end + +# A Default port of 443 for URI::WSS +# +# source://uri//lib/uri/wss.rb#19 +URI::WSS::DEFAULT_PORT = T.let(T.unsafe(nil), Integer) diff --git a/lib/resource_registry.rb b/lib/resource_registry.rb index 54132e7..f34487b 100644 --- a/lib/resource_registry.rb +++ b/lib/resource_registry.rb @@ -8,12 +8,15 @@ require "public/versions" require "public/versions/version" require "public/entity_finder" +require "public/resource_struct_builder" +require "public/registry" +require "public/serializer" +require "public/repositories/base" +require "schema_registry/registry" require "schema_registry/json_schema_mapper" require "schema_registry/maybe" require "schema_registry/generate_from_struct" require "runtime_generic" -require "public/resource_struct_builder" -require "public/registry" # Entry point for ResourceRegistry module ResourceRegistry diff --git a/lib/schema_generator.rb b/lib/schema_generator.rb deleted file mode 100644 index e12cbc2..0000000 --- a/lib/schema_generator.rb +++ /dev/null @@ -1,34 +0,0 @@ -# typed: strict - -require_relative "./schema_registry/generate_from_struct" - -module ResourceRegistry - class SchemaGenerator - extend T::Sig - - Repository = - T.type_alias { T.class_of(ResourceRegistry::Repositories::Base) } - - sig do - params(repository: Repository).returns(T.nilable(SchemaRegistry::Schema)) - end - def generate(repository:) - struct_klass = ResourceRegistry::EntityFinder.call(repository: repository) - return nil unless struct_klass - - definition = - SchemaRegistry::GenerateFromStruct.new(struct_klass: struct_klass).call - SchemaRegistry::JsonSchemaMapper.new( - namespace: repository.namespace, - definition: definition - ).call - end - - private - - sig { params(repo: Repository).returns(Symbol) } - def identifier_from_repo(repo) - "#{repo.namespace.underscore}.#{T.must(repo.name).underscore.singularize}".to_sym - end - end -end diff --git a/resource_registry.gemspec b/resource_registry.gemspec index 5d24fa9..efc9e85 100644 --- a/resource_registry.gemspec +++ b/resource_registry.gemspec @@ -1,19 +1,21 @@ Gem::Specification.new do |s| - s.name = 'resource_registry' - s.version = '0.0.0' - s.summary = 'Resource Registry' - s.description = 'A declarative approach to define resources and their relationships' - s.authors = ['Genar Trias Ortiz'] - s.email = 'genar.factorial@factorial.co' - s.files = ['lib/resource_registry.rb', 'lib/public/repositories/base.rb', 'rbi/resource_registry.rbi'] - s.homepage = - 'https://rubygems.org/gems/resource_registry' - s.license = 'MIT' - s.add_dependency 'sorbet-coerce', '>= 0.2.6' - # s.add_runtime_dependency 'sorbet-runtime-stub', '0.2.0' - s.add_development_dependency 'sorbet', '0.5.11609' - s.add_runtime_dependency 'activesupport', '>= 7.1.3' - s.add_runtime_dependency 'dry-inflector', '>= 0.1.2' - s.add_runtime_dependency 'sorbet-runtime', '0.5.11609' - # s.add_development_dependency 'tapioca' + s.name = "resource_registry" + s.version = "0.0.0" + s.summary = "Resource Registry" + s.description = + "A declarative approach to define resources and their relationships" + s.authors = ["Genar Trias Ortiz"] + s.email = "genar.factorial@factorial.co" + s.files = %w[ + lib/resource_registry.rb + lib/public/repositories/base.rb + rbi/resource_registry.rbi + ] + s.homepage = "https://rubygems.org/gems/resource_registry" + s.license = "MIT" + s.required_ruby_version = ">= 3.0" + s.add_development_dependency "sorbet", "0.5.11670" + s.add_runtime_dependency "sorbet-runtime", "0.5.11670" + s.add_dependency "sorbet-coerce", "~> 0.7" + s.add_runtime_dependency "activesupport", ">= 7.1.3" end diff --git a/sorbet/rbi/annotations/activesupport.rbi b/sorbet/rbi/annotations/activesupport.rbi index 716210d..20a88d3 100644 --- a/sorbet/rbi/annotations/activesupport.rbi +++ b/sorbet/rbi/annotations/activesupport.rbi @@ -437,12 +437,15 @@ class String end class ActiveSupport::ErrorReporter + # @version >= 7.1.0.beta1 sig { type_parameters(:Block, :Fallback).params(error_classes: T.class_of(Exception), severity: T.nilable(Symbol), context: T.nilable(T::Hash[Symbol, T.untyped]), fallback: T.nilable(T.proc.returns(T.type_parameter(:Fallback))), source: T.nilable(String), blk: T.proc.returns(T.type_parameter(:Block))).returns(T.any(T.type_parameter(:Block), T.type_parameter(:Fallback))) } def handle(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), fallback: T.unsafe(nil), source: T.unsafe(nil), &blk); end + # @version >= 7.1.0.beta1 sig { type_parameters(:Block).params(error_classes: T.class_of(Exception), severity: T.nilable(Symbol), context: T.nilable(T::Hash[Symbol, T.untyped]), source: T.nilable(String), blk: T.proc.returns(T.type_parameter(:Block))).returns(T.type_parameter(:Block)) } def record(*error_classes, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil), &blk); end + # @version >= 7.1.0.beta1 sig { params(error: Exception, handled: T::Boolean, severity: T.nilable(Symbol), context: T::Hash[Symbol, T.untyped], source: T.nilable(String)).void } def report(error, handled: true, severity: T.unsafe(nil), context: T.unsafe(nil), source: T.unsafe(nil)); end diff --git a/sorbet/rbi/dsl/.gitattributes b/sorbet/rbi/dsl/.gitattributes new file mode 100644 index 0000000..d9bb82a --- /dev/null +++ b/sorbet/rbi/dsl/.gitattributes @@ -0,0 +1 @@ +**/*.rbi linguist-generated=true diff --git a/sorbet/rbi/dsl/active_support/callbacks.rbi b/sorbet/rbi/dsl/active_support/callbacks.rbi new file mode 100644 index 0000000..15ee6be --- /dev/null +++ b/sorbet/rbi/dsl/active_support/callbacks.rbi @@ -0,0 +1,21 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for dynamic methods in `ActiveSupport::Callbacks`. +# Please instead update this file by running `bin/tapioca dsl ActiveSupport::Callbacks`. + + +module ActiveSupport::Callbacks + include GeneratedInstanceMethods + + mixes_in_class_methods GeneratedClassMethods + + module GeneratedClassMethods + def __callbacks; end + def __callbacks=(value); end + end + + module GeneratedInstanceMethods + def __callbacks; end + end +end diff --git a/sorbet/rbi/gems/benchmark@0.3.0.rbi b/sorbet/rbi/gems/benchmark@0.4.0.rbi similarity index 100% rename from sorbet/rbi/gems/benchmark@0.3.0.rbi rename to sorbet/rbi/gems/benchmark@0.4.0.rbi diff --git a/sorbet/rbi/gems/minitest@5.25.1.rbi b/sorbet/rbi/gems/minitest@5.25.2.rbi similarity index 100% rename from sorbet/rbi/gems/minitest@5.25.1.rbi rename to sorbet/rbi/gems/minitest@5.25.2.rbi diff --git a/sorbet/rbi/gems/rspec-expectations@3.13.1.rbi b/sorbet/rbi/gems/rspec-expectations@3.13.1.rbi new file mode 100644 index 0000000..f3dd6e5 --- /dev/null +++ b/sorbet/rbi/gems/rspec-expectations@3.13.1.rbi @@ -0,0 +1,9 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `rspec-expectations` gem. +# Please instead update this file by running `bin/tapioca gem rspec-expectations`. + + +# THIS IS AN EMPTY RBI FILE. +# see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem diff --git a/sorbet/rbi/gems/securerandom@0.3.1.rbi b/sorbet/rbi/gems/securerandom@0.3.1.rbi deleted file mode 100644 index 6e8b28c..0000000 --- a/sorbet/rbi/gems/securerandom@0.3.1.rbi +++ /dev/null @@ -1,73 +0,0 @@ -# typed: true - -# DO NOT EDIT MANUALLY -# This is an autogenerated file for types exported from the `securerandom` gem. -# Please instead update this file by running `bin/tapioca gem securerandom`. - - -# == Secure random number generator interface. -# -# This library is an interface to secure random number generators which are -# suitable for generating session keys in HTTP cookies, etc. -# -# You can use this library in your application by requiring it: -# -# require 'securerandom' -# -# It supports the following secure random number generators: -# -# * openssl -# * /dev/urandom -# * Win32 -# -# SecureRandom is extended by the Random::Formatter module which -# defines the following methods: -# -# * alphanumeric -# * base64 -# * choose -# * gen_random -# * hex -# * rand -# * random_bytes -# * random_number -# * urlsafe_base64 -# * uuid -# -# These methods are usable as class methods of SecureRandom such as -# +SecureRandom.hex+. -# -# If a secure random number generator is not available, -# +NotImplementedError+ is raised. -module SecureRandom - extend ::Random::Formatter - - class << self - # Returns a random binary string containing +size+ bytes. - # - # See Random.bytes - # - # source://securerandom//securerandom.rb#50 - def bytes(n); end - - # source://securerandom//securerandom.rb#64 - def gen_random(n); end - - private - - # Implementation using OpenSSL - # - # source://securerandom//securerandom.rb#59 - def gen_random_openssl(n); end - - # Implementation using system random device - # - # source://securerandom//securerandom.rb#64 - def gen_random_urandom(n); end - end -end - -# The version -# -# source://securerandom//securerandom.rb#44 -SecureRandom::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/securerandom@0.3.2.rbi b/sorbet/rbi/gems/securerandom@0.3.2.rbi new file mode 100644 index 0000000..3bd41bc --- /dev/null +++ b/sorbet/rbi/gems/securerandom@0.3.2.rbi @@ -0,0 +1,395 @@ +# typed: false + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `securerandom` gem. +# Please instead update this file by running `bin/tapioca gem securerandom`. + + +class Random::Base + include ::Random::Formatter + extend ::Random::Formatter + + def initialize(*_arg0); end + + def bytes(_arg0); end + def rand(*_arg0); end + def seed; end +end + +# == \Random number formatter. +# +# Formats generated random numbers in many manners. When 'random/formatter' +# is required, several methods are added to empty core module Random::Formatter, +# making them available as Random's instance and module methods. +# +# Standard library SecureRandom is also extended with the module, and the methods +# described below are available as a module methods in it. +# +# === Examples +# +# Generate random hexadecimal strings: +# +# require 'random/formatter' +# +# prng = Random.new +# prng.hex(10) #=> "52750b30ffbc7de3b362" +# prng.hex(10) #=> "92b15d6c8dc4beb5f559" +# prng.hex(13) #=> "39b290146bea6ce975c37cfc23" +# # or just +# Random.hex #=> "1aed0c631e41be7f77365415541052ee" +# +# Generate random base64 strings: +# +# prng.base64(10) #=> "EcmTPZwWRAozdA==" +# prng.base64(10) #=> "KO1nIU+p9DKxGg==" +# prng.base64(12) #=> "7kJSM/MzBJI+75j8" +# Random.base64(4) #=> "bsQ3fQ==" +# +# Generate random binary strings: +# +# prng.random_bytes(10) #=> "\016\t{\370g\310pbr\301" +# prng.random_bytes(10) #=> "\323U\030TO\234\357\020\a\337" +# Random.random_bytes(6) #=> "\xA1\xE6Lr\xC43" +# +# Generate alphanumeric strings: +# +# prng.alphanumeric(10) #=> "S8baxMJnPl" +# prng.alphanumeric(10) #=> "aOxAg8BAJe" +# Random.alphanumeric #=> "TmP9OsJHJLtaZYhP" +# +# Generate UUIDs: +# +# prng.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594" +# prng.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab" +# Random.uuid #=> "f14e0271-de96-45cc-8911-8910292a42cd" +# +# All methods are available in the standard library SecureRandom, too: +# +# SecureRandom.hex #=> "05b45376a30c67238eb93b16499e50cf" +# +# source://securerandom//lib/random/formatter.rb#55 +module Random::Formatter + # Generate a random alphanumeric string. + # + # The argument _n_ specifies the length, in characters, of the alphanumeric + # string to be generated. + # The argument _chars_ specifies the character list which the result is + # consist of. + # + # If _n_ is not specified or is nil, 16 is assumed. + # It may be larger in the future. + # + # The result may contain A-Z, a-z and 0-9, unless _chars_ is specified. + # + # require 'random/formatter' + # + # Random.alphanumeric #=> "2BuBuLf3WfSKyQbR" + # # or + # prng = Random.new + # prng.alphanumeric(10) #=> "i6K93NdqiH" + # + # Random.alphanumeric(4, chars: [*"0".."9"]) #=> "2952" + # # or + # prng = Random.new + # prng.alphanumeric(10, chars: [*"!".."/"]) #=> ",.,++%/''." + # + # source://securerandom//lib/random/formatter.rb#368 + def alphanumeric(n = T.unsafe(nil), chars: T.unsafe(nil)); end + + # Generate a random base64 string. + # + # The argument _n_ specifies the length, in bytes, of the random number + # to be generated. The length of the result string is about 4/3 of _n_. + # + # If _n_ is not specified or is nil, 16 is assumed. + # It may be larger in the future. + # + # The result may contain A-Z, a-z, 0-9, "+", "/" and "=". + # + # require 'random/formatter' + # + # Random.base64 #=> "/2BuBuLf3+WfSKyQbRcc/A==" + # # or + # prng = Random.new + # prng.base64 #=> "6BbW0pxO0YENxn38HMUbcQ==" + # + # See RFC 3548 for the definition of base64. + # + # source://securerandom//lib/random/formatter.rb#115 + def base64(n = T.unsafe(nil)); end + + # Generate a random hexadecimal string. + # + # The argument _n_ specifies the length, in bytes, of the random number to be generated. + # The length of the resulting hexadecimal string is twice of _n_. + # + # If _n_ is not specified or is nil, 16 is assumed. + # It may be larger in the future. + # + # The result may contain 0-9 and a-f. + # + # require 'random/formatter' + # + # Random.hex #=> "eb693ec8252cd630102fd0d0fb7c3485" + # # or + # prng = Random.new + # prng.hex #=> "91dc3bfb4de5b11d029d376634589b61" + # + # source://securerandom//lib/random/formatter.rb#93 + def hex(n = T.unsafe(nil)); end + + # Generate a random binary string. + # + # The argument _n_ specifies the length of the result string. + # + # If _n_ is not specified or is nil, 16 is assumed. + # It may be larger in future. + # + # The result may contain any byte: "\x00" - "\xff". + # + # require 'random/formatter' + # + # Random.random_bytes #=> "\xD8\\\xE0\xF4\r\xB2\xFC*WM\xFF\x83\x18\xF45\xB6" + # # or + # prng = Random.new + # prng.random_bytes #=> "m\xDC\xFC/\a\x00Uf\xB2\xB2P\xBD\xFF6S\x97" + # + # source://securerandom//lib/random/formatter.rb#72 + def random_bytes(n = T.unsafe(nil)); end + + # Generate a random URL-safe base64 string. + # + # The argument _n_ specifies the length, in bytes, of the random number + # to be generated. The length of the result string is about 4/3 of _n_. + # + # If _n_ is not specified or is nil, 16 is assumed. + # It may be larger in the future. + # + # The boolean argument _padding_ specifies the padding. + # If it is false or nil, padding is not generated. + # Otherwise padding is generated. + # By default, padding is not generated because "=" may be used as a URL delimiter. + # + # The result may contain A-Z, a-z, 0-9, "-" and "_". + # "=" is also used if _padding_ is true. + # + # require 'random/formatter' + # + # Random.urlsafe_base64 #=> "b4GOKm4pOYU_-BOXcrUGDg" + # # or + # prng = Random.new + # prng.urlsafe_base64 #=> "UZLdOkzop70Ddx-IJR0ABg" + # + # prng.urlsafe_base64(nil, true) #=> "i0XQ-7gglIsHGV2_BNPrdQ==" + # prng.urlsafe_base64(nil, true) #=> "-M8rLhr7JEpJlqFGUMmOxg==" + # + # See RFC 3548 for the definition of URL-safe base64. + # + # source://securerandom//lib/random/formatter.rb#146 + def urlsafe_base64(n = T.unsafe(nil), padding = T.unsafe(nil)); end + + # Generate a random v4 UUID (Universally Unique IDentifier). + # + # require 'random/formatter' + # + # Random.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594" + # Random.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab" + # # or + # prng = Random.new + # prng.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b" + # + # The version 4 UUID is purely random (except the version). + # It doesn't contain meaningful information such as MAC addresses, timestamps, etc. + # + # The result contains 122 random bits (15.25 random bytes). + # + # See RFC9562[https://www.rfc-editor.org/rfc/rfc9562] for details of UUIDv4. + # + # source://securerandom//lib/random/formatter.rb#170 + def uuid; end + + # Generate a random v4 UUID (Universally Unique IDentifier). + # + # require 'random/formatter' + # + # Random.uuid #=> "2d931510-d99f-494a-8c67-87feb05e1594" + # Random.uuid #=> "bad85eb9-0713-4da7-8d36-07a8e4b00eab" + # # or + # prng = Random.new + # prng.uuid #=> "62936e70-1815-439b-bf89-8492855a7e6b" + # + # The version 4 UUID is purely random (except the version). + # It doesn't contain meaningful information such as MAC addresses, timestamps, etc. + # + # The result contains 122 random bits (15.25 random bytes). + # + # See RFC9562[https://www.rfc-editor.org/rfc/rfc9562] for details of UUIDv4. + # + # source://securerandom//lib/random/formatter.rb#170 + def uuid_v4; end + + # Generate a random v7 UUID (Universally Unique IDentifier). + # + # require 'random/formatter' + # + # Random.uuid_v7 # => "0188d4c3-1311-7f96-85c7-242a7aa58f1e" + # Random.uuid_v7 # => "0188d4c3-16fe-744f-86af-38fa04c62bb5" + # Random.uuid_v7 # => "0188d4c3-1af8-764f-b049-c204ce0afa23" + # Random.uuid_v7 # => "0188d4c3-1e74-7085-b14f-ef6415dc6f31" + # # |<--sorted-->| |<----- random ---->| + # + # # or + # prng = Random.new + # prng.uuid_v7 # => "0188ca51-5e72-7950-a11d-def7ff977c98" + # + # The version 7 UUID starts with the least significant 48 bits of a 64 bit + # Unix timestamp (milliseconds since the epoch) and fills the remaining bits + # with random data, excluding the version and variant bits. + # + # This allows version 7 UUIDs to be sorted by creation time. Time ordered + # UUIDs can be used for better database index locality of newly inserted + # records, which may have a significant performance benefit compared to random + # data inserts. + # + # The result contains 74 random bits (9.25 random bytes). + # + # Note that this method cannot be made reproducible because its output + # includes not only random bits but also timestamp. + # + # See RFC9562[https://www.rfc-editor.org/rfc/rfc9562] for details of UUIDv7. + # + # ==== Monotonicity + # + # UUIDv7 has millisecond precision by default, so multiple UUIDs created + # within the same millisecond are not issued in monotonically increasing + # order. To create UUIDs that are time-ordered with sub-millisecond + # precision, up to 12 bits of additional timestamp may added with + # +extra_timestamp_bits+. The extra timestamp precision comes at the expense + # of random bits. Setting extra_timestamp_bits: 12 provides ~244ns + # of precision, but only 62 random bits (7.75 random bytes). + # + # prng = Random.new + # Array.new(4) { prng.uuid_v7(extra_timestamp_bits: 12) } + # # => + # ["0188d4c7-13da-74f9-8b53-22a786ffdd5a", + # "0188d4c7-13da-753b-83a5-7fb9b2afaeea", + # "0188d4c7-13da-754a-88ea-ac0baeedd8db", + # "0188d4c7-13da-7557-83e1-7cad9cda0d8d"] + # # |<--- sorted --->| |<-- random --->| + # + # Array.new(4) { prng.uuid_v7(extra_timestamp_bits: 8) } + # # => + # ["0188d4c7-3333-7a95-850a-de6edb858f7e", + # "0188d4c7-3333-7ae8-842e-bc3a8b7d0cf9", # <- out of order + # "0188d4c7-3333-7ae2-995a-9f135dc44ead", # <- out of order + # "0188d4c7-3333-7af9-87c3-8f612edac82e"] + # # |<--- sorted -->||<---- random --->| + # + # Any rollbacks of the system clock will break monotonicity. UUIDv7 is based + # on UTC, which excludes leap seconds and can rollback the clock. To avoid + # this, the system clock can synchronize with an NTP server configured to use + # a "leap smear" approach. NTP or PTP will also be needed to synchronize + # across distributed nodes. + # + # Counters and other mechanisms for stronger guarantees of monotonicity are + # not implemented. Applications with stricter requirements should follow + # {Section 6.2}[https://www.rfc-editor.org/rfc/rfc9562.html#name-monotonicity-and-counters] + # of the specification. + # + # source://securerandom//lib/random/formatter.rb#247 + def uuid_v7(extra_timestamp_bits: T.unsafe(nil)); end + + private + + # Generate a string that randomly draws from a + # source array of characters. + # + # The argument _source_ specifies the array of characters from which + # to generate the string. + # The argument _n_ specifies the length, in characters, of the string to be + # generated. + # + # The result may contain whatever characters are in the source array. + # + # require 'random/formatter' + # + # prng.choose([*'l'..'r'], 16) #=> "lmrqpoonmmlqlron" + # prng.choose([*'0'..'9'], 5) #=> "27309" + # + # source://securerandom//lib/random/formatter.rb#313 + def choose(source, n); end + + # Internal interface to Random; Generate random data _n_ bytes. + # + # source://securerandom//lib/random/formatter.rb#295 + def gen_random(n); end +end + +# == Secure random number generator interface. +# +# This library is an interface to secure random number generators which are +# suitable for generating session keys in HTTP cookies, etc. +# +# You can use this library in your application by requiring it: +# +# require 'securerandom' +# +# It supports the following secure random number generators: +# +# * openssl +# * /dev/urandom +# * Win32 +# +# SecureRandom is extended by the Random::Formatter module which +# defines the following methods: +# +# * alphanumeric +# * base64 +# * choose +# * gen_random +# * hex +# * rand +# * random_bytes +# * random_number +# * urlsafe_base64 +# * uuid +# +# These methods are usable as class methods of SecureRandom such as +# +SecureRandom.hex+. +# +# If a secure random number generator is not available, +# +NotImplementedError+ is raised. +# +# source://securerandom//lib/securerandom.rb#41 +module SecureRandom + extend ::Random::Formatter + + class << self + # Returns a random binary string containing +size+ bytes. + # + # See Random.bytes + # + # source://securerandom//lib/securerandom.rb#50 + def bytes(n); end + + # source://securerandom//lib/securerandom.rb#64 + def gen_random(n); end + + private + + # Implementation using OpenSSL + # + # source://securerandom//lib/securerandom.rb#59 + def gen_random_openssl(n); end + + # Implementation using system random device + # + # source://securerandom//lib/securerandom.rb#64 + def gen_random_urandom(n); end + end +end + +# The version +# +# source://securerandom//lib/securerandom.rb#44 +SecureRandom::VERSION = T.let(T.unsafe(nil), String) diff --git a/sorbet/rbi/gems/uri@1.0.2.rbi b/sorbet/rbi/gems/uri@1.0.2.rbi new file mode 100644 index 0000000..63b9a7f --- /dev/null +++ b/sorbet/rbi/gems/uri@1.0.2.rbi @@ -0,0 +1,2377 @@ +# typed: true + +# DO NOT EDIT MANUALLY +# This is an autogenerated file for types exported from the `uri` gem. +# Please instead update this file by running `bin/tapioca gem uri`. + + +# module URI +# +# source://uri//lib/uri/common.rb#852 +module Kernel + private + + # Returns a \URI object derived from the given +uri+, + # which may be a \URI string or an existing \URI object: + # + # # Returns a new URI. + # uri = URI('http://github.com/ruby/ruby') + # # => # + # # Returns the given URI. + # URI(uri) + # # => # + # + # source://uri//lib/uri/common.rb#865 + def URI(uri); end + + class << self + # Returns a \URI object derived from the given +uri+, + # which may be a \URI string or an existing \URI object: + # + # # Returns a new URI. + # uri = URI('http://github.com/ruby/ruby') + # # => # + # # Returns the given URI. + # URI(uri) + # # => # + # + # source://uri//lib/uri/common.rb#865 + def URI(uri); end + end +end + +# source://uri//lib/uri.rb#90 +module URI + class << self + # source://uri//lib/uri/common.rb#43 + def const_missing(const); end + + # Like URI.decode_www_form_component, except that '+' is preserved. + # + # source://uri//lib/uri/common.rb#402 + def decode_uri_component(str, enc = T.unsafe(nil)); end + + # Returns name/value pairs derived from the given string +str+, + # which must be an ASCII string. + # + # The method may be used to decode the body of Net::HTTPResponse object +res+ + # for which res['Content-Type'] is 'application/x-www-form-urlencoded'. + # + # The returned data is an array of 2-element subarrays; + # each subarray is a name/value pair (both are strings). + # Each returned string has encoding +enc+, + # and has had invalid characters removed via + # {String#scrub}[https://docs.ruby-lang.org/en/master/String.html#method-i-scrub]. + # + # A simple example: + # + # URI.decode_www_form('foo=0&bar=1&baz') + # # => [["foo", "0"], ["bar", "1"], ["baz", ""]] + # + # The returned strings have certain conversions, + # similar to those performed in URI.decode_www_form_component: + # + # URI.decode_www_form('f%23o=%2F&b-r=%24&b+z=%40') + # # => [["f#o", "/"], ["b-r", "$"], ["b z", "@"]] + # + # The given string may contain consecutive separators: + # + # URI.decode_www_form('foo=0&&bar=1&&baz=2') + # # => [["foo", "0"], ["", ""], ["bar", "1"], ["", ""], ["baz", "2"]] + # + # A different separator may be specified: + # + # URI.decode_www_form('foo=0--bar=1--baz', separator: '--') + # # => [["foo", "0"], ["bar", "1"], ["baz", ""]] + # + # @raise [ArgumentError] + # + # source://uri//lib/uri/common.rb#577 + def decode_www_form(str, enc = T.unsafe(nil), separator: T.unsafe(nil), use__charset_: T.unsafe(nil), isindex: T.unsafe(nil)); end + + # Returns a string decoded from the given \URL-encoded string +str+. + # + # The given string is first encoded as Encoding::ASCII-8BIT (using String#b), + # then decoded (as below), and finally force-encoded to the given encoding +enc+. + # + # The returned string: + # + # - Preserves: + # + # - Characters '*', '.', '-', and '_'. + # - Character in ranges 'a'..'z', 'A'..'Z', + # and '0'..'9'. + # + # Example: + # + # URI.decode_www_form_component('*.-_azAZ09') + # # => "*.-_azAZ09" + # + # - Converts: + # + # - Character '+' to character ' '. + # - Each "percent notation" to an ASCII character. + # + # Example: + # + # URI.decode_www_form_component('Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A') + # # => "Here are some punctuation characters: ,;?:" + # + # Related: URI.decode_uri_component (preserves '+'). + # + # source://uri//lib/uri/common.rb#391 + def decode_www_form_component(str, enc = T.unsafe(nil)); end + + # Like URI.encode_www_form_component, except that ' ' (space) + # is encoded as '%20' (instead of '+'). + # + # source://uri//lib/uri/common.rb#397 + def encode_uri_component(str, enc = T.unsafe(nil)); end + + # Returns a URL-encoded string derived from the given + # {Enumerable}[https://docs.ruby-lang.org/en/master/Enumerable.html#module-Enumerable-label-Enumerable+in+Ruby+Classes] + # +enum+. + # + # The result is suitable for use as form data + # for an \HTTP request whose Content-Type is + # 'application/x-www-form-urlencoded'. + # + # The returned string consists of the elements of +enum+, + # each converted to one or more URL-encoded strings, + # and all joined with character '&'. + # + # Simple examples: + # + # URI.encode_www_form([['foo', 0], ['bar', 1], ['baz', 2]]) + # # => "foo=0&bar=1&baz=2" + # URI.encode_www_form({foo: 0, bar: 1, baz: 2}) + # # => "foo=0&bar=1&baz=2" + # + # The returned string is formed using method URI.encode_www_form_component, + # which converts certain characters: + # + # URI.encode_www_form('f#o': '/', 'b-r': '$', 'b z': '@') + # # => "f%23o=%2F&b-r=%24&b+z=%40" + # + # When +enum+ is Array-like, each element +ele+ is converted to a field: + # + # - If +ele+ is an array of two or more elements, + # the field is formed from its first two elements + # (and any additional elements are ignored): + # + # name = URI.encode_www_form_component(ele[0], enc) + # value = URI.encode_www_form_component(ele[1], enc) + # "#{name}=#{value}" + # + # Examples: + # + # URI.encode_www_form([%w[foo bar], %w[baz bat bah]]) + # # => "foo=bar&baz=bat" + # URI.encode_www_form([['foo', 0], ['bar', :baz, 'bat']]) + # # => "foo=0&bar=baz" + # + # - If +ele+ is an array of one element, + # the field is formed from ele[0]: + # + # URI.encode_www_form_component(ele[0]) + # + # Example: + # + # URI.encode_www_form([['foo'], [:bar], [0]]) + # # => "foo&bar&0" + # + # - Otherwise the field is formed from +ele+: + # + # URI.encode_www_form_component(ele) + # + # Example: + # + # URI.encode_www_form(['foo', :bar, 0]) + # # => "foo&bar&0" + # + # The elements of an Array-like +enum+ may be mixture: + # + # URI.encode_www_form([['foo', 0], ['bar', 1, 2], ['baz'], :bat]) + # # => "foo=0&bar=1&baz&bat" + # + # When +enum+ is Hash-like, + # each +key+/+value+ pair is converted to one or more fields: + # + # - If +value+ is + # {Array-convertible}[https://docs.ruby-lang.org/en/master/implicit_conversion_rdoc.html#label-Array-Convertible+Objects], + # each element +ele+ in +value+ is paired with +key+ to form a field: + # + # name = URI.encode_www_form_component(key, enc) + # value = URI.encode_www_form_component(ele, enc) + # "#{name}=#{value}" + # + # Example: + # + # URI.encode_www_form({foo: [:bar, 1], baz: [:bat, :bam, 2]}) + # # => "foo=bar&foo=1&baz=bat&baz=bam&baz=2" + # + # - Otherwise, +key+ and +value+ are paired to form a field: + # + # name = URI.encode_www_form_component(key, enc) + # value = URI.encode_www_form_component(value, enc) + # "#{name}=#{value}" + # + # Example: + # + # URI.encode_www_form({foo: 0, bar: 1, baz: 2}) + # # => "foo=0&bar=1&baz=2" + # + # The elements of a Hash-like +enum+ may be mixture: + # + # URI.encode_www_form({foo: [0, 1], bar: 2}) + # # => "foo=0&foo=1&bar=2" + # + # source://uri//lib/uri/common.rb#524 + def encode_www_form(enum, enc = T.unsafe(nil)); end + + # Returns a URL-encoded string derived from the given string +str+. + # + # The returned string: + # + # - Preserves: + # + # - Characters '*', '.', '-', and '_'. + # - Character in ranges 'a'..'z', 'A'..'Z', + # and '0'..'9'. + # + # Example: + # + # URI.encode_www_form_component('*.-_azAZ09') + # # => "*.-_azAZ09" + # + # - Converts: + # + # - Character ' ' to character '+'. + # - Any other character to "percent notation"; + # the percent notation for character c is '%%%X' % c.ord. + # + # Example: + # + # URI.encode_www_form_component('Here are some punctuation characters: ,;?:') + # # => "Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A" + # + # Encoding: + # + # - If +str+ has encoding Encoding::ASCII_8BIT, argument +enc+ is ignored. + # - Otherwise +str+ is converted first to Encoding::UTF_8 + # (with suitable character replacements), + # and then to encoding +enc+. + # + # In either case, the returned string has forced encoding Encoding::US_ASCII. + # + # Related: URI.encode_uri_component (encodes ' ' as '%20'). + # + # source://uri//lib/uri/common.rb#358 + def encode_www_form_component(str, enc = T.unsafe(nil)); end + + # == Synopsis + # + # URI::extract(str[, schemes][,&blk]) + # + # == Args + # + # +str+:: + # String to extract URIs from. + # +schemes+:: + # Limit URI matching to specific schemes. + # + # == Description + # + # Extracts URIs from a string. If block given, iterates through all matched URIs. + # Returns nil if block given or array with matches. + # + # == Usage + # + # require "uri" + # + # URI.extract("text here http://foo.example.org/bla and here mailto:test@example.com and here also.") + # # => ["http://foo.example.com/bla", "mailto:test@example.com"] + # + # source://uri//lib/uri/common.rb#262 + def extract(str, schemes = T.unsafe(nil), &block); end + + # Returns a new object constructed from the given +scheme+, +arguments+, + # and +default+: + # + # - The new object is an instance of URI.scheme_list[scheme.upcase]. + # - The object is initialized by calling the class initializer + # using +scheme+ and +arguments+. + # See URI::Generic.new. + # + # Examples: + # + # values = ['john.doe', 'www.example.com', '123', nil, '/forum/questions/', nil, 'tag=networking&order=newest', 'top'] + # URI.for('https', *values) + # # => # + # URI.for('foo', *values, default: URI::HTTP) + # # => # + # + # source://uri//lib/uri/common.rb#146 + def for(scheme, *arguments, default: T.unsafe(nil)); end + + # return encoding or nil + # http://encoding.spec.whatwg.org/#concept-encoding-get + # + # source://uri//lib/uri/common.rb#847 + def get_encoding(label); end + + # Merges the given URI strings +str+ + # per {RFC 2396}[https://www.rfc-editor.org/rfc/rfc2396.html]. + # + # Each string in +str+ is converted to an + # {RFC3986 URI}[https://www.rfc-editor.org/rfc/rfc3986.html] before being merged. + # + # Examples: + # + # URI.join("http://example.com/","main.rbx") + # # => # + # + # URI.join('http://example.com', 'foo') + # # => # + # + # URI.join('http://example.com', '/foo', '/bar') + # # => # + # + # URI.join('http://example.com', '/foo', 'bar') + # # => # + # + # URI.join('http://example.com', '/foo/', 'bar') + # # => # + # + # source://uri//lib/uri/common.rb#234 + def join(*str); end + + # Returns a new \URI object constructed from the given string +uri+: + # + # URI.parse('https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top') + # # => # + # URI.parse('http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top') + # # => # + # + # It's recommended to first ::escape string +uri+ + # if it may contain invalid URI characters. + # + # source://uri//lib/uri/common.rb#207 + def parse(uri); end + + # source://uri//lib/uri/common.rb#25 + def parser=(parser = T.unsafe(nil)); end + + # == Synopsis + # + # URI::regexp([match_schemes]) + # + # == Args + # + # +match_schemes+:: + # Array of schemes. If given, resulting regexp matches to URIs + # whose scheme is one of the match_schemes. + # + # == Description + # + # Returns a Regexp object which matches to URI-like strings. + # The Regexp object returned by this method includes arbitrary + # number of capture group (parentheses). Never rely on its number. + # + # == Usage + # + # require 'uri' + # + # # extract first URI from html_string + # html_string.slice(URI.regexp) + # + # # remove ftp URIs + # html_string.sub(URI.regexp(['ftp']), '') + # + # # You should not rely on the number of parentheses + # html_string.scan(URI.regexp) do |*matches| + # p $& + # end + # + # source://uri//lib/uri/common.rb#299 + def regexp(schemes = T.unsafe(nil)); end + + # Registers the given +klass+ as the class to be instantiated + # when parsing a \URI with the given +scheme+: + # + # URI.register_scheme('MS_SEARCH', URI::Generic) # => URI::Generic + # URI.scheme_list['MS_SEARCH'] # => URI::Generic + # + # Note that after calling String#upcase on +scheme+, it must be a valid + # constant name. + # + # source://uri//lib/uri/common.rb#102 + def register_scheme(scheme, klass); end + + # Returns a hash of the defined schemes: + # + # URI.scheme_list + # # => + # {"MAILTO"=>URI::MailTo, + # "LDAPS"=>URI::LDAPS, + # "WS"=>URI::WS, + # "HTTP"=>URI::HTTP, + # "HTTPS"=>URI::HTTPS, + # "LDAP"=>URI::LDAP, + # "FILE"=>URI::File, + # "FTP"=>URI::FTP} + # + # Related: URI.register_scheme. + # + # source://uri//lib/uri/common.rb#120 + def scheme_list; end + + # Returns a 9-element array representing the parts of the \URI + # formed from the string +uri+; + # each array element is a string or +nil+: + # + # names = %w[scheme userinfo host port registry path opaque query fragment] + # values = URI.split('https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top') + # names.zip(values) + # # => + # [["scheme", "https"], + # ["userinfo", "john.doe"], + # ["host", "www.example.com"], + # ["port", "123"], + # ["registry", nil], + # ["path", "/forum/questions/"], + # ["opaque", nil], + # ["query", "tag=networking&order=newest"], + # ["fragment", "top"]] + # + # source://uri//lib/uri/common.rb#193 + def split(uri); end + + private + + # @raise [ArgumentError] + # + # source://uri//lib/uri/common.rb#420 + def _decode_uri_component(regexp, str, enc); end + + # source://uri//lib/uri/common.rb#406 + def _encode_uri_component(regexp, table, str, enc); end + end +end + +# FTP URI syntax is defined by RFC1738 section 3.2. +# +# This class will be redesigned because of difference of implementations; +# the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it +# is a good summary about the de facto spec. +# https://datatracker.ietf.org/doc/html/draft-hoffman-ftp-uri-04 +# +# source://uri//lib/uri/ftp.rb#22 +class URI::FTP < ::URI::Generic + # == Description + # + # Creates a new URI::FTP object from generic URL components with no + # syntax checking. + # + # Unlike build(), this method does not escape the path component as + # required by RFC1738; instead it is treated as per RFC2396. + # + # Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+, + # +opaque+, +query+, and +fragment+, in that order. + # + # @raise [InvalidURIError] + # @return [FTP] a new instance of FTP + # + # source://uri//lib/uri/ftp.rb#133 + def initialize(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = T.unsafe(nil), arg_check = T.unsafe(nil)); end + + # source://uri//lib/uri/ftp.rb#214 + def merge(oth); end + + # Returns the path from an FTP URI. + # + # RFC 1738 specifically states that the path for an FTP URI does not + # include the / which separates the URI path from the URI host. Example: + # + # ftp://ftp.example.com/pub/ruby + # + # The above URI indicates that the client should connect to + # ftp.example.com then cd to pub/ruby from the initial login directory. + # + # If you want to cd to an absolute directory, you must include an + # escaped / (%2F) in the path. Example: + # + # ftp://ftp.example.com/%2Fpub/ruby + # + # This method will then return "/pub/ruby". + # + # source://uri//lib/uri/ftp.rb#240 + def path; end + + # Returns a String representation of the URI::FTP. + # + # source://uri//lib/uri/ftp.rb#251 + def to_s; end + + # typecode accessor. + # + # See URI::FTP::COMPONENT. + # + # source://uri//lib/uri/ftp.rb#161 + def typecode; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the typecode +v+ + # (with validation). + # + # See also URI::FTP.check_typecode. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("ftp://john@ftp.example.com/my_file.img") + # #=> # + # uri.typecode = "i" + # uri + # #=> # + # + # source://uri//lib/uri/ftp.rb#208 + def typecode=(typecode); end + + protected + + # Private setter for the path of the URI::FTP. + # + # source://uri//lib/uri/ftp.rb#245 + def set_path(v); end + + # Private setter for the typecode +v+. + # + # See also URI::FTP.typecode=. + # + # source://uri//lib/uri/ftp.rb#180 + def set_typecode(v); end + + private + + # Validates typecode +v+, + # returns +true+ or +false+. + # + # source://uri//lib/uri/ftp.rb#166 + def check_typecode(v); end + + class << self + # == Description + # + # Creates a new URI::FTP object from components, with syntax checking. + # + # The components accepted are +userinfo+, +host+, +port+, +path+, and + # +typecode+. + # + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. + # + # If an Array is used, the components must be passed in the + # order [userinfo, host, port, path, typecode]. + # + # If the path supplied is absolute, it will be escaped in order to + # make it absolute in the URI. + # + # Examples: + # + # require 'uri' + # + # uri1 = URI::FTP.build(['user:password', 'ftp.example.com', nil, + # '/path/file.zip', 'i']) + # uri1.to_s # => "ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=i" + # + # uri2 = URI::FTP.build({:host => 'ftp.example.com', + # :path => 'ruby/src'}) + # uri2.to_s # => "ftp://ftp.example.com/ruby/src" + # + # source://uri//lib/uri/ftp.rb#96 + def build(args); end + + # source://uri//lib/uri/ftp.rb#47 + def new2(user, password, host, port, path, typecode = T.unsafe(nil), arg_check = T.unsafe(nil)); end + end +end + +# The "file" URI is defined by RFC8089. +# +# source://uri//lib/uri/file.rb#10 +class URI::File < ::URI::Generic + # raise InvalidURIError + # + # @raise [URI::InvalidURIError] + # + # source://uri//lib/uri/file.rb#82 + def check_password(user); end + + # raise InvalidURIError + # + # @raise [URI::InvalidURIError] + # + # source://uri//lib/uri/file.rb#77 + def check_user(user); end + + # raise InvalidURIError + # + # @raise [URI::InvalidURIError] + # + # source://uri//lib/uri/file.rb#72 + def check_userinfo(user); end + + # Protected setter for the host component +v+. + # + # See also URI::Generic.host=. + # + # source://uri//lib/uri/file.rb#62 + def set_host(v); end + + # do nothing + # + # source://uri//lib/uri/file.rb#95 + def set_password(v); end + + # do nothing + # + # source://uri//lib/uri/file.rb#68 + def set_port(v); end + + # do nothing + # + # source://uri//lib/uri/file.rb#91 + def set_user(v); end + + # do nothing + # + # source://uri//lib/uri/file.rb#87 + def set_userinfo(v); end + + class << self + # == Description + # + # Creates a new URI::File object from components, with syntax checking. + # + # The components accepted are +host+ and +path+. + # + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. + # + # If an Array is used, the components must be passed in the + # order [host, path]. + # + # A path from e.g. the File class should be escaped before + # being passed. + # + # Examples: + # + # require 'uri' + # + # uri1 = URI::File.build(['host.example.com', '/path/file.zip']) + # uri1.to_s # => "file://host.example.com/path/file.zip" + # + # uri2 = URI::File.build({:host => 'host.example.com', + # :path => '/ruby/src'}) + # uri2.to_s # => "file://host.example.com/ruby/src" + # + # uri3 = URI::File.build({:path => URI::escape('/path/my file.txt')}) + # uri3.to_s # => "file:///path/my%20file.txt" + # + # source://uri//lib/uri/file.rb#53 + def build(args); end + end +end + +# An Array of the available components for URI::File. +# +# source://uri//lib/uri/file.rb#17 +URI::File::COMPONENT = T.let(T.unsafe(nil), Array) + +# A Default port of nil for URI::File. +# +# source://uri//lib/uri/file.rb#12 +URI::File::DEFAULT_PORT = T.let(T.unsafe(nil), T.untyped) + +# Base class for all URI classes. +# Implements generic URI syntax as per RFC 2396. +# +# source://uri//lib/uri/generic.rb#21 +class URI::Generic + include ::URI + + # == Args + # + # +scheme+:: + # Protocol scheme, i.e. 'http','ftp','mailto' and so on. + # +userinfo+:: + # User name and password, i.e. 'sdmitry:bla'. + # +host+:: + # Server host name. + # +port+:: + # Server port. + # +registry+:: + # Registry of naming authorities. + # +path+:: + # Path on server. + # +opaque+:: + # Opaque part. + # +query+:: + # Query data. + # +fragment+:: + # Part of the URI after '#' character. + # +parser+:: + # Parser for internal use [URI::DEFAULT_PARSER by default]. + # +arg_check+:: + # Check arguments [false by default]. + # + # == Description + # + # Creates a new URI::Generic instance from ``generic'' components without check. + # + # @return [Generic] a new instance of Generic + # + # source://uri//lib/uri/generic.rb#169 + def initialize(scheme, userinfo, host, port, registry, path, opaque, query, fragment, parser = T.unsafe(nil), arg_check = T.unsafe(nil)); end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Merges two URIs. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.merge("/main.rbx?page=1") + # # => "http://my.example.com/main.rbx?page=1" + # merge + # + # source://uri//lib/uri/generic.rb#1109 + def +(oth); end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Calculates relative path from oth to self. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse('http://my.example.com/main.rbx?page=1') + # uri.route_from('http://my.example.com') + # #=> # + # + # source://uri//lib/uri/generic.rb#1262 + def -(oth); end + + # Compares two URIs. + # + # source://uri//lib/uri/generic.rb#1387 + def ==(oth); end + + # Returns true if URI has a scheme (e.g. http:// or https://) specified. + # + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#972 + def absolute; end + + # Returns true if URI has a scheme (e.g. http:// or https://) specified. + # + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#972 + def absolute?; end + + # == Args + # + # +v+:: + # URI or String + # + # == Description + # + # Attempts to parse other URI +oth+, + # returns [parsed_oth, self]. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.coerce("http://foo.com") + # #=> [#, #] + # + # source://uri//lib/uri/generic.rb#1464 + def coerce(oth); end + + # Components of the URI in the order. + # + # source://uri//lib/uri/generic.rb#313 + def component; end + + # Returns the password component after URI decoding. + # + # source://uri//lib/uri/generic.rb#583 + def decoded_password; end + + # Returns the user component after URI decoding. + # + # source://uri//lib/uri/generic.rb#578 + def decoded_user; end + + # Returns default port. + # + # source://uri//lib/uri/generic.rb#39 + def default_port; end + + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#1399 + def eql?(oth); end + + # Returns a proxy URI. + # The proxy URI is obtained from environment variables such as http_proxy, + # ftp_proxy, no_proxy, etc. + # If there is no proper proxy, nil is returned. + # + # If the optional parameter +env+ is specified, it is used instead of ENV. + # + # Note that capitalized variables (HTTP_PROXY, FTP_PROXY, NO_PROXY, etc.) + # are examined, too. + # + # But http_proxy and HTTP_PROXY is treated specially under CGI environment. + # It's because HTTP_PROXY may be set by Proxy: header. + # So HTTP_PROXY is not used. + # http_proxy is not used too if the variable is case insensitive. + # CGI_HTTP_PROXY can be used instead. + # + # @raise [BadURIError] + # + # source://uri//lib/uri/generic.rb#1490 + def find_proxy(env = T.unsafe(nil)); end + + # Returns the fragment component of the URI. + # + # URI("http://foo/bar/baz?search=FooBar#ponies").fragment #=> "ponies" + # + # source://uri//lib/uri/generic.rb#283 + def fragment; end + + # Checks the fragment +v+ component against the URI::Parser Regexp for :FRAGMENT. + # + # + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the fragment component +v+ + # (with validation). + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com/?id=25#time=1305212049") + # uri.fragment = "time=1305212086" + # uri.to_s #=> "http://my.example.com/?id=25#time=1305212086" + # + # source://uri//lib/uri/generic.rb#929 + def fragment=(v); end + + # source://uri//lib/uri/generic.rb#1395 + def hash; end + + # Returns true if URI is hierarchical. + # + # == Description + # + # URI has components listed in order of decreasing significance from left to right, + # see RFC3986 https://www.rfc-editor.org/rfc/rfc3986 1.2.3. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com/") + # uri.hierarchical? + # #=> true + # uri = URI.parse("mailto:joe@example.com") + # uri.hierarchical? + # #=> false + # + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#961 + def hierarchical?; end + + # Returns the host component of the URI. + # + # URI("http://foo/bar/baz").host #=> "foo" + # + # It returns nil if no host component exists. + # + # URI("mailto:foo@example.org").host #=> nil + # + # The component does not contain the port number. + # + # URI("http://foo:8080/bar/baz").host #=> "foo" + # + # Since IPv6 addresses are wrapped with brackets in URIs, + # this method returns IPv6 addresses wrapped with brackets. + # This form is not appropriate to pass to socket methods such as TCPSocket.open. + # If unwrapped host names are required, use the #hostname method. + # + # URI("http://[::1]/bar/baz").host #=> "[::1]" + # URI("http://[::1]/bar/baz").hostname #=> "::1" + # + # source://uri//lib/uri/generic.rb#243 + def host; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the host component +v+ + # (with validation). + # + # See also URI::Generic.check_host. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.host = "foo.com" + # uri.to_s #=> "http://foo.com" + # + # source://uri//lib/uri/generic.rb#639 + def host=(v); end + + # Extract the host part of the URI and unwrap brackets for IPv6 addresses. + # + # This method is the same as URI::Generic#host except + # brackets for IPv6 (and future IP) addresses are removed. + # + # uri = URI("http://[::1]/bar") + # uri.hostname #=> "::1" + # uri.host #=> "[::1]" + # + # source://uri//lib/uri/generic.rb#654 + def hostname; end + + # Sets the host part of the URI as the argument with brackets for IPv6 addresses. + # + # This method is the same as URI::Generic#host= except + # the argument can be a bare IPv6 address. + # + # uri = URI("http://foo/bar") + # uri.hostname = "::1" + # uri.to_s #=> "http://[::1]/bar" + # + # If the argument seems to be an IPv6 address, + # it is wrapped with brackets. + # + # source://uri//lib/uri/generic.rb#671 + def hostname=(v); end + + # source://uri//lib/uri/generic.rb#1441 + def inspect; end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Merges two URIs. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.merge("/main.rbx?page=1") + # # => "http://my.example.com/main.rbx?page=1" + # + # source://uri//lib/uri/generic.rb#1109 + def merge(oth); end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Destructive form of #merge. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.merge!("/main.rbx?page=1") + # uri.to_s # => "http://my.example.com/main.rbx?page=1" + # + # source://uri//lib/uri/generic.rb#1081 + def merge!(oth); end + + # Returns normalized URI. + # + # require 'uri' + # + # URI("HTTP://my.EXAMPLE.com").normalize + # #=> # + # + # Normalization here means: + # + # * scheme and host are converted to lowercase, + # * an empty path component is set to "/". + # + # source://uri//lib/uri/generic.rb#1319 + def normalize; end + + # Destructive version of #normalize. + # + # source://uri//lib/uri/generic.rb#1328 + def normalize!; end + + # Returns the opaque part of the URI. + # + # URI("mailto:foo@example.org").opaque #=> "foo@example.org" + # URI("http://foo/bar/baz").opaque #=> nil + # + # The portion of the path that does not make use of the slash '/'. + # The path typically refers to an absolute path or an opaque part. + # (See RFC2396 Section 3 and 5.2.) + # + # source://uri//lib/uri/generic.rb#277 + def opaque; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the opaque component +v+ + # (with validation). + # + # See also URI::Generic.check_opaque. + # + # source://uri//lib/uri/generic.rb#901 + def opaque=(v); end + + # Returns the parser to be used. + # + # Unless a URI::Parser is defined, DEFAULT_PARSER is used. + # + # source://uri//lib/uri/generic.rb#289 + def parser; end + + # Returns the password component (without URI decoding). + # + # source://uri//lib/uri/generic.rb#573 + def password; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the +password+ component + # (with validation). + # + # See also URI::Generic.check_password. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://john:S3nsit1ve@my.example.com") + # uri.password = "V3ry_S3nsit1ve" + # uri.to_s #=> "http://john:V3ry_S3nsit1ve@my.example.com" + # + # source://uri//lib/uri/generic.rb#498 + def password=(password); end + + # Returns the path component of the URI. + # + # URI("http://foo/bar/baz").path #=> "/bar/baz" + # + # source://uri//lib/uri/generic.rb#260 + def path; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the path component +v+ + # (with validation). + # + # See also URI::Generic.check_path. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com/pub/files") + # uri.path = "/faq/" + # uri.to_s #=> "http://my.example.com/faq/" + # + # source://uri//lib/uri/generic.rb#815 + def path=(v); end + + # Returns the port component of the URI. + # + # URI("http://foo/bar/baz").port #=> 80 + # URI("http://foo:8080/bar/baz").port #=> 8080 + # + # source://uri//lib/uri/generic.rb#250 + def port; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the port component +v+ + # (with validation). + # + # See also URI::Generic.check_port. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.port = 8080 + # uri.to_s #=> "http://my.example.com:8080" + # + # source://uri//lib/uri/generic.rb#729 + def port=(v); end + + # Returns the query component of the URI. + # + # URI("http://foo/bar/baz?search=FooBar").query #=> "search=FooBar" + # + # source://uri//lib/uri/generic.rb#266 + def query; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the query component +v+. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com/?id=25") + # uri.query = "id=1" + # uri.to_s #=> "http://my.example.com/?id=1" + # + # @raise [InvalidURIError] + # + # source://uri//lib/uri/generic.rb#839 + def query=(v); end + + # source://uri//lib/uri/generic.rb#252 + def registry; end + + # @raise [InvalidURIError] + # + # source://uri//lib/uri/generic.rb#745 + def registry=(v); end + + # Returns true if URI does not have a scheme (e.g. http:// or https://) specified. + # + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#984 + def relative?; end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Calculates relative path from oth to self. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse('http://my.example.com/main.rbx?page=1') + # uri.route_from('http://my.example.com') + # #=> # + # + # source://uri//lib/uri/generic.rb#1262 + def route_from(oth); end + + # == Args + # + # +oth+:: + # URI or String + # + # == Description + # + # Calculates relative path to oth from self. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse('http://my.example.com') + # uri.route_to('http://my.example.com/main.rbx?page=1') + # #=> # + # + # source://uri//lib/uri/generic.rb#1302 + def route_to(oth); end + + # Returns the scheme component of the URI. + # + # URI("http://foo/bar/baz").scheme #=> "http" + # + # source://uri//lib/uri/generic.rb#221 + def scheme; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the scheme component +v+ + # (with validation). + # + # See also URI::Generic.check_scheme. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://my.example.com") + # uri.scheme = "https" + # uri.to_s #=> "https://my.example.com" + # + # source://uri//lib/uri/generic.rb#360 + def scheme=(v); end + + # == Args + # + # +components+:: + # Multiple Symbol arguments defined in URI::HTTP. + # + # == Description + # + # Selects specified components from URI. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse('http://myuser:mypass@my.example.com/test.rbx') + # uri.select(:userinfo, :host, :path) + # # => ["myuser:mypass", "my.example.com", "/test.rbx"] + # + # source://uri//lib/uri/generic.rb#1430 + def select(*components); end + + # Constructs String from URI. + # + # source://uri//lib/uri/generic.rb#1343 + def to_s; end + + # Constructs String from URI. + # + # source://uri//lib/uri/generic.rb#1343 + def to_str; end + + # Returns the user component (without URI decoding). + # + # source://uri//lib/uri/generic.rb#568 + def user; end + + # == Args + # + # +v+:: + # String + # + # == Description + # + # Public setter for the +user+ component + # (with validation). + # + # See also URI::Generic.check_user. + # + # == Usage + # + # require 'uri' + # + # uri = URI.parse("http://john:S3nsit1ve@my.example.com") + # uri.user = "sam" + # uri.to_s #=> "http://sam:V3ry_S3nsit1ve@my.example.com" + # + # source://uri//lib/uri/generic.rb#471 + def user=(user); end + + # Returns the userinfo, either as 'user' or 'user:password'. + # + # source://uri//lib/uri/generic.rb#557 + def userinfo; end + + # Sets userinfo, argument is string like 'name:pass'. + # + # source://uri//lib/uri/generic.rb#441 + def userinfo=(userinfo); end + + protected + + # Returns an Array of the components defined from the COMPONENT Array. + # + # source://uri//lib/uri/generic.rb#1406 + def component_ary; end + + # Protected setter for the host component +v+. + # + # See also URI::Generic.host=. + # + # source://uri//lib/uri/generic.rb#613 + def set_host(v); end + + # Protected setter for the opaque component +v+. + # + # See also URI::Generic.opaque=. + # + # source://uri//lib/uri/generic.rb#883 + def set_opaque(v); end + + # Protected setter for the password component +v+. + # + # See also URI::Generic.password=. + # + # source://uri//lib/uri/generic.rb#534 + def set_password(v); end + + # Protected setter for the path component +v+. + # + # See also URI::Generic.path=. + # + # source://uri//lib/uri/generic.rb#789 + def set_path(v); end + + # Protected setter for the port component +v+. + # + # See also URI::Generic.port=. + # + # source://uri//lib/uri/generic.rb#702 + def set_port(v); end + + # @raise [InvalidURIError] + # + # source://uri//lib/uri/generic.rb#740 + def set_registry(v); end + + # Protected setter for the scheme component +v+. + # + # See also URI::Generic.scheme=. + # + # source://uri//lib/uri/generic.rb#334 + def set_scheme(v); end + + # Protected setter for the user component +v+. + # + # See also URI::Generic.user=. + # + # source://uri//lib/uri/generic.rb#524 + def set_user(v); end + + # Protected setter for the +user+ component, and +password+ if available + # (with validation). + # + # See also URI::Generic.userinfo=. + # + # source://uri//lib/uri/generic.rb#509 + def set_userinfo(user, password = T.unsafe(nil)); end + + private + + # Checks the host +v+ component for RFC2396 compliance + # and against the URI::Parser Regexp for :HOST. + # + # Can not have a registry or opaque component defined, + # with a host component defined. + # + # source://uri//lib/uri/generic.rb#594 + def check_host(v); end + + # Checks the opaque +v+ component for RFC2396 compliance and + # against the URI::Parser Regexp for :OPAQUE. + # + # Can not have a host, port, user, or path component defined, + # with an opaque component defined. + # + # source://uri//lib/uri/generic.rb#861 + def check_opaque(v); end + + # Checks the password +v+ component for RFC2396 compliance + # and against the URI::Parser Regexp for :USERINFO. + # + # Can not have a registry or opaque component defined, + # with a user component defined. + # + # source://uri//lib/uri/generic.rb#417 + def check_password(v, user = T.unsafe(nil)); end + + # Checks the path +v+ component for RFC2396 compliance + # and against the URI::Parser Regexp + # for :ABS_PATH and :REL_PATH. + # + # Can not have a opaque component defined, + # with a path component defined. + # + # source://uri//lib/uri/generic.rb#757 + def check_path(v); end + + # Checks the port +v+ component for RFC2396 compliance + # and against the URI::Parser Regexp for :PORT. + # + # Can not have a registry or opaque component defined, + # with a port component defined. + # + # source://uri//lib/uri/generic.rb#683 + def check_port(v); end + + # @raise [InvalidURIError] + # + # source://uri//lib/uri/generic.rb#735 + def check_registry(v); end + + # Checks the scheme +v+ component against the URI::Parser Regexp for :SCHEME. + # + # source://uri//lib/uri/generic.rb#320 + def check_scheme(v); end + + # Checks the user +v+ component for RFC2396 compliance + # and against the URI::Parser Regexp for :USERINFO. + # + # Can not have a registry or opaque component defined, + # with a user component defined. + # + # source://uri//lib/uri/generic.rb#393 + def check_user(v); end + + # Checks the +user+ and +password+. + # + # If +password+ is not provided, then +user+ is + # split, using URI::Generic.split_userinfo, to + # pull +user+ and +password. + # + # See also URI::Generic.check_user, URI::Generic.check_password. + # + # source://uri//lib/uri/generic.rb#375 + def check_userinfo(user, password = T.unsafe(nil)); end + + # Escapes 'user:password' +v+ based on RFC 1738 section 3.1. + # + # source://uri//lib/uri/generic.rb#551 + def escape_userpass(v); end + + # Merges a base path +base+, with relative path +rel+, + # returns a modified base path. + # + # source://uri//lib/uri/generic.rb#1000 + def merge_path(base, rel); end + + # Replaces self by other URI object. + # + # source://uri//lib/uri/generic.rb#299 + def replace!(oth); end + + # :stopdoc: + # + # source://uri//lib/uri/generic.rb#1194 + def route_from0(oth); end + + # :stopdoc: + # + # source://uri//lib/uri/generic.rb#1155 + def route_from_path(src, dst); end + + # Returns an Array of the path split on '/'. + # + # source://uri//lib/uri/generic.rb#991 + def split_path(path); end + + # Returns the userinfo +ui+ as [user, password] + # if properly formatted as 'user:password'. + # + # source://uri//lib/uri/generic.rb#542 + def split_userinfo(ui); end + + class << self + # == Synopsis + # + # See ::new. + # + # == Description + # + # Creates a new URI::Generic instance from components of URI::Generic + # with check. Components are: scheme, userinfo, host, port, registry, path, + # opaque, query, and fragment. You can provide arguments either by an Array or a Hash. + # See ::new for hash keys to use or for order of array items. + # + # source://uri//lib/uri/generic.rb#116 + def build(args); end + + # == Synopsis + # + # See ::new. + # + # == Description + # + # At first, tries to create a new URI::Generic instance using + # URI::Generic::build. But, if exception URI::InvalidComponentError is raised, + # then it does URI::Escape.escape all URI components and tries again. + # + # source://uri//lib/uri/generic.rb#78 + def build2(args); end + + # Components of the URI in the order. + # + # source://uri//lib/uri/generic.rb#57 + def component; end + + # Returns default port. + # + # source://uri//lib/uri/generic.rb#32 + def default_port; end + + # @return [Boolean] + # + # source://uri//lib/uri/generic.rb#1556 + def use_proxy?(hostname, addr, port, no_proxy); end + + # source://uri//lib/uri/generic.rb#63 + def use_registry; end + end +end + +# The syntax of HTTP URIs is defined in RFC1738 section 3.3. +# +# Note that the Ruby URI library allows HTTP URLs containing usernames and +# passwords. This is not legal as per the RFC, but used to be +# supported in Internet Explorer 5 and 6, before the MS04-004 security +# update. See . +# +# source://uri//lib/uri/http.rb#22 +class URI::HTTP < ::URI::Generic + # == Description + # + # Returns the authority for an HTTP uri, as defined in + # https://www.rfc-editor.org/rfc/rfc3986#section-3.2. + # + # + # Example: + # + # URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').authority #=> "www.example.com" + # URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').authority #=> "www.example.com:8000" + # URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').authority #=> "www.example.com" + # + # source://uri//lib/uri/http.rb#97 + def authority; end + + # == Description + # + # Returns the origin for an HTTP uri, as defined in + # https://www.rfc-editor.org/rfc/rfc6454. + # + # + # Example: + # + # URI::HTTP.build(host: 'www.example.com', path: '/foo/bar').origin #=> "http://www.example.com" + # URI::HTTP.build(host: 'www.example.com', port: 8000, path: '/foo/bar').origin #=> "http://www.example.com:8000" + # URI::HTTP.build(host: 'www.example.com', port: 80, path: '/foo/bar').origin #=> "http://www.example.com" + # URI::HTTPS.build(host: 'www.example.com', path: '/foo/bar').origin #=> "https://www.example.com" + # + # source://uri//lib/uri/http.rb#119 + def origin; end + + # == Description + # + # Returns the full path for an HTTP request, as required by Net::HTTP::Get. + # + # If the URI contains a query, the full path is URI#path + '?' + URI#query. + # Otherwise, the path is simply URI#path. + # + # Example: + # + # uri = URI::HTTP.build(path: '/foo/bar', query: 'test=true') + # uri.request_uri # => "/foo/bar?test=true" + # + # source://uri//lib/uri/http.rb#77 + def request_uri; end + + class << self + # == Description + # + # Creates a new URI::HTTP object from components, with syntax checking. + # + # The components accepted are userinfo, host, port, path, query, and + # fragment. + # + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. + # + # If an Array is used, the components must be passed in the + # order [userinfo, host, port, path, query, fragment]. + # + # Example: + # + # uri = URI::HTTP.build(host: 'www.example.com', path: '/foo/bar') + # + # uri = URI::HTTP.build([nil, "www.example.com", nil, "/path", + # "query", 'fragment']) + # + # Currently, if passed userinfo components this method generates + # invalid HTTP URIs as per RFC 1738. + # + # source://uri//lib/uri/http.rb#59 + def build(args); end + end +end + +# source://uri//lib/uri/common.rb#126 +URI::INITIAL_SCHEMES = T.let(T.unsafe(nil), Hash) + +# LDAP URI SCHEMA (described in RFC2255). +# -- +# ldap:///[?[?[?[?]]]] +# ++ +# +# source://uri//lib/uri/ldap.rb#23 +class URI::LDAP < ::URI::Generic + # == Description + # + # Creates a new URI::LDAP object from generic URI components as per + # RFC 2396. No LDAP-specific syntax checking is performed. + # + # Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+, + # +opaque+, +query+, and +fragment+, in that order. + # + # Example: + # + # uri = URI::LDAP.new("ldap", nil, "ldap.example.com", nil, nil, + # "/dc=example;dc=com", nil, "query", nil) + # + # See also URI::Generic.new. + # + # @return [LDAP] a new instance of LDAP + # + # source://uri//lib/uri/ldap.rb#108 + def initialize(*arg); end + + # Returns attributes. + # + # source://uri//lib/uri/ldap.rb#178 + def attributes; end + + # Setter for attributes +val+. + # + # source://uri//lib/uri/ldap.rb#191 + def attributes=(val); end + + # Returns dn. + # + # source://uri//lib/uri/ldap.rb#159 + def dn; end + + # Setter for dn +val+. + # + # source://uri//lib/uri/ldap.rb#172 + def dn=(val); end + + # Returns extensions. + # + # source://uri//lib/uri/ldap.rb#235 + def extensions; end + + # Setter for extensions +val+. + # + # source://uri//lib/uri/ldap.rb#248 + def extensions=(val); end + + # Returns filter. + # + # source://uri//lib/uri/ldap.rb#216 + def filter; end + + # Setter for filter +val+. + # + # source://uri//lib/uri/ldap.rb#229 + def filter=(val); end + + # Checks if URI has a path. + # For URI::LDAP this will return +false+. + # + # @return [Boolean] + # + # source://uri//lib/uri/ldap.rb#255 + def hierarchical?; end + + # Returns scope. + # + # source://uri//lib/uri/ldap.rb#197 + def scope; end + + # Setter for scope +val+. + # + # source://uri//lib/uri/ldap.rb#210 + def scope=(val); end + + protected + + # Private setter for attributes +val+. + # + # source://uri//lib/uri/ldap.rb#183 + def set_attributes(val); end + + # Private setter for dn +val+. + # + # source://uri//lib/uri/ldap.rb#164 + def set_dn(val); end + + # Private setter for extensions +val+. + # + # source://uri//lib/uri/ldap.rb#240 + def set_extensions(val); end + + # Private setter for filter +val+. + # + # source://uri//lib/uri/ldap.rb#221 + def set_filter(val); end + + # Private setter for scope +val+. + # + # source://uri//lib/uri/ldap.rb#202 + def set_scope(val); end + + private + + # Private method to assemble +query+ from +attributes+, +scope+, +filter+, and +extensions+. + # + # source://uri//lib/uri/ldap.rb#146 + def build_path_query; end + + # Private method to cleanup +dn+ from using the +path+ component attribute. + # + # @raise [InvalidURIError] + # + # source://uri//lib/uri/ldap.rb#120 + def parse_dn; end + + # Private method to cleanup +attributes+, +scope+, +filter+, and +extensions+ + # from using the +query+ component attribute. + # + # source://uri//lib/uri/ldap.rb#128 + def parse_query; end + + class << self + # == Description + # + # Creates a new URI::LDAP object from components, with syntax checking. + # + # The components accepted are host, port, dn, attributes, + # scope, filter, and extensions. + # + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. + # + # If an Array is used, the components must be passed in the + # order [host, port, dn, attributes, scope, filter, extensions]. + # + # Example: + # + # uri = URI::LDAP.build({:host => 'ldap.example.com', + # :dn => '/dc=example'}) + # + # uri = URI::LDAP.build(["ldap.example.com", nil, + # "/dc=example;dc=com", "query", nil, nil, nil]) + # + # source://uri//lib/uri/ldap.rb#74 + def build(args); end + end +end + +# RFC6068, the mailto URL scheme. +# +# source://uri//lib/uri/mailto.rb#17 +class URI::MailTo < ::URI::Generic + include ::URI::RFC2396_REGEXP + + # == Description + # + # Creates a new URI::MailTo object from generic URL components with + # no syntax checking. + # + # This method is usually called from URI::parse, which checks + # the validity of each component. + # + # @return [MailTo] a new instance of MailTo + # + # source://uri//lib/uri/mailto.rb#132 + def initialize(*arg); end + + # E-mail headers set by the URL, as an Array of Arrays. + # + # source://uri//lib/uri/mailto.rb#166 + def headers; end + + # Setter for headers +v+. + # + # source://uri//lib/uri/mailto.rb#232 + def headers=(v); end + + # The primary e-mail address of the URL, as a String. + # + # source://uri//lib/uri/mailto.rb#163 + def to; end + + # Setter for to +v+. + # + # source://uri//lib/uri/mailto.rb#200 + def to=(v); end + + # Returns the RFC822 e-mail text equivalent of the URL, as a String. + # + # Example: + # + # require 'uri' + # + # uri = URI.parse("mailto:ruby-list@ruby-lang.org?Subject=subscribe&cc=myaddr") + # uri.to_mailtext + # # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n" + # + # source://uri//lib/uri/mailto.rb#268 + def to_mailtext; end + + # Returns the RFC822 e-mail text equivalent of the URL, as a String. + # + # Example: + # + # require 'uri' + # + # uri = URI.parse("mailto:ruby-list@ruby-lang.org?Subject=subscribe&cc=myaddr") + # uri.to_mailtext + # # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n" + # + # source://uri//lib/uri/mailto.rb#268 + def to_rfc822text; end + + # Constructs String from URI. + # + # source://uri//lib/uri/mailto.rb#239 + def to_s; end + + protected + + # Private setter for headers +v+. + # + # source://uri//lib/uri/mailto.rb#221 + def set_headers(v); end + + # Private setter for to +v+. + # + # source://uri//lib/uri/mailto.rb#194 + def set_to(v); end + + private + + # Checks the headers +v+ component against either + # * HEADER_REGEXP + # + # source://uri//lib/uri/mailto.rb#208 + def check_headers(v); end + + # Checks the to +v+ component. + # + # source://uri//lib/uri/mailto.rb#169 + def check_to(v); end + + class << self + # == Description + # + # Creates a new URI::MailTo object from components, with syntax checking. + # + # Components can be provided as an Array or Hash. If an Array is used, + # the components must be supplied as [to, headers]. + # + # If a Hash is used, the keys are the component names preceded by colons. + # + # The headers can be supplied as a pre-encoded string, such as + # "subject=subscribe&cc=address", or as an Array of Arrays + # like [['subject', 'subscribe'], ['cc', 'address']]. + # + # Examples: + # + # require 'uri' + # + # m1 = URI::MailTo.build(['joe@example.com', 'subject=Ruby']) + # m1.to_s # => "mailto:joe@example.com?subject=Ruby" + # + # m2 = URI::MailTo.build(['john@example.com', [['Subject', 'Ruby'], ['Cc', 'jack@example.com']]]) + # m2.to_s # => "mailto:john@example.com?Subject=Ruby&Cc=jack@example.com" + # + # m3 = URI::MailTo.build({:to => 'listman@example.com', :headers => [['subject', 'subscribe']]}) + # m3.to_s # => "mailto:listman@example.com?subject=subscribe" + # + # source://uri//lib/uri/mailto.rb#85 + def build(args); end + end +end + +# Class that parses String's into URI's. +# +# It contains a Hash set of patterns and Regexp's that match and validate. +# +# source://uri//lib/uri/rfc2396_parser.rb#64 +class URI::RFC2396_Parser + include ::URI::RFC2396_REGEXP + + # == Synopsis + # + # URI::Parser.new([opts]) + # + # == Args + # + # The constructor accepts a hash as options for parser. + # Keys of options are pattern names of URI components + # and values of options are pattern strings. + # The constructor generates set of regexps for parsing URIs. + # + # You can use the following keys: + # + # * :ESCAPED (URI::PATTERN::ESCAPED in default) + # * :UNRESERVED (URI::PATTERN::UNRESERVED in default) + # * :DOMLABEL (URI::PATTERN::DOMLABEL in default) + # * :TOPLABEL (URI::PATTERN::TOPLABEL in default) + # * :HOSTNAME (URI::PATTERN::HOSTNAME in default) + # + # == Examples + # + # p = URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})") + # u = p.parse("http://example.jp/%uABCD") #=> # + # URI.parse(u.to_s) #=> raises URI::InvalidURIError + # + # s = "http://example.com/ABCD" + # u1 = p.parse(s) #=> # + # u2 = URI.parse(s) #=> # + # u1 == u2 #=> true + # u1.eql?(u2) #=> false + # + # @return [RFC2396_Parser] a new instance of RFC2396_Parser + # + # source://uri//lib/uri/rfc2396_parser.rb#99 + def initialize(opts = T.unsafe(nil)); end + + # :call-seq: + # escape( str ) + # escape( str, unsafe ) + # + # == Args + # + # +str+:: + # String to make safe + # +unsafe+:: + # Regexp to apply. Defaults to +self.regexp[:UNSAFE]+ + # + # == Description + # + # Constructs a safe String from +str+, removing unsafe characters, + # replacing them with codes. + # + # source://uri//lib/uri/rfc2396_parser.rb#287 + def escape(str, unsafe = T.unsafe(nil)); end + + # :call-seq: + # extract( str ) + # extract( str, schemes ) + # extract( str, schemes ) {|item| block } + # + # == Args + # + # +str+:: + # String to search + # +schemes+:: + # Patterns to apply to +str+ + # + # == Description + # + # Attempts to parse and merge a set of URIs. + # If no +block+ given, then returns the result, + # else it calls +block+ for each element in result. + # + # See also URI::Parser.make_regexp. + # + # source://uri//lib/uri/rfc2396_parser.rb#249 + def extract(str, schemes = T.unsafe(nil)); end + + # source://uri//lib/uri/rfc2396_parser.rb#326 + def inspect; end + + # == Args + # + # +uris+:: + # an Array of Strings + # + # == Description + # + # Attempts to parse and merge a set of URIs. + # + # source://uri//lib/uri/rfc2396_parser.rb#223 + def join(*uris); end + + # Returns Regexp that is default +self.regexp[:ABS_URI_REF]+, + # unless +schemes+ is provided. Then it is a Regexp.union with +self.pattern[:X_ABS_URI]+. + # + # source://uri//lib/uri/rfc2396_parser.rb#262 + def make_regexp(schemes = T.unsafe(nil)); end + + # == Args + # + # +uri+:: + # String + # + # == Description + # + # Parses +uri+ and constructs either matching URI scheme object + # (File, FTP, HTTP, HTTPS, LDAP, LDAPS, or MailTo) or URI::Generic. + # + # == Usage + # + # p = URI::Parser.new + # p.parse("ldap://ldap.example.com/dc=example?user=john") + # #=> # + # + # source://uri//lib/uri/rfc2396_parser.rb#209 + def parse(uri); end + + # The Hash of patterns. + # + # See also URI::Parser.initialize_pattern. + # + # source://uri//lib/uri/rfc2396_parser.rb#112 + def pattern; end + + # The Hash of Regexp. + # + # See also URI::Parser.initialize_regexp. + # + # source://uri//lib/uri/rfc2396_parser.rb#117 + def regexp; end + + # Returns a split URI against +regexp[:ABS_URI]+. + # + # source://uri//lib/uri/rfc2396_parser.rb#120 + def split(uri); end + + # :call-seq: + # unescape( str ) + # unescape( str, escaped ) + # + # == Args + # + # +str+:: + # String to remove escapes from + # +escaped+:: + # Regexp to apply. Defaults to +self.regexp[:ESCAPED]+ + # + # == Description + # + # Removes escapes from +str+. + # + # source://uri//lib/uri/rfc2396_parser.rb#318 + def unescape(str, escaped = T.unsafe(nil)); end + + private + + # source://uri//lib/uri/rfc2396_parser.rb#527 + def convert_to_uri(uri); end + + # Constructs the default Hash of patterns. + # + # source://uri//lib/uri/rfc2396_parser.rb#338 + def initialize_pattern(opts = T.unsafe(nil)); end + + # Constructs the default Hash of Regexp's. + # + # source://uri//lib/uri/rfc2396_parser.rb#496 + def initialize_regexp(pattern); end +end + +# source://uri//lib/uri/rfc3986_parser.rb#3 +class URI::RFC3986_Parser + # @return [RFC3986_Parser] a new instance of RFC3986_Parser + # + # source://uri//lib/uri/rfc3986_parser.rb#73 + def initialize; end + + # Compatibility for RFC2396 parser + # + # source://uri//lib/uri/rfc3986_parser.rb#156 + def escape(str, unsafe = T.unsafe(nil)); end + + # Compatibility for RFC2396 parser + # + # source://uri//lib/uri/rfc3986_parser.rb#144 + def extract(str, schemes = T.unsafe(nil), &block); end + + # source://uri//lib/uri/rfc3986_parser.rb#169 + def inspect; end + + # source://uri//lib/uri/rfc3986_parser.rb#138 + def join(*uris); end + + # Compatibility for RFC2396 parser + # + # source://uri//lib/uri/rfc3986_parser.rb#150 + def make_regexp(schemes = T.unsafe(nil)); end + + # source://uri//lib/uri/rfc3986_parser.rb#134 + def parse(uri); end + + # Returns the value of attribute regexp. + # + # source://uri//lib/uri/rfc3986_parser.rb#71 + def regexp; end + + # source://uri//lib/uri/rfc3986_parser.rb#77 + def split(uri); end + + # Compatibility for RFC2396 parser + # + # source://uri//lib/uri/rfc3986_parser.rb#162 + def unescape(str, escaped = T.unsafe(nil)); end + + private + + # source://uri//lib/uri/rfc3986_parser.rb#194 + def convert_to_uri(uri); end + + # source://uri//lib/uri/rfc3986_parser.rb#180 + def default_regexp; end +end + +# source://uri//lib/uri/rfc3986_parser.rb#33 +URI::RFC3986_Parser::FRAGMENT = T.let(T.unsafe(nil), String) + +# URI defined in RFC3986 +# +# source://uri//lib/uri/rfc3986_parser.rb#5 +URI::RFC3986_Parser::HOST = T.let(T.unsafe(nil), Regexp) + +# source://uri//lib/uri/rfc3986_parser.rb#54 +URI::RFC3986_Parser::RFC3986_relative_ref = T.let(T.unsafe(nil), Regexp) + +# source://uri//lib/uri/rfc3986_parser.rb#30 +URI::RFC3986_Parser::SCHEME = T.let(T.unsafe(nil), String) + +# source://uri//lib/uri/rfc3986_parser.rb#31 +URI::RFC3986_Parser::SEG = T.let(T.unsafe(nil), String) + +# source://uri//lib/uri/rfc3986_parser.rb#32 +URI::RFC3986_Parser::SEG_NC = T.let(T.unsafe(nil), String) + +# source://uri//lib/uri/rfc3986_parser.rb#28 +URI::RFC3986_Parser::USERINFO = T.let(T.unsafe(nil), Regexp) + +# source://uri//lib/uri/common.rb#90 +module URI::Schemes; end + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::FILE = URI::File + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::FTP = URI::FTP + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::HTTP = URI::HTTP + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::HTTPS = URI::HTTPS + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::LDAP = URI::LDAP + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::LDAPS = URI::LDAPS + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::MAILTO = URI::MailTo + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::SOURCE = URI::Source + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::WS = URI::WS + +# source://uri//lib/uri/common.rb#103 +URI::Schemes::WSS = URI::WSS + +class URI::Source < ::URI::File + # source://tapioca/0.15.1/lib/tapioca/helpers/source_uri.rb#58 + sig { params(v: T.nilable(::String)).returns(T::Boolean) } + def check_host(v); end + + # source://uri//lib/uri/generic.rb#243 + def gem_name; end + + # source://tapioca/0.15.1/lib/tapioca/helpers/source_uri.rb#25 + sig { returns(T.nilable(::String)) } + def gem_version; end + + # source://uri//lib/uri/generic.rb#283 + def line_number; end + + # source://tapioca/0.15.1/lib/tapioca/helpers/source_uri.rb#51 + sig { params(v: T.nilable(::String)).void } + def set_path(v); end + + # source://tapioca/0.15.1/lib/tapioca/helpers/source_uri.rb#70 + sig { returns(::String) } + def to_s; end + + class << self + # source://tapioca/0.15.1/lib/tapioca/helpers/source_uri.rb#38 + sig do + params( + gem_name: ::String, + gem_version: T.nilable(::String), + path: ::String, + line_number: T.nilable(::String) + ).returns(::URI::Source) + end + def build(gem_name:, gem_version:, path:, line_number:); end + end +end + +# source://uri//lib/uri/common.rb#308 +URI::TBLENCURICOMP_ = T.let(T.unsafe(nil), Hash) + +# source://uri//lib/uri/common.rb#58 +module URI::Util + private + + # source://uri//lib/uri/common.rb#59 + def make_components_hash(klass, array_hash); end + + class << self + # source://uri//lib/uri/common.rb#59 + def make_components_hash(klass, array_hash); end + end +end + +# The syntax of WS URIs is defined in RFC6455 section 3. +# +# Note that the Ruby URI library allows WS URLs containing usernames and +# passwords. This is not legal as per the RFC, but used to be +# supported in Internet Explorer 5 and 6, before the MS04-004 security +# update. See . +# +# source://uri//lib/uri/ws.rb#22 +class URI::WS < ::URI::Generic + # == Description + # + # Returns the full path for a WS URI, as required by Net::HTTP::Get. + # + # If the URI contains a query, the full path is URI#path + '?' + URI#query. + # Otherwise, the path is simply URI#path. + # + # Example: + # + # uri = URI::WS.build(path: '/foo/bar', query: 'test=true') + # uri.request_uri # => "/foo/bar?test=true" + # + # source://uri//lib/uri/ws.rb#74 + def request_uri; end + + class << self + # == Description + # + # Creates a new URI::WS object from components, with syntax checking. + # + # The components accepted are userinfo, host, port, path, and query. + # + # The components should be provided either as an Array, or as a Hash + # with keys formed by preceding the component names with a colon. + # + # If an Array is used, the components must be passed in the + # order [userinfo, host, port, path, query]. + # + # Example: + # + # uri = URI::WS.build(host: 'www.example.com', path: '/foo/bar') + # + # uri = URI::WS.build([nil, "www.example.com", nil, "/path", "query"]) + # + # Currently, if passed userinfo components this method generates + # invalid WS URIs as per RFC 1738. + # + # source://uri//lib/uri/ws.rb#56 + def build(args); end + end +end + +# The default port for WSS URIs is 443, and the scheme is 'wss:' rather +# than 'ws:'. Other than that, WSS URIs are identical to WS URIs; +# see URI::WS. +# +# source://uri//lib/uri/wss.rb#17 +class URI::WSS < ::URI::WS; end + +# A Default port of 443 for URI::WSS +# +# source://uri//lib/uri/wss.rb#19 +URI::WSS::DEFAULT_PORT = T.let(T.unsafe(nil), Integer)