diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 869f056b5ba1f..5252b47466920 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -54,7 +54,7 @@ jobs:
- name: Check RuboCop filepaths
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/Library/Homebrew
run: |
- public_apis=$(git grep -l "@api public" | wc -l | tr -d ' ')
+ public_apis=$(git grep -l "@api public" -- :^sorbet/ :^vendor/ | wc -l | tr -d ' ')
rubocop_docs=$(yq '.Style/Documentation.Include' .rubocop.yml | wc -l | tr -d ' ')
if [[ public_apis -ne rubocop_docs ]]
then
diff --git a/.gitignore b/.gitignore
index eb1ff5afc9425..205be86300c69 100644
--- a/.gitignore
+++ b/.gitignore
@@ -102,6 +102,7 @@
**/vendor/bundle/ruby/*/gems/diff-lcs-*/
**/vendor/bundle/ruby/*/gems/docile-*/
**/vendor/bundle/ruby/*/gems/ecma-re-validator-*/
+**/vendor/bundle/ruby/*/gems/erubi-*/
**/vendor/bundle/ruby/*/gems/hana-*/
**/vendor/bundle/ruby/*/gems/highline-*/
**/vendor/bundle/ruby/*/gems/hpricot-*/
@@ -109,17 +110,21 @@
**/vendor/bundle/ruby/*/gems/jaro_winkler-*/
**/vendor/bundle/ruby/*/gems/json-*/
**/vendor/bundle/ruby/*/gems/json_schemer-*/
+**/vendor/bundle/ruby/*/gems/language_server-protocol-*/
**/vendor/bundle/ruby/*/gems/method_source-*/
**/vendor/bundle/ruby/*/gems/mini_portile2-*/
**/vendor/bundle/ruby/*/gems/minitest-*/
**/vendor/bundle/ruby/*/gems/msgpack-*/
**/vendor/bundle/ruby/*/gems/mustache-*/
+**/vendor/bundle/ruby/*/gems/netrc-*/
**/vendor/bundle/ruby/*/gems/ntlm-http-*/
**/vendor/bundle/ruby/*/gems/parallel-*/
**/vendor/bundle/ruby/*/gems/parallel_tests-*/
**/vendor/bundle/ruby/*/gems/parlour-*/
**/vendor/bundle/ruby/*/gems/parser-*/
**/vendor/bundle/ruby/*/gems/powerpack-*/
+**/vendor/bundle/ruby/*/gems/prettier_print-*/
+**/vendor/bundle/ruby/*/gems/prism-*/
**/vendor/bundle/ruby/*/gems/psych-*/
**/vendor/bundle/ruby/*/gems/pry-*/
**/vendor/bundle/ruby/*/gems/racc-*/
@@ -140,13 +145,7 @@
**/vendor/bundle/ruby/*/gems/rspec-support-*/
**/vendor/bundle/ruby/*/gems/rspec-sorbet-*/
**/vendor/bundle/ruby/*/gems/rspec-wait-*/
-**/vendor/bundle/ruby/*/gems/rubocop-1*/
-**/vendor/bundle/ruby/*/gems/rubocop-ast-*/
-**/vendor/bundle/ruby/*/gems/rubocop-capybara-*/
-**/vendor/bundle/ruby/*/gems/rubocop-performance-*/
-**/vendor/bundle/ruby/*/gems/rubocop-rails-*/
-**/vendor/bundle/ruby/*/gems/rubocop-rspec-*/
-**/vendor/bundle/ruby/*/gems/rubocop-sorbet-*/
+**/vendor/bundle/ruby/*/gems/rubocop-*/
**/vendor/bundle/ruby/*/gems/ruby-prof-*/
**/vendor/bundle/ruby/*/gems/ruby-progressbar-*/
**/vendor/bundle/ruby/*/gems/simplecov-*/
@@ -158,6 +157,7 @@
**/vendor/bundle/ruby/*/gems/spoom-*/
**/vendor/bundle/ruby/*/gems/stackprof-*/
**/vendor/bundle/ruby/*/gems/strscan-*/
+**/vendor/bundle/ruby/*/gems/syntax_tree-*/
**/vendor/bundle/ruby/*/gems/tapioca-*/
**/vendor/bundle/ruby/*/gems/thor-*/
**/vendor/bundle/ruby/*/gems/tzinfo-*/
diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml
index 4c0cec6600403..baa7d1e2b4885 100644
--- a/Library/.rubocop.yml
+++ b/Library/.rubocop.yml
@@ -253,8 +253,8 @@ RSpec/DescribeClass:
Enabled: false
RSpec/FilePath:
Enabled: false
-# RSpec/SpecFilePathFormat:
-# Enabled: false
+RSpec/SpecFilePathFormat:
+ Enabled: false
RSpec/StubbedMock:
Enabled: false
RSpec/SubjectStub:
@@ -384,7 +384,7 @@ Style/InvertibleUnlessCondition:
# Unset this (prefer `unless a.zero?` over `if a.nonzero?`)
:zero?:
# Don't require non-standard `exclude?` (for now at least) - it's not available in every file
- # :include?:
+ :include?:
# TODO: Enable this cop again once https://github.com/Homebrew/brew/pull/16337#issuecomment-1855668516 is done.
# From the RuboCop docs: "NOTE: Regexp and Range literals are frozen objects since Ruby 3.0."
@@ -442,8 +442,8 @@ Style/StringMethods:
Enabled: true
# Treating this the same as Style/MethodCallWithArgsParentheses
-# Style/SuperWithArgsParentheses:
-# Enabled: false
+Style/SuperWithArgsParentheses:
+ Enabled: false
# An array of symbols is more readable than a symbol array
# and also allows for easier grepping.
diff --git a/Library/Homebrew/Gemfile b/Library/Homebrew/Gemfile
index 382ac47d9747e..c15ae77d6ead0 100644
--- a/Library/Homebrew/Gemfile
+++ b/Library/Homebrew/Gemfile
@@ -4,10 +4,10 @@ source "https://rubygems.org"
# The default case (no envs), should always be a restrictive bound on the lowest supported minor version.
# This is the branch that Dependabot will use.
-if ENV.fetch("HOMEBREW_USE_RUBY_FROM_PATH", "").empty? && ENV.fetch("HOMEBREW_RUBY3", "").empty?
- ruby "~> 2.6.0"
+if ENV.fetch("HOMEBREW_USE_RUBY_FROM_PATH", "").empty?
+ ruby "~> 3.1.0"
else
- ruby ">= 2.6.0"
+ ruby ">= 3.1.0"
end
# disallowed gems (should not be used)
@@ -74,7 +74,7 @@ group :audit, :bump_unversioned_casks, :livecheck, optional: true do
end
# vendored gems (no group)
-gem "activesupport"
+gem "activesupport", "<7" # we're actively working to remove this: https://github.com/Homebrew/brew/issues/16190
gem "addressable"
gem "patchelf"
gem "plist"
diff --git a/Library/Homebrew/Gemfile.lock b/Library/Homebrew/Gemfile.lock
index f60bb8619fa0c..4821bf8210031 100644
--- a/Library/Homebrew/Gemfile.lock
+++ b/Library/Homebrew/Gemfile.lock
@@ -22,6 +22,7 @@ GEM
docile (1.4.0)
elftools (1.2.0)
bindata (~> 2)
+ erubi (1.12.0)
hana (1.3.7)
highline (2.0.3)
hpricot (0.8.6)
@@ -32,12 +33,14 @@ GEM
hana (~> 1.3)
regexp_parser (~> 2.0)
simpleidn (~> 0.2)
+ language_server-protocol (3.17.0.3)
method_source (1.0.0)
minitest (5.20.0)
msgpack (1.7.2)
mustache (1.1.1)
+ netrc (0.11.0)
parallel (1.23.0)
- parallel_tests (3.13.0)
+ parallel_tests (4.3.0)
parallel
parlour (8.1.0)
commander (~> 4.5)
@@ -50,6 +53,8 @@ GEM
patchelf (1.4.0)
elftools (>= 1.2)
plist (3.7.0)
+ prettier_print (1.2.1)
+ prism (0.19.0)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
@@ -57,11 +62,9 @@ GEM
racc (1.7.3)
rack (3.0.8)
rainbow (3.1.1)
- rbi (0.0.14)
- ast
- parser (>= 2.6.4.0)
+ rbi (0.1.6)
+ prism (>= 0.18.0, < 0.20)
sorbet-runtime (>= 0.5.9204)
- unparser
rdiscount (2.2.7.1)
regexp_parser (2.8.3)
rexml (3.2.6)
@@ -93,30 +96,35 @@ GEM
rspec-support (3.12.1)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
- rubocop (1.50.2)
+ rubocop (1.59.0)
json (~> 2.3)
+ language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
- parser (>= 3.2.0.0)
+ parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
- rubocop-ast (>= 1.28.0, < 2.0)
+ rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
- rubocop-capybara (2.18.0)
+ rubocop-capybara (2.19.0)
rubocop (~> 1.41)
- rubocop-performance (1.17.1)
+ rubocop-factory_bot (2.24.0)
+ rubocop (~> 1.33)
+ rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
- rubocop-rails (2.19.1)
+ rubocop-rails (2.22.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
- rubocop-rspec (2.20.0)
- rubocop (~> 1.33)
+ rubocop-ast (>= 1.30.0, < 2.0)
+ rubocop-rspec (2.25.0)
+ rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
+ rubocop-factory_bot (~> 2.22)
rubocop-sorbet (0.7.6)
rubocop (>= 0.90.0)
ruby-macho (4.0.0)
@@ -133,34 +141,29 @@ GEM
simplecov_json_formatter (0.1.4)
simpleidn (0.2.1)
unf (~> 0.1.4)
- sorbet (0.5.10461)
- sorbet-static (= 0.5.10461)
- sorbet-runtime (0.5.10461)
- sorbet-static (0.5.10461-universal-darwin-14)
- sorbet-static (0.5.10461-universal-darwin-15)
- sorbet-static (0.5.10461-universal-darwin-16)
- sorbet-static (0.5.10461-universal-darwin-17)
- sorbet-static (0.5.10461-universal-darwin-18)
- sorbet-static (0.5.10461-universal-darwin-19)
- sorbet-static (0.5.10461-universal-darwin-20)
- sorbet-static (0.5.10461-universal-darwin-21)
- sorbet-static (0.5.10461-universal-darwin-22)
- sorbet-static (0.5.10461-x86_64-linux)
- sorbet-static-and-runtime (0.5.10461)
- sorbet (= 0.5.10461)
- sorbet-runtime (= 0.5.10461)
- spoom (1.1.11)
- sorbet (>= 0.5.9204)
- sorbet-runtime (>= 0.5.9204)
+ sorbet (0.5.11155)
+ sorbet-static (= 0.5.11155)
+ sorbet-runtime (0.5.11155)
+ sorbet-static (0.5.11155-universal-darwin)
+ sorbet-static (0.5.11155-x86_64-linux)
+ sorbet-static-and-runtime (0.5.11155)
+ sorbet (= 0.5.11155)
+ sorbet-runtime (= 0.5.11155)
+ spoom (1.2.4)
+ erubi (>= 1.10.0)
+ sorbet-static-and-runtime (>= 0.5.10187)
+ syntax_tree (>= 6.1.1)
thor (>= 0.19.2)
stackprof (0.2.25)
- tapioca (0.7.3)
- bundler (>= 1.17.3)
- pry (>= 0.12.2)
- rbi (~> 0.0.0, >= 0.0.14)
- sorbet-runtime (>= 0.5.9204)
- sorbet-static (>= 0.5.9204)
- spoom (~> 1.1.0, >= 1.1.11)
+ syntax_tree (6.2.0)
+ prettier_print (>= 1.2.0)
+ tapioca (0.11.13)
+ bundler (>= 2.2.25)
+ netrc (>= 0.11.0)
+ parallel (>= 1.21.0)
+ rbi (>= 0.1.4, < 0.2)
+ sorbet-static-and-runtime (>= 0.5.10187)
+ spoom (~> 1.2.0, >= 1.2.0)
thor (>= 1.2.0)
yard-sorbet
thor (1.3.0)
@@ -170,12 +173,9 @@ GEM
unf_ext
unf_ext (0.0.9.1)
unicode-display_width (2.5.0)
- unparser (0.6.4)
- diff-lcs (~> 1.3)
- parser (>= 3.1.0)
warning (1.3.0)
yard (0.9.34)
- yard-sorbet (0.6.1)
+ yard-sorbet (0.8.1)
sorbet-runtime (>= 0.5)
yard (>= 0.9)
zeitwerk (2.6.12)
@@ -188,7 +188,7 @@ PLATFORMS
x86_64-linux
DEPENDENCIES
- activesupport
+ activesupport (< 7)
addressable
bootsnap
byebug
@@ -226,7 +226,7 @@ DEPENDENCIES
warning
RUBY VERSION
- ruby 2.6.10p210
+ ruby 3.1.4p223
BUNDLED WITH
2.4.18
diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh
index 162e8e135b29b..9776e87177409 100644
--- a/Library/Homebrew/brew.sh
+++ b/Library/Homebrew/brew.sh
@@ -358,8 +358,6 @@ auto-update() {
# Restore user path as it'll be refiltered by HOMEBREW_BREW_FILE (bin/brew)
export PATH=${HOMEBREW_PATH}
- unset HOMEBREW_RUBY3
-
# exec a new process to set any new environment variables.
exec "${HOMEBREW_BREW_FILE}" "$@"
fi
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index 8730c8474ea53..d9cfb2121394f 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -893,10 +893,7 @@ EOS
[[ ! -f "${HOMEBREW_CACHE}/all_commands_list.txt" ]] ||
[[ -n "${HOMEBREW_DEVELOPER}" && -z "${HOMEBREW_UPDATE_AUTO}" ]]
then
- (
- unset HOMEBREW_RUBY3
- brew update-report "$@"
- )
+ brew update-report "$@"
return $?
elif [[ -z "${HOMEBREW_UPDATE_AUTO}" && -z "${HOMEBREW_QUIET}" ]]
then
diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb
index 100f39d9225b5..d1703667840a6 100644
--- a/Library/Homebrew/dev-cmd/tests.rb
+++ b/Library/Homebrew/dev-cmd/tests.rb
@@ -208,7 +208,6 @@ def setup_environment!(args)
HOMEBREW_CACHE
HOMEBREW_LOGS
HOMEBREW_TEMP
- HOMEBREW_RUBY3
]
allowed_test_env << "HOMEBREW_USE_RUBY_FROM_PATH" if Homebrew::EnvConfig.developer?
Homebrew::EnvConfig::ENVS.keys.map(&:to_s).each do |env|
diff --git a/Library/Homebrew/dev-cmd/typecheck.rb b/Library/Homebrew/dev-cmd/typecheck.rb
index 649dd56d97e17..a105d4ac7118e 100644
--- a/Library/Homebrew/dev-cmd/typecheck.rb
+++ b/Library/Homebrew/dev-cmd/typecheck.rb
@@ -46,14 +46,9 @@ def self.typecheck
HOMEBREW_LIBRARY_PATH.cd do
if update
excluded_gems = [
- "did_you_mean", # RBI file is already provided by Sorbet
"json", # RBI file is already provided by Sorbet
- "sorbet-static-and-runtime", # Unnecessary RBI - remove this entry with Tapioca 0.8
]
- typed_overrides = [
- "msgpack:false", # Investigate removing this with Tapioca 0.8
- ]
- tapioca_args = ["--exclude", *excluded_gems, "--typed-overrides", *typed_overrides]
+ tapioca_args = ["--exclude", *excluded_gems, "--pre", "sorbet/tapioca/prerequire.rb"]
tapioca_args << "--all" if args.update_all?
ohai "Updating homegrown RBI files..."
@@ -63,13 +58,23 @@ def self.typecheck
ohai "Updating Tapioca RBI files..."
safe_system "bundle", "exec", "tapioca", "gem", *tapioca_args
safe_system "bundle", "exec", "parlour"
+
safe_system({ "RUBYLIB" => "#{HOMEBREW_LIBRARY_PATH}/sorbet/hidden_definitions_hacks" },
"bundle", "exec", "srb", "rbi", "hidden-definitions")
- safe_system "bundle", "exec", "tapioca", "todo"
+ # HACK: we'll phase out hidden-definitions soon
+ tmp_file = "sorbet/rbi/hidden-definitions/hidden.rbi.tmp"
+ orig_file = "sorbet/rbi/hidden-definitions/hidden.rbi"
+ File.open(tmp_file, "w") do |out_file|
+ File.foreach(orig_file) do |line|
+ out_file.puts line unless line.include?("def self.new(*args, **arg, &blk); end")
+ end
+ end
+ File.rename(tmp_file, orig_file)
if args.suggest_typed?
ohai "Bumping Sorbet `typed` sigils..."
- safe_system "bundle", "exec", "spoom", "bump"
+ # --sorbet needed because of https://github.com/Shopify/spoom/issues/488
+ safe_system "bundle", "exec", "spoom", "bump", "--dry", "--sorbet", "#{Gem.bin_path("sorbet", "srb")} tc"
end
return
diff --git a/Library/Homebrew/livecheck/livecheck.rb b/Library/Homebrew/livecheck/livecheck.rb
index 3a6aa747686fb..42eb080e67212 100644
--- a/Library/Homebrew/livecheck/livecheck.rb
+++ b/Library/Homebrew/livecheck/livecheck.rb
@@ -51,12 +51,12 @@ module Livecheck
rc
].freeze, T::Array[String])
- sig { returns(T::Hash[Class, String]) }
+ sig { returns(T::Hash[T::Class[T.anything], String]) }
def livecheck_strategy_names
return T.must(@livecheck_strategy_names) if defined?(@livecheck_strategy_names)
# Cache demodulized strategy names, to avoid repeating this work
- @livecheck_strategy_names = T.let({}, T.nilable(T::Hash[Class, String]))
+ @livecheck_strategy_names = T.let({}, T.nilable(T::Hash[T::Class[T.anything], String]))
Strategy.constants.sort.each do |const_symbol|
constant = Strategy.const_get(const_symbol)
next unless constant.is_a?(Class)
diff --git a/Library/Homebrew/sorbet/rbi/gems/.gitattributes b/Library/Homebrew/sorbet/rbi/gems/.gitattributes
new file mode 100644
index 0000000000000..d9bb82a4de2cf
--- /dev/null
+++ b/Library/Homebrew/sorbet/rbi/gems/.gitattributes
@@ -0,0 +1 @@
+**/*.rbi linguist-generated=true
diff --git a/Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.7.6.rbi b/Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.7.6.rbi
index 306080cd2a7ec..9de6db63870c1 100644
--- a/Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.7.6.rbi
+++ b/Library/Homebrew/sorbet/rbi/gems/activesupport@6.1.7.6.rbi
@@ -4,43 +4,94 @@
# This is an autogenerated file for types exported from the `activesupport` gem.
# Please instead update this file by running `bin/tapioca gem activesupport`.
-::APPLE_GEM_HOME = T.let(T.unsafe(nil), String)
-::RUBY19 = T.let(T.unsafe(nil), TrueClass)
-::RUBY_FRAMEWORK = T.let(T.unsafe(nil), TrueClass)
-::RUBY_FRAMEWORK_VERSION = T.let(T.unsafe(nil), String)
-
+# source://activesupport//lib/active_support/lazy_load_hooks.rb#3
module ActiveSupport
extend ::ActiveSupport::LazyLoadHooks
extend ::ActiveSupport::Autoload
+ # source://activesupport//lib/active_support/json/decoding.rb#9
def parse_json_times; end
+
+ # source://activesupport//lib/active_support/json/decoding.rb#9
def parse_json_times=(val); end
+
+ # source://activesupport//lib/active_support.rb#89
def test_order; end
+
+ # source://activesupport//lib/active_support.rb#89
def test_order=(val); end
class << self
+ # source://activesupport//lib/active_support.rb#83
def eager_load!; end
- def escape_html_entities_in_json(*args, &block); end
+
+ # source://activesupport//lib/active_support/json/encoding.rb#8
+ def escape_html_entities_in_json(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/json/encoding.rb#8
def escape_html_entities_in_json=(arg); end
+
+ # Returns the version of the currently loaded Active Support as a Gem::Version.
+ #
+ # source://activesupport//lib/active_support/gem_version.rb#5
def gem_version; end
- def json_encoder(*args, &block); end
+
+ # source://activesupport//lib/active_support/json/encoding.rb#8
+ def json_encoder(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/json/encoding.rb#8
def json_encoder=(arg); end
+
+ # source://activesupport//lib/active_support/json/decoding.rb#9
def parse_json_times; end
+
+ # source://activesupport//lib/active_support/json/decoding.rb#9
def parse_json_times=(val); end
+
+ # source://activesupport//lib/active_support.rb#89
def test_order; end
+
+ # source://activesupport//lib/active_support.rb#89
def test_order=(val); end
- def time_precision(*args, &block); end
+
+ # source://activesupport//lib/active_support/json/encoding.rb#8
+ def time_precision(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/json/encoding.rb#8
def time_precision=(arg); end
+
+ # source://activesupport//lib/active_support.rb#91
def to_time_preserves_timezone; end
+
+ # source://activesupport//lib/active_support.rb#95
def to_time_preserves_timezone=(value); end
- def use_standard_json_time_format(*args, &block); end
+
+ # source://activesupport//lib/active_support/json/encoding.rb#8
+ def use_standard_json_time_format(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/json/encoding.rb#8
def use_standard_json_time_format=(arg); end
+
+ # source://activesupport//lib/active_support.rb#99
def utc_to_local_returns_utc_offset_times; end
+
+ # source://activesupport//lib/active_support.rb#103
def utc_to_local_returns_utc_offset_times=(value); end
+
+ # Returns the version of the currently loaded ActiveSupport as a Gem::Version
+ #
+ # source://activesupport//lib/active_support/version.rb#7
def version; end
end
end
+# Actionable errors let's you define actions to resolve an error.
+#
+# To make an error actionable, include the ActiveSupport::ActionableError
+# module and invoke the +action+ class macro to define the action. An action
+# needs a name and a block to execute.
+#
+# source://activesupport//lib/active_support/actionable_error.rb#9
module ActiveSupport::ActionableError
extend ::ActiveSupport::Concern
include GeneratedInstanceMethods
@@ -49,7 +100,10 @@ module ActiveSupport::ActionableError
mixes_in_class_methods ::ActiveSupport::ActionableError::ClassMethods
class << self
+ # source://activesupport//lib/active_support/actionable_error.rb#18
def actions(error); end
+
+ # source://activesupport//lib/active_support/actionable_error.rb#27
def dispatch(error, name); end
end
@@ -66,302 +120,1389 @@ module ActiveSupport::ActionableError
end
end
+# source://activesupport//lib/active_support/actionable_error.rb#33
module ActiveSupport::ActionableError::ClassMethods
+ # Defines an action that can resolve the error.
+ #
+ # class PendingMigrationError < MigrationError
+ # include ActiveSupport::ActionableError
+ #
+ # action "Run pending migrations" do
+ # ActiveRecord::Tasks::DatabaseTasks.migrate
+ # end
+ # end
+ #
+ # source://activesupport//lib/active_support/actionable_error.rb#43
def action(name, &block); end
end
+# source://activesupport//lib/active_support/actionable_error.rb#12
class ActiveSupport::ActionableError::NonActionable < ::StandardError; end
+# Wrapping an array in an +ArrayInquirer+ gives a friendlier way to check
+# its string-like contents:
+#
+# variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
+#
+# variants.phone? # => true
+# variants.tablet? # => true
+# variants.desktop? # => false
+#
+# source://activesupport//lib/active_support/array_inquirer.rb#26
class ActiveSupport::ArrayInquirer < ::Array
+ # Passes each element of +candidates+ collection to ArrayInquirer collection.
+ # The method returns true if any element from the ArrayInquirer collection
+ # is equal to the stringified or symbolized form of any element in the +candidates+ collection.
+ #
+ # If +candidates+ collection is not given, method returns true.
+ #
+ # variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
+ #
+ # variants.any? # => true
+ # variants.any?(:phone, :tablet) # => true
+ # variants.any?('phone', 'desktop') # => true
+ # variants.any?(:desktop, :watch) # => false
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/array_inquirer.rb#27
def any?(*candidates); end
private
+ # source://activesupport//lib/active_support/array_inquirer.rb#42
def method_missing(name, *args); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/array_inquirer.rb#38
def respond_to_missing?(name, include_private = T.unsafe(nil)); end
end
+# Autoload and eager load conveniences for your library.
+#
+# This module allows you to define autoloads based on
+# Rails conventions (i.e. no need to define the path
+# it is automatically guessed based on the filename)
+# and also define a set of constants that needs to be
+# eager loaded:
+#
+# module MyLib
+# extend ActiveSupport::Autoload
+#
+# autoload :Model
+#
+# eager_autoload do
+# autoload :Cache
+# end
+# end
+#
+# Then your library can be eager loaded by simply calling:
+#
+# MyLib.eager_load!
+#
+# source://activesupport//lib/active_support/dependencies/autoload.rb#27
module ActiveSupport::Autoload
+ # source://activesupport//lib/active_support/dependencies/autoload.rb#37
def autoload(const_name, path = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/dependencies/autoload.rb#57
def autoload_at(path); end
+
+ # source://activesupport//lib/active_support/dependencies/autoload.rb#50
def autoload_under(path); end
+
+ # source://activesupport//lib/active_support/dependencies/autoload.rb#75
def autoloads; end
+
+ # source://activesupport//lib/active_support/dependencies/autoload.rb#64
def eager_autoload; end
+
+ # source://activesupport//lib/active_support/dependencies/autoload.rb#71
def eager_load!; end
class << self
+ # source://activesupport//lib/active_support/dependencies/autoload.rb#28
def extended(base); end
end
end
+# Backtraces often include many lines that are not relevant for the context
+# under review. This makes it hard to find the signal amongst the backtrace
+# noise, and adds debugging time. With a BacktraceCleaner, filters and
+# silencers are used to remove the noisy lines, so that only the most relevant
+# lines remain.
+#
+# Filters are used to modify lines of data, while silencers are used to remove
+# lines entirely. The typical filter use case is to remove lengthy path
+# information from the start of each line, and view file paths relevant to the
+# app directory instead of the file system root. The typical silencer use case
+# is to exclude the output of a noisy library from the backtrace, so that you
+# can focus on the rest.
+#
+# bc = ActiveSupport::BacktraceCleaner.new
+# bc.add_filter { |line| line.gsub(Rails.root.to_s, '') } # strip the Rails.root prefix
+# bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems
+# bc.clean(exception.backtrace) # perform the cleanup
+#
+# To reconfigure an existing BacktraceCleaner (like the default one in Rails)
+# and show as much data as possible, you can always call
+# BacktraceCleaner#remove_silencers!, which will restore the
+# backtrace to a pristine state. If you need to reconfigure an existing
+# BacktraceCleaner so that it does not filter or modify the paths of any lines
+# of the backtrace, you can call BacktraceCleaner#remove_filters!
+# These two methods will give you a completely untouched backtrace.
+#
+# Inspired by the Quiet Backtrace gem by thoughtbot.
+#
+# source://activesupport//lib/active_support/backtrace_cleaner.rb#31
class ActiveSupport::BacktraceCleaner
+ # @return [BacktraceCleaner] a new instance of BacktraceCleaner
+ #
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#32
def initialize; end
+ # Adds a filter from the block provided. Each line in the backtrace will be
+ # mapped against this filter.
+ #
+ # # Will turn "/my/rails/root/app/models/person.rb" into "/app/models/person.rb"
+ # backtrace_cleaner.add_filter { |line| line.gsub(Rails.root, '') }
+ #
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#60
def add_filter(&block); end
+
+ # Adds a silencer from the block provided. If the silencer returns +true+
+ # for a given line, it will be excluded from the clean backtrace.
+ #
+ # # Will reject all lines that include the word "puma", like "/gems/puma/server.rb" or "/app/my_puma_server/rb"
+ # backtrace_cleaner.add_silencer { |line| /puma/.match?(line) }
+ #
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#69
def add_silencer(&block); end
+
+ # Returns the backtrace after all filters and silencers have been run
+ # against it. Filters run first, then silencers.
+ #
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#41
def clean(backtrace, kind = T.unsafe(nil)); end
+
+ # Returns the backtrace after all filters and silencers have been run
+ # against it. Filters run first, then silencers.
+ #
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#41
def filter(backtrace, kind = T.unsafe(nil)); end
+
+ # Removes all filters, but leaves in the silencers. Useful if you suddenly
+ # need to see entire filepaths in the backtrace that you had already
+ # filtered out.
+ #
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#83
def remove_filters!; end
+
+ # Removes all silencers, but leaves in the filters. Useful if your
+ # context of debugging suddenly expands as you suspect a bug in one of
+ # the libraries you use.
+ #
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#76
def remove_silencers!; end
private
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#90
def add_gem_filter; end
+
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#99
def add_gem_silencer; end
+
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#103
def add_stdlib_silencer; end
+
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#107
def filter_backtrace(backtrace); end
+
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#123
def noise(backtrace); end
+
+ # source://activesupport//lib/active_support/backtrace_cleaner.rb#115
def silence(backtrace); end
end
+# source://activesupport//lib/active_support/backtrace_cleaner.rb#88
ActiveSupport::BacktraceCleaner::FORMATTED_GEMS_PATTERN = T.let(T.unsafe(nil), Regexp)
+# source://activesupport//lib/active_support/benchmarkable.rb#7
module ActiveSupport::Benchmarkable
+ # Allows you to measure the execution time of a block in a template and
+ # records the result to the log. Wrap this block around expensive operations
+ # or possible bottlenecks to get a time reading for the operation. For
+ # example, let's say you thought your file processing method was taking too
+ # long; you could wrap it in a benchmark block.
+ #
+ # <% benchmark 'Process data files' do %>
+ # <%= expensive_files_operation %>
+ # <% end %>
+ #
+ # That would add something like "Process data files (345.2ms)" to the log,
+ # which you can then use to compare timings when optimizing your code.
+ #
+ # You may give an optional logger level (:debug, :info,
+ # :warn, :error) as the :level option. The
+ # default logger level value is :info.
+ #
+ # <% benchmark 'Low-level files', level: :debug do %>
+ # <%= lowlevel_files_operation %>
+ # <% end %>
+ #
+ # Finally, you can pass true as the third argument to silence all log
+ # activity (other than the timing information) from inside the block. This
+ # is great for boiling down a noisy block to just a single statement that
+ # produces one log line:
+ #
+ # <% benchmark 'Process data files', level: :info, silence: true do %>
+ # <%= expensive_and_chatty_files_operation %>
+ # <% end %>
+ #
+ # source://activesupport//lib/active_support/benchmarkable.rb#37
def benchmark(message = T.unsafe(nil), options = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/core_ext/big_decimal/conversions.rb#7
module ActiveSupport::BigDecimalWithDefaultFormat
+ # source://activesupport//lib/active_support/core_ext/big_decimal/conversions.rb#8
def to_s(format = T.unsafe(nil)); end
end
+# See ActiveSupport::Cache::Store for documentation.
+#
+# source://activesupport//lib/active_support/cache.rb#16
module ActiveSupport::Cache
class << self
+ # Expands out the +key+ argument into a key that can be used for the
+ # cache store. Optionally accepts a namespace, and all keys will be
+ # scoped within that namespace.
+ #
+ # If the +key+ argument provided is an array, or responds to +to_a+, then
+ # each of elements in the array will be turned into parameters/keys and
+ # concatenated into a single key. For example:
+ #
+ # ActiveSupport::Cache.expand_cache_key([:foo, :bar]) # => "foo/bar"
+ # ActiveSupport::Cache.expand_cache_key([:foo, :bar], "namespace") # => "namespace/foo/bar"
+ #
+ # The +key+ argument can also respond to +cache_key+ or +to_param+.
+ #
+ # source://activesupport//lib/active_support/cache.rb#89
def expand_cache_key(key, namespace = T.unsafe(nil)); end
+
+ # Creates a new Store object according to the given options.
+ #
+ # If no arguments are passed to this method, then a new
+ # ActiveSupport::Cache::MemoryStore object will be returned.
+ #
+ # If you pass a Symbol as the first argument, then a corresponding cache
+ # store class under the ActiveSupport::Cache namespace will be created.
+ # For example:
+ #
+ # ActiveSupport::Cache.lookup_store(:memory_store)
+ # # => returns a new ActiveSupport::Cache::MemoryStore object
+ #
+ # ActiveSupport::Cache.lookup_store(:mem_cache_store)
+ # # => returns a new ActiveSupport::Cache::MemCacheStore object
+ #
+ # Any additional arguments will be passed to the corresponding cache store
+ # class's constructor:
+ #
+ # ActiveSupport::Cache.lookup_store(:file_store, '/tmp/cache')
+ # # => same as: ActiveSupport::Cache::FileStore.new('/tmp/cache')
+ #
+ # If the first argument is not a Symbol, then it will simply be returned:
+ #
+ # ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new)
+ # # => returns MyOwnCacheStore.new
+ #
+ # source://activesupport//lib/active_support/cache.rb#57
def lookup_store(store = T.unsafe(nil), *parameters); end
private
+ # source://activesupport//lib/active_support/cache.rb#101
def retrieve_cache_key(key); end
+
+ # Obtains the specified cache store class, given the name of the +store+.
+ # Raises an error when the store class cannot be found.
+ #
+ # source://activesupport//lib/active_support/cache.rb#113
def retrieve_store_class(store); end
end
end
+# This class is used to represent cache entries. Cache entries have a value, an optional
+# expiration time, and an optional version. The expiration time is used to support the :race_condition_ttl option
+# on the cache. The version is used to support the :version option on the cache for rejecting
+# mismatches.
+#
+# Since cache entries in most instances will be serialized, the internals of this class are highly optimized
+# using short instance variable names that are lazily defined.
+#
+# source://activesupport//lib/active_support/cache.rb#779
class ActiveSupport::Cache::Entry
+ # Creates a new cache entry for the specified value. Options supported are
+ # +:compress+, +:compress_threshold+, +:version+ and +:expires_in+.
+ #
+ # @return [Entry] a new instance of Entry
+ #
+ # source://activesupport//lib/active_support/cache.rb#786
def initialize(value, compress: T.unsafe(nil), compress_threshold: T.unsafe(nil), version: T.unsafe(nil), expires_in: T.unsafe(nil), **_arg5); end
+ # Returns the size of the cached value. This could be less than
+ # value.bytesize if the data is compressed.
+ #
+ # source://activesupport//lib/active_support/cache.rb#823
def bytesize; end
+
+ # Duplicates the value in a class. This is used by cache implementations that don't natively
+ # serialize entries to protect against accidental cache modifications.
+ #
+ # source://activesupport//lib/active_support/cache.rb#836
def dup_value!; end
+
+ # Checks if the entry is expired. The +expires_in+ parameter can override
+ # the value set when the entry was created.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/cache.rb#805
def expired?; end
+
+ # source://activesupport//lib/active_support/cache.rb#809
def expires_at; end
+
+ # source://activesupport//lib/active_support/cache.rb#813
def expires_at=(value); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/cache.rb#799
def mismatched?(version); end
+
+ # source://activesupport//lib/active_support/cache.rb#795
def value; end
+
+ # source://activesupport//lib/active_support/cache.rb#780
def version; end
private
+ # source://activesupport//lib/active_support/cache.rb#847
def compress!(compress_threshold); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/cache.rb#869
def compressed?; end
+
+ # source://activesupport//lib/active_support/cache.rb#873
def uncompress(value); end
end
+# source://activesupport//lib/active_support/cache.rb#782
ActiveSupport::Cache::Entry::DEFAULT_COMPRESS_LIMIT = T.let(T.unsafe(nil), Integer)
+# A cache store implementation which stores everything on the filesystem.
+#
+# FileStore implements the Strategy::LocalCache strategy which implements
+# an in-memory cache inside of a block.
+#
+# source://activesupport//lib/active_support/cache/file_store.rb#14
class ActiveSupport::Cache::FileStore < ::ActiveSupport::Cache::Store
include ::ActiveSupport::Cache::Strategy::LocalCache
+ # @return [FileStore] a new instance of FileStore
+ #
+ # source://activesupport//lib/active_support/cache/file_store.rb#23
def initialize(cache_path, **options); end
+ # Returns the value of attribute cache_path.
+ #
+ # source://activesupport//lib/active_support/cache/file_store.rb#16
def cache_path; end
+ # Preemptively iterates through all stored keys and removes the ones which have expired.
+ #
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#104
+ def cleanup(**options); end
+
+ # Deletes all items from the cache. In this case it deletes all the entries in the specified
+ # file store directory except for .keep or .gitkeep. Be careful which directory is specified in your
+ # config file when using +FileStore+ because everything in that directory will be deleted.
+ #
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#98
+ def clear(**options); end
+
+ # Decrements an already existing integer value that is stored in the cache.
+ # If the key is not found nothing is done.
+ #
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#123
+ def decrement(name, amount = T.unsafe(nil), **options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#110
+ def delete_matched(matcher, options = T.unsafe(nil)); end
+
+ # Increments an already existing integer value that is stored in the cache.
+ # If the key is not found nothing is done.
+ #
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#116
+ def increment(name, amount = T.unsafe(nil), **options); end
+
private
+ # Delete empty directories in the cache.
+ #
+ # source://activesupport//lib/active_support/cache/file_store.rb#154
def delete_empty_directories(dir); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#168
+ def delete_entry(key, **options); end
+
+ # Make sure a file path's directories exist.
+ #
+ # source://activesupport//lib/active_support/cache/file_store.rb#163
def ensure_cache_path(path); end
+
+ # Translate a file path into a key.
+ #
+ # source://activesupport//lib/active_support/cache/file_store.rb#148
def file_path_key(path); end
+
+ # Lock a file for a block so only one process can modify it at a time.
+ #
+ # source://activesupport//lib/active_support/cache/file_store.rb#107
def lock_file(file_name, &block); end
+
+ # Modifies the amount of an already existing integer value that is stored in the cache.
+ # If the key is not found nothing is done.
+ #
+ # source://activesupport//lib/active_support/cache/file_store.rb#181
def modify_value(name, amount, options); end
+
+ # Translate a key into a file path.
+ #
+ # source://activesupport//lib/active_support/cache/file_store.rb#121
def normalize_key(key, options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#131
+ def read_entry(key, **options); end
+
+ # source://activesupport//lib/active_support/cache/file_store.rb#167
def search_dir(dir, &callback); end
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#158
+ def write_entry(key, entry, **options); end
+
class << self
+ # Advertise cache versioning support.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/cache/file_store.rb#29
def supports_cache_versioning?; end
end
end
+# source://activesupport//lib/active_support/cache/file_store.rb#18
ActiveSupport::Cache::FileStore::DIR_FORMATTER = T.let(T.unsafe(nil), String)
+
+# max filename size on file system is 255, minus room for timestamp, pid, and random characters appended by Tempfile (used by atomic write)
+#
+# source://activesupport//lib/active_support/cache/file_store.rb#19
ActiveSupport::Cache::FileStore::FILENAME_MAX_SIZE = T.let(T.unsafe(nil), Integer)
+
+# max is 1024, plus some room
+#
+# source://activesupport//lib/active_support/cache/file_store.rb#20
ActiveSupport::Cache::FileStore::FILEPATH_MAX_SIZE = T.let(T.unsafe(nil), Integer)
+
+# source://activesupport//lib/active_support/cache/file_store.rb#21
ActiveSupport::Cache::FileStore::GITKEEP_FILES = T.let(T.unsafe(nil), Array)
+# A cache store implementation which stores everything into memory in the
+# same process. If you're running multiple Ruby on Rails server processes
+# (which is the case if you're using Phusion Passenger or puma clustered mode),
+# then this means that Rails server process instances won't be able
+# to share cache data with each other and this may not be the most
+# appropriate cache in that scenario.
+#
+# This cache has a bounded size specified by the :size options to the
+# initializer (default is 32Mb). When the cache exceeds the allotted size,
+# a cleanup will occur which tries to prune the cache down to three quarters
+# of the maximum size by removing the least recently used entries.
+#
+# Unlike other Cache store implementations, MemoryStore does not compress
+# values by default. MemoryStore does not benefit from compression as much
+# as other Store implementations, as it does not send data over a network.
+# However, when compression is enabled, it still pays the full cost of
+# compression in terms of cpu use.
+#
+# MemoryStore is thread-safe.
+#
+# source://activesupport//lib/active_support/cache/memory_store.rb#26
class ActiveSupport::Cache::MemoryStore < ::ActiveSupport::Cache::Store
+ # @return [MemoryStore] a new instance of MemoryStore
+ #
+ # source://activesupport//lib/active_support/cache/memory_store.rb#44
def initialize(options = T.unsafe(nil)); end
+ # Preemptively iterates through all stored keys and removes the ones which have expired.
+ #
+ # source://activesupport//lib/active_support/cache/memory_store.rb#71
def cleanup(options = T.unsafe(nil)); end
+
+ # Delete all data stored in a given cache store.
+ #
+ # source://activesupport//lib/active_support/cache/memory_store.rb#63
def clear(options = T.unsafe(nil)); end
+
+ # Decrement an integer value in the cache.
+ #
+ # source://activesupport//lib/active_support/cache/memory_store.rb#113
def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # Deletes cache entries if the cache key matches a given pattern.
+ #
+ # source://activesupport//lib/active_support/cache/memory_store.rb#118
def delete_matched(matcher, options = T.unsafe(nil)); end
+
+ # Increment an integer value in the cache.
+ #
+ # source://activesupport//lib/active_support/cache/memory_store.rb#108
def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/cache/memory_store.rb#129
def inspect; end
+
+ # To ensure entries fit within the specified memory prune the cache by removing the least
+ # recently accessed entries.
+ #
+ # source://activesupport//lib/active_support/cache/memory_store.rb#84
def prune(target_size, max_time = T.unsafe(nil)); end
+
+ # Returns true if the cache is currently being pruned.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/cache/memory_store.rb#103
def pruning?; end
+
+ # Synchronize calls to the cache. This should be called wherever the underlying cache implementation
+ # is not thread safe.
+ #
+ # source://activesupport//lib/active_support/cache/memory_store.rb#135
def synchronize(&block); end
private
+ # source://activesupport//lib/active_support/cache/memory_store.rb#142
def cached_size(key, payload); end
+
+ # source://activesupport//lib/active_support/cache/memory_store.rb#175
def delete_entry(key, **options); end
+
+ # source://activesupport//lib/active_support/cache/memory_store.rb#183
def modify_value(name, amount, options); end
+
+ # source://activesupport//lib/active_support/cache/memory_store.rb#146
def read_entry(key, **options); end
+
+ # source://activesupport//lib/active_support/cache/memory_store.rb#158
def write_entry(key, entry, **options); end
class << self
+ # Advertise cache versioning support.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/cache/memory_store.rb#58
def supports_cache_versioning?; end
end
end
+# source://activesupport//lib/active_support/cache/memory_store.rb#42
ActiveSupport::Cache::MemoryStore::DEFAULT_CODER = ActiveSupport::Cache::MemoryStore::DupCoder
+# source://activesupport//lib/active_support/cache/memory_store.rb#27
module ActiveSupport::Cache::MemoryStore::DupCoder
class << self
+ # source://activesupport//lib/active_support/cache/memory_store.rb#35
def dump(entry); end
+
+ # source://activesupport//lib/active_support/cache/memory_store.rb#29
def load(entry); end
end
end
+# source://activesupport//lib/active_support/cache/memory_store.rb#140
ActiveSupport::Cache::MemoryStore::PER_ENTRY_OVERHEAD = T.let(T.unsafe(nil), Integer)
+# source://activesupport//lib/active_support/cache.rb#760
module ActiveSupport::Cache::NullCoder
class << self
+ # source://activesupport//lib/active_support/cache.rb#766
def dump(entry); end
+
+ # source://activesupport//lib/active_support/cache.rb#762
def load(payload); end
end
end
+# A cache store implementation which doesn't actually store anything. Useful in
+# development and test environments where you don't want caching turned on but
+# need to go through the caching interface.
+#
+# This cache does implement the local cache strategy, so values will actually
+# be cached inside blocks that utilize this strategy. See
+# ActiveSupport::Cache::Strategy::LocalCache for more details.
+#
+# source://activesupport//lib/active_support/cache/null_store.rb#12
class ActiveSupport::Cache::NullStore < ::ActiveSupport::Cache::Store
include ::ActiveSupport::Cache::Strategy::LocalCache
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#104
+ def cleanup(**options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#98
+ def clear(**options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#123
+ def decrement(name, amount = T.unsafe(nil), **options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#110
+ def delete_matched(matcher, options = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#116
+ def increment(name, amount = T.unsafe(nil), **options); end
+
+ private
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#168
+ def delete_entry(key, **options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#131
+ def read_entry(key, **options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#158
+ def write_entry(key, entry, **options); end
+
class << self
+ # Advertise cache versioning support.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/cache/null_store.rb#16
def supports_cache_versioning?; end
end
end
+# An abstract cache store class. There are multiple cache store
+# implementations, each having its own additional features. See the classes
+# under the ActiveSupport::Cache module, e.g.
+# ActiveSupport::Cache::MemCacheStore. MemCacheStore is currently the most
+# popular cache store for large production websites.
+#
+# Some implementations may not support all methods beyond the basic cache
+# methods of +fetch+, +write+, +read+, +exist?+, and +delete+.
+#
+# ActiveSupport::Cache::Store can store any serializable Ruby object.
+#
+# cache = ActiveSupport::Cache::MemoryStore.new
+#
+# cache.read('city') # => nil
+# cache.write('city', "Duckburgh")
+# cache.read('city') # => "Duckburgh"
+#
+# Keys are always translated into Strings and are case sensitive. When an
+# object is specified as a key and has a +cache_key+ method defined, this
+# method will be called to define the key. Otherwise, the +to_param+
+# method will be called. Hashes and Arrays can also be used as keys. The
+# elements will be delimited by slashes, and the elements within a Hash
+# will be sorted by key so they are consistent.
+#
+# cache.read('city') == cache.read(:city) # => true
+#
+# Nil values can be cached.
+#
+# If your cache is on a shared infrastructure, you can define a namespace
+# for your cache entries. If a namespace is defined, it will be prefixed on
+# to every key. The namespace can be either a static value or a Proc. If it
+# is a Proc, it will be invoked when each key is evaluated so that you can
+# use application logic to invalidate keys.
+#
+# cache.namespace = -> { @last_mod_time } # Set the namespace to a variable
+# @last_mod_time = Time.now # Invalidate the entire cache by changing namespace
+#
+# Cached data larger than 1kB are compressed by default. To turn off
+# compression, pass compress: false to the initializer or to
+# individual +fetch+ or +write+ method calls. The 1kB compression
+# threshold is configurable with the :compress_threshold option,
+# specified in bytes.
+#
+# source://activesupport//lib/active_support/cache.rb#166
class ActiveSupport::Cache::Store
+ # Creates a new cache. The options will be passed to any write method calls
+ # except for :namespace which can be used to set the global
+ # namespace for the cache.
+ #
+ # @return [Store] a new instance of Store
+ #
+ # source://activesupport//lib/active_support/cache.rb#194
def initialize(options = T.unsafe(nil)); end
+ # Cleanups the cache by removing expired entries.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # Some implementations may not support this method.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://activesupport//lib/active_support/cache.rb#547
def cleanup(options = T.unsafe(nil)); end
+
+ # Clears the entire cache. Be careful with this method since it could
+ # affect other processes if shared cache is being used.
+ #
+ # The options hash is passed to the underlying cache implementation.
+ #
+ # Some implementations may not support this method.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://activesupport//lib/active_support/cache.rb#557
def clear(options = T.unsafe(nil)); end
+
+ # Decrements an integer value in the cache.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # Some implementations may not support this method.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://activesupport//lib/active_support/cache.rb#538
def decrement(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # Deletes an entry in the cache. Returns +true+ if an entry is deleted.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # source://activesupport//lib/active_support/cache.rb#483
def delete(name, options = T.unsafe(nil)); end
+
+ # Deletes all entries with keys matching the pattern.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # Some implementations may not support this method.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://activesupport//lib/active_support/cache.rb#520
def delete_matched(matcher, options = T.unsafe(nil)); end
+
+ # Deletes multiple entries in the cache.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # source://activesupport//lib/active_support/cache.rb#494
def delete_multi(names, options = T.unsafe(nil)); end
+
+ # Returns +true+ if the cache contains an entry for the given key.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/cache.rb#506
def exist?(name, options = T.unsafe(nil)); end
+
+ # Fetches data from the cache, using the given key. If there is data in
+ # the cache with the given key, then that data is returned.
+ #
+ # If there is no such data in the cache (a cache miss), then +nil+ will be
+ # returned. However, if a block has been passed, that block will be passed
+ # the key and executed in the event of a cache miss. The return value of the
+ # block will be written to the cache under the given cache key, and that
+ # return value will be returned.
+ #
+ # cache.write('today', 'Monday')
+ # cache.fetch('today') # => "Monday"
+ #
+ # cache.fetch('city') # => nil
+ # cache.fetch('city') do
+ # 'Duckburgh'
+ # end
+ # cache.fetch('city') # => "Duckburgh"
+ #
+ # You may also specify additional options via the +options+ argument.
+ # Setting force: true forces a cache "miss," meaning we treat
+ # the cache value as missing even if it's present. Passing a block is
+ # required when +force+ is true so this always results in a cache write.
+ #
+ # cache.write('today', 'Monday')
+ # cache.fetch('today', force: true) { 'Tuesday' } # => 'Tuesday'
+ # cache.fetch('today', force: true) # => ArgumentError
+ #
+ # The +:force+ option is useful when you're calling some other method to
+ # ask whether you should force a cache write. Otherwise, it's clearer to
+ # just call Cache#write.
+ #
+ # Setting skip_nil: true will not cache nil result:
+ #
+ # cache.fetch('foo') { nil }
+ # cache.fetch('bar', skip_nil: true) { nil }
+ # cache.exist?('foo') # => true
+ # cache.exist?('bar') # => false
+ #
+ #
+ # Setting compress: false disables compression of the cache entry.
+ #
+ # Setting :expires_in will set an expiration time on the cache.
+ # All caches support auto-expiring content after a specified number of
+ # seconds. This value can be specified as an option to the constructor
+ # (in which case all entries will be affected), or it can be supplied to
+ # the +fetch+ or +write+ method to effect just one entry.
+ #
+ # cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 5.minutes)
+ # cache.write(key, value, expires_in: 1.minute) # Set a lower value for one entry
+ #
+ # Setting :version verifies the cache stored under name
+ # is of the same version. nil is returned on mismatches despite contents.
+ # This feature is used to support recyclable cache keys.
+ #
+ # Setting :race_condition_ttl is very useful in situations where
+ # a cache entry is used very frequently and is under heavy load. If a
+ # cache expires and due to heavy load several different processes will try
+ # to read data natively and then they all will try to write to cache. To
+ # avoid that case the first process to find an expired cache entry will
+ # bump the cache expiration time by the value set in :race_condition_ttl.
+ # Yes, this process is extending the time for a stale value by another few
+ # seconds. Because of extended life of the previous cache, other processes
+ # will continue to use slightly stale data for a just a bit longer. In the
+ # meantime that first process will go ahead and will write into cache the
+ # new value. After that all the processes will start getting the new value.
+ # The key is to keep :race_condition_ttl small.
+ #
+ # If the process regenerating the entry errors out, the entry will be
+ # regenerated after the specified number of seconds. Also note that the
+ # life of stale cache is extended only if it expired recently. Otherwise
+ # a new value is generated and :race_condition_ttl does not play
+ # any role.
+ #
+ # # Set all values to expire after one minute.
+ # cache = ActiveSupport::Cache::MemoryStore.new(expires_in: 1.minute)
+ #
+ # cache.write('foo', 'original value')
+ # val_1 = nil
+ # val_2 = nil
+ # sleep 60
+ #
+ # Thread.new do
+ # val_1 = cache.fetch('foo', race_condition_ttl: 10.seconds) do
+ # sleep 1
+ # 'new value 1'
+ # end
+ # end
+ #
+ # Thread.new do
+ # val_2 = cache.fetch('foo', race_condition_ttl: 10.seconds) do
+ # 'new value 2'
+ # end
+ # end
+ #
+ # cache.fetch('foo') # => "original value"
+ # sleep 10 # First thread extended the life of cache by another 10 seconds
+ # cache.fetch('foo') # => "new value 1"
+ # val_1 # => "new value 1"
+ # val_2 # => "original value"
+ #
+ # Other options will be handled by the specific cache store implementation.
+ # Internally, #fetch calls #read_entry, and calls #write_entry on a cache
+ # miss. +options+ will be passed to the #read and #write calls.
+ #
+ # For example, MemCacheStore's #write method supports the +:raw+
+ # option, which tells the memcached server to store all values as strings.
+ # We can use this option with #fetch too:
+ #
+ # cache = ActiveSupport::Cache::MemCacheStore.new
+ # cache.fetch("foo", force: true, raw: true) do
+ # :bar
+ # end
+ # cache.fetch('foo') # => "bar"
+ #
+ # source://activesupport//lib/active_support/cache.rb#326
def fetch(name, options = T.unsafe(nil), &block); end
+
+ # Fetches data from the cache, using the given keys. If there is data in
+ # the cache with the given keys, then that data is returned. Otherwise,
+ # the supplied block is called for each key for which there was no data,
+ # and the result will be written to the cache and returned.
+ # Therefore, you need to pass a block that returns the data to be written
+ # to the cache. If you do not want to write the cache when the cache is
+ # not found, use #read_multi.
+ #
+ # Returns a hash with the data for each of the names. For example:
+ #
+ # cache.write("bim", "bam")
+ # cache.fetch_multi("bim", "unknown_key") do |key|
+ # "Fallback value for key: #{key}"
+ # end
+ # # => { "bim" => "bam",
+ # # "unknown_key" => "Fallback value for key: unknown_key" }
+ #
+ # Options are passed to the underlying cache implementation. For example:
+ #
+ # cache.fetch_multi("fizz", expires_in: 5.seconds) do |key|
+ # "buzz"
+ # end
+ # # => {"fizz"=>"buzz"}
+ # cache.read("fizz")
+ # # => "buzz"
+ # sleep(6)
+ # cache.read("fizz")
+ # # => nil
+ #
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/cache.rb#446
def fetch_multi(*names); end
+
+ # Increments an integer value in the cache.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # Some implementations may not support this method.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://activesupport//lib/active_support/cache.rb#529
def increment(name, amount = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/cache.rb#169
def logger; end
+
+ # source://activesupport//lib/active_support/cache.rb#169
def logger=(val); end
+
+ # Silences the logger within a block.
+ #
+ # source://activesupport//lib/active_support/cache.rb#206
def mute; end
+
+ # Returns the value of attribute options.
+ #
+ # source://activesupport//lib/active_support/cache.rb#171
def options; end
+
+ # Reads data from the cache, using the given key. If there is data in
+ # the cache with the given key, then that data is returned. Otherwise,
+ # +nil+ is returned.
+ #
+ # Note, if data was written with the :expires_in or
+ # :version options, both of these conditions are applied before
+ # the data is returned.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # source://activesupport//lib/active_support/cache.rb#361
def read(name, options = T.unsafe(nil)); end
+
+ # Reads multiple values at once from the cache. Options can be passed
+ # in the last argument.
+ #
+ # Some cache implementation may optimize this method.
+ #
+ # Returns a hash mapping the names provided to the values found.
+ #
+ # source://activesupport//lib/active_support/cache.rb#394
def read_multi(*names); end
+
+ # Returns the value of attribute silence.
+ #
+ # source://activesupport//lib/active_support/cache.rb#171
def silence; end
+
+ # Silences the logger.
+ #
+ # source://activesupport//lib/active_support/cache.rb#200
def silence!; end
+
+ # Returns the value of attribute silence.
+ #
+ # source://activesupport//lib/active_support/cache.rb#171
def silence?; end
+
+ # Writes the value to the cache, with the key.
+ #
+ # Options are passed to the underlying cache implementation.
+ #
+ # source://activesupport//lib/active_support/cache.rb#471
def write(name, value, options = T.unsafe(nil)); end
+
+ # Cache Storage API to write multiple values at once.
+ #
+ # source://activesupport//lib/active_support/cache.rb#406
def write_multi(hash, options = T.unsafe(nil)); end
private
+ # Deletes an entry from the cache implementation. Subclasses must
+ # implement this method.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://activesupport//lib/active_support/cache.rb#630
def delete_entry(key, **options); end
+
+ # Deletes multiples entries in the cache implementation. Subclasses MAY
+ # implement this method.
+ #
+ # source://activesupport//lib/active_support/cache.rb#636
def delete_multi_entries(entries, **options); end
+
+ # source://activesupport//lib/active_support/cache.rb#597
def deserialize_entry(payload); end
+
+ # Expands key to be a consistent string value. Invokes +cache_key+ if
+ # object responds to +cache_key+. Otherwise, +to_param+ method will be
+ # called. If the key is a Hash, then keys will be sorted alphabetically.
+ #
+ # source://activesupport//lib/active_support/cache.rb#690
def expanded_key(key); end
+
+ # source://activesupport//lib/active_support/cache.rb#711
def expanded_version(key); end
+
+ # source://activesupport//lib/active_support/cache.rb#745
def get_entry_value(entry, name, options); end
+
+ # source://activesupport//lib/active_support/cache.rb#729
def handle_expired_entry(entry, key, options); end
+
+ # source://activesupport//lib/active_support/cache.rb#719
def instrument(operation, key, options = T.unsafe(nil)); end
+
+ # Adds the namespace defined in the options to a pattern designed to
+ # match keys. Implementations that support delete_matched should call
+ # this method to translate a pattern that matches names into one that
+ # matches namespaced keys.
+ #
+ # source://activesupport//lib/active_support/cache.rb#566
def key_matcher(pattern, options); end
+
+ # Merges the default options with ones specific to a method call.
+ #
+ # source://activesupport//lib/active_support/cache.rb#641
def merged_options(call_options); end
+
+ # Prefix the key with a namespace string:
+ #
+ # namespace_key 'foo', namespace: 'cache'
+ # # => 'cache:foo'
+ #
+ # With a namespace block:
+ #
+ # namespace_key 'foo', namespace: -> { 'cache' }
+ # # => 'cache:foo'
+ #
+ # source://activesupport//lib/active_support/cache.rb#668
def namespace_key(key, options = T.unsafe(nil)); end
+
+ # Expands and namespaces the cache key. May be overridden by
+ # cache stores to do additional normalization.
+ #
+ # source://activesupport//lib/active_support/cache.rb#655
def normalize_key(key, options = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/cache.rb#707
def normalize_version(key, options = T.unsafe(nil)); end
+
+ # Reads an entry from the cache implementation. Subclasses must implement
+ # this method.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://activesupport//lib/active_support/cache.rb#583
def read_entry(key, **options); end
+
+ # Reads multiple entries from the cache implementation. Subclasses MAY
+ # implement this method.
+ #
+ # source://activesupport//lib/active_support/cache.rb#603
def read_multi_entries(names, **options); end
+
+ # source://activesupport//lib/active_support/cache.rb#750
def save_block_result_to_cache(name, options); end
+
+ # source://activesupport//lib/active_support/cache.rb#593
def serialize_entry(entry); end
+
+ # Writes an entry to the cache implementation. Subclasses must implement
+ # this method.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://activesupport//lib/active_support/cache.rb#589
def write_entry(key, entry, **options); end
+
+ # Writes multiple entries to the cache implementation. Subclasses MAY
+ # implement this method.
+ #
+ # source://activesupport//lib/active_support/cache.rb#622
def write_multi_entries(hash, **options); end
class << self
+ # source://activesupport//lib/active_support/cache.rb#169
def logger; end
+
+ # source://activesupport//lib/active_support/cache.rb#169
def logger=(val); end
private
+ # source://activesupport//lib/active_support/cache.rb#183
def ensure_connection_pool_added!; end
+
+ # source://activesupport//lib/active_support/cache.rb#176
def retrieve_pool_options(options); end
end
end
+# source://activesupport//lib/active_support/cache.rb#167
ActiveSupport::Cache::Store::DEFAULT_CODER = Marshal
+
+# source://activesupport//lib/active_support/cache.rb#27
module ActiveSupport::Cache::Strategy; end
+# Caches that implement LocalCache will be backed by an in-memory cache for the
+# duration of a block. Repeated calls to the cache for the same key will hit the
+# in-memory cache for faster access.
+#
+# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#12
module ActiveSupport::Cache::Strategy::LocalCache
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#104
def cleanup(**options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#98
def clear(**options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#123
def decrement(name, amount = T.unsafe(nil), **options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#110
def delete_matched(matcher, options = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#116
def increment(name, amount = T.unsafe(nil), **options); end
+
+ # Middleware class can be inserted as a Rack handler to be local cache for the
+ # duration of request.
+ #
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#92
def middleware; end
+
+ # Use a local cache for the duration of block.
+ #
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#86
def with_local_cache; end
private
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#193
def bypass_local_cache; end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#168
def delete_entry(key, **options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#189
def local_cache; end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#185
def local_cache_key; end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#131
def read_entry(key, **options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#145
def read_multi_entries(keys, **options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#197
def use_temporary_local_cache(temporary_cache); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#173
def write_cache_value(name, value, **options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#158
def write_entry(key, entry, **options); end
end
+# Class for storing and registering the local caches.
+#
+# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#16
class ActiveSupport::Cache::Strategy::LocalCache::LocalCacheRegistry
extend ::ActiveSupport::PerThreadRegistry
+ # @return [LocalCacheRegistry] a new instance of LocalCacheRegistry
+ #
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#19
def initialize; end
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#23
def cache_for(local_cache_key); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#27
def set_cache_for(local_cache_key, value); end
class << self
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#32
def cache_for(l); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#31
def set_cache_for(l, v); end
end
end
+# Simple memory backed cache. This cache is not thread safe and is intended only
+# for serving as a temporary memory cache for a single thread.
+#
+# source://activesupport//lib/active_support/cache/strategy/local_cache.rb#37
class ActiveSupport::Cache::Strategy::LocalCache::LocalStore < ::ActiveSupport::Cache::Store
+ # @return [LocalStore] a new instance of LocalStore
+ #
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#38
def initialize; end
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#48
def clear(options = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#73
def delete_entry(key, **options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#77
def fetch_entry(key, options = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#52
def read_entry(key, **options); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#56
def read_multi_entries(keys, **options); end
+
+ # Don't allow synchronizing since it isn't thread safe.
+ #
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#44
def synchronize; end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache.rb#67
def write_entry(key, entry, **options); end
end
+# --
+# This class wraps up local storage for middlewares. Only the middleware method should
+# construct them.
+#
+# source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#13
class ActiveSupport::Cache::Strategy::LocalCache::Middleware
+ # @return [Middleware] a new instance of Middleware
+ #
+ # source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#16
def initialize(name, local_cache_key); end
+ # source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#27
def call(env); end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#14
def local_cache_key; end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#14
def name; end
+
+ # source://activesupport//lib/active_support/cache/strategy/local_cache_middleware.rb#22
def new(app); end
end
+# These options mean something to all cache implementations. Individual cache
+# implementations may support additional options.
+#
+# source://activesupport//lib/active_support/cache.rb#25
ActiveSupport::Cache::UNIVERSAL_OPTIONS = T.let(T.unsafe(nil), Array)
+# CachingKeyGenerator is a wrapper around KeyGenerator which allows users to avoid
+# re-executing the key generation process when it's called using the same salt and
+# key_size.
+#
+# source://activesupport//lib/active_support/key_generator.rb#30
class ActiveSupport::CachingKeyGenerator
+ # @return [CachingKeyGenerator] a new instance of CachingKeyGenerator
+ #
+ # source://activesupport//lib/active_support/key_generator.rb#31
def initialize(key_generator); end
+ # Returns a derived key suitable for use.
+ #
+ # source://activesupport//lib/active_support/key_generator.rb#37
def generate_key(*args); end
end
+# Callbacks are code hooks that are run at key points in an object's life cycle.
+# The typical use case is to have a base class define a set of callbacks
+# relevant to the other functionality it supplies, so that subclasses can
+# install callbacks that enhance or modify the base functionality without
+# needing to override or redefine methods of the base class.
+#
+# Mixing in this module allows you to define the events in the object's
+# life cycle that will support callbacks (via +ClassMethods.define_callbacks+),
+# set the instance methods, procs, or callback objects to be called (via
+# +ClassMethods.set_callback+), and run the installed callbacks at the
+# appropriate times (via +run_callbacks+).
+#
+# By default callbacks are halted by throwing +:abort+.
+# See +ClassMethods.define_callbacks+ for details.
+#
+# Three kinds of callbacks are supported: before callbacks, run before a
+# certain event; after callbacks, run after the event; and around callbacks,
+# blocks that surround the event, triggering it when they yield. Callback code
+# can be contained in instance methods, procs or lambdas, or callback objects
+# that respond to certain predetermined methods. See +ClassMethods.set_callback+
+# for details.
+#
+# class Record
+# include ActiveSupport::Callbacks
+# define_callbacks :save
+#
+# def save
+# run_callbacks :save do
+# puts "- save"
+# end
+# end
+# end
+#
+# class PersonRecord < Record
+# set_callback :save, :before, :saving_message
+# def saving_message
+# puts "saving..."
+# end
+#
+# set_callback :save, :after do |object|
+# puts "saved"
+# end
+# end
+#
+# person = PersonRecord.new
+# person.save
+#
+# Output:
+# saving...
+# - save
+# saved
+#
+# source://activesupport//lib/active_support/callbacks.rb#62
module ActiveSupport::Callbacks
extend ::ActiveSupport::Concern
include GeneratedInstanceMethods
@@ -370,10 +1511,39 @@ module ActiveSupport::Callbacks
mixes_in_class_methods ::ActiveSupport::Callbacks::ClassMethods
mixes_in_class_methods ::ActiveSupport::DescendantsTracker
+ # Runs the callbacks for the given event.
+ #
+ # Calls the before and around callbacks in the order they were set, yields
+ # the block (if given one), and then runs the after callbacks in reverse
+ # order.
+ #
+ # If the callback chain was halted, returns +false+. Otherwise returns the
+ # result of the block, +nil+ if no callbacks have been set, or +true+
+ # if callbacks have been set but no block is given.
+ #
+ # run_callbacks :save do
+ # save
+ # end
+ #
+ # --
+ #
+ # As this method is used in many places, and often wraps large portions of
+ # user code, it has an additional design goal of minimizing its impact on
+ # the visible call stack. An exception from inside a :before or :after
+ # callback can be as noisy as it likes -- but when control has passed
+ # smoothly through and into the supplied block, we want as little evidence
+ # as possible that we were here.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#94
def run_callbacks(kind); end
private
+ # A hook invoked every time a before callback is halted.
+ # This can be overridden in ActiveSupport::Callbacks implementors in order
+ # to provide better debugging/logging.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#146
def halted_callback_hook(filter, name); end
module GeneratedClassMethods
@@ -388,474 +1558,1841 @@ module ActiveSupport::Callbacks
end
end
+# source://activesupport//lib/active_support/callbacks.rb#70
ActiveSupport::Callbacks::CALLBACK_FILTER_TYPES = T.let(T.unsafe(nil), Array)
+# A future invocation of user-supplied code (either as a callback,
+# or a condition filter).
+#
+# source://activesupport//lib/active_support/callbacks.rb#387
class ActiveSupport::Callbacks::CallTemplate
+ # @return [CallTemplate] a new instance of CallTemplate
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#388
def initialize(target, method, arguments, block); end
+ # Return the parts needed to make this call, with the given
+ # input values.
+ #
+ # Returns an array of the form:
+ #
+ # [target, block, method, *arguments]
+ #
+ # This array can be used as such:
+ #
+ # target.send(method, *arguments, &block)
+ #
+ # The actual invocation is left up to the caller to minimize
+ # call stack pollution.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#408
def expand(target, value, block); end
+
+ # Return a lambda that will make this call when given the input
+ # values, but then return the boolean inverse of that result.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#433
def inverted_lambda; end
+
+ # Return a lambda that will make this call when given the input
+ # values.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#424
def make_lambda; end
class << self
+ # Filters support:
+ #
+ # Symbols:: A method to call.
+ # Procs:: A proc to call with the object.
+ # Objects:: An object with a before_foo method on it to call.
+ #
+ # All of these objects are converted into a CallTemplate and handled
+ # the same after this point.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#448
def build(filter, callback); end
end
end
+# source://activesupport//lib/active_support/callbacks.rb#279
class ActiveSupport::Callbacks::Callback
+ # @return [Callback] a new instance of Callback
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#294
def initialize(name, filter, kind, options, chain_config); end
+ # Wraps code with filter
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#333
def apply(callback_sequence); end
+
+ # Returns the value of attribute chain_config.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#292
def chain_config; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#347
def current_scopes; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#323
def duplicates?(other); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#304
def filter; end
+
+ # Returns the value of attribute kind.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#291
def kind; end
+
+ # Sets the attribute kind
+ #
+ # @param value the value to set the attribute kind to.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#291
def kind=(_arg0); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#319
def matches?(_kind, _filter); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#307
def merge_conditional_options(chain, if_option:, unless_option:); end
+
+ # Returns the value of attribute name.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#291
def name; end
+
+ # Sets the attribute name
+ #
+ # @param value the value to set the attribute name to.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#291
def name=(_arg0); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#305
def raw_filter; end
private
+ # source://activesupport//lib/active_support/callbacks.rb#355
def check_conditionals(conditionals); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#370
def compute_identifier(filter); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#379
def conditions_lambdas; end
class << self
+ # source://activesupport//lib/active_support/callbacks.rb#280
def build(chain, filter, kind, options); end
end
end
+# source://activesupport//lib/active_support/callbacks.rb#352
ActiveSupport::Callbacks::Callback::EMPTY_ARRAY = T.let(T.unsafe(nil), Array)
+# source://activesupport//lib/active_support/callbacks.rb#520
class ActiveSupport::Callbacks::CallbackChain
include ::Enumerable
+ # @return [CallbackChain] a new instance of CallbackChain
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#525
def initialize(name, config); end
+ # source://activesupport//lib/active_support/callbacks.rb#571
def append(*callbacks); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#550
def clear; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#562
def compile; end
+
+ # Returns the value of attribute config.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#523
def config; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#545
def delete(o); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#536
def each(&block); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#538
def empty?; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#537
def index(o); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#540
def insert(index, o); end
+
+ # Returns the value of attribute name.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#523
def name; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#575
def prepend(*callbacks); end
protected
+ # Returns the value of attribute chain.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#580
def chain; end
private
+ # source://activesupport//lib/active_support/callbacks.rb#583
def append_one(callback); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#600
def default_terminator; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#556
def initialize_copy(other); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#589
def prepend_one(callback); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#595
def remove_duplicates(callback); end
end
+# Execute before and after filters in a sequence instead of
+# chaining them with nested lambda calls, see:
+# https://github.com/rails/rails/issues/18011
+#
+# source://activesupport//lib/active_support/callbacks.rb#473
class ActiveSupport::Callbacks::CallbackSequence
+ # @return [CallbackSequence] a new instance of CallbackSequence
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#474
def initialize(nested = T.unsafe(nil), call_template = T.unsafe(nil), user_conditions = T.unsafe(nil)); end
+ # source://activesupport//lib/active_support/callbacks.rb#488
def after(&after); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#493
def around(call_template, user_conditions); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#483
def before(&before); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#507
def expand_call_template(arg, block); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#503
def final?; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#515
def invoke_after(arg); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#511
def invoke_before(arg); end
+
+ # Returns the value of attribute nested.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#501
def nested; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#497
def skip?(arg); end
end
+# source://activesupport//lib/active_support/callbacks.rb#612
module ActiveSupport::Callbacks::ClassMethods
+ # This is used internally to append, prepend and skip callbacks to the
+ # CallbackChain.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#622
def __update_callbacks(name); end
+
+ # Define sets of events in the object life cycle that support callbacks.
+ #
+ # define_callbacks :validate
+ # define_callbacks :initialize, :save, :destroy
+ #
+ # ===== Options
+ #
+ # * :terminator - Determines when a before filter will halt the
+ # callback chain, preventing following before and around callbacks from
+ # being called and the event from being triggered.
+ # This should be a lambda to be executed.
+ # The current object and the result lambda of the callback will be provided
+ # to the terminator lambda.
+ #
+ # define_callbacks :validate, terminator: ->(target, result_lambda) { result_lambda.call == false }
+ #
+ # In this example, if any before validate callbacks returns +false+,
+ # any successive before and around callback is not executed.
+ #
+ # The default terminator halts the chain when a callback throws +:abort+.
+ #
+ # * :skip_after_callbacks_if_terminated - Determines if after
+ # callbacks should be terminated by the :terminator option. By
+ # default after callbacks are executed no matter if callback chain was
+ # terminated or not. This option has no effect if :terminator
+ # option is set to +nil+.
+ #
+ # * :scope - Indicates which methods should be executed when an
+ # object is used as a callback.
+ #
+ # class Audit
+ # def before(caller)
+ # puts 'Audit: before is called'
+ # end
+ #
+ # def before_save(caller)
+ # puts 'Audit: before_save is called'
+ # end
+ # end
+ #
+ # class Account
+ # include ActiveSupport::Callbacks
+ #
+ # define_callbacks :save
+ # set_callback :save, :before, Audit.new
+ #
+ # def save
+ # run_callbacks :save do
+ # puts 'save in main'
+ # end
+ # end
+ # end
+ #
+ # In the above case whenever you save an account the method
+ # Audit#before will be called. On the other hand
+ #
+ # define_callbacks :save, scope: [:kind, :name]
+ #
+ # would trigger Audit#before_save instead. That's constructed
+ # by calling #{kind}_#{name} on the given instance. In this
+ # case "kind" is "before" and "name" is "save". In this context +:kind+
+ # and +:name+ have special meanings: +:kind+ refers to the kind of
+ # callback (before/after/around) and +:name+ refers to the method on
+ # which callbacks are being defined.
+ #
+ # A declaration like
+ #
+ # define_callbacks :save, scope: [:name]
+ #
+ # would call Audit#save.
+ #
+ # ===== Notes
+ #
+ # +names+ passed to +define_callbacks+ must not end with
+ # !, ? or =.
+ #
+ # Calling +define_callbacks+ multiple times with the same +names+ will
+ # overwrite previous callbacks registered with +set_callback+.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#812
def define_callbacks(*names); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#613
def normalize_callback_params(filters, block); end
+
+ # Remove all set callbacks for the given event.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#722
def reset_callbacks(name); end
+
+ # Install a callback for the given event.
+ #
+ # set_callback :save, :before, :before_method
+ # set_callback :save, :after, :after_method, if: :condition
+ # set_callback :save, :around, ->(r, block) { stuff; result = block.call; stuff }
+ #
+ # The second argument indicates whether the callback is to be run +:before+,
+ # +:after+, or +:around+ the event. If omitted, +:before+ is assumed. This
+ # means the first example above can also be written as:
+ #
+ # set_callback :save, :before_method
+ #
+ # The callback can be specified as a symbol naming an instance method; as a
+ # proc, lambda, or block; or as an object that responds to a certain method
+ # determined by the :scope argument to +define_callbacks+.
+ #
+ # If a proc, lambda, or block is given, its body is evaluated in the context
+ # of the current object. It can also optionally accept the current object as
+ # an argument.
+ #
+ # Before and around callbacks are called in the order that they are set;
+ # after callbacks are called in the reverse order.
+ #
+ # Around callbacks can access the return value from the event, if it
+ # wasn't halted, from the +yield+ call.
+ #
+ # ===== Options
+ #
+ # * :if - A symbol or an array of symbols, each naming an instance
+ # method or a proc; the callback will be called only when they all return
+ # a true value.
+ #
+ # If a proc is given, its body is evaluated in the context of the
+ # current object. It can also optionally accept the current object as
+ # an argument.
+ # * :unless - A symbol or an array of symbols, each naming an
+ # instance method or a proc; the callback will be called only when they
+ # all return a false value.
+ #
+ # If a proc is given, its body is evaluated in the context of the
+ # current object. It can also optionally accept the current object as
+ # an argument.
+ # * :prepend - If +true+, the callback will be prepended to the
+ # existing chain rather than appended.
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#673
def set_callback(name, *filter_list, &block); end
+
+ # Skip a previously set callback. Like +set_callback+, :if or
+ # :unless options may be passed in order to control when the
+ # callback is skipped.
+ #
+ # class Writer < Person
+ # skip_callback :validate, :before, :check_membership, if: -> { age > 18 }
+ # end
+ #
+ # An ArgumentError will be raised if the callback has not
+ # already been set (unless the :raise option is set to false).
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#697
def skip_callback(name, *filter_list, &block); end
protected
+ # source://activesupport//lib/active_support/callbacks.rb#843
def get_callbacks(name); end
+
+ # Ruby 2.6 and newer
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#852
def set_callbacks(name, callbacks); end
end
+# source://activesupport//lib/active_support/callbacks.rb#149
module ActiveSupport::Callbacks::Conditionals; end
+# source://activesupport//lib/active_support/callbacks.rb#150
class ActiveSupport::Callbacks::Conditionals::Value
+ # @return [Value] a new instance of Value
+ #
+ # source://activesupport//lib/active_support/callbacks.rb#151
def initialize(&block); end
+ # source://activesupport//lib/active_support/callbacks.rb#154
def call(target, value); end
end
+# source://activesupport//lib/active_support/callbacks.rb#158
module ActiveSupport::Callbacks::Filters; end
+# source://activesupport//lib/active_support/callbacks.rb#211
class ActiveSupport::Callbacks::Filters::After
class << self
+ # source://activesupport//lib/active_support/callbacks.rb#212
def build(callback_sequence, user_callback, user_conditions, chain_config); end
private
+ # source://activesupport//lib/active_support/callbacks.rb#254
def conditional(callback_sequence, user_callback, user_conditions); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#243
def halting(callback_sequence, user_callback); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#228
def halting_and_conditional(callback_sequence, user_callback, user_conditions); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#268
def simple(callback_sequence, user_callback); end
end
end
+# source://activesupport//lib/active_support/callbacks.rb#161
class ActiveSupport::Callbacks::Filters::Before
class << self
+ # source://activesupport//lib/active_support/callbacks.rb#162
def build(callback_sequence, user_callback, user_conditions, chain_config, filter, name); end
private
+ # source://activesupport//lib/active_support/callbacks.rb#191
def halting(callback_sequence, user_callback, halted_lambda, filter, name); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#172
def halting_and_conditional(callback_sequence, user_callback, user_conditions, halted_lambda, filter, name); end
end
end
+# source://activesupport//lib/active_support/callbacks.rb#159
class ActiveSupport::Callbacks::Filters::Environment < ::Struct
+ # Returns the value of attribute halted
+ #
+ # @return [Object] the current value of halted
def halted; end
+
+ # Sets the attribute halted
+ #
+ # @param value [Object] the value to set the attribute halted to.
+ # @return [Object] the newly set value
def halted=(_); end
+
+ # Returns the value of attribute target
+ #
+ # @return [Object] the current value of target
def target; end
+
+ # Sets the attribute target
+ #
+ # @param value [Object] the value to set the attribute target to.
+ # @return [Object] the newly set value
def target=(_); end
+
+ # Returns the value of attribute value
+ #
+ # @return [Object] the current value of value
def value; end
+
+ # Sets the attribute value
+ #
+ # @param value [Object] the value to set the attribute value to.
+ # @return [Object] the newly set value
def value=(_); end
class << self
def [](*_arg0); end
def inspect; end
+ def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
+# source://activesupport//lib/active_support/core_ext/range/compare_range.rb#4
module ActiveSupport::CompareWithRange
+ # Extends the default Range#=== to support range comparisons.
+ # (1..5) === (1..5) # => true
+ # (1..5) === (2..3) # => true
+ # (1..5) === (1...6) # => true
+ # (1..5) === (2..6) # => false
+ #
+ # The native Range#=== behavior is untouched.
+ # ('a'..'f') === ('c') # => true
+ # (5..9) === (11) # => false
+ #
+ # The given range must be fully bounded, with both start and end.
+ #
+ # source://activesupport//lib/active_support/core_ext/range/compare_range.rb#16
def ===(value); end
+
+ # Extends the default Range#cover? to support range comparisons.
+ # (1..5).cover?(1..5) # => true
+ # (1..5).cover?(2..3) # => true
+ # (1..5).cover?(1...6) # => true
+ # (1..5).cover?(2..6) # => false
+ #
+ # The native Range#cover? behavior is untouched.
+ # ('a'..'f').cover?('c') # => true
+ # (5..9).cover?(11) # => false
+ #
+ # The given range must be fully bounded, with both start and end.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/range/compare_range.rb#66
def cover?(value); end
+
+ # Extends the default Range#include? to support range comparisons.
+ # (1..5).include?(1..5) # => true
+ # (1..5).include?(2..3) # => true
+ # (1..5).include?(1...6) # => true
+ # (1..5).include?(2..6) # => false
+ #
+ # The native Range#include? behavior is untouched.
+ # ('a'..'f').include?('c') # => true
+ # (5..9).include?(11) # => false
+ #
+ # The given range must be fully bounded, with both start and end.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/range/compare_range.rb#41
def include?(value); end
end
+# A typical module looks like this:
+#
+# module M
+# def self.included(base)
+# base.extend ClassMethods
+# base.class_eval do
+# scope :disabled, -> { where(disabled: true) }
+# end
+# end
+#
+# module ClassMethods
+# ...
+# end
+# end
+#
+# By using ActiveSupport::Concern the above module could instead be
+# written as:
+#
+# require "active_support/concern"
+#
+# module M
+# extend ActiveSupport::Concern
+#
+# included do
+# scope :disabled, -> { where(disabled: true) }
+# end
+#
+# class_methods do
+# ...
+# end
+# end
+#
+# Moreover, it gracefully handles module dependencies. Given a +Foo+ module
+# and a +Bar+ module which depends on the former, we would typically write the
+# following:
+#
+# module Foo
+# def self.included(base)
+# base.class_eval do
+# def self.method_injected_by_foo
+# ...
+# end
+# end
+# end
+# end
+#
+# module Bar
+# def self.included(base)
+# base.method_injected_by_foo
+# end
+# end
+#
+# class Host
+# include Foo # We need to include this dependency for Bar
+# include Bar # Bar is the module that Host really needs
+# end
+#
+# But why should +Host+ care about +Bar+'s dependencies, namely +Foo+? We
+# could try to hide these from +Host+ directly including +Foo+ in +Bar+:
+#
+# module Bar
+# include Foo
+# def self.included(base)
+# base.method_injected_by_foo
+# end
+# end
+#
+# class Host
+# include Bar
+# end
+#
+# Unfortunately this won't work, since when +Foo+ is included, its base
+# is the +Bar+ module, not the +Host+ class. With ActiveSupport::Concern,
+# module dependencies are properly resolved:
+#
+# require "active_support/concern"
+#
+# module Foo
+# extend ActiveSupport::Concern
+# included do
+# def self.method_injected_by_foo
+# ...
+# end
+# end
+# end
+#
+# module Bar
+# extend ActiveSupport::Concern
+# include Foo
+#
+# included do
+# self.method_injected_by_foo
+# end
+# end
+#
+# class Host
+# include Bar # It works, now Bar takes care of its dependencies
+# end
+#
+# === Prepending concerns
+#
+# Just like include, concerns also support prepend with a corresponding
+# prepended do callback. module ClassMethods or class_methods do are
+# prepended as well.
+#
+# prepend is also used for any dependencies.
+#
+# source://activesupport//lib/active_support/concern.rb#110
module ActiveSupport::Concern
+ # source://activesupport//lib/active_support/concern.rb#127
def append_features(base); end
+
+ # Define class methods from given block.
+ # You can define private class methods as well.
+ #
+ # module Example
+ # extend ActiveSupport::Concern
+ #
+ # class_methods do
+ # def foo; puts 'foo'; end
+ #
+ # private
+ # def bar; puts 'bar'; end
+ # end
+ # end
+ #
+ # class Buzz
+ # include Example
+ # end
+ #
+ # Buzz.foo # => "foo"
+ # Buzz.bar # => private method 'bar' called for Buzz:Class(NoMethodError)
+ #
+ # source://activesupport//lib/active_support/concern.rb#207
def class_methods(&class_methods_module_definition); end
+
+ # Evaluate given block in context of base class,
+ # so that you can write class macros here.
+ # When you define more than one +included+ block, it raises an exception.
+ #
+ # source://activesupport//lib/active_support/concern.rb#156
def included(base = T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/concern.rb#140
def prepend_features(base); end
+
+ # Evaluate given block in context of base class,
+ # so that you can write class macros here.
+ # When you define more than one +prepended+ block, it raises an exception.
+ #
+ # source://activesupport//lib/active_support/concern.rb#173
def prepended(base = T.unsafe(nil), &block); end
class << self
+ # source://activesupport//lib/active_support/concern.rb#123
def extended(base); end
end
end
+# source://activesupport//lib/active_support/concern.rb#111
class ActiveSupport::Concern::MultipleIncludedBlocks < ::StandardError
+ # @return [MultipleIncludedBlocks] a new instance of MultipleIncludedBlocks
+ #
+ # source://activesupport//lib/active_support/concern.rb#112
def initialize; end
end
+# source://activesupport//lib/active_support/concern.rb#117
class ActiveSupport::Concern::MultiplePrependBlocks < ::StandardError
+ # @return [MultiplePrependBlocks] a new instance of MultiplePrependBlocks
+ #
+ # source://activesupport//lib/active_support/concern.rb#118
def initialize; end
end
+# source://activesupport//lib/active_support/concurrency/share_lock.rb#7
module ActiveSupport::Concurrency; end
+# A share/exclusive lock, otherwise known as a read/write lock.
+#
+# https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock
+#
+# source://activesupport//lib/active_support/concurrency/share_lock.rb#11
class ActiveSupport::Concurrency::ShareLock
include ::MonitorMixin
+ # @return [ShareLock] a new instance of ShareLock
+ #
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#50
def initialize; end
+ # Execute the supplied block while holding the Exclusive lock. If
+ # +no_wait+ is set and the lock is not immediately available,
+ # returns +nil+ without yielding. Otherwise, returns the result of
+ # the block.
+ #
+ # See +start_exclusive+ for other options.
+ #
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#148
def exclusive(purpose: T.unsafe(nil), compatible: T.unsafe(nil), after_compatible: T.unsafe(nil), no_wait: T.unsafe(nil)); end
+
+ # We track Thread objects, instead of just using counters, because
+ # we need exclusive locks to be reentrant, and we need to be able
+ # to upgrade share locks to exclusive.
+ #
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#18
def raw_state; end
+
+ # Execute the supplied block while holding the Share lock.
+ #
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#159
def sharing; end
+
+ # Returns false if +no_wait+ is set and the lock is not
+ # immediately available. Otherwise, returns true after the lock
+ # has been acquired.
+ #
+ # +purpose+ and +compatible+ work together; while this thread is
+ # waiting for the exclusive lock, it will yield its share (if any)
+ # to any other attempt whose +purpose+ appears in this attempt's
+ # +compatible+ list. This allows a "loose" upgrade, which, being
+ # less strict, prevents some classes of deadlocks.
+ #
+ # For many resources, loose upgrades are sufficient: if a thread
+ # is awaiting a lock, it is not running any other code. With
+ # +purpose+ matching, it is possible to yield only to other
+ # threads whose activity will not interfere.
+ #
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#76
def start_exclusive(purpose: T.unsafe(nil), compatible: T.unsafe(nil), no_wait: T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#114
def start_sharing; end
+
+ # Relinquish the exclusive lock. Must only be called by the thread
+ # that called start_exclusive (and currently holds the lock).
+ #
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#96
def stop_exclusive(compatible: T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#131
def stop_sharing; end
+
+ # Temporarily give up all held Share locks while executing the
+ # supplied block, allowing any +compatible+ exclusive lock request
+ # to proceed.
+ #
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#171
def yield_shares(purpose: T.unsafe(nil), compatible: T.unsafe(nil), block_share: T.unsafe(nil)); end
private
+ # Must be called within synchronize
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#204
def busy_for_exclusive?(purpose); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#209
def busy_for_sharing?(purpose); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#214
def eligible_waiters?(compatible); end
+
+ # source://activesupport//lib/active_support/concurrency/share_lock.rb#218
def wait_for(method); end
end
+# Configurable provides a config method to store and retrieve
+# configuration options as an OrderedOptions.
+#
+# source://activesupport//lib/active_support/configurable.rb#9
module ActiveSupport::Configurable
extend ::ActiveSupport::Concern
mixes_in_class_methods ::ActiveSupport::Configurable::ClassMethods
+ # Reads and writes attributes from a configuration OrderedOptions.
+ #
+ # require "active_support/configurable"
+ #
+ # class User
+ # include ActiveSupport::Configurable
+ # end
+ #
+ # user = User.new
+ #
+ # user.config.allowed_access = true
+ # user.config.level = 1
+ #
+ # user.config.allowed_access # => true
+ # user.config.level # => 1
+ #
+ # source://activesupport//lib/active_support/configurable.rb#142
def config; end
end
+# source://activesupport//lib/active_support/configurable.rb#27
module ActiveSupport::Configurable::ClassMethods
+ # source://activesupport//lib/active_support/configurable.rb#28
def config; end
+
+ # @yield [config]
+ #
+ # source://activesupport//lib/active_support/configurable.rb#37
def configure; end
private
+ # Allows you to add shortcut so that you don't have to refer to attribute
+ # through config. Also look at the example for config to contrast.
+ #
+ # Defines both class and instance config accessors.
+ #
+ # class User
+ # include ActiveSupport::Configurable
+ # config_accessor :allowed_access
+ # end
+ #
+ # User.allowed_access # => nil
+ # User.allowed_access = false
+ # User.allowed_access # => false
+ #
+ # user = User.new
+ # user.allowed_access # => false
+ # user.allowed_access = true
+ # user.allowed_access # => true
+ #
+ # User.allowed_access # => false
+ #
+ # The attribute name must be a valid method name in Ruby.
+ #
+ # class User
+ # include ActiveSupport::Configurable
+ # config_accessor :"1_Badname"
+ # end
+ # # => NameError: invalid config attribute name
+ #
+ # To omit the instance writer method, pass instance_writer: false.
+ # To omit the instance reader method, pass instance_reader: false.
+ #
+ # class User
+ # include ActiveSupport::Configurable
+ # config_accessor :allowed_access, instance_reader: false, instance_writer: false
+ # end
+ #
+ # User.allowed_access = false
+ # User.allowed_access # => false
+ #
+ # User.new.allowed_access = true # => NoMethodError
+ # User.new.allowed_access # => NoMethodError
+ #
+ # Or pass instance_accessor: false, to omit both instance methods.
+ #
+ # class User
+ # include ActiveSupport::Configurable
+ # config_accessor :allowed_access, instance_accessor: false
+ # end
+ #
+ # User.allowed_access = false
+ # User.allowed_access # => false
+ #
+ # User.new.allowed_access = true # => NoMethodError
+ # User.new.allowed_access # => NoMethodError
+ #
+ # Also you can pass a block to set up the attribute with a default value.
+ #
+ # class User
+ # include ActiveSupport::Configurable
+ # config_accessor :hair_colors do
+ # [:brown, :black, :blonde, :red]
+ # end
+ # end
+ #
+ # User.hair_colors # => [:brown, :black, :blonde, :red]
+ #
+ # source://activesupport//lib/active_support/configurable.rb#107
def config_accessor(*names, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/configurable.rb#12
class ActiveSupport::Configurable::Configuration < ::ActiveSupport::InheritableOptions
+ # source://activesupport//lib/active_support/configurable.rb#13
def compile_methods!; end
class << self
+ # Compiles reader methods so we don't have to go through method_missing.
+ #
+ # source://activesupport//lib/active_support/configurable.rb#18
def compile_methods!(keys); end
end
end
+# Reads a YAML configuration file, evaluating any ERB, then
+# parsing the resulting YAML.
+#
+# Warns in case of YAML confusing characters, like invisible
+# non-breaking spaces.
+#
+# source://activesupport//lib/active_support/configuration_file.rb#9
class ActiveSupport::ConfigurationFile
+ # @return [ConfigurationFile] a new instance of ConfigurationFile
+ #
+ # source://activesupport//lib/active_support/configuration_file.rb#12
def initialize(content_path); end
+ # source://activesupport//lib/active_support/configuration_file.rb#21
def parse(context: T.unsafe(nil), **options); end
private
+ # source://activesupport//lib/active_support/configuration_file.rb#35
def read(content_path); end
+
+ # source://activesupport//lib/active_support/configuration_file.rb#46
def render(context); end
class << self
+ # source://activesupport//lib/active_support/configuration_file.rb#17
def parse(content_path, **options); end
end
end
+# source://activesupport//lib/active_support/configuration_file.rb#10
class ActiveSupport::ConfigurationFile::FormatError < ::StandardError; end
+# Abstract super class that provides a thread-isolated attributes singleton, which resets automatically
+# before and after each request. This allows you to keep all the per-request attributes easily
+# available to the whole system.
+#
+# The following full app-like example demonstrates how to use a Current class to
+# facilitate easy access to the global, per-request attributes without passing them deeply
+# around everywhere:
+#
+# # app/models/current.rb
+# class Current < ActiveSupport::CurrentAttributes
+# attribute :account, :user
+# attribute :request_id, :user_agent, :ip_address
+#
+# resets { Time.zone = nil }
+#
+# def user=(user)
+# super
+# self.account = user.account
+# Time.zone = user.time_zone
+# end
+# end
+#
+# # app/controllers/concerns/authentication.rb
+# module Authentication
+# extend ActiveSupport::Concern
+#
+# included do
+# before_action :authenticate
+# end
+#
+# private
+# def authenticate
+# if authenticated_user = User.find_by(id: cookies.encrypted[:user_id])
+# Current.user = authenticated_user
+# else
+# redirect_to new_session_url
+# end
+# end
+# end
+#
+# # app/controllers/concerns/set_current_request_details.rb
+# module SetCurrentRequestDetails
+# extend ActiveSupport::Concern
+#
+# included do
+# before_action do
+# Current.request_id = request.uuid
+# Current.user_agent = request.user_agent
+# Current.ip_address = request.ip
+# end
+# end
+# end
+#
+# class ApplicationController < ActionController::Base
+# include Authentication
+# include SetCurrentRequestDetails
+# end
+#
+# class MessagesController < ApplicationController
+# def create
+# Current.account.messages.create(message_params)
+# end
+# end
+#
+# class Message < ApplicationRecord
+# belongs_to :creator, default: -> { Current.user }
+# after_create { |message| Event.create(record: message) }
+# end
+#
+# class Event < ApplicationRecord
+# before_create do
+# self.request_id = Current.request_id
+# self.user_agent = Current.user_agent
+# self.ip_address = Current.ip_address
+# end
+# end
+#
+# A word of caution: It's easy to overdo a global singleton like Current and tangle your model as a result.
+# Current should only be used for a few, top-level globals, like account, user, and request details.
+# The attributes stuck in Current should be used by more or less all actions on all requests. If you start
+# sticking controller-specific attributes in there, you're going to create a mess.
+#
+# source://activesupport//lib/active_support/current_attributes.rb#89
class ActiveSupport::CurrentAttributes
include ::ActiveSupport::Callbacks
extend ::ActiveSupport::Callbacks::ClassMethods
extend ::ActiveSupport::DescendantsTracker
+ # @return [CurrentAttributes] a new instance of CurrentAttributes
+ #
+ # source://activesupport//lib/active_support/current_attributes.rb#172
def initialize; end
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks?; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#835
def _reset_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#823
def _run_reset_callbacks(&block); end
+
+ # Returns the value of attribute attributes.
+ #
+ # source://activesupport//lib/active_support/current_attributes.rb#170
def attributes; end
+
+ # Sets the attribute attributes
+ #
+ # @param value the value to set the attribute attributes to.
+ #
+ # source://activesupport//lib/active_support/current_attributes.rb#170
def attributes=(_arg0); end
+
+ # Reset all attributes. Should be called before and after actions, when used as a per-request singleton.
+ #
+ # source://activesupport//lib/active_support/current_attributes.rb#195
def reset; end
+
+ # Expose one or more attributes within a block. Old values are returned after the block concludes.
+ # Example demonstrating the common use of needing to set Current attributes outside the request-cycle:
+ #
+ # class Chat::PublicationJob < ApplicationJob
+ # def perform(attributes, room_number, creator)
+ # Current.set(person: creator) do
+ # Chat::Publisher.publish(attributes: attributes, room_number: room_number)
+ # end
+ # end
+ # end
+ #
+ # source://activesupport//lib/active_support/current_attributes.rb#186
def set(set_attributes); end
private
+ # source://activesupport//lib/active_support/current_attributes.rb#202
def assign_attributes(new_attributes); end
+
+ # source://activesupport//lib/active_support/current_attributes.rb#206
def compute_attributes(keys); end
class << self
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks=(value); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks?; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#827
def _reset_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#831
def _reset_callbacks=(value); end
+
+ # Calls this block after #reset is called on the instance. Used for resetting external collaborators, like Time.zone.
+ #
+ # source://activesupport//lib/active_support/current_attributes.rb#130
def after_reset(&block); end
+
+ # Declares one or more attributes that will be given both class and instance accessor methods.
+ #
+ # source://activesupport//lib/active_support/current_attributes.rb#100
def attribute(*names); end
+
+ # Calls this block before #reset is called on the instance. Used for resetting external collaborators that depend on current values.
+ #
+ # source://activesupport//lib/active_support/current_attributes.rb#125
def before_reset(&block); end
+
+ # source://activesupport//lib/active_support/current_attributes.rb#141
def clear_all; end
+
+ # Returns singleton instance for this class in this thread. If none exists, one is created.
+ #
+ # source://activesupport//lib/active_support/current_attributes.rb#95
def instance; end
- def reset(*args, &block); end
+
+ # source://activesupport//lib/active_support/current_attributes.rb#135
+ def reset(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/current_attributes.rb#137
def reset_all; end
+
+ # Calls this block after #reset is called on the instance. Used for resetting external collaborators, like Time.zone.
+ #
+ # source://activesupport//lib/active_support/current_attributes.rb#130
def resets(&block); end
- def set(*args, &block); end
+
+ # source://activesupport//lib/active_support/current_attributes.rb#135
+ def set(*_arg0, **_arg1, &_arg2); end
private
+ # source://activesupport//lib/active_support/current_attributes.rb#151
def current_instances; end
+
+ # source://activesupport//lib/active_support/current_attributes.rb#155
def current_instances_key; end
+
+ # source://activesupport//lib/active_support/current_attributes.rb#147
def generated_attribute_methods; end
- def method_missing(name, *args, &block); end
+
+ # source://activesupport//lib/active_support/current_attributes.rb#159
+ def method_missing(name, *args, **_arg2, &block); end
end
end
+# source://activesupport//lib/active_support/dependencies/interlock.rb#6
module ActiveSupport::Dependencies
extend ::ActiveSupport::Dependencies
+ # source://activesupport//lib/active_support/dependencies.rb#78
def _eager_load_paths; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#78
def _eager_load_paths=(val); end
+
+ # Attempt to autoload the provided module name by searching for a directory
+ # matching the expected path suffix. If found, the module is created and
+ # assigned to +into+'s constants with the name +const_name+. Provided that
+ # the directory was loaded from a reloadable base path, it is added to the
+ # set of constants that are to be unloaded.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#499
def autoload_module!(into, const_name, qualified_name, path_suffix); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#73
def autoload_once_paths; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#73
def autoload_once_paths=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#69
def autoload_paths; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#69
def autoload_paths=(val); end
+
+ # Does the provided path_suffix correspond to an autoloadable module?
+ # Instead of returning a boolean, the autoload base for this module is
+ # returned.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#481
def autoloadable_module?(path_suffix); end
+
+ # Determine if the given constant has been automatically loaded.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#677
def autoloaded?(desc); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#83
def autoloaded_constants; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#83
def autoloaded_constants=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#389
def clear; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#185
def constant_watch_stack; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#185
def constant_watch_stack=(val); end
+
+ # Get the reference for class named +name+.
+ # Raises an exception if referenced class does not exist.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#666
def constantize(name); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#373
def depend_on(file_name, message = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#87
def explicitly_unloadable_constants; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#87
def explicitly_unloadable_constants=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#55
def history; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#55
def history=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#358
def hook!; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#25
def interlock; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#25
def interlock=(val); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#369
def load?; end
+
+ # Load the file at the provided path. +const_paths+ is a set of qualified
+ # constant names. When loading the file, Dependencies will watch for the
+ # addition of these constants. Each that is defined will be marked as
+ # autoloaded, and will be removed when Dependencies.clear is next called.
+ #
+ # If the second parameter is left off, then Dependencies will construct a
+ # set of names that the file at +path+ may define. See
+ # +loadable_constants_for_path+ for more details.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#517
def load_file(path, const_paths = T.unsafe(nil)); end
+
+ # Load the constant named +const_name+ which is missing from +from_mod+. If
+ # it is not possible to load the constant into from_mod, try its parent
+ # module using +const_missing+.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#540
def load_missing_constant(from_mod, const_name); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#488
def load_once_path?(path); end
+
+ # Given +path+, a filesystem path to a ruby file, return an array of
+ # constant paths which would cause Dependencies to attempt to load this
+ # file.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#447
def loadable_constants_for_path(path, bases = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#58
def loaded; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#58
def loaded=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#61
def loading; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#61
def loading=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#805
def log(message); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#90
def logger; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#90
def logger=(val); end
+
+ # Mark the provided constant name for unloading. This constant will be
+ # unloaded on each request, not just the next one.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#692
def mark_for_unload(const_desc); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#64
def mechanism; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#64
def mechanism=(val); end
+
+ # Run the provided block and detect the new constants that were loaded during
+ # its execution. Constants may only be regarded as 'new' once -- so if the
+ # block calls +new_constants_in+ again, then the constants defined within the
+ # inner call will not be reported in this one.
+ #
+ # If the provided block does not run to completion, and instead raises an
+ # exception, any new constants are regarded as being only partially defined
+ # and will be removed immediately.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#710
def new_constants_in(*descs); end
+
+ # Is the provided constant path defined?
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#440
def qualified_const_defined?(path); end
+
+ # Returns the constant path for the provided parent and constant name.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#532
def qualified_name_for(mod, name); end
+
+ # Store a reference to a class +klass+.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#660
def reference(klass); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#740
def remove_constant(const); end
+
+ # Remove the constants that have been autoloaded, and those that have been
+ # marked for unloading. Before each constant is removed a callback is sent
+ # to its class/module if it implements +before_remove_const+.
+ #
+ # The callback implementation should be restricted to cleaning up caches, etc.
+ # as the environment will be in an inconsistent state, e.g. other constants
+ # may have already been unloaded and not accessible.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#613
def remove_unloadable_constants!; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#397
def require_or_load(file_name, const_path = T.unsafe(nil)); end
+
+ # Get the reference for class named +name+ if one exists.
+ # Otherwise returns +nil+.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#672
def safe_constantize(name); end
+
+ # Search for a file in autoload_paths matching the provided suffix.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#468
def search_for_file(path_suffix); end
+
+ # Convert the provided const desc to a qualified constant name (as a string).
+ # A module, class, symbol, or string may be provided.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#729
def to_constant_name(desc); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#364
def unhook!; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#93
def verbose; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#93
def verbose=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#52
def warnings_on_first_load; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#52
def warnings_on_first_load=(val); end
+
+ # Will the provided constant descriptor be unloaded?
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#685
def will_unload?(const_desc); end
private
+ # Returns the original name of a class or module even if `name` has been
+ # overridden.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#822
def real_mod_name(mod); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#815
def uninitialized_constant(qualified_name, const_name, receiver:); end
class << self
+ # source://activesupport//lib/active_support/dependencies.rb#78
def _eager_load_paths; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#78
def _eager_load_paths=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#73
def autoload_once_paths; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#73
def autoload_once_paths=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#69
def autoload_paths; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#69
def autoload_paths=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#83
def autoloaded_constants; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#83
def autoloaded_constants=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#185
def constant_watch_stack; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#185
def constant_watch_stack=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#87
def explicitly_unloadable_constants; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#87
def explicitly_unloadable_constants=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#55
def history; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#55
def history=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#25
def interlock; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#25
def interlock=(val); end
+
+ # Execute the supplied block while holding an exclusive lock,
+ # preventing any other thread from being inside a #run_interlock
+ # block at the same time.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#38
def load_interlock; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#58
def loaded; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#58
def loaded=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#61
def loading; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#61
def loading=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#90
def logger; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#90
def logger=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#64
def mechanism; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#64
def mechanism=(val); end
+
+ # Execute the supplied block without interference from any
+ # concurrent loads.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#31
def run_interlock; end
+
+ # Execute the supplied block while holding an exclusive lock,
+ # preventing any other thread from being inside a #run_interlock
+ # block at the same time.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#45
def unload_interlock; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#93
def verbose; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#93
def verbose=(val); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#52
def warnings_on_first_load; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#52
def warnings_on_first_load=(val); end
end
end
+# Exception file-blaming.
+#
+# source://activesupport//lib/active_support/dependencies.rb#338
module ActiveSupport::Dependencies::Blamable
+ # source://activesupport//lib/active_support/dependencies.rb#339
def blame_file!(file); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#343
def blamed_files; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#352
def copy_blame!(exc); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#347
def describe_blame; end
end
+# source://activesupport//lib/active_support/dependencies.rb#621
class ActiveSupport::Dependencies::ClassCache
+ # @return [ClassCache] a new instance of ClassCache
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#622
def initialize; end
+ # source://activesupport//lib/active_support/dependencies.rb#634
def [](key); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#652
def clear!; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#626
def empty?; end
+
+ # source://activesupport//lib/active_support/dependencies.rb#634
def get(key); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#630
def key?(key); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#640
def safe_get(key); end
+
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#645
def store(klass); end
end
+# source://activesupport//lib/active_support/dependencies/interlock.rb#7
class ActiveSupport::Dependencies::Interlock
+ # @return [Interlock] a new instance of Interlock
+ #
+ # source://activesupport//lib/active_support/dependencies/interlock.rb#8
def initialize; end
+ # source://activesupport//lib/active_support/dependencies/interlock.rb#36
def done_running; end
+
+ # source://activesupport//lib/active_support/dependencies/interlock.rb#28
def done_unloading; end
+
+ # source://activesupport//lib/active_support/dependencies/interlock.rb#12
def loading; end
+
+ # source://activesupport//lib/active_support/dependencies/interlock.rb#46
def permit_concurrent_loads; end
+
+ # source://activesupport//lib/active_support/dependencies/interlock.rb#52
def raw_state(&block); end
+
+ # source://activesupport//lib/active_support/dependencies/interlock.rb#40
def running; end
+
+ # source://activesupport//lib/active_support/dependencies/interlock.rb#32
def start_running; end
+
+ # source://activesupport//lib/active_support/dependencies/interlock.rb#24
def start_unloading; end
+
+ # source://activesupport//lib/active_support/dependencies/interlock.rb#18
def unloading; end
end
+# Object includes this module.
+#
+# source://activesupport//lib/active_support/dependencies.rb#235
module ActiveSupport::Dependencies::Loadable
+ # source://activesupport//lib/active_support/dependencies.rb#293
def load_dependency(file); end
+
+ # Warning: This method is obsolete in +:zeitwerk+ mode. In
+ # +:zeitwerk+ mode semantics match Ruby's and you do not need to be
+ # defensive with load order. Just refer to classes and modules normally.
+ # If the constant name is dynamic, camelize if needed, and constantize.
+ #
+ # In +:classic+ mode, interprets a file using +mechanism+ and marks its
+ # defined constants as autoloaded. +file_name+ can be either a string or
+ # respond to to_path.
+ #
+ # In +:classic+ mode, use this method in code that absolutely needs a
+ # certain constant to be defined at that point. A typical use case is to
+ # make constant name resolution deterministic for constants with the same
+ # relative name in different namespaces whose evaluation would depend on
+ # load order otherwise.
+ #
+ # Engines that do not control the mode in which their parent application
+ # runs should call +require_dependency+ where needed in case the runtime
+ # mode is +:classic+.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#282
def require_dependency(file_name, message = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#258
def require_or_load(file_name); end
+
+ # Mark the given constant as unloadable. Unloadable constants are removed
+ # each time dependencies are cleared.
+ #
+ # Note that marking a constant for unloading need only be done once. Setup
+ # or init scripts may list each unloadable constant that may need unloading;
+ # each constant will be removed for every subsequent clear, as opposed to
+ # for the first clear.
+ #
+ # The provided constant descriptor may be a (non-anonymous) module or class,
+ # or a qualified constant name as a string or symbol.
+ #
+ # Returns +true+ if the constant was not previously marked for unloading,
+ # +false+ otherwise.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#319
def unloadable(const_desc); end
private
+ # source://activesupport//lib/active_support/dependencies.rb#324
def load(file, wrap = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#330
def require(file); end
class << self
+ # source://activesupport//lib/active_support/dependencies.rb#236
def exclude_from(base); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#246
def include_into(base); end
end
end
+# Module includes this module.
+#
+# source://activesupport//lib/active_support/dependencies.rb#188
module ActiveSupport::Dependencies::ModuleConstMissing
+ # source://activesupport//lib/active_support/dependencies.rb#211
def const_missing(const_name); end
+
+ # We assume that the name of the module reflects the nesting
+ # (unless it can be proven that is not the case) and the path to the file
+ # that defines the constant. Anonymous modules cannot follow these
+ # conventions and therefore we assume that the user wants to refer to a
+ # top-level constant.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#221
def guess_for_anonymous(const_name); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#229
def unloadable(const_desc = T.unsafe(nil)); end
class << self
+ # source://activesupport//lib/active_support/dependencies.rb#189
def append_features(base); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#199
def exclude_from(base); end
+
+ # source://activesupport//lib/active_support/dependencies.rb#206
def include_into(base); end
end
end
+# source://activesupport//lib/active_support/dependencies.rb#657
ActiveSupport::Dependencies::Reference = T.let(T.unsafe(nil), ActiveSupport::Dependencies::ClassCache)
+
+# source://activesupport//lib/active_support/dependencies.rb#22
ActiveSupport::Dependencies::UNBOUND_METHOD_MODULE_NAME = T.let(T.unsafe(nil), UnboundMethod)
+# The WatchStack keeps a stack of the modules being watched as files are
+# loaded. If a file in the process of being loaded (parent.rb) triggers the
+# load of another file (child.rb) the stack will ensure that child.rb
+# handles the new constants.
+#
+# If child.rb is being autoloaded, its constants will be added to
+# autoloaded_constants. If it was being required, they will be discarded.
+#
+# This is handled by walking back up the watch stack and adding the constants
+# found by child.rb to the list of original constants in parent.rb.
+#
+# source://activesupport//lib/active_support/dependencies.rb#105
class ActiveSupport::Dependencies::WatchStack
include ::Enumerable
+ # @return [WatchStack] a new instance of WatchStack
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#115
def initialize; end
+ # source://activesupport//lib/active_support/dependencies.rb#120
def each(&block); end
+
+ # Returns a list of new constants found since the last call to
+ # watch_namespaces.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#130
def new_constants; end
+
+ # Add a set of modules to the watch stack, remembering the initial
+ # constants.
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#167
def watch_namespaces(namespaces); end
+
+ # if parent.rb is autoloaded, the stack will look like [[Object]]. If
+ # parent.rb then requires namespace/child.rb, the stack will look like
+ # [[Object], [Namespace]].
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#113
def watching; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/dependencies.rb#124
def watching?; end
private
+ # source://activesupport//lib/active_support/dependencies.rb#179
def pop_modules(modules); end
end
+# \Deprecation specifies the API used by Rails to deprecate methods, instance
+# variables, objects and constants.
+#
+# source://activesupport//lib/active_support/deprecation.rb#8
class ActiveSupport::Deprecation
include ::Singleton
include ::ActiveSupport::Deprecation::InstanceDelegator
@@ -867,359 +3404,1278 @@ class ActiveSupport::Deprecation
extend ::ActiveSupport::Deprecation::InstanceDelegator::ClassMethods
extend ::ActiveSupport::Deprecation::InstanceDelegator::OverrideDelegators
+ # It accepts two parameters on initialization. The first is a version of library
+ # and the second is a library name.
+ #
+ # ActiveSupport::Deprecation.new('2.0', 'MyLibrary')
+ #
+ # @return [Deprecation] a new instance of Deprecation
+ #
+ # source://activesupport//lib/active_support/deprecation.rb#41
def initialize(deprecation_horizon = T.unsafe(nil), gem_name = T.unsafe(nil)); end
+ # The version number in which the deprecated behavior will be removed, by default.
+ #
+ # source://activesupport//lib/active_support/deprecation.rb#35
def deprecation_horizon; end
+
+ # The version number in which the deprecated behavior will be removed, by default.
+ #
+ # source://activesupport//lib/active_support/deprecation.rb#35
def deprecation_horizon=(_arg0); end
class << self
- def allow(*args, &block); end
- def behavior(*args, &block); end
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
+ def allow(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
+ def behavior(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
def behavior=(arg); end
- def debug(*args, &block); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
+ def debug(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
def debug=(arg); end
- def deprecate_methods(*args, &block); end
- def deprecation_horizon(*args, &block); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
+ def deprecate_methods(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
+ def deprecation_horizon(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
def deprecation_horizon=(arg); end
- def disallowed_behavior(*args, &block); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#31
+ def deprecation_warning(deprecated_method_name, message = T.unsafe(nil), caller_backtrace = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
+ def disallowed_behavior(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
def disallowed_behavior=(arg); end
- def disallowed_warnings(*args, &block); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
+ def disallowed_warnings(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
def disallowed_warnings=(arg); end
- def gem_name(*args, &block); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
+ def gem_name(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
def gem_name=(arg); end
- def instance; end
- def silence(*args, &block); end
- def silenced(*args, &block); end
+
+ def new(*_arg0); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
+ def silence(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
+ def silenced(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#21
def silenced=(arg); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#26
+ def warn(message = T.unsafe(nil), callstack = T.unsafe(nil)); end
+
+ private
+
+ def allocate; end
end
end
+# Behavior module allows to determine how to display deprecation messages.
+# You can create a custom behavior or set any from the +DEFAULT_BEHAVIORS+
+# constant. Available behaviors are:
+#
+# [+raise+] Raise ActiveSupport::DeprecationException.
+# [+stderr+] Log all deprecation warnings to $stderr.
+# [+log+] Log all deprecation warnings to +Rails.logger+.
+# [+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+.
+# [+silence+] Do nothing.
+#
+# Setting behaviors only affects deprecations that happen after boot time.
+# For more information you can read the documentation of the +behavior=+ method.
+#
+# source://activesupport//lib/active_support/deprecation/behaviors.rb#61
module ActiveSupport::Deprecation::Behavior
+ # Returns the current behavior or if one isn't set, defaults to +:stderr+.
+ #
+ # source://activesupport//lib/active_support/deprecation/behaviors.rb#66
def behavior; end
+
+ # Sets the behavior to the specified value. Can be a single value, array,
+ # or an object that responds to +call+.
+ #
+ # Available behaviors:
+ #
+ # [+raise+] Raise ActiveSupport::DeprecationException.
+ # [+stderr+] Log all deprecation warnings to $stderr.
+ # [+log+] Log all deprecation warnings to +Rails.logger+.
+ # [+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+.
+ # [+silence+] Do nothing.
+ #
+ # Setting behaviors only affects deprecations that happen after boot time.
+ # Deprecation warnings raised by gems are not affected by this setting
+ # because they happen before Rails boots up.
+ #
+ # ActiveSupport::Deprecation.behavior = :stderr
+ # ActiveSupport::Deprecation.behavior = [:stderr, :log]
+ # ActiveSupport::Deprecation.behavior = MyCustomHandler
+ # ActiveSupport::Deprecation.behavior = ->(message, callstack, deprecation_horizon, gem_name) {
+ # # custom stuff
+ # }
+ #
+ # source://activesupport//lib/active_support/deprecation/behaviors.rb#96
def behavior=(behavior); end
+
+ # Whether to print a backtrace along with the warning.
+ #
+ # source://activesupport//lib/active_support/deprecation/behaviors.rb#63
def debug; end
+
+ # Whether to print a backtrace along with the warning.
+ #
+ # source://activesupport//lib/active_support/deprecation/behaviors.rb#63
def debug=(_arg0); end
+
+ # Returns the current behavior for disallowed deprecations or if one isn't set, defaults to +:raise+.
+ #
+ # source://activesupport//lib/active_support/deprecation/behaviors.rb#71
def disallowed_behavior; end
+
+ # Sets the behavior for disallowed deprecations (those configured by
+ # ActiveSupport::Deprecation.disallowed_warnings=) to the specified
+ # value. As with +behavior=+, this can be a single value, array, or an
+ # object that responds to +call+.
+ #
+ # source://activesupport//lib/active_support/deprecation/behaviors.rb#104
def disallowed_behavior=(behavior); end
private
+ # source://activesupport//lib/active_support/deprecation/behaviors.rb#109
def arity_coerce(behavior); end
end
+# Default warning behaviors per Rails.env.
+#
+# source://activesupport//lib/active_support/deprecation/behaviors.rb#13
ActiveSupport::Deprecation::DEFAULT_BEHAVIORS = T.let(T.unsafe(nil), Hash)
+# DeprecatedConstantAccessor transforms a constant into a deprecated one by
+# hooking +const_missing+.
+#
+# It takes the names of an old (deprecated) constant and of a new constant
+# (both in string form) and optionally a deprecator. The deprecator defaults
+# to +ActiveSupport::Deprecator+ if none is specified.
+#
+# The deprecated constant now returns the same object as the new one rather
+# than a proxy object, so it can be used transparently in +rescue+ blocks
+# etc.
+#
+# PLANETS = %w(mercury venus earth mars jupiter saturn uranus neptune pluto)
+#
+# # (In a later update, the original implementation of `PLANETS` has been removed.)
+#
+# PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune)
+# include ActiveSupport::Deprecation::DeprecatedConstantAccessor
+# deprecate_constant 'PLANETS', 'PLANETS_POST_2006'
+#
+# PLANETS.map { |planet| planet.capitalize }
+# # => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead.
+# (Backtrace information…)
+# ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]
+#
+# source://activesupport//lib/active_support/deprecation/constant_accessor.rb#28
module ActiveSupport::Deprecation::DeprecatedConstantAccessor
class << self
+ # @private
+ #
+ # source://activesupport//lib/active_support/deprecation/constant_accessor.rb#29
def included(base); end
end
end
+# DeprecatedConstantProxy transforms a constant into a deprecated one. It
+# takes the names of an old (deprecated) constant and of a new constant
+# (both in string form) and optionally a deprecator. The deprecator defaults
+# to +ActiveSupport::Deprecator+ if none is specified. The deprecated constant
+# now returns the value of the new one.
+#
+# PLANETS = %w(mercury venus earth mars jupiter saturn uranus neptune pluto)
+#
+# # (In a later update, the original implementation of `PLANETS` has been removed.)
+#
+# PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune)
+# PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('PLANETS', 'PLANETS_POST_2006')
+#
+# PLANETS.map { |planet| planet.capitalize }
+# # => DEPRECATION WARNING: PLANETS is deprecated! Use PLANETS_POST_2006 instead.
+# (Backtrace information…)
+# ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]
+#
+# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#123
class ActiveSupport::Deprecation::DeprecatedConstantProxy < ::Module
+ # @return [DeprecatedConstantProxy] a new instance of DeprecatedConstantProxy
+ #
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#131
def initialize(old_const, new_const, deprecator = T.unsafe(nil), message: T.unsafe(nil)); end
+ # Returns the class of the new constant.
+ #
+ # PLANETS_POST_2006 = %w(mercury venus earth mars jupiter saturn uranus neptune)
+ # PLANETS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('PLANETS', 'PLANETS_POST_2006')
+ # PLANETS.class # => Array
+ #
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#157
def class; end
- def hash(*args, &block); end
+
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#150
+ def hash(*_arg0, **_arg1, &_arg2); end
+
+ # Don't give a deprecation warning on inspect since test/unit and error
+ # logs rely on it for diagnostics.
+ #
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#144
def inspect; end
- def instance_methods(*args, &block); end
- def name(*args, &block); end
- def respond_to?(*args, &block); end
+
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#150
+ def instance_methods(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#150
+ def name(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#150
+ def respond_to?(*_arg0, **_arg1, &_arg2); end
private
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#166
def const_missing(name); end
+
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#171
def method_missing(called, *args, &block); end
+
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#162
def target; end
class << self
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#124
def new(*args, **options, &block); end
end
end
+# DeprecatedInstanceVariableProxy transforms an instance variable into a
+# deprecated one. It takes an instance of a class, a method on that class
+# and an instance variable. It optionally takes a deprecator as the last
+# argument. The deprecator defaults to +ActiveSupport::Deprecator+ if none
+# is specified.
+#
+# class Example
+# def initialize
+# @request = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(self, :request, :@request)
+# @_request = :special_request
+# end
+#
+# def request
+# @_request
+# end
+#
+# def old_request
+# @request
+# end
+# end
+#
+# example = Example.new
+# # => #
+#
+# example.old_request.to_s
+# # => DEPRECATION WARNING: @request is deprecated! Call request.to_s instead of
+# @request.to_s
+# (Backtrace information…)
+# "special_request"
+#
+# example.request.to_s
+# # => "special_request"
+#
+# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#88
class ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy < ::ActiveSupport::Deprecation::DeprecationProxy
+ # @return [DeprecatedInstanceVariableProxy] a new instance of DeprecatedInstanceVariableProxy
+ #
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#89
def initialize(instance, method, var = T.unsafe(nil), deprecator = T.unsafe(nil)); end
private
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#97
def target; end
+
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#101
def warn(callstack, called, args); end
end
+# DeprecatedObjectProxy transforms an object into a deprecated one. It
+# takes an object, a deprecation message and optionally a deprecator. The
+# deprecator defaults to +ActiveSupport::Deprecator+ if none is specified.
+#
+# deprecated_object = ActiveSupport::Deprecation::DeprecatedObjectProxy.new(Object.new, "This object is now deprecated")
+# # => #
+#
+# deprecated_object.to_s
+# DEPRECATION WARNING: This object is now deprecated.
+# (Backtrace)
+# # => "#"
+#
+# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#39
class ActiveSupport::Deprecation::DeprecatedObjectProxy < ::ActiveSupport::Deprecation::DeprecationProxy
+ # @return [DeprecatedObjectProxy] a new instance of DeprecatedObjectProxy
+ #
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#40
def initialize(object, message, deprecator = T.unsafe(nil)); end
private
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#47
def target; end
+
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#51
def warn(callstack, called, args); end
end
+# source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#5
class ActiveSupport::Deprecation::DeprecationProxy
+ # Don't give a deprecation warning on inspect since test/unit and error
+ # logs rely on it for diagnostics.
+ #
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#17
def inspect; end
private
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#22
def method_missing(called, *args, &block); end
class << self
+ # source://activesupport//lib/active_support/deprecation/proxy_wrappers.rb#6
def new(*args, &block); end
end
end
+# source://activesupport//lib/active_support/deprecation/disallowed.rb#5
module ActiveSupport::Deprecation::Disallowed
+ # Returns the configured criteria used to identify deprecation messages
+ # which should be treated as disallowed.
+ #
+ # source://activesupport//lib/active_support/deprecation/disallowed.rb#21
def disallowed_warnings; end
+
+ # Sets the criteria used to identify deprecation messages which should be
+ # disallowed. Can be an array containing strings, symbols, or regular
+ # expressions. (Symbols are treated as strings). These are compared against
+ # the text of the generated deprecation warning.
+ #
+ # Additionally the scalar symbol +:all+ may be used to treat all
+ # deprecations as disallowed.
+ #
+ # Deprecations matching a substring or regular expression will be handled
+ # using the configured +ActiveSupport::Deprecation.disallowed_behavior+
+ # rather than +ActiveSupport::Deprecation.behavior+
+ #
+ # source://activesupport//lib/active_support/deprecation/disallowed.rb#17
def disallowed_warnings=(_arg0); end
private
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/deprecation/disallowed.rb#26
def deprecation_disallowed?(message); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/deprecation/disallowed.rb#40
def explicitly_allowed?(message); end
end
+# source://activesupport//lib/active_support/deprecation/instance_delegator.rb#7
module ActiveSupport::Deprecation::InstanceDelegator
mixes_in_class_methods ::ActiveSupport::Deprecation::InstanceDelegator::ClassMethods
mixes_in_class_methods ::ActiveSupport::Deprecation::InstanceDelegator::OverrideDelegators
class << self
+ # @private
+ #
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#8
def included(base); end
end
end
+# source://activesupport//lib/active_support/deprecation/instance_delegator.rb#14
module ActiveSupport::Deprecation::InstanceDelegator::ClassMethods
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#15
def include(included_module); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#20
def method_added(method_name); end
end
+# source://activesupport//lib/active_support/deprecation/instance_delegator.rb#25
module ActiveSupport::Deprecation::InstanceDelegator::OverrideDelegators
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#31
def deprecation_warning(deprecated_method_name, message = T.unsafe(nil), caller_backtrace = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/deprecation/instance_delegator.rb#26
def warn(message = T.unsafe(nil), callstack = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/deprecation/method_wrappers.rb#8
module ActiveSupport::Deprecation::MethodWrapper
+ # Declare that a method has been deprecated.
+ #
+ # class Fred
+ # def aaa; end
+ # def bbb; end
+ # def ccc; end
+ # def ddd; end
+ # def eee; end
+ # end
+ #
+ # Using the default deprecator:
+ # ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead')
+ # # => Fred
+ #
+ # Fred.new.aaa
+ # # DEPRECATION WARNING: aaa is deprecated and will be removed from Rails 5.1. (called from irb_binding at (irb):10)
+ # # => nil
+ #
+ # Fred.new.bbb
+ # # DEPRECATION WARNING: bbb is deprecated and will be removed from Rails 5.1 (use zzz instead). (called from irb_binding at (irb):11)
+ # # => nil
+ #
+ # Fred.new.ccc
+ # # DEPRECATION WARNING: ccc is deprecated and will be removed from Rails 5.1 (use Bar#ccc instead). (called from irb_binding at (irb):12)
+ # # => nil
+ #
+ # Passing in a custom deprecator:
+ # custom_deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem')
+ # ActiveSupport::Deprecation.deprecate_methods(Fred, ddd: :zzz, deprecator: custom_deprecator)
+ # # => [:ddd]
+ #
+ # Fred.new.ddd
+ # DEPRECATION WARNING: ddd is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):15)
+ # # => nil
+ #
+ # Using a custom deprecator directly:
+ # custom_deprecator = ActiveSupport::Deprecation.new('next-release', 'MyGem')
+ # custom_deprecator.deprecate_methods(Fred, eee: :zzz)
+ # # => [:eee]
+ #
+ # Fred.new.eee
+ # DEPRECATION WARNING: eee is deprecated and will be removed from MyGem next-release (use zzz instead). (called from irb_binding at (irb):18)
+ # # => nil
+ #
+ # source://activesupport//lib/active_support/deprecation/method_wrappers.rb#52
def deprecate_methods(target_module, *method_names); end
end
+# source://activesupport//lib/active_support/deprecation/reporting.rb#7
module ActiveSupport::Deprecation::Reporting
+ # Allow previously disallowed deprecation warnings within the block.
+ # allowed_warnings can be an array containing strings, symbols, or regular
+ # expressions. (Symbols are treated as strings). These are compared against
+ # the text of deprecation warning messages generated within the block.
+ # Matching warnings will be exempt from the rules set by
+ # +ActiveSupport::Deprecation.disallowed_warnings+
+ #
+ # The optional if: argument accepts a truthy/falsy value or an object that
+ # responds to .call. If truthy, then matching warnings will be allowed.
+ # If falsey then the method yields to the block without allowing the warning.
+ #
+ # ActiveSupport::Deprecation.disallowed_behavior = :raise
+ # ActiveSupport::Deprecation.disallowed_warnings = [
+ # "something broke"
+ # ]
+ #
+ # ActiveSupport::Deprecation.warn('something broke!')
+ # # => ActiveSupport::DeprecationException
+ #
+ # ActiveSupport::Deprecation.allow ['something broke'] do
+ # ActiveSupport::Deprecation.warn('something broke!')
+ # end
+ # # => nil
+ #
+ # ActiveSupport::Deprecation.allow ['something broke'], if: Rails.env.production? do
+ # ActiveSupport::Deprecation.warn('something broke!')
+ # end
+ # # => ActiveSupport::DeprecationException for dev/test, nil for production
+ #
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#72
def allow(allowed_warnings = T.unsafe(nil), if: T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#86
def deprecation_warning(deprecated_method_name, message = T.unsafe(nil), caller_backtrace = T.unsafe(nil)); end
+
+ # Name of gem where method is deprecated
+ #
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#11
def gem_name; end
+
+ # Name of gem where method is deprecated
+ #
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#11
def gem_name=(_arg0); end
+
+ # Silence deprecation warnings within the block.
+ #
+ # ActiveSupport::Deprecation.warn('something broke!')
+ # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
+ #
+ # ActiveSupport::Deprecation.silence do
+ # ActiveSupport::Deprecation.warn('something broke!')
+ # end
+ # # => nil
+ #
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#40
def silence(&block); end
+
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#82
def silenced; end
+
+ # Whether to print a message (silent mode)
+ #
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#9
def silenced=(_arg0); end
+
+ # Outputs a deprecation warning to the output configured by
+ # ActiveSupport::Deprecation.behavior.
+ #
+ # ActiveSupport::Deprecation.warn('something broke!')
+ # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
+ #
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#18
def warn(message = T.unsafe(nil), callstack = T.unsafe(nil)); end
private
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#137
def _extract_callstack(callstack); end
+
+ # Outputs a deprecation warning message
+ #
+ # deprecated_method_warning(:method_name)
+ # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon}"
+ # deprecated_method_warning(:method_name, :another_method)
+ # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (use another_method instead)"
+ # deprecated_method_warning(:method_name, "Optional message")
+ # # => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (Optional message)"
+ #
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#102
def deprecated_method_warning(method_name, message = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#116
def deprecation_caller_message(callstack); end
+
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#111
def deprecation_message(callstack, message = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#127
def extract_callstack(callstack); end
+
+ # source://activesupport//lib/active_support/deprecation/reporting.rb#152
def ignored_callstack(path); end
end
+# source://activesupport//lib/active_support/deprecation/reporting.rb#150
ActiveSupport::Deprecation::Reporting::RAILS_GEM_ROOT = T.let(T.unsafe(nil), String)
+
+# Raised when ActiveSupport::Deprecation::Behavior#behavior is set with :raise.
+# You would set :raise, as a behavior to raise errors and proactively report exceptions from deprecations.
+#
+# source://activesupport//lib/active_support/deprecation/behaviors.rb#8
class ActiveSupport::DeprecationException < ::StandardError; end
+# This module provides an internal implementation to track descendants
+# which is faster than iterating through ObjectSpace.
+#
+# source://activesupport//lib/active_support/descendants_tracker.rb#8
module ActiveSupport::DescendantsTracker
+ # source://activesupport//lib/active_support/descendants_tracker.rb#65
def descendants; end
+
+ # source://activesupport//lib/active_support/descendants_tracker.rb#60
def direct_descendants; end
+
+ # source://activesupport//lib/active_support/descendants_tracker.rb#55
def inherited(base); end
+
+ # source://activesupport//lib/active_support/descendants_tracker.rb#60
def subclasses; end
class << self
+ # source://activesupport//lib/active_support/descendants_tracker.rb#24
def clear; end
+
+ # source://activesupport//lib/active_support/descendants_tracker.rb#18
def descendants(klass); end
+
+ # source://activesupport//lib/active_support/descendants_tracker.rb#12
def direct_descendants(klass); end
+
+ # This is the only method that is not thread safe, but is only ever called
+ # during the eager loading phase.
+ #
+ # source://activesupport//lib/active_support/descendants_tracker.rb#40
def store_inherited(klass, descendant); end
+
+ # source://activesupport//lib/active_support/descendants_tracker.rb#12
def subclasses(klass); end
private
+ # source://activesupport//lib/active_support/descendants_tracker.rb#45
def accumulate_descendants(klass, acc); end
end
end
+# DescendantsArray is an array that contains weak references to classes.
+#
+# source://activesupport//lib/active_support/descendants_tracker.rb#70
class ActiveSupport::DescendantsTracker::DescendantsArray
include ::Enumerable
+ # @return [DescendantsArray] a new instance of DescendantsArray
+ #
+ # source://activesupport//lib/active_support/descendants_tracker.rb#73
def initialize; end
+ # source://activesupport//lib/active_support/descendants_tracker.rb#81
def <<(klass); end
+
+ # source://activesupport//lib/active_support/descendants_tracker.rb#99
def cleanup!; end
+
+ # source://activesupport//lib/active_support/descendants_tracker.rb#85
def each; end
+
+ # source://activesupport//lib/active_support/descendants_tracker.rb#95
def refs_size; end
+
+ # source://activesupport//lib/active_support/descendants_tracker.rb#103
def reject!; end
private
+ # source://activesupport//lib/active_support/descendants_tracker.rb#77
def initialize_copy(orig); end
end
+# source://activesupport//lib/active_support/digest.rb#6
class ActiveSupport::Digest
class << self
+ # source://activesupport//lib/active_support/digest.rb#8
def hash_digest_class; end
+
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/digest.rb#12
def hash_digest_class=(klass); end
+
+ # source://activesupport//lib/active_support/digest.rb#17
def hexdigest(arg); end
end
end
+# Provides accurate date and time measurements using Date#advance and
+# Time#advance, respectively. It mainly supports the methods on Numeric.
+#
+# 1.month.ago # equivalent to Time.now.advance(months: -1)
+#
+# source://activesupport//lib/active_support/duration.rb#13
class ActiveSupport::Duration
+ # @return [Duration] a new instance of Duration
+ #
+ # source://activesupport//lib/active_support/duration.rb#213
def initialize(value, parts); end
+ # Returns the modulo of this Duration by another Duration or Numeric.
+ # Numeric values are treated as seconds.
+ #
+ # source://activesupport//lib/active_support/duration.rb#285
def %(other); end
+
+ # Multiplies this Duration by a Numeric and returns a new Duration.
+ #
+ # source://activesupport//lib/active_support/duration.rb#260
def *(other); end
+
+ # Adds another Duration or a Numeric to this Duration. Numeric values
+ # are treated as seconds.
+ #
+ # source://activesupport//lib/active_support/duration.rb#241
def +(other); end
+
+ # source://activesupport//lib/active_support/duration.rb#299
def +@; end
+
+ # Subtracts another Duration or a Numeric from this Duration. Numeric
+ # values are treated as seconds.
+ #
+ # source://activesupport//lib/active_support/duration.rb#255
def -(other); end
+
+ # source://activesupport//lib/active_support/duration.rb#295
def -@; end
+
+ # Divides this Duration by a Numeric and returns a new Duration.
+ #
+ # source://activesupport//lib/active_support/duration.rb#271
def /(other); end
+
+ # Compares one Duration with another or a Numeric to this Duration.
+ # Numeric values are treated as seconds.
+ #
+ # source://activesupport//lib/active_support/duration.rb#231
def <=>(other); end
+
+ # Returns +true+ if +other+ is also a Duration instance with the
+ # same +value+, or if other == value.
+ #
+ # source://activesupport//lib/active_support/duration.rb#314
def ==(other); end
+
+ # Calculates a new Time or Date that is as far in the future
+ # as this Duration represents.
+ #
+ # source://activesupport//lib/active_support/duration.rb#409
def after(time = T.unsafe(nil)); end
+
+ # Calculates a new Time or Date that is as far in the past
+ # as this Duration represents.
+ #
+ # source://activesupport//lib/active_support/duration.rb#417
def ago(time = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/duration.rb#432
def as_json(options = T.unsafe(nil)); end
+
+ # Calculates a new Time or Date that is as far in the past
+ # as this Duration represents.
+ #
+ # source://activesupport//lib/active_support/duration.rb#417
def before(time = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/duration.rb#218
def coerce(other); end
+
+ # source://activesupport//lib/active_support/duration.rb#440
def encode_with(coder); end
+
+ # Returns +true+ if +other+ is also a Duration instance, which has the
+ # same parts as this one.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/duration.rb#399
def eql?(other); end
+
+ # Calculates a new Time or Date that is as far in the future
+ # as this Duration represents.
+ #
+ # source://activesupport//lib/active_support/duration.rb#409
def from_now(time = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/duration.rb#403
def hash; end
+
+ # Returns the amount of days a duration covers as a float
+ #
+ # 12.hours.in_days # => 0.5
+ #
+ # source://activesupport//lib/active_support/duration.rb#372
def in_days; end
+
+ # Returns the amount of hours a duration covers as a float
+ #
+ # 1.day.in_hours # => 24.0
+ #
+ # source://activesupport//lib/active_support/duration.rb#365
def in_hours; end
+
+ # Returns the amount of minutes a duration covers as a float
+ #
+ # 1.day.in_minutes # => 1440.0
+ #
+ # source://activesupport//lib/active_support/duration.rb#358
def in_minutes; end
+
+ # Returns the amount of months a duration covers as a float
+ #
+ # 9.weeks.in_months # => 2.07
+ #
+ # source://activesupport//lib/active_support/duration.rb#386
def in_months; end
+
+ # Returns the number of seconds that this Duration represents.
+ #
+ # 1.minute.to_i # => 60
+ # 1.hour.to_i # => 3600
+ # 1.day.to_i # => 86400
+ #
+ # Note that this conversion makes some assumptions about the
+ # duration of some periods, e.g. months are always 1/12 of year
+ # and years are 365.2425 days:
+ #
+ # # equivalent to (1.year / 12).to_i
+ # 1.month.to_i # => 2629746
+ #
+ # # equivalent to 365.2425.days.to_i
+ # 1.year.to_i # => 31556952
+ #
+ # In such cases, Ruby's core
+ # Date[https://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html] and
+ # Time[https://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html] should be used for precision
+ # date and time arithmetic.
+ #
+ # source://activesupport//lib/active_support/duration.rb#350
def in_seconds; end
+
+ # Returns the amount of weeks a duration covers as a float
+ #
+ # 2.months.in_weeks # => 8.696
+ #
+ # source://activesupport//lib/active_support/duration.rb#379
def in_weeks; end
+
+ # Returns the amount of years a duration covers as a float
+ #
+ # 30.days.in_years # => 0.082
+ #
+ # source://activesupport//lib/active_support/duration.rb#393
def in_years; end
+
+ # source://activesupport//lib/active_support/duration.rb#436
def init_with(coder); end
+
+ # source://activesupport//lib/active_support/duration.rb#423
def inspect; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/duration.rb#308
def instance_of?(klass); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/duration.rb#303
def is_a?(klass); end
+
+ # Build ISO 8601 Duration string for this duration.
+ # The +precision+ parameter can be used to limit seconds' precision of duration.
+ #
+ # source://activesupport//lib/active_support/duration.rb#446
def iso8601(precision: T.unsafe(nil)); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/duration.rb#303
def kind_of?(klass); end
+
+ # Returns the value of attribute parts.
+ #
+ # source://activesupport//lib/active_support/duration.rb#127
def parts; end
+
+ # Sets the attribute parts
+ #
+ # @param value the value to set the attribute parts to.
+ #
+ # source://activesupport//lib/active_support/duration.rb#127
def parts=(_arg0); end
+
+ # Calculates a new Time or Date that is as far in the future
+ # as this Duration represents.
+ #
+ # source://activesupport//lib/active_support/duration.rb#409
def since(time = T.unsafe(nil)); end
+
+ # Returns the number of seconds that this Duration represents.
+ #
+ # 1.minute.to_i # => 60
+ # 1.hour.to_i # => 3600
+ # 1.day.to_i # => 86400
+ #
+ # Note that this conversion makes some assumptions about the
+ # duration of some periods, e.g. months are always 1/12 of year
+ # and years are 365.2425 days:
+ #
+ # # equivalent to (1.year / 12).to_i
+ # 1.month.to_i # => 2629746
+ #
+ # # equivalent to 365.2425.days.to_i
+ # 1.year.to_i # => 31556952
+ #
+ # In such cases, Ruby's core
+ # Date[https://ruby-doc.org/stdlib/libdoc/date/rdoc/Date.html] and
+ # Time[https://ruby-doc.org/stdlib/libdoc/time/rdoc/Time.html] should be used for precision
+ # date and time arithmetic.
+ #
+ # source://activesupport//lib/active_support/duration.rb#350
def to_i; end
+
+ # Returns the amount of seconds a duration covers as a string.
+ # For more information check to_i method.
+ #
+ # 1.day.to_s # => "86400"
+ #
+ # source://activesupport//lib/active_support/duration.rb#326
def to_s; end
+
+ # Calculates a new Time or Date that is as far in the past
+ # as this Duration represents.
+ #
+ # source://activesupport//lib/active_support/duration.rb#417
def until(time = T.unsafe(nil)); end
+
+ # Returns the value of attribute value.
+ #
+ # source://activesupport//lib/active_support/duration.rb#127
def value; end
+
+ # Sets the attribute value
+ #
+ # @param value the value to set the attribute value to.
+ #
+ # source://activesupport//lib/active_support/duration.rb#127
def value=(_arg0); end
private
+ # source://activesupport//lib/active_support/duration.rb#477
def method_missing(method, *args, &block); end
+
+ # @raise [TypeError]
+ #
+ # source://activesupport//lib/active_support/duration.rb#481
def raise_type_error(other); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/duration.rb#473
def respond_to_missing?(method, _); end
+
+ # source://activesupport//lib/active_support/duration.rb#451
def sum(sign, time = T.unsafe(nil)); end
class << self
+ # source://activesupport//lib/active_support/duration.rb#143
def ===(other); end
+
+ # Creates a new Duration from a seconds value that is converted
+ # to the individual parts:
+ #
+ # ActiveSupport::Duration.build(31556952).parts # => {:years=>1}
+ # ActiveSupport::Duration.build(2716146).parts # => {:months=>1, :days=>1}
+ #
+ # source://activesupport//lib/active_support/duration.rb#183
def build(value); end
+
+ # source://activesupport//lib/active_support/duration.rb#161
def days(value); end
+
+ # source://activesupport//lib/active_support/duration.rb#157
def hours(value); end
+
+ # source://activesupport//lib/active_support/duration.rb#153
def minutes(value); end
+
+ # source://activesupport//lib/active_support/duration.rb#169
def months(value); end
+
+ # Creates a new Duration from string formatted according to ISO 8601 Duration.
+ #
+ # See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information.
+ # This method allows negative parts to be present in pattern.
+ # If invalid string is provided, it will raise +ActiveSupport::Duration::ISO8601Parser::ParsingError+.
+ #
+ # source://activesupport//lib/active_support/duration.rb#138
def parse(iso8601duration); end
+
+ # source://activesupport//lib/active_support/duration.rb#149
def seconds(value); end
+
+ # source://activesupport//lib/active_support/duration.rb#165
def weeks(value); end
+
+ # source://activesupport//lib/active_support/duration.rb#173
def years(value); end
private
+ # source://activesupport//lib/active_support/duration.rb#206
def calculate_total_seconds(parts); end
end
end
+# Parses a string formatted according to ISO 8601 Duration into the hash.
+#
+# See {ISO 8601}[https://en.wikipedia.org/wiki/ISO_8601#Durations] for more information.
+#
+# This parser allows negative parts to be present in pattern.
+#
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#12
class ActiveSupport::Duration::ISO8601Parser
+ # @return [ISO8601Parser] a new instance of ISO8601Parser
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#34
def initialize(string); end
+ # Returns the value of attribute mode.
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#32
def mode; end
+
+ # Sets the attribute mode
+ #
+ # @param value the value to set the attribute mode to.
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#32
def mode=(_arg0); end
+
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#41
def parse!; end
+
+ # Returns the value of attribute parts.
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#31
def parts; end
+
+ # Returns the value of attribute scanner.
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#31
def scanner; end
+
+ # Returns the value of attribute sign.
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#32
def sign; end
+
+ # Sets the attribute sign
+ #
+ # @param value the value to set the attribute sign to.
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#32
def sign=(_arg0); end
private
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#83
def finished?; end
+
+ # Parses number which can be a float with either comma or period.
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#88
def number; end
+
+ # @raise [ParsingError]
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#96
def raise_parsing_error(reason = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#92
def scan(pattern); end
+
+ # Checks for various semantic errors as stated in ISO 8601 standard.
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_parser.rb#101
def validate!; end
end
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#17
ActiveSupport::Duration::ISO8601Parser::COMMA = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#22
ActiveSupport::Duration::ISO8601Parser::DATE_COMPONENT = T.let(T.unsafe(nil), Regexp)
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#28
ActiveSupport::Duration::ISO8601Parser::DATE_COMPONENTS = T.let(T.unsafe(nil), Array)
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#20
ActiveSupport::Duration::ISO8601Parser::DATE_MARKER = T.let(T.unsafe(nil), Regexp)
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#25
ActiveSupport::Duration::ISO8601Parser::DATE_TO_PART = T.let(T.unsafe(nil), Hash)
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#16
ActiveSupport::Duration::ISO8601Parser::PERIOD = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#15
ActiveSupport::Duration::ISO8601Parser::PERIOD_OR_COMMA = T.let(T.unsafe(nil), Regexp)
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#13
class ActiveSupport::Duration::ISO8601Parser::ParsingError < ::ArgumentError; end
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#19
ActiveSupport::Duration::ISO8601Parser::SIGN_MARKER = T.let(T.unsafe(nil), Regexp)
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#23
ActiveSupport::Duration::ISO8601Parser::TIME_COMPONENT = T.let(T.unsafe(nil), Regexp)
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#29
ActiveSupport::Duration::ISO8601Parser::TIME_COMPONENTS = T.let(T.unsafe(nil), Array)
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#21
ActiveSupport::Duration::ISO8601Parser::TIME_MARKER = T.let(T.unsafe(nil), Regexp)
+
+# source://activesupport//lib/active_support/duration/iso8601_parser.rb#26
ActiveSupport::Duration::ISO8601Parser::TIME_TO_PART = T.let(T.unsafe(nil), Hash)
+# Serializes duration to string according to ISO 8601 Duration format.
+#
+# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#8
class ActiveSupport::Duration::ISO8601Serializer
+ # @return [ISO8601Serializer] a new instance of ISO8601Serializer
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#11
def initialize(duration, precision: T.unsafe(nil)); end
+ # Builds and returns output string.
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#17
def serialize; end
private
+ # Return pair of duration's parts and whole duration sign.
+ # Parts are summarized (as they can become repetitive due to addition, etc).
+ # Zero parts are removed as not significant.
+ # If all parts are negative it will negate all of them and return minus as a sign.
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#41
def normalize; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/duration/iso8601_serializer.rb#54
def week_mixed_with_date?(parts); end
end
+# source://activesupport//lib/active_support/duration/iso8601_serializer.rb#9
ActiveSupport::Duration::ISO8601Serializer::DATE_COMPONENTS = T.let(T.unsafe(nil), Array)
+
+# source://activesupport//lib/active_support/duration.rb#125
ActiveSupport::Duration::PARTS = T.let(T.unsafe(nil), Array)
+
+# source://activesupport//lib/active_support/duration.rb#115
ActiveSupport::Duration::PARTS_IN_SECONDS = T.let(T.unsafe(nil), Hash)
+
+# source://activesupport//lib/active_support/duration.rb#110
ActiveSupport::Duration::SECONDS_PER_DAY = T.let(T.unsafe(nil), Integer)
+
+# source://activesupport//lib/active_support/duration.rb#109
ActiveSupport::Duration::SECONDS_PER_HOUR = T.let(T.unsafe(nil), Integer)
+
+# source://activesupport//lib/active_support/duration.rb#108
ActiveSupport::Duration::SECONDS_PER_MINUTE = T.let(T.unsafe(nil), Integer)
+
+# 1/12 of a gregorian year
+#
+# source://activesupport//lib/active_support/duration.rb#112
ActiveSupport::Duration::SECONDS_PER_MONTH = T.let(T.unsafe(nil), Integer)
+
+# source://activesupport//lib/active_support/duration.rb#111
ActiveSupport::Duration::SECONDS_PER_WEEK = T.let(T.unsafe(nil), Integer)
+
+# length of a gregorian year (365.2425 days)
+#
+# source://activesupport//lib/active_support/duration.rb#113
ActiveSupport::Duration::SECONDS_PER_YEAR = T.let(T.unsafe(nil), Integer)
+# source://activesupport//lib/active_support/duration.rb#14
class ActiveSupport::Duration::Scalar < ::Numeric
+ # @return [Scalar] a new instance of Scalar
+ #
+ # source://activesupport//lib/active_support/duration.rb#18
def initialize(value); end
+ # source://activesupport//lib/active_support/duration.rb#84
def %(other); end
+
+ # source://activesupport//lib/active_support/duration.rb#65
def *(other); end
+
+ # source://activesupport//lib/active_support/duration.rb#40
def +(other); end
+
+ # source://activesupport//lib/active_support/duration.rb#52
def -(other); end
+
+ # source://activesupport//lib/active_support/duration.rb#26
def -@; end
+
+ # source://activesupport//lib/active_support/duration.rb#76
def /(other); end
+
+ # source://activesupport//lib/active_support/duration.rb#30
def <=>(other); end
+
+ # source://activesupport//lib/active_support/duration.rb#22
def coerce(other); end
- def to_f(*args, &block); end
- def to_i(*args, &block); end
- def to_s(*args, &block); end
+
+ # source://activesupport//lib/active_support/duration.rb#16
+ def to_f(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/duration.rb#16
+ def to_i(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/duration.rb#16
+ def to_s(*_arg0, **_arg1, &_arg2); end
+
+ # Returns the value of attribute value.
+ #
+ # source://activesupport//lib/active_support/duration.rb#15
def value; end
private
+ # source://activesupport//lib/active_support/duration.rb#93
def calculate(op, other); end
+
+ # @raise [TypeError]
+ #
+ # source://activesupport//lib/active_support/duration.rb#103
def raise_type_error(other); end
end
+# source://activesupport//lib/active_support/core_ext/range/each.rb#6
module ActiveSupport::EachTimeWithZone
+ # source://activesupport//lib/active_support/core_ext/range/each.rb#7
def each(&block); end
+
+ # source://activesupport//lib/active_support/core_ext/range/each.rb#12
def step(n = T.unsafe(nil), &block); end
private
+ # @raise [TypeError]
+ #
+ # source://activesupport//lib/active_support/core_ext/range/each.rb#18
def ensure_iteration_allowed; end
end
+# source://activesupport//lib/active_support/environment_inquirer.rb#6
class ActiveSupport::EnvironmentInquirer < ::ActiveSupport::StringInquirer
+ # @return [EnvironmentInquirer] a new instance of EnvironmentInquirer
+ #
+ # source://activesupport//lib/active_support/environment_inquirer.rb#8
def initialize(env); end
def development?; end
@@ -1227,1023 +4683,4481 @@ class ActiveSupport::EnvironmentInquirer < ::ActiveSupport::StringInquirer
def test?; end
end
+# source://activesupport//lib/active_support/environment_inquirer.rb#7
ActiveSupport::EnvironmentInquirer::DEFAULT_ENVIRONMENTS = T.let(T.unsafe(nil), Array)
+# source://activesupport//lib/active_support/execution_wrapper.rb#7
class ActiveSupport::ExecutionWrapper
include ::ActiveSupport::Callbacks
extend ::ActiveSupport::Callbacks::ClassMethods
extend ::ActiveSupport::DescendantsTracker
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks?; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#835
def _complete_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#835
def _run_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#823
def _run_complete_callbacks(&block); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#823
def _run_run_callbacks(&block); end
+
+ # Complete this in-flight execution. This method *must* be called
+ # exactly once on the result of any call to +run!+.
+ #
+ # Where possible, prefer +wrap+.
+ #
+ # source://activesupport//lib/active_support/execution_wrapper.rb#121
def complete!; end
+
+ # source://activesupport//lib/active_support/execution_wrapper.rb#112
def run!; end
private
+ # source://activesupport//lib/active_support/execution_wrapper.rb#128
def hook_state; end
class << self
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks=(value); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks?; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#827
def _complete_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#831
def _complete_callbacks=(value); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#827
def _run_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#831
def _run_callbacks=(value); end
+
+ # Returns the value of attribute active.
+ #
+ # source://activesupport//lib/active_support/execution_wrapper.rb#98
def active; end
+
+ # Sets the attribute active
+ #
+ # @param value the value to set the attribute active to.
+ #
+ # source://activesupport//lib/active_support/execution_wrapper.rb#98
def active=(_arg0); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/execution_wrapper.rb#108
def active?; end
+
+ # source://activesupport//lib/active_support/execution_wrapper.rb#101
def inherited(other); end
+
+ # Register an object to be invoked during both the +run+ and
+ # +complete+ steps.
+ #
+ # +hook.complete+ will be passed the value returned from +hook.run+,
+ # and will only be invoked if +run+ has previously been called.
+ # (Mostly, this means it won't be invoked if an exception occurs in
+ # a preceding +to_run+ block; all ordinary +to_complete+ blocks are
+ # invoked in that situation.)
+ #
+ # source://activesupport//lib/active_support/execution_wrapper.rb#50
def register_hook(hook, outer: T.unsafe(nil)); end
+
+ # Run this execution.
+ #
+ # Returns an instance, whose +complete!+ method *must* be invoked
+ # after the work has been performed.
+ #
+ # Where possible, prefer +wrap+.
+ #
+ # source://activesupport//lib/active_support/execution_wrapper.rb#66
def run!(reset: T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/execution_wrapper.rb#21
def to_complete(*args, &block); end
+
+ # source://activesupport//lib/active_support/execution_wrapper.rb#17
def to_run(*args, &block); end
+
+ # Perform the work in the supplied block as an execution.
+ #
+ # source://activesupport//lib/active_support/execution_wrapper.rb#86
def wrap; end
end
end
+# source://activesupport//lib/active_support/execution_wrapper.rb#32
class ActiveSupport::ExecutionWrapper::CompleteHook < ::Struct
+ # source://activesupport//lib/active_support/execution_wrapper.rb#33
def after(target); end
+
+ # source://activesupport//lib/active_support/execution_wrapper.rb#33
def before(target); end
+
+ # Returns the value of attribute hook
+ #
+ # @return [Object] the current value of hook
def hook; end
+
+ # Sets the attribute hook
+ #
+ # @param value [Object] the value to set the attribute hook to.
+ # @return [Object] the newly set value
def hook=(_); end
class << self
def [](*_arg0); end
def inspect; end
+ def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
+# source://activesupport//lib/active_support/execution_wrapper.rb#10
ActiveSupport::ExecutionWrapper::Null = T.let(T.unsafe(nil), Object)
+# source://activesupport//lib/active_support/execution_wrapper.rb#25
class ActiveSupport::ExecutionWrapper::RunHook < ::Struct
+ # source://activesupport//lib/active_support/execution_wrapper.rb#26
def before(target); end
+
+ # Returns the value of attribute hook
+ #
+ # @return [Object] the current value of hook
def hook; end
+
+ # Sets the attribute hook
+ #
+ # @param value [Object] the value to set the attribute hook to.
+ # @return [Object] the newly set value
def hook=(_); end
class << self
def [](*_arg0); end
def inspect; end
+ def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
+# source://activesupport//lib/active_support/executor.rb#6
class ActiveSupport::Executor < ::ActiveSupport::ExecutionWrapper; end
+# FileUpdateChecker specifies the API used by Rails to watch files
+# and control reloading. The API depends on four methods:
+#
+# * +initialize+ which expects two parameters and one block as
+# described below.
+#
+# * +updated?+ which returns a boolean if there were updates in
+# the filesystem or not.
+#
+# * +execute+ which executes the given block on initialization
+# and updates the latest watched files and timestamp.
+#
+# * +execute_if_updated+ which just executes the block if it was updated.
+#
+# After initialization, a call to +execute_if_updated+ must execute
+# the block only if there was really a change in the filesystem.
+#
+# This class is used by Rails to reload the I18n framework whenever
+# they are changed upon a new request.
+#
+# i18n_reloader = ActiveSupport::FileUpdateChecker.new(paths) do
+# I18n.reload!
+# end
+#
+# ActiveSupport::Reloader.to_prepare do
+# i18n_reloader.execute_if_updated
+# end
+#
+# source://activesupport//lib/active_support/file_update_checker.rb#33
class ActiveSupport::FileUpdateChecker
+ # It accepts two parameters on initialization. The first is an array
+ # of files and the second is an optional hash of directories. The hash must
+ # have directories as keys and the value is an array of extensions to be
+ # watched under that directory.
+ #
+ # This method must also receive a block that will be called once a path
+ # changes. The array of files and list of directories cannot be changed
+ # after FileUpdateChecker has been initialized.
+ #
+ # @return [FileUpdateChecker] a new instance of FileUpdateChecker
+ #
+ # source://activesupport//lib/active_support/file_update_checker.rb#42
def initialize(files, dirs = T.unsafe(nil), &block); end
+ # Executes the given block and updates the latest watched files and
+ # timestamp.
+ #
+ # source://activesupport//lib/active_support/file_update_checker.rb#80
def execute; end
+
+ # Execute the block given if updated.
+ #
+ # source://activesupport//lib/active_support/file_update_checker.rb#90
def execute_if_updated; end
+
+ # Check if any of the entries were updated. If so, the watched and/or
+ # updated_at values are cached until the block is executed via +execute+
+ # or +execute_if_updated+.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/file_update_checker.rb#61
def updated?; end
private
+ # source://activesupport//lib/active_support/file_update_checker.rb#156
def compile_ext(array); end
+
+ # source://activesupport//lib/active_support/file_update_checker.rb#142
def compile_glob(hash); end
+
+ # source://activesupport//lib/active_support/file_update_checker.rb#152
def escape(key); end
+
+ # This method returns the maximum mtime of the files in +paths+, or +nil+
+ # if the array is empty.
+ #
+ # Files with a mtime in the future are ignored. Such abnormal situation
+ # can happen for example if the user changes the clock by hand. It is
+ # healthy to consider this edge case because with mtimes in the future
+ # reloading is not triggered.
+ #
+ # source://activesupport//lib/active_support/file_update_checker.rb#120
def max_mtime(paths); end
+
+ # source://activesupport//lib/active_support/file_update_checker.rb#109
def updated_at(paths); end
+
+ # source://activesupport//lib/active_support/file_update_checker.rb#101
def watched; end
end
+# source://activesupport//lib/active_support/fork_tracker.rb#4
module ActiveSupport::ForkTracker
class << self
+ # source://activesupport//lib/active_support/fork_tracker.rb#52
def after_fork(&block); end
+
+ # source://activesupport//lib/active_support/fork_tracker.rb#36
def check!; end
+
+ # source://activesupport//lib/active_support/fork_tracker.rb#43
def hook!; end
+
+ # source://activesupport//lib/active_support/fork_tracker.rb#57
def unregister(callback); end
end
end
+# source://activesupport//lib/active_support/fork_tracker.rb#5
module ActiveSupport::ForkTracker::CoreExt
- def fork(*_arg0); end
+ # source://activesupport//lib/active_support/fork_tracker.rb#6
+ def fork(*_arg0, **_arg1); end
end
+# source://activesupport//lib/active_support/fork_tracker.rb#22
module ActiveSupport::ForkTracker::CoreExtPrivate
+ include ::ActiveSupport::ForkTracker::CoreExt
+
private
- def fork(*_arg0); end
+ # source://activesupport//lib/active_support/fork_tracker.rb#26
+ def fork(*_arg0, **_arg1); end
end
+# A convenient wrapper for the zlib standard library that allows
+# compression/decompression of strings with gzip.
+#
+# gzip = ActiveSupport::Gzip.compress('compress me!')
+# # => "\x1F\x8B\b\x00o\x8D\xCDO\x00\x03K\xCE\xCF-(J-.V\xC8MU\x04\x00R>n\x83\f\x00\x00\x00"
+#
+# ActiveSupport::Gzip.decompress(gzip)
+# # => "compress me!"
+#
+# source://activesupport//lib/active_support/gzip.rb#15
module ActiveSupport::Gzip
class << self
+ # Compresses a string using gzip.
+ #
+ # source://activesupport//lib/active_support/gzip.rb#30
def compress(source, level = T.unsafe(nil), strategy = T.unsafe(nil)); end
+
+ # Decompresses a gzipped string.
+ #
+ # source://activesupport//lib/active_support/gzip.rb#25
def decompress(source); end
end
end
+# source://activesupport//lib/active_support/gzip.rb#16
class ActiveSupport::Gzip::Stream < ::StringIO
+ # @return [Stream] a new instance of Stream
+ #
+ # source://activesupport//lib/active_support/gzip.rb#17
def initialize(*_arg0); end
+ # source://activesupport//lib/active_support/gzip.rb#21
def close; end
end
+# Implements a hash where keys :foo and "foo" are considered
+# to be the same.
+#
+# rgb = ActiveSupport::HashWithIndifferentAccess.new
+#
+# rgb[:black] = '#000000'
+# rgb[:black] # => '#000000'
+# rgb['black'] # => '#000000'
+#
+# rgb['white'] = '#FFFFFF'
+# rgb[:white] # => '#FFFFFF'
+# rgb['white'] # => '#FFFFFF'
+#
+# Internally symbols are mapped to strings when used as keys in the entire
+# writing interface (calling []=, merge, etc). This
+# mapping belongs to the public interface. For example, given:
+#
+# hash = ActiveSupport::HashWithIndifferentAccess.new(a: 1)
+#
+# You are guaranteed that the key is returned as a string:
+#
+# hash.keys # => ["a"]
+#
+# Technically other types of keys are accepted:
+#
+# hash = ActiveSupport::HashWithIndifferentAccess.new(a: 1)
+# hash[0] = 0
+# hash # => {"a"=>1, 0=>0}
+#
+# but this class is intended for use cases where strings or symbols are the
+# expected keys and it is convenient to understand both as the same. For
+# example the +params+ hash in Ruby on Rails.
+#
+# Note that core extensions define Hash#with_indifferent_access:
+#
+# rgb = { black: '#000000', white: '#FFFFFF' }.with_indifferent_access
+#
+# which may be handy.
+#
+# To access this class outside of Rails, require the core extension with:
+#
+# require "active_support/core_ext/hash/indifferent_access"
+#
+# which will, in turn, require this file.
+#
+# source://activesupport//lib/active_support/hash_with_indifferent_access.rb#55
class ActiveSupport::HashWithIndifferentAccess < ::Hash
+ # @return [HashWithIndifferentAccess] a new instance of HashWithIndifferentAccess
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#68
def initialize(constructor = T.unsafe(nil)); end
+ # Same as Hash#[] where the key passed as argument can be
+ # either a string or a symbol:
+ #
+ # counters = ActiveSupport::HashWithIndifferentAccess.new
+ # counters[:foo] = 1
+ #
+ # counters['foo'] # => 1
+ # counters[:foo] # => 1
+ # counters[:zoo] # => nil
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#164
def [](key); end
+
+ # Assigns a new value to the hash:
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash[:key] = 'value'
+ #
+ # This value can be later fetched using either +:key+ or 'key'.
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#94
def []=(key, value); end
+
+ # Same as Hash#assoc where the key passed as argument can be
+ # either a string or a symbol:
+ #
+ # counters = ActiveSupport::HashWithIndifferentAccess.new
+ # counters[:foo] = 1
+ #
+ # counters.assoc('foo') # => ["foo", 1]
+ # counters.assoc(:foo) # => ["foo", 1]
+ # counters.assoc(:zoo) # => nil
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#177
def assoc(key); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#355
def compact; end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#309
def deep_stringify_keys; end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#307
def deep_stringify_keys!; end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#314
def deep_symbolize_keys; end
+
+ # Same as Hash#default where the key passed as argument can be
+ # either a string or a symbol:
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new(1)
+ # hash.default # => 1
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new { |hash, key| key }
+ # hash.default # => nil
+ # hash.default('foo') # => 'foo'
+ # hash.default(:foo) # => 'foo'
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#219
def default(*args); end
+
+ # Removes the specified key from the hash.
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#293
def delete(key); end
+
+ # Same as Hash#dig where the key passed as argument can be
+ # either a string or a symbol:
+ #
+ # counters = ActiveSupport::HashWithIndifferentAccess.new
+ # counters[:foo] = { bar: 1 }
+ #
+ # counters.dig('foo', 'bar') # => 1
+ # counters.dig(:foo, :bar) # => 1
+ # counters.dig(:zoo) # => nil
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#204
def dig(*args); end
+
+ # Returns a shallow copy of the hash.
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new({ a: { b: 'b' } })
+ # dup = hash.dup
+ # dup[:a][:c] = 'c'
+ #
+ # hash[:a][:c] # => "c"
+ # dup[:a][:c] # => "c"
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#254
def dup; end
+
+ # Returns a hash with indifferent access that includes everything except given keys.
+ # hash = { a: "x", b: "y", c: 10 }.with_indifferent_access
+ # hash.except(:a, "b") # => {c: 10}.with_indifferent_access
+ # hash # => { a: "x", b: "y", c: 10 }.with_indifferent_access
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#301
def except(*keys); end
+
+ # Returns +true+ so that Array#extract_options! finds members of
+ # this class.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#56
def extractable_options?; end
+
+ # Same as Hash#fetch where the key passed as argument can be
+ # either a string or a symbol:
+ #
+ # counters = ActiveSupport::HashWithIndifferentAccess.new
+ # counters[:foo] = 1
+ #
+ # counters.fetch('foo') # => 1
+ # counters.fetch(:bar, 0) # => 0
+ # counters.fetch(:bar) { |key| 0 } # => 0
+ # counters.fetch(:zoo) # => KeyError: key not found: "zoo"
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#191
def fetch(key, *extras); end
+
+ # Returns an array of the values at the specified indices, but also
+ # raises an exception when one of the keys can't be found.
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash[:a] = 'x'
+ # hash[:b] = 'y'
+ # hash.fetch_values('a', 'b') # => ["x", "y"]
+ # hash.fetch_values('a', 'c') { |key| 'z' } # => ["x", "z"]
+ # hash.fetch_values('a', 'c') # => KeyError: key not found: "c"
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#242
def fetch_values(*indices, &block); end
+
+ # Checks the hash for a key matching the argument passed in:
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash['key'] = 'value'
+ # hash.key?(:key) # => true
+ # hash.key?('key') # => true
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#147
def has_key?(key); end
+
+ # Checks the hash for a key matching the argument passed in:
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash['key'] = 'value'
+ # hash.key?(:key) # => true
+ # hash.key?('key') # => true
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#147
def include?(key); end
+
+ # Checks the hash for a key matching the argument passed in:
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash['key'] = 'value'
+ # hash.key?(:key) # => true
+ # hash.key?('key') # => true
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#147
def key?(key); end
+
+ # Checks the hash for a key matching the argument passed in:
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash['key'] = 'value'
+ # hash.key?(:key) # => true
+ # hash.key?('key') # => true
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#147
def member?(key); end
+
+ # This method has the same semantics of +update+, except it does not
+ # modify the receiver but rather returns a new hash with indifferent
+ # access with the result of the merge.
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#263
def merge(*hashes, &block); end
+
+ # Updates the receiver in-place, merging in the hashes passed as arguments:
+ #
+ # hash_1 = ActiveSupport::HashWithIndifferentAccess.new
+ # hash_1[:key] = 'value'
+ #
+ # hash_2 = ActiveSupport::HashWithIndifferentAccess.new
+ # hash_2[:key] = 'New Value!'
+ #
+ # hash_1.update(hash_2) # => {"key"=>"New Value!"}
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash.update({ "a" => 1 }, { "b" => 2 }) # => { "a" => 1, "b" => 2 }
+ #
+ # The arguments can be either an
+ # ActiveSupport::HashWithIndifferentAccess or a regular +Hash+.
+ # In either case the merge respects the semantics of indifferent access.
+ #
+ # If the argument is a regular hash with keys +:key+ and "key" only one
+ # of the values end up in the receiver, but which one is unspecified.
+ #
+ # When given a block, the value for duplicated keys will be determined
+ # by the result of invoking the block with the duplicated key, the value
+ # in the receiver, and the value in +other_hash+. The rules for duplicated
+ # keys follow the semantics of indifferent access:
+ #
+ # hash_1[:key] = 10
+ # hash_2['key'] = 12
+ # hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22}
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#128
def merge!(*other_hashes, &block); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#64
def nested_under_indifferent_access; end
+
def regular_update(*_arg0); end
def regular_writer(_arg0, _arg1); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#322
def reject(*args, &block); end
+
+ # Replaces the contents of this hash with other_hash.
+ #
+ # h = { "a" => 100, "b" => 200 }
+ # h.replace({ "c" => 300, "d" => 400 }) # => {"c"=>300, "d"=>400}
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#288
def replace(other_hash); end
+
+ # Like +merge+ but the other way around: Merges the receiver into the
+ # argument and returns a new hash with indifferent access as result:
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash['a'] = nil
+ # hash.reverse_merge(a: 0, b: 1) # => {"a"=>nil, "b"=>1}
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#273
def reverse_merge(other_hash); end
+
+ # Same semantics as +reverse_merge+ but modifies the receiver in-place.
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#279
def reverse_merge!(other_hash); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#317
def select(*args, &block); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#345
def slice(*keys); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#350
def slice!(*keys); end
+
+ # Assigns a new value to the hash:
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash[:key] = 'value'
+ #
+ # This value can be later fetched using either +:key+ or 'key'.
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#94
def store(key, value); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#308
def stringify_keys; end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#306
def stringify_keys!; end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#312
def symbolize_keys; end
+
+ # Convert to a regular hash with string keys.
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#360
def to_hash; end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#312
def to_options; end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#315
def to_options!; end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#332
def transform_keys(*args, &block); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#337
def transform_keys!; end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#327
def transform_values(*args, &block); end
+
+ # Updates the receiver in-place, merging in the hashes passed as arguments:
+ #
+ # hash_1 = ActiveSupport::HashWithIndifferentAccess.new
+ # hash_1[:key] = 'value'
+ #
+ # hash_2 = ActiveSupport::HashWithIndifferentAccess.new
+ # hash_2[:key] = 'New Value!'
+ #
+ # hash_1.update(hash_2) # => {"key"=>"New Value!"}
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash.update({ "a" => 1 }, { "b" => 2 }) # => { "a" => 1, "b" => 2 }
+ #
+ # The arguments can be either an
+ # ActiveSupport::HashWithIndifferentAccess or a regular +Hash+.
+ # In either case the merge respects the semantics of indifferent access.
+ #
+ # If the argument is a regular hash with keys +:key+ and "key" only one
+ # of the values end up in the receiver, but which one is unspecified.
+ #
+ # When given a block, the value for duplicated keys will be determined
+ # by the result of invoking the block with the duplicated key, the value
+ # in the receiver, and the value in +other_hash+. The rules for duplicated
+ # keys follow the semantics of indifferent access:
+ #
+ # hash_1[:key] = 10
+ # hash_2['key'] = 12
+ # hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22}
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#128
def update(*other_hashes, &block); end
+
+ # Returns an array of the values at the specified indices:
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash[:a] = 'x'
+ # hash[:b] = 'y'
+ # hash.values_at('a', 'b') # => ["x", "y"]
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#229
def values_at(*keys); end
+
+ # Like +merge+ but the other way around: Merges the receiver into the
+ # argument and returns a new hash with indifferent access as result:
+ #
+ # hash = ActiveSupport::HashWithIndifferentAccess.new
+ # hash['a'] = nil
+ # hash.reverse_merge(a: 0, b: 1) # => {"a"=>nil, "b"=>1}
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#273
def with_defaults(other_hash); end
+
+ # Same semantics as +reverse_merge+ but modifies the receiver in-place.
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#279
def with_defaults!(other_hash); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#60
def with_indifferent_access; end
+
+ # Returns a hash with indifferent access that includes everything except given keys.
+ # hash = { a: "x", b: "y", c: 10 }.with_indifferent_access
+ # hash.except(:a, "b") # => {c: 10}.with_indifferent_access
+ # hash # => { a: "x", b: "y", c: 10 }.with_indifferent_access
+ #
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#301
def without(*keys); end
private
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#372
def convert_key(key); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#381
def convert_value(value, conversion: T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#398
def set_defaults(target); end
+
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#406
def update_with_single_argument(other_hash, block); end
class << self
+ # source://activesupport//lib/active_support/hash_with_indifferent_access.rb#81
def [](*args); end
end
end
+# source://activesupport//lib/active_support/core_ext/range/include_time_with_zone.rb#7
module ActiveSupport::IncludeTimeWithZone
+ # Extends the default Range#include? to support ActiveSupport::TimeWithZone.
+ #
+ # (1.hour.ago..1.hour.from_now).include?(Time.current) # => true
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/range/include_time_with_zone.rb#12
def include?(value); end
end
+# The Inflector transforms words from singular to plural, class names to table
+# names, modularized class names to ones without, and class names to foreign
+# keys. The default inflections for pluralization, singularization, and
+# uncountable words are kept in inflections.rb.
+#
+# The Rails core team has stated patches for the inflections library will not
+# be accepted in order to avoid breaking legacy applications which may be
+# relying on errant inflections. If you discover an incorrect inflection and
+# require it for your application or wish to define rules for languages other
+# than English, please correct or add them yourself (explained below).
+#
+# source://activesupport//lib/active_support/inflector/inflections.rb#7
module ActiveSupport::Inflector
extend ::ActiveSupport::Inflector
+ # Converts strings to UpperCamelCase.
+ # If the +uppercase_first_letter+ parameter is set to false, then produces
+ # lowerCamelCase.
+ #
+ # Also converts '/' to '::' which is useful for converting
+ # paths to namespaces.
+ #
+ # camelize('active_model') # => "ActiveModel"
+ # camelize('active_model', false) # => "activeModel"
+ # camelize('active_model/errors') # => "ActiveModel::Errors"
+ # camelize('active_model/errors', false) # => "activeModel::Errors"
+ #
+ # As a rule of thumb you can think of +camelize+ as the inverse of
+ # #underscore, though there are cases where that does not hold:
+ #
+ # camelize(underscore('SSLError')) # => "SslError"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#69
def camelize(term, uppercase_first_letter = T.unsafe(nil)); end
+
+ # Creates a class name from a plural table name like Rails does for table
+ # names to models. Note that this returns a string and not a Class (To
+ # convert to an actual class follow +classify+ with #constantize).
+ #
+ # classify('ham_and_eggs') # => "HamAndEgg"
+ # classify('posts') # => "Post"
+ #
+ # Singular names are not handled correctly:
+ #
+ # classify('calculus') # => "Calculu"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#200
def classify(table_name); end
+
+ # Tries to find a constant with the name specified in the argument string.
+ #
+ # constantize('Module') # => Module
+ # constantize('Foo::Bar') # => Foo::Bar
+ #
+ # The name is assumed to be the one of a top-level constant, no matter
+ # whether it starts with "::" or not. No lexical context is taken into
+ # account:
+ #
+ # C = 'outside'
+ # module M
+ # C = 'inside'
+ # C # => 'inside'
+ # constantize('C') # => 'outside', same as ::C
+ # end
+ #
+ # NameError is raised when the name is not in CamelCase or the constant is
+ # unknown.
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#271
def constantize(camel_cased_word); end
+
+ # Replaces underscores with dashes in the string.
+ #
+ # dasherize('puni_puni') # => "puni-puni"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#208
def dasherize(underscored_word); end
+
+ # Removes the rightmost segment from the constant expression in the string.
+ #
+ # deconstantize('Net::HTTP') # => "Net"
+ # deconstantize('::Net::HTTP') # => "::Net"
+ # deconstantize('String') # => ""
+ # deconstantize('::String') # => ""
+ # deconstantize('') # => ""
+ #
+ # See also #demodulize.
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#238
def deconstantize(path); end
+
+ # Removes the module part from the expression in the string.
+ #
+ # demodulize('ActiveSupport::Inflector::Inflections') # => "Inflections"
+ # demodulize('Inflections') # => "Inflections"
+ # demodulize('::Inflections') # => "Inflections"
+ # demodulize('') # => ""
+ #
+ # See also #deconstantize.
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#220
def demodulize(path); end
+
+ # Creates a foreign key name from a class name.
+ # +separate_class_name_and_id_with_underscore+ sets whether
+ # the method should put '_' between the name and 'id'.
+ #
+ # foreign_key('Message') # => "message_id"
+ # foreign_key('Message', false) # => "messageid"
+ # foreign_key('Admin::Post') # => "post_id"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#249
def foreign_key(class_name, separate_class_name_and_id_with_underscore = T.unsafe(nil)); end
+
+ # Tweaks an attribute name for display to end users.
+ #
+ # Specifically, performs these transformations:
+ #
+ # * Applies human inflection rules to the argument.
+ # * Deletes leading underscores, if any.
+ # * Removes a "_id" suffix if present.
+ # * Replaces underscores with spaces, if any.
+ # * Downcases all words except acronyms.
+ # * Capitalizes the first word.
+ # The capitalization of the first word can be turned off by setting the
+ # +:capitalize+ option to false (default is true).
+ #
+ # The trailing '_id' can be kept and capitalized by setting the
+ # optional parameter +keep_id_suffix+ to true (default is false).
+ #
+ # humanize('employee_salary') # => "Employee salary"
+ # humanize('author_id') # => "Author"
+ # humanize('author_id', capitalize: false) # => "author"
+ # humanize('_id') # => "Id"
+ # humanize('author_id', keep_id_suffix: true) # => "Author Id"
+ #
+ # If "SSL" was defined to be an acronym:
+ #
+ # humanize('ssl_error') # => "SSL error"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#128
def humanize(lower_case_and_underscored_word, capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end
+
+ # Yields a singleton instance of Inflector::Inflections so you can specify
+ # additional inflector rules. If passed an optional locale, rules for other
+ # languages can be specified. If not specified, defaults to :en.
+ # Only rules for English are provided.
+ #
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
+ # inflect.uncountable 'rails'
+ # end
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#247
def inflections(locale = T.unsafe(nil)); end
+
+ # Returns the suffix that should be added to a number to denote the position
+ # in an ordered sequence such as 1st, 2nd, 3rd, 4th.
+ #
+ # ordinal(1) # => "st"
+ # ordinal(2) # => "nd"
+ # ordinal(1002) # => "nd"
+ # ordinal(1003) # => "rd"
+ # ordinal(-11) # => "th"
+ # ordinal(-1021) # => "st"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#347
def ordinal(number); end
+
+ # Turns a number into an ordinal string used to denote the position in an
+ # ordered sequence such as 1st, 2nd, 3rd, 4th.
+ #
+ # ordinalize(1) # => "1st"
+ # ordinalize(2) # => "2nd"
+ # ordinalize(1002) # => "1002nd"
+ # ordinalize(1003) # => "1003rd"
+ # ordinalize(-11) # => "-11th"
+ # ordinalize(-1021) # => "-1021st"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#360
def ordinalize(number); end
+
+ # Replaces special characters in a string so that it may be used as part of
+ # a 'pretty' URL.
+ #
+ # parameterize("Donald E. Knuth") # => "donald-e-knuth"
+ # parameterize("^très|Jolie-- ") # => "tres-jolie"
+ #
+ # To use a custom separator, override the +separator+ argument.
+ #
+ # parameterize("Donald E. Knuth", separator: '_') # => "donald_e_knuth"
+ # parameterize("^très|Jolie__ ", separator: '_') # => "tres_jolie"
+ #
+ # To preserve the case of the characters in a string, use the +preserve_case+ argument.
+ #
+ # parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth"
+ # parameterize("^très|Jolie-- ", preserve_case: true) # => "tres-Jolie"
+ #
+ # It preserves dashes and underscores unless they are used as separators:
+ #
+ # parameterize("^très|Jolie__ ") # => "tres-jolie__"
+ # parameterize("^très|Jolie-- ", separator: "_") # => "tres_jolie--"
+ # parameterize("^très_Jolie-- ", separator: ".") # => "tres_jolie--"
+ #
+ # If the optional parameter +locale+ is specified,
+ # the word will be parameterized as a word of that language.
+ # By default, this parameter is set to nil and it will use
+ # the configured I18n.locale.
+ #
+ # source://activesupport//lib/active_support/inflector/transliterate.rb#121
def parameterize(string, separator: T.unsafe(nil), preserve_case: T.unsafe(nil), locale: T.unsafe(nil)); end
+
+ # Returns the plural form of the word in the string.
+ #
+ # If passed an optional +locale+ parameter, the word will be
+ # pluralized using rules defined for that language. By default,
+ # this parameter is set to :en.
+ #
+ # pluralize('post') # => "posts"
+ # pluralize('octopus') # => "octopi"
+ # pluralize('sheep') # => "sheep"
+ # pluralize('words') # => "words"
+ # pluralize('CamelOctopus') # => "CamelOctopi"
+ # pluralize('ley', :es) # => "leyes"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#32
def pluralize(word, locale = T.unsafe(nil)); end
+
+ # Tries to find a constant with the name specified in the argument string.
+ #
+ # safe_constantize('Module') # => Module
+ # safe_constantize('Foo::Bar') # => Foo::Bar
+ #
+ # The name is assumed to be the one of a top-level constant, no matter
+ # whether it starts with "::" or not. No lexical context is taken into
+ # account:
+ #
+ # C = 'outside'
+ # module M
+ # C = 'inside'
+ # C # => 'inside'
+ # safe_constantize('C') # => 'outside', same as ::C
+ # end
+ #
+ # +nil+ is returned when the name is not in CamelCase or the constant (or
+ # part of it) is unknown.
+ #
+ # safe_constantize('blargle') # => nil
+ # safe_constantize('UnknownModule') # => nil
+ # safe_constantize('UnknownModule::Foo::Bar') # => nil
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#328
def safe_constantize(camel_cased_word); end
+
+ # The reverse of #pluralize, returns the singular form of a word in a
+ # string.
+ #
+ # If passed an optional +locale+ parameter, the word will be
+ # singularized using rules defined for that language. By default,
+ # this parameter is set to :en.
+ #
+ # singularize('posts') # => "post"
+ # singularize('octopi') # => "octopus"
+ # singularize('sheep') # => "sheep"
+ # singularize('word') # => "word"
+ # singularize('CamelOctopi') # => "CamelOctopus"
+ # singularize('leyes', :es) # => "ley"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#49
def singularize(word, locale = T.unsafe(nil)); end
+
+ # Creates the name of a table like Rails does for models to table names.
+ # This method uses the #pluralize method on the last word in the string.
+ #
+ # tableize('RawScaledScorer') # => "raw_scaled_scorers"
+ # tableize('ham_and_egg') # => "ham_and_eggs"
+ # tableize('fancyCategory') # => "fancy_categories"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#186
def tableize(class_name); end
+
+ # Capitalizes all the words and replaces some characters in the string to
+ # create a nicer looking title. +titleize+ is meant for creating pretty
+ # output. It is not used in the Rails internals.
+ #
+ # The trailing '_id','Id'.. can be kept and capitalized by setting the
+ # optional parameter +keep_id_suffix+ to true.
+ # By default, this parameter is false.
+ #
+ # +titleize+ is also aliased as +titlecase+.
+ #
+ # titleize('man from the boondocks') # => "Man From The Boondocks"
+ # titleize('x-men: the last stand') # => "X Men: The Last Stand"
+ # titleize('TheManWithoutAPast') # => "The Man Without A Past"
+ # titleize('raiders_of_the_lost_ark') # => "Raiders Of The Lost Ark"
+ # titleize('string_ending_with_id', keep_id_suffix: true) # => "String Ending With Id"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#174
def titleize(word, keep_id_suffix: T.unsafe(nil)); end
+
+ # Replaces non-ASCII characters with an ASCII approximation, or if none
+ # exists, a replacement character which defaults to "?".
+ #
+ # transliterate('Ærøskøbing')
+ # # => "AEroskobing"
+ #
+ # Default approximations are provided for Western/Latin characters,
+ # e.g, "ø", "ñ", "é", "ß", etc.
+ #
+ # This method is I18n aware, so you can set up custom approximations for a
+ # locale. This can be useful, for example, to transliterate German's "ü"
+ # and "ö" to "ue" and "oe", or to add support for transliterating Russian
+ # to ASCII.
+ #
+ # In order to make your custom transliterations available, you must set
+ # them as the i18n.transliterate.rule i18n key:
+ #
+ # # Store the transliterations in locales/de.yml
+ # i18n:
+ # transliterate:
+ # rule:
+ # ü: "ue"
+ # ö: "oe"
+ #
+ # # Or set them using Ruby
+ # I18n.backend.store_translations(:de, i18n: {
+ # transliterate: {
+ # rule: {
+ # 'ü' => 'ue',
+ # 'ö' => 'oe'
+ # }
+ # }
+ # })
+ #
+ # The value for i18n.transliterate.rule can be a simple Hash that
+ # maps characters to ASCII approximations as shown above, or, for more
+ # complex requirements, a Proc:
+ #
+ # I18n.backend.store_translations(:de, i18n: {
+ # transliterate: {
+ # rule: ->(string) { MyTransliterator.transliterate(string) }
+ # }
+ # })
+ #
+ # Now you can have different transliterations for each locale:
+ #
+ # transliterate('Jürgen', locale: :en)
+ # # => "Jurgen"
+ #
+ # transliterate('Jürgen', locale: :de)
+ # # => "Juergen"
+ #
+ # Transliteration is restricted to UTF-8, US-ASCII and GB18030 strings
+ # Other encodings will raise an ArgumentError.
+ #
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/inflector/transliterate.rb#64
def transliterate(string, replacement = T.unsafe(nil), locale: T.unsafe(nil)); end
+
+ # Makes an underscored, lowercase form from the expression in the string.
+ #
+ # Changes '::' to '/' to convert namespaces to paths.
+ #
+ # underscore('ActiveModel') # => "active_model"
+ # underscore('ActiveModel::Errors') # => "active_model/errors"
+ #
+ # As a rule of thumb you can think of +underscore+ as the inverse of
+ # #camelize, though there are cases where that does not hold:
+ #
+ # camelize(underscore('SSLError')) # => "SslError"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#92
def underscore(camel_cased_word); end
+
+ # Converts just the first character to uppercase.
+ #
+ # upcase_first('what a Lovely Day') # => "What a Lovely Day"
+ # upcase_first('w') # => "W"
+ # upcase_first('') # => ""
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#155
def upcase_first(string); end
private
+ # Applies inflection rules for +singularize+ and +pluralize+.
+ #
+ # If passed an optional +locale+ parameter, the uncountables will be
+ # found for that locale.
+ #
+ # apply_inflections('post', inflections.plurals, :en) # => "posts"
+ # apply_inflections('posts', inflections.singulars, :en) # => "post"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#389
def apply_inflections(word, rules, locale = T.unsafe(nil)); end
+
+ # Mounts a regular expression, returned as a string to ease interpolation,
+ # that will match part by part the given constant.
+ #
+ # const_regexp("Foo::Bar::Baz") # => "Foo(::Bar(::Baz)?)?"
+ # const_regexp("::") # => "::"
+ #
+ # source://activesupport//lib/active_support/inflector/methods.rb#370
def const_regexp(camel_cased_word); end
end
+# source://activesupport//lib/active_support/inflector/transliterate.rb#8
ActiveSupport::Inflector::ALLOWED_ENCODINGS_FOR_TRANSLITERATE = T.let(T.unsafe(nil), Array)
+# A singleton instance of this class is yielded by Inflector.inflections,
+# which can then be used to specify additional inflection rules. If passed
+# an optional locale, rules for other languages can be specified. The
+# default locale is :en. Only rules for English are provided.
+#
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, '\1\2en'
+# inflect.singular /^(ox)en/i, '\1'
+#
+# inflect.irregular 'octopus', 'octopi'
+#
+# inflect.uncountable 'equipment'
+# end
+#
+# New rules are added at the top. So in the example above, the irregular
+# rule for octopus will now be the first of the pluralization and
+# singularization rules that is runs. This guarantees that your rules run
+# before any of the rules that may already have been loaded.
+#
+# source://activesupport//lib/active_support/inflector/inflections.rb#28
class ActiveSupport::Inflector::Inflections
+ # @return [Inflections] a new instance of Inflections
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#71
def initialize; end
+ # Specifies a new acronym. An acronym must be specified as it will appear
+ # in a camelized string. An underscore string that contains the acronym
+ # will retain the acronym when passed to +camelize+, +humanize+, or
+ # +titleize+. A camelized string that contains the acronym will maintain
+ # the acronym when titleized or humanized, and will convert the acronym
+ # into a non-delimited single lowercase word when passed to +underscore+.
+ #
+ # acronym 'HTML'
+ # titleize 'html' # => 'HTML'
+ # camelize 'html' # => 'HTML'
+ # underscore 'MyHTML' # => 'my_html'
+ #
+ # The acronym, however, must occur as a delimited unit and not be part of
+ # another word for conversions to recognize it:
+ #
+ # acronym 'HTTP'
+ # camelize 'my_http_delimited' # => 'MyHTTPDelimited'
+ # camelize 'https' # => 'Https', not 'HTTPs'
+ # underscore 'HTTPS' # => 'http_s', not 'https'
+ #
+ # acronym 'HTTPS'
+ # camelize 'https' # => 'HTTPS'
+ # underscore 'HTTPS' # => 'https'
+ #
+ # Note: Acronyms that are passed to +pluralize+ will no longer be
+ # recognized, since the acronym will not occur as a delimited unit in the
+ # pluralized result. To work around this, you must specify the pluralized
+ # form as an acronym as well:
+ #
+ # acronym 'API'
+ # camelize(pluralize('api')) # => 'Apis'
+ #
+ # acronym 'APIs'
+ # camelize(pluralize('api')) # => 'APIs'
+ #
+ # +acronym+ may be used to specify any word that contains an acronym or
+ # otherwise needs to maintain a non-standard capitalization. The only
+ # restriction is that the word must begin with a capital letter.
+ #
+ # acronym 'RESTful'
+ # underscore 'RESTful' # => 'restful'
+ # underscore 'RESTfulController' # => 'restful_controller'
+ # titleize 'RESTfulController' # => 'RESTful Controller'
+ # camelize 'restful' # => 'RESTful'
+ # camelize 'restful_controller' # => 'RESTfulController'
+ #
+ # acronym 'McDonald'
+ # underscore 'McDonald' # => 'mcdonald'
+ # camelize 'mcdonald' # => 'McDonald'
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#133
def acronym(word); end
+
+ # Returns the value of attribute acronyms.
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#67
def acronyms; end
+
+ # source://activesupport//lib/active_support/inflector/inflections.rb#69
def acronyms_camelize_regex; end
+
+ # source://activesupport//lib/active_support/inflector/inflections.rb#69
def acronyms_underscore_regex; end
+
+ # Clears the loaded inflections within a given scope (default is
+ # :all). Give the scope as a symbol of the inflection type, the
+ # options are: :plurals, :singulars, :uncountables,
+ # :humans.
+ #
+ # clear :all
+ # clear :plurals
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#222
def clear(scope = T.unsafe(nil)); end
+
+ # Specifies a humanized form of a string by a regular expression rule or
+ # by a string mapping. When using a regular expression based replacement,
+ # the normal humanize formatting is called after the replacement. When a
+ # string is used, the human form should be specified as desired (example:
+ # 'The name', not 'the_name').
+ #
+ # human /_cnt$/i, '\1_count'
+ # human 'legacy_col_person_name', 'Name'
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#211
def human(rule, replacement); end
+
+ # Returns the value of attribute humans.
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#67
def humans; end
+
+ # Specifies a new irregular that applies to both pluralization and
+ # singularization at the same time. This can only be used for strings, not
+ # regular expressions. You simply pass the irregular in singular and
+ # plural form.
+ #
+ # irregular 'octopus', 'octopi'
+ # irregular 'person', 'people'
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#165
def irregular(singular, plural); end
+
+ # Specifies a new pluralization rule and its replacement. The rule can
+ # either be a string or a regular expression. The replacement should
+ # always be a string that may include references to the matched data from
+ # the rule.
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#142
def plural(rule, replacement); end
+
+ # Returns the value of attribute plurals.
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#67
def plurals; end
+
+ # Specifies a new singularization rule and its replacement. The rule can
+ # either be a string or a regular expression. The replacement should
+ # always be a string that may include references to the matched data from
+ # the rule.
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#152
def singular(rule, replacement); end
+
+ # Returns the value of attribute singulars.
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#67
def singulars; end
+
+ # Specifies words that are uncountable and should not be inflected.
+ #
+ # uncountable 'money'
+ # uncountable 'money', 'information'
+ # uncountable %w( money information rice )
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#199
def uncountable(*words); end
+
+ # Returns the value of attribute uncountables.
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#67
def uncountables; end
private
+ # source://activesupport//lib/active_support/inflector/inflections.rb#232
def define_acronym_regex_patterns; end
+
+ # Private, for the test suite.
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#77
def initialize_dup(orig); end
class << self
+ # source://activesupport//lib/active_support/inflector/inflections.rb#63
def instance(locale = T.unsafe(nil)); end
end
end
+# source://activesupport//lib/active_support/inflector/inflections.rb#31
class ActiveSupport::Inflector::Inflections::Uncountables < ::Array
+ # @return [Uncountables] a new instance of Uncountables
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#32
def initialize; end
+ # source://activesupport//lib/active_support/inflector/inflections.rb#42
def <<(*word); end
+
+ # source://activesupport//lib/active_support/inflector/inflections.rb#46
def add(words); end
+
+ # source://activesupport//lib/active_support/inflector/inflections.rb#37
def delete(entry); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/inflector/inflections.rb#53
def uncountable?(str); end
private
+ # source://activesupport//lib/active_support/inflector/inflections.rb#58
def to_regex(string); end
end
+# +InheritableOptions+ provides a constructor to build an +OrderedOptions+
+# hash inherited from another hash.
+#
+# Use this if you already have some hash and you want to create a new one based on it.
+#
+# h = ActiveSupport::InheritableOptions.new({ girl: 'Mary', boy: 'John' })
+# h.girl # => 'Mary'
+# h.boy # => 'John'
+#
+# source://activesupport//lib/active_support/ordered_options.rb#79
class ActiveSupport::InheritableOptions < ::ActiveSupport::OrderedOptions
+ # @return [InheritableOptions] a new instance of InheritableOptions
+ #
+ # source://activesupport//lib/active_support/ordered_options.rb#80
def initialize(parent = T.unsafe(nil)); end
+ # source://activesupport//lib/active_support/ordered_options.rb#91
def inheritable_copy; end
end
+# source://activesupport//lib/active_support/json/decoding.rb#11
module ActiveSupport::JSON
class << self
+ # Parses a JSON string (JavaScript Object Notation) into a hash.
+ # See http://www.json.org for more info.
+ #
+ # ActiveSupport::JSON.decode("{\"team\":\"rails\",\"players\":\"36\"}")
+ # => {"team" => "rails", "players" => "36"}
+ #
+ # source://activesupport//lib/active_support/json/decoding.rb#22
def decode(json); end
+
+ # Dumps objects in JSON (JavaScript Object Notation).
+ # See http://www.json.org for more info.
+ #
+ # ActiveSupport::JSON.encode({ team: 'rails', players: '36' })
+ # # => "{\"team\":\"rails\",\"players\":\"36\"}"
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#21
def encode(value, options = T.unsafe(nil)); end
+
+ # Returns the class of the error that will be raised when there is an
+ # error in decoding JSON. Using this method means you won't directly
+ # depend on the ActiveSupport's JSON implementation, in case it changes
+ # in the future.
+ #
+ # begin
+ # obj = ActiveSupport::JSON.decode(some_string)
+ # rescue ActiveSupport::JSON.parse_error
+ # Rails.logger.warn("Attempted to decode invalid JSON: #{some_string}")
+ # end
+ #
+ # source://activesupport//lib/active_support/json/decoding.rb#42
def parse_error; end
private
+ # source://activesupport//lib/active_support/json/decoding.rb#47
def convert_dates_from(data); end
end
end
+# source://activesupport//lib/active_support/json/decoding.rb#14
ActiveSupport::JSON::DATETIME_REGEX = T.let(T.unsafe(nil), Regexp)
+
+# matches YAML-formatted dates
+#
+# source://activesupport//lib/active_support/json/decoding.rb#13
ActiveSupport::JSON::DATE_REGEX = T.let(T.unsafe(nil), Regexp)
+# source://activesupport//lib/active_support/json/encoding.rb#25
module ActiveSupport::JSON::Encoding
class << self
+ # If true, encode >, <, & as escaped unicode sequences (e.g. > as \u003e)
+ # as a safety measure.
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#121
def escape_html_entities_in_json; end
+
+ # If true, encode >, <, & as escaped unicode sequences (e.g. > as \u003e)
+ # as a safety measure.
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#121
def escape_html_entities_in_json=(_arg0); end
+
+ # Sets the encoder used by Rails to encode Ruby objects into JSON strings
+ # in +Object#to_json+ and +ActiveSupport::JSON.encode+.
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#129
def json_encoder; end
+
+ # Sets the encoder used by Rails to encode Ruby objects into JSON strings
+ # in +Object#to_json+ and +ActiveSupport::JSON.encode+.
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#129
def json_encoder=(_arg0); end
+
+ # Sets the precision of encoded time values.
+ # Defaults to 3 (equivalent to millisecond precision)
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#125
def time_precision; end
+
+ # Sets the precision of encoded time values.
+ # Defaults to 3 (equivalent to millisecond precision)
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#125
def time_precision=(_arg0); end
+
+ # If true, use ISO 8601 format for dates and times. Otherwise, fall back
+ # to the Active Support legacy format.
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#117
def use_standard_json_time_format; end
+
+ # If true, use ISO 8601 format for dates and times. Otherwise, fall back
+ # to the Active Support legacy format.
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#117
def use_standard_json_time_format=(_arg0); end
end
end
+# source://activesupport//lib/active_support/json/encoding.rb#26
class ActiveSupport::JSON::Encoding::JSONGemEncoder
+ # @return [JSONGemEncoder] a new instance of JSONGemEncoder
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#29
def initialize(options = T.unsafe(nil)); end
+ # Encode the given object into a JSON string
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#34
def encode(value); end
+
+ # Returns the value of attribute options.
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#27
def options; end
private
+ # Convert an object into a "JSON-ready" representation composed of
+ # primitives like Hash, Array, String, Numeric,
+ # and +true+/+false+/+nil+.
+ # Recursively calls #as_json to the object to recursively build a
+ # fully JSON-ready object.
+ #
+ # This allows developers to implement #as_json without having to
+ # worry about what base types of objects they are allowed to return
+ # or having to remember to call #as_json recursively.
+ #
+ # Note: the +options+ hash passed to +object.to_json+ is only passed
+ # to +object.as_json+, not any of this method's recursive +#as_json+
+ # calls.
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#89
def jsonify(value); end
+
+ # Encode a "jsonified" Ruby data structure using the JSON gem
+ #
+ # source://activesupport//lib/active_support/json/encoding.rb#109
def stringify(jsonified); end
end
+# Rails does more escaping than the JSON gem natively does (we
+# escape \u2028 and \u2029 and optionally >, <, & to work around
+# certain browser problems).
+#
+# source://activesupport//lib/active_support/json/encoding.rb#42
ActiveSupport::JSON::Encoding::JSONGemEncoder::ESCAPED_CHARS = T.let(T.unsafe(nil), Hash)
+
+# source://activesupport//lib/active_support/json/encoding.rb#51
ActiveSupport::JSON::Encoding::JSONGemEncoder::ESCAPE_REGEX_WITHOUT_HTML_ENTITIES = T.let(T.unsafe(nil), Regexp)
+
+# source://activesupport//lib/active_support/json/encoding.rb#50
ActiveSupport::JSON::Encoding::JSONGemEncoder::ESCAPE_REGEX_WITH_HTML_ENTITIES = T.let(T.unsafe(nil), Regexp)
+# This class wraps all the strings we see and does the extra escaping
+#
+# source://activesupport//lib/active_support/json/encoding.rb#54
class ActiveSupport::JSON::Encoding::JSONGemEncoder::EscapedString < ::String
+ # source://activesupport//lib/active_support/json/encoding.rb#55
def to_json(*_arg0); end
+
+ # source://activesupport//lib/active_support/json/encoding.rb#67
def to_s; end
end
+# KeyGenerator is a simple wrapper around OpenSSL's implementation of PBKDF2.
+# It can be used to derive a number of keys for various purposes from a given secret.
+# This lets Rails applications have a single secure secret, but avoid reusing that
+# key in multiple incompatible contexts.
+#
+# source://activesupport//lib/active_support/key_generator.rb#11
class ActiveSupport::KeyGenerator
+ # @return [KeyGenerator] a new instance of KeyGenerator
+ #
+ # source://activesupport//lib/active_support/key_generator.rb#12
def initialize(secret, options = T.unsafe(nil)); end
+ # Returns a derived key suitable for use. The default key_size is chosen
+ # to be compatible with the default settings of ActiveSupport::MessageVerifier.
+ # i.e. OpenSSL::Digest::SHA1#block_length
+ #
+ # source://activesupport//lib/active_support/key_generator.rb#22
def generate_key(salt, key_size = T.unsafe(nil)); end
end
+# lazy_load_hooks allows Rails to lazily load a lot of components and thus
+# making the app boot faster. Because of this feature now there is no need to
+# require ActiveRecord::Base at boot time purely to apply
+# configuration. Instead a hook is registered that applies configuration once
+# ActiveRecord::Base is loaded. Here ActiveRecord::Base is
+# used as example but this feature can be applied elsewhere too.
+#
+# Here is an example where +on_load+ method is called to register a hook.
+#
+# initializer 'active_record.initialize_timezone' do
+# ActiveSupport.on_load(:active_record) do
+# self.time_zone_aware_attributes = true
+# self.default_timezone = :utc
+# end
+# end
+#
+# When the entirety of +ActiveRecord::Base+ has been
+# evaluated then +run_load_hooks+ is invoked. The very last line of
+# +ActiveRecord::Base+ is:
+#
+# ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base)
+#
+# source://activesupport//lib/active_support/lazy_load_hooks.rb#25
module ActiveSupport::LazyLoadHooks
+ # Declares a block that will be executed when a Rails component is fully
+ # loaded.
+ #
+ # Options:
+ #
+ # * :yield - Yields the object that run_load_hooks to +block+.
+ # * :run_once - Given +block+ will run only once.
+ #
+ # source://activesupport//lib/active_support/lazy_load_hooks.rb#41
def on_load(name, options = T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/lazy_load_hooks.rb#49
def run_load_hooks(name, base = T.unsafe(nil)); end
private
+ # source://activesupport//lib/active_support/lazy_load_hooks.rb#65
def execute_hook(name, base, options, block); end
+
+ # source://activesupport//lib/active_support/lazy_load_hooks.rb#57
def with_execution_control(name, block, once); end
class << self
+ # source://activesupport//lib/active_support/lazy_load_hooks.rb#26
def extended(base); end
end
end
+# ActiveSupport::LogSubscriber is an object set to consume
+# ActiveSupport::Notifications with the sole purpose of logging them.
+# The log subscriber dispatches notifications to a registered object based
+# on its given namespace.
+#
+# An example would be Active Record log subscriber responsible for logging
+# queries:
+#
+# module ActiveRecord
+# class LogSubscriber < ActiveSupport::LogSubscriber
+# def sql(event)
+# info "#{event.payload[:name]} (#{event.duration}) #{event.payload[:sql]}"
+# end
+# end
+# end
+#
+# And it's finally registered as:
+#
+# ActiveRecord::LogSubscriber.attach_to :active_record
+#
+# Since we need to know all instance methods before attaching the log
+# subscriber, the line above should be called after your
+# ActiveRecord::LogSubscriber definition.
+#
+# A logger also needs to be set with ActiveRecord::LogSubscriber.logger=.
+# This is assigned automatically in a Rails environment.
+#
+# After configured, whenever a "sql.active_record" notification is published,
+# it will properly dispatch the event
+# (ActiveSupport::Notifications::Event) to the sql method.
+#
+# Being an ActiveSupport::Notifications consumer,
+# ActiveSupport::LogSubscriber exposes a simple interface to check if
+# instrumented code raises an exception. It is common to log a different
+# message in case of an error, and this can be achieved by extending
+# the previous example:
+#
+# module ActiveRecord
+# class LogSubscriber < ActiveSupport::LogSubscriber
+# def sql(event)
+# exception = event.payload[:exception]
+#
+# if exception
+# exception_object = event.payload[:exception_object]
+#
+# error "[ERROR] #{event.payload[:name]}: #{exception.join(', ')} " \
+# "(#{exception_object.backtrace.first})"
+# else
+# # standard logger code
+# end
+# end
+# end
+# end
+#
+# Log subscriber also has some helpers to deal with logging and automatically
+# flushes all logs when the request finishes
+# (via action_dispatch.callback notification) in a Rails environment.
+#
+# source://activesupport//lib/active_support/log_subscriber.rb#66
class ActiveSupport::LogSubscriber < ::ActiveSupport::Subscriber
+ # source://activesupport//lib/active_support/log_subscriber.rb#80
def colorize_logging; end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#80
def colorize_logging=(val); end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#125
def debug(progname = T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#125
def error(progname = T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#125
def fatal(progname = T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#114
def finish(name, id, payload); end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#125
def info(progname = T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#106
def logger; end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#110
def start(name, id, payload); end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#125
def unknown(progname = T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#125
def warn(progname = T.unsafe(nil), &block); end
private
+ # Set color by using a symbol or one of the defined constants. If a third
+ # option is set to +true+, it also adds bold to the string. This is based
+ # on the Highline implementation and will automatically append CLEAR to the
+ # end of the returned String.
+ #
+ # source://activesupport//lib/active_support/log_subscriber.rb#135
def color(text, color, bold = T.unsafe(nil)); end
class << self
+ # source://activesupport//lib/active_support/log_subscriber.rb#80
def colorize_logging; end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#80
def colorize_logging=(val); end
+
+ # Flush all log_subscribers' logger.
+ #
+ # source://activesupport//lib/active_support/log_subscriber.rb#96
def flush_all!; end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#91
def log_subscribers; end
+
+ # source://activesupport//lib/active_support/log_subscriber.rb#83
def logger; end
+
+ # Sets the attribute logger
+ #
+ # @param value the value to set the attribute logger to.
+ #
+ # source://activesupport//lib/active_support/log_subscriber.rb#89
def logger=(_arg0); end
private
+ # source://activesupport//lib/active_support/log_subscriber.rb#101
def fetch_public_methods(subscriber, inherit_all); end
end
end
+# Colors
+#
+# source://activesupport//lib/active_support/log_subscriber.rb#71
ActiveSupport::LogSubscriber::BLACK = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/log_subscriber.rb#75
ActiveSupport::LogSubscriber::BLUE = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/log_subscriber.rb#68
ActiveSupport::LogSubscriber::BOLD = T.let(T.unsafe(nil), String)
+
+# Embed in a String to clear all previous ANSI sequences.
+#
+# source://activesupport//lib/active_support/log_subscriber.rb#67
ActiveSupport::LogSubscriber::CLEAR = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/log_subscriber.rb#77
ActiveSupport::LogSubscriber::CYAN = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/log_subscriber.rb#73
ActiveSupport::LogSubscriber::GREEN = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/log_subscriber.rb#76
ActiveSupport::LogSubscriber::MAGENTA = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/log_subscriber.rb#72
ActiveSupport::LogSubscriber::RED = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/log_subscriber.rb#78
ActiveSupport::LogSubscriber::WHITE = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/log_subscriber.rb#74
ActiveSupport::LogSubscriber::YELLOW = T.let(T.unsafe(nil), String)
+# source://activesupport//lib/active_support/logger.rb#8
class ActiveSupport::Logger < ::Logger
include ::ActiveSupport::LoggerSilence
include ::ActiveSupport::LoggerThreadSafeLevel
+ # @return [Logger] a new instance of Logger
+ #
+ # source://activesupport//lib/active_support/logger.rb#80
def initialize(*args, **kwargs); end
+ # source://activesupport//lib/active_support/logger_silence.rb#12
def silencer; end
+
+ # source://activesupport//lib/active_support/logger_silence.rb#12
def silencer=(val); end
class << self
+ # Broadcasts logs to multiple loggers.
+ #
+ # source://activesupport//lib/active_support/logger.rb#23
def broadcast(logger); end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#13
def local_levels; end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#13
def local_levels=(val); end
+
+ # Returns true if the logger destination matches one of the sources
+ #
+ # logger = Logger.new(STDOUT)
+ # ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT)
+ # # => true
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/logger.rb#16
def logger_outputs_to?(logger, *sources); end
+
+ # source://activesupport//lib/active_support/logger_silence.rb#12
def silencer; end
+
+ # source://activesupport//lib/active_support/logger_silence.rb#12
def silencer=(val); end
end
end
+# Simple formatter which only displays the message.
+#
+# source://activesupport//lib/active_support/logger.rb#87
class ActiveSupport::Logger::SimpleFormatter < ::Logger::Formatter
+ # This method is invoked when a log event occurs
+ #
+ # source://activesupport//lib/active_support/logger.rb#88
def call(severity, timestamp, progname, msg); end
end
+# source://activesupport//lib/active_support/logger_silence.rb#8
module ActiveSupport::LoggerSilence
extend ::ActiveSupport::Concern
include ::ActiveSupport::LoggerThreadSafeLevel
+ # Silences the logger for the duration of the block.
+ #
+ # source://activesupport//lib/active_support/logger_silence.rb#17
def silence(severity = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/logger_thread_safe_level.rb#9
module ActiveSupport::LoggerThreadSafeLevel
extend ::ActiveSupport::Concern
+ # Redefined to check severity against #level, and thus the thread-local level, rather than +@level+.
+ # FIXME: Remove when the minimum Ruby version supports overriding Logger#level.
+ #
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#59
def add(severity, message = T.unsafe(nil), progname = T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18
def debug?; end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18
def error?; end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18
def fatal?; end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18
def info?; end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#45
def level; end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#28
def local_level; end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#32
def local_level=(level); end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#24
def local_log_id; end
+
+ # Change the thread-local level for the duration of the given block.
+ #
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#50
def log_at(level); end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18
def unknown?; end
+
+ # source://activesupport//lib/active_support/logger_thread_safe_level.rb#18
def warn?; end
end
+# source://activesupport//lib/active_support/core_ext/marshal.rb#6
module ActiveSupport::MarshalWithAutoloading
+ # source://activesupport//lib/active_support/core_ext/marshal.rb#7
def load(source, proc = T.unsafe(nil)); end
end
+# MessageEncryptor is a simple way to encrypt values which get stored
+# somewhere you don't trust.
+#
+# The cipher text and initialization vector are base64 encoded and returned
+# to you.
+#
+# This can be used in situations similar to the MessageVerifier, but
+# where you don't want users to be able to determine the value of the payload.
+#
+# len = ActiveSupport::MessageEncryptor.key_len
+# salt = SecureRandom.random_bytes(len)
+# key = ActiveSupport::KeyGenerator.new('password').generate_key(salt, len) # => "\x89\xE0\x156\xAC..."
+# crypt = ActiveSupport::MessageEncryptor.new(key) # => #
+# encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..."
+# crypt.decrypt_and_verify(encrypted_data) # => "my secret data"
+#
+# === Confining messages to a specific purpose
+#
+# By default any message can be used throughout your app. But they can also be
+# confined to a specific +:purpose+.
+#
+# token = crypt.encrypt_and_sign("this is the chair", purpose: :login)
+#
+# Then that same purpose must be passed when verifying to get the data back out:
+#
+# crypt.decrypt_and_verify(token, purpose: :login) # => "this is the chair"
+# crypt.decrypt_and_verify(token, purpose: :shipping) # => nil
+# crypt.decrypt_and_verify(token) # => nil
+#
+# Likewise, if a message has no purpose it won't be returned when verifying with
+# a specific purpose.
+#
+# token = crypt.encrypt_and_sign("the conversation is lively")
+# crypt.decrypt_and_verify(token, purpose: :scare_tactics) # => nil
+# crypt.decrypt_and_verify(token) # => "the conversation is lively"
+#
+# === Making messages expire
+#
+# By default messages last forever and verifying one year from now will still
+# return the original value. But messages can be set to expire at a given
+# time with +:expires_in+ or +:expires_at+.
+#
+# crypt.encrypt_and_sign(parcel, expires_in: 1.month)
+# crypt.encrypt_and_sign(doowad, expires_at: Time.now.end_of_year)
+#
+# Then the messages can be verified and returned up to the expire time.
+# Thereafter, verifying returns +nil+.
+#
+# === Rotating keys
+#
+# MessageEncryptor also supports rotating out old configurations by falling
+# back to a stack of encryptors. Call +rotate+ to build and add an encryptor
+# so +decrypt_and_verify+ will also try the fallback.
+#
+# By default any rotated encryptors use the values of the primary
+# encryptor unless specified otherwise.
+#
+# You'd give your encryptor the new defaults:
+#
+# crypt = ActiveSupport::MessageEncryptor.new(@secret, cipher: "aes-256-gcm")
+#
+# Then gradually rotate the old values out by adding them as fallbacks. Any message
+# generated with the old values will then work until the rotation is removed.
+#
+# crypt.rotate old_secret # Fallback to an old secret instead of @secret.
+# crypt.rotate cipher: "aes-256-cbc" # Fallback to an old cipher instead of aes-256-gcm.
+#
+# Though if both the secret and the cipher was changed at the same time,
+# the above should be combined into:
+#
+# crypt.rotate old_secret, cipher: "aes-256-cbc"
+#
+# source://activesupport//lib/active_support/message_encryptor.rb#81
class ActiveSupport::MessageEncryptor
include ::ActiveSupport::Messages::Rotator
include ::ActiveSupport::Messages::Rotator::Encryptor
+ # Initialize a new MessageEncryptor. +secret+ must be at least as long as
+ # the cipher key size. For the default 'aes-256-gcm' cipher, this is 256
+ # bits. If you are using a user-entered secret, you can generate a suitable
+ # key by using ActiveSupport::KeyGenerator or a similar key
+ # derivation function.
+ #
+ # First additional parameter is used as the signature key for +MessageVerifier+.
+ # This allows you to specify keys to encrypt and sign data.
+ #
+ # ActiveSupport::MessageEncryptor.new('secret', 'signature_secret')
+ #
+ # Options:
+ # * :cipher - Cipher to use. Can be any cipher returned by
+ # OpenSSL::Cipher.ciphers. Default is 'aes-256-gcm'.
+ # * :digest - String of digest to use for signing. Default is
+ # +SHA1+. Ignored when using an AEAD cipher like 'aes-256-gcm'.
+ # * :serializer - Object serializer to use. Default is +Marshal+.
+ #
+ # @return [MessageEncryptor] a new instance of MessageEncryptor
+ #
+ # source://activesupport//lib/active_support/messages/rotator.rb#6
+ def initialize(*secrets, on_rotation: T.unsafe(nil), **options); end
+
+ # Decrypt and verify a message. We need to verify the message in order to
+ # avoid padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/.
+ #
+ # source://activesupport//lib/active_support/messages/rotator.rb#21
+ def decrypt_and_verify(*args, on_rotation: T.unsafe(nil), **options); end
+
+ # Encrypt and sign a message. We need to sign the message in order to avoid
+ # padding attacks. Reference: https://www.limited-entropy.com/padding-oracle-attacks/.
+ #
+ # source://activesupport//lib/active_support/message_encryptor.rb#147
def encrypt_and_sign(value, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end
private
+ # source://activesupport//lib/active_support/message_encryptor.rb#180
def _decrypt(encrypted_message, purpose); end
+
+ # source://activesupport//lib/active_support/message_encryptor.rb#163
def _encrypt(value, **metadata_options); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/message_encryptor.rb#212
def aead_mode?; end
+
+ # source://activesupport//lib/active_support/message_encryptor.rb#206
def new_cipher; end
+
+ # source://activesupport//lib/active_support/message_encryptor.rb#216
def resolve_verifier; end
+
+ # Returns the value of attribute verifier.
+ #
+ # source://activesupport//lib/active_support/message_encryptor.rb#210
def verifier; end
class << self
+ # source://activesupport//lib/active_support/message_encryptor.rb#87
def default_cipher; end
+
+ # Given a cipher, returns the key length of the cipher to help generate the key of desired size
+ #
+ # source://activesupport//lib/active_support/message_encryptor.rb#158
def key_len(cipher = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/message_encryptor.rb#84
def use_authenticated_message_encryption; end
+
+ # source://activesupport//lib/active_support/message_encryptor.rb#84
def use_authenticated_message_encryption=(val); end
end
end
+# source://activesupport//lib/active_support/message_encryptor.rb#116
class ActiveSupport::MessageEncryptor::InvalidMessage < ::StandardError; end
+# source://activesupport//lib/active_support/message_encryptor.rb#96
module ActiveSupport::MessageEncryptor::NullSerializer
class << self
+ # source://activesupport//lib/active_support/message_encryptor.rb#101
def dump(value); end
+
+ # source://activesupport//lib/active_support/message_encryptor.rb#97
def load(value); end
end
end
+# source://activesupport//lib/active_support/message_encryptor.rb#106
module ActiveSupport::MessageEncryptor::NullVerifier
class << self
+ # source://activesupport//lib/active_support/message_encryptor.rb#111
def generate(value); end
+
+ # source://activesupport//lib/active_support/message_encryptor.rb#107
def verify(value); end
end
end
+# source://activesupport//lib/active_support/message_encryptor.rb#117
ActiveSupport::MessageEncryptor::OpenSSLCipherError = OpenSSL::Cipher::CipherError
+# +MessageVerifier+ makes it easy to generate and verify messages which are
+# signed to prevent tampering.
+#
+# This is useful for cases like remember-me tokens and auto-unsubscribe links
+# where the session store isn't suitable or available.
+#
+# Remember Me:
+# cookies[:remember_me] = @verifier.generate([@user.id, 2.weeks.from_now])
+#
+# In the authentication filter:
+#
+# id, time = @verifier.verify(cookies[:remember_me])
+# if Time.now < time
+# self.current_user = User.find(id)
+# end
+#
+# By default it uses Marshal to serialize the message. If you want to use
+# another serialization method, you can set the serializer in the options
+# hash upon initialization:
+#
+# @verifier = ActiveSupport::MessageVerifier.new('s3Krit', serializer: YAML)
+#
+# +MessageVerifier+ creates HMAC signatures using SHA1 hash algorithm by default.
+# If you want to use a different hash algorithm, you can change it by providing
+# +:digest+ key as an option while initializing the verifier:
+#
+# @verifier = ActiveSupport::MessageVerifier.new('s3Krit', digest: 'SHA256')
+#
+# === Confining messages to a specific purpose
+#
+# By default any message can be used throughout your app. But they can also be
+# confined to a specific +:purpose+.
+#
+# token = @verifier.generate("this is the chair", purpose: :login)
+#
+# Then that same purpose must be passed when verifying to get the data back out:
+#
+# @verifier.verified(token, purpose: :login) # => "this is the chair"
+# @verifier.verified(token, purpose: :shipping) # => nil
+# @verifier.verified(token) # => nil
+#
+# @verifier.verify(token, purpose: :login) # => "this is the chair"
+# @verifier.verify(token, purpose: :shipping) # => ActiveSupport::MessageVerifier::InvalidSignature
+# @verifier.verify(token) # => ActiveSupport::MessageVerifier::InvalidSignature
+#
+# Likewise, if a message has no purpose it won't be returned when verifying with
+# a specific purpose.
+#
+# token = @verifier.generate("the conversation is lively")
+# @verifier.verified(token, purpose: :scare_tactics) # => nil
+# @verifier.verified(token) # => "the conversation is lively"
+#
+# @verifier.verify(token, purpose: :scare_tactics) # => ActiveSupport::MessageVerifier::InvalidSignature
+# @verifier.verify(token) # => "the conversation is lively"
+#
+# === Making messages expire
+#
+# By default messages last forever and verifying one year from now will still
+# return the original value. But messages can be set to expire at a given
+# time with +:expires_in+ or +:expires_at+.
+#
+# @verifier.generate(parcel, expires_in: 1.month)
+# @verifier.generate(doowad, expires_at: Time.now.end_of_year)
+#
+# Then the messages can be verified and returned up to the expire time.
+# Thereafter, the +verified+ method returns +nil+ while +verify+ raises
+# ActiveSupport::MessageVerifier::InvalidSignature.
+#
+# === Rotating keys
+#
+# MessageVerifier also supports rotating out old configurations by falling
+# back to a stack of verifiers. Call +rotate+ to build and add a verifier to
+# so either +verified+ or +verify+ will also try verifying with the fallback.
+#
+# By default any rotated verifiers use the values of the primary
+# verifier unless specified otherwise.
+#
+# You'd give your verifier the new defaults:
+#
+# verifier = ActiveSupport::MessageVerifier.new(@secret, digest: "SHA512", serializer: JSON)
+#
+# Then gradually rotate the old values out by adding them as fallbacks. Any message
+# generated with the old values will then work until the rotation is removed.
+#
+# verifier.rotate old_secret # Fallback to an old secret instead of @secret.
+# verifier.rotate digest: "SHA256" # Fallback to an old digest instead of SHA512.
+# verifier.rotate serializer: Marshal # Fallback to an old serializer instead of JSON.
+#
+# Though the above would most likely be combined into one rotation:
+#
+# verifier.rotate old_secret, digest: "SHA256", serializer: Marshal
+#
+# source://activesupport//lib/active_support/message_verifier.rb#101
class ActiveSupport::MessageVerifier
include ::ActiveSupport::Messages::Rotator
include ::ActiveSupport::Messages::Rotator::Verifier
+ # @raise [ArgumentError]
+ # @return [MessageVerifier] a new instance of MessageVerifier
+ #
+ # source://activesupport//lib/active_support/messages/rotator.rb#6
+ def initialize(*secrets, on_rotation: T.unsafe(nil), **options); end
+
+ # Generates a signed message for the provided value.
+ #
+ # The message is signed with the +MessageVerifier+'s secret.
+ # Returns Base64-encoded message joined with the generated signature.
+ #
+ # verifier = ActiveSupport::MessageVerifier.new 's3Krit'
+ # verifier.generate 'a private message' # => "BAhJIhRwcml2YXRlLW1lc3NhZ2UGOgZFVA==--e2d724331ebdee96a10fb99b089508d1c72bd772"
+ #
+ # source://activesupport//lib/active_support/message_verifier.rb#186
def generate(value, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end
+
+ # Checks if a signed message could have been generated by signing an object
+ # with the +MessageVerifier+'s secret.
+ #
+ # verifier = ActiveSupport::MessageVerifier.new 's3Krit'
+ # signed_message = verifier.generate 'a private message'
+ # verifier.valid_message?(signed_message) # => true
+ #
+ # tampered_message = signed_message.chop # editing the message invalidates the signature
+ # verifier.valid_message?(tampered_message) # => false
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/message_verifier.rb#122
def valid_message?(signed_message); end
+
+ # Decodes the signed message using the +MessageVerifier+'s secret.
+ #
+ # verifier = ActiveSupport::MessageVerifier.new 's3Krit'
+ #
+ # signed_message = verifier.generate 'a private message'
+ # verifier.verified(signed_message) # => 'a private message'
+ #
+ # Returns +nil+ if the message was not signed with the same secret.
+ #
+ # other_verifier = ActiveSupport::MessageVerifier.new 'd1ff3r3nt-s3Krit'
+ # other_verifier.verified(signed_message) # => nil
+ #
+ # Returns +nil+ if the message is not Base64-encoded.
+ #
+ # invalid_message = "f--46a0120593880c733a53b6dad75b42ddc1c8996d"
+ # verifier.verified(invalid_message) # => nil
+ #
+ # Raises any error raised while decoding the signed message.
+ #
+ # incompatible_message = "test--dad7b06c94abba8d46a15fafaef56c327665d5ff"
+ # verifier.verified(incompatible_message) # => TypeError: incompatible marshal file format
+ #
+ # source://activesupport//lib/active_support/messages/rotator.rb#36
+ def verified(*args, on_rotation: T.unsafe(nil), **options); end
+
+ # Decodes the signed message using the +MessageVerifier+'s secret.
+ #
+ # verifier = ActiveSupport::MessageVerifier.new 's3Krit'
+ # signed_message = verifier.generate 'a private message'
+ #
+ # verifier.verify(signed_message) # => 'a private message'
+ #
+ # Raises +InvalidSignature+ if the message was not signed with the same
+ # secret or was not Base64-encoded.
+ #
+ # other_verifier = ActiveSupport::MessageVerifier.new 'd1ff3r3nt-s3Krit'
+ # other_verifier.verify(signed_message) # => ActiveSupport::MessageVerifier::InvalidSignature
+ #
+ # source://activesupport//lib/active_support/message_verifier.rb#175
def verify(*args, **options); end
private
+ # source://activesupport//lib/active_support/message_verifier.rb#196
def decode(data); end
+
+ # source://activesupport//lib/active_support/message_verifier.rb#192
def encode(data); end
+
+ # source://activesupport//lib/active_support/message_verifier.rb#200
def generate_digest(data); end
end
+# source://activesupport//lib/active_support/message_verifier.rb#104
class ActiveSupport::MessageVerifier::InvalidSignature < ::StandardError; end
+
+# source://activesupport//lib/active_support/messages/rotator.rb#4
module ActiveSupport::Messages; end
+# source://activesupport//lib/active_support/messages/metadata.rb#7
class ActiveSupport::Messages::Metadata
+ # @return [Metadata] a new instance of Metadata
+ #
+ # source://activesupport//lib/active_support/messages/metadata.rb#8
def initialize(message, expires_at = T.unsafe(nil), purpose = T.unsafe(nil)); end
+ # source://activesupport//lib/active_support/messages/metadata.rb#13
def as_json(options = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/messages/metadata.rb#58
def verify(purpose); end
private
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/messages/metadata.rb#67
def fresh?; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/messages/metadata.rb#63
def match?(purpose); end
+
+ # source://activesupport//lib/active_support/messages/metadata.rb#71
def parse_expires_at(expires_at); end
class << self
+ # source://activesupport//lib/active_support/messages/metadata.rb#26
def verify(message, purpose); end
+
+ # source://activesupport//lib/active_support/messages/metadata.rb#18
def wrap(message, expires_at: T.unsafe(nil), expires_in: T.unsafe(nil), purpose: T.unsafe(nil)); end
private
+ # source://activesupport//lib/active_support/messages/metadata.rb#53
def decode(message); end
+
+ # source://activesupport//lib/active_support/messages/metadata.rb#49
def encode(message); end
+
+ # source://activesupport//lib/active_support/messages/metadata.rb#39
def extract_metadata(message); end
+
+ # source://activesupport//lib/active_support/messages/metadata.rb#31
def pick_expiry(expires_at, expires_in); end
end
end
+# source://activesupport//lib/active_support/messages/rotator.rb#5
module ActiveSupport::Messages::Rotator
+ # source://activesupport//lib/active_support/messages/rotator.rb#6
def initialize(*secrets, on_rotation: T.unsafe(nil), **options); end
+ # source://activesupport//lib/active_support/messages/rotator.rb#14
def rotate(*secrets, **options); end
private
+ # source://activesupport//lib/active_support/messages/rotator.rb#47
def run_rotations(on_rotation); end
end
+# source://activesupport//lib/active_support/messages/rotator.rb#18
module ActiveSupport::Messages::Rotator::Encryptor
include ::ActiveSupport::Messages::Rotator
+ # source://activesupport//lib/active_support/messages/rotator.rb#21
def decrypt_and_verify(*args, on_rotation: T.unsafe(nil), **options); end
private
+ # source://activesupport//lib/active_support/messages/rotator.rb#28
def build_rotation(secret = T.unsafe(nil), sign_secret = T.unsafe(nil), options); end
end
+# source://activesupport//lib/active_support/messages/rotator.rb#33
module ActiveSupport::Messages::Rotator::Verifier
include ::ActiveSupport::Messages::Rotator
+ # source://activesupport//lib/active_support/messages/rotator.rb#36
def verified(*args, on_rotation: T.unsafe(nil), **options); end
private
+ # source://activesupport//lib/active_support/messages/rotator.rb#41
def build_rotation(secret = T.unsafe(nil), options); end
end
+# source://activesupport//lib/active_support/multibyte.rb#4
module ActiveSupport::Multibyte
class << self
+ # Returns the current proxy class.
+ #
+ # source://activesupport//lib/active_support/multibyte.rb#19
def proxy_class; end
+
+ # The proxy class returned when calling mb_chars. You can use this accessor
+ # to configure your own proxy class so you can support other encodings. See
+ # the ActiveSupport::Multibyte::Chars implementation for an example how to
+ # do this.
+ #
+ # ActiveSupport::Multibyte.proxy_class = CharsForUTF32
+ #
+ # source://activesupport//lib/active_support/multibyte.rb#14
def proxy_class=(klass); end
end
end
+# Chars enables you to work transparently with UTF-8 encoding in the Ruby
+# String class without having extensive knowledge about the encoding. A
+# Chars object accepts a string upon initialization and proxies String
+# methods in an encoding safe manner. All the normal String methods are also
+# implemented on the proxy.
+#
+# String methods are proxied through the Chars object, and can be accessed
+# through the +mb_chars+ method. Methods which would normally return a
+# String object now return a Chars object so methods can be chained.
+#
+# 'The Perfect String '.mb_chars.downcase.strip
+# # => #
+#
+# Chars objects are perfectly interchangeable with String objects as long as
+# no explicit class checks are made. If certain methods do explicitly check
+# the class, call +to_s+ before you pass chars objects to them.
+#
+# bad.explicit_checking_method 'T'.mb_chars.downcase.to_s
+#
+# The default Chars implementation assumes that the encoding of the string
+# is UTF-8, if you want to handle different encodings you can write your own
+# multibyte string handler and configure it through
+# ActiveSupport::Multibyte.proxy_class.
+#
+# class CharsForUTF32
+# def size
+# @wrapped_string.size / 4
+# end
+#
+# def self.accepts?(string)
+# string.length % 4 == 0
+# end
+# end
+#
+# ActiveSupport::Multibyte.proxy_class = CharsForUTF32
+#
+# source://activesupport//lib/active_support/multibyte/chars.rb#46
class ActiveSupport::Multibyte::Chars
include ::Comparable
+ # Creates a new Chars instance by wrapping _string_.
+ #
+ # @return [Chars] a new instance of Chars
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#55
def initialize(string); end
- def <=>(*args, &block); end
- def =~(*args, &block); end
- def acts_like_string?(*args, &block); end
+ # source://activesupport//lib/active_support/multibyte/chars.rb#52
+ def <=>(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/multibyte/chars.rb#52
+ def =~(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/multibyte/chars.rb#52
+ def acts_like_string?(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/multibyte/chars.rb#160
def as_json(options = T.unsafe(nil)); end
+
+ # Performs composition on all the characters.
+ #
+ # 'é'.length # => 3
+ # 'é'.mb_chars.compose.to_s.length # => 2
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#139
def compose; end
+
+ # Performs canonical decomposition on all the characters.
+ #
+ # 'é'.length # => 2
+ # 'é'.mb_chars.decompose.to_s.length # => 3
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#131
def decompose; end
+
+ # Returns the number of grapheme clusters in the string.
+ #
+ # 'क्षि'.mb_chars.length # => 4
+ # 'क्षि'.mb_chars.grapheme_length # => 3
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#147
def grapheme_length; end
+
+ # Limits the byte size of the string to a number of bytes without breaking
+ # characters. Usable when the storage for a string is limited for some
+ # reason.
+ #
+ # 'こんにちは'.mb_chars.limit(7).to_s # => "こん"
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#114
def limit(limit); end
- def match?(*args, &block); end
+
+ # source://activesupport//lib/active_support/multibyte/chars.rb#52
+ def match?(*_arg0, **_arg1, &_arg2); end
+
+ # Forward all undefined methods to the wrapped string.
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#61
def method_missing(method, *args, &block); end
+
+ # Reverses all characters in the string.
+ #
+ # 'Café'.mb_chars.reverse.to_s # => 'éfaC'
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#105
def reverse; end
+
+ # source://activesupport//lib/active_support/multibyte/chars.rb#165
def reverse!(*args); end
+
+ # Works like String#slice!, but returns an instance of
+ # Chars, or +nil+ if the string was not modified. The string will not be
+ # modified if the range given is out of bounds
+ #
+ # string = 'Welcome'
+ # string.mb_chars.slice!(3) # => #
+ # string # => 'Welome'
+ # string.mb_chars.slice!(0..3) # => #
+ # string # => 'me'
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#95
def slice!(*args); end
+
+ # Works just like String#split, with the exception that the items
+ # in the resulting list are Chars instances instead of String. This makes
+ # chaining methods easier.
+ #
+ # 'Café périferôl'.mb_chars.split(/é/).map { |part| part.upcase.to_s } # => ["CAF", " P", "RIFERÔL"]
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#82
def split(*args); end
+
+ # Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent
+ # resulting in a valid UTF-8 string.
+ #
+ # Passing +true+ will forcibly tidy all bytes, assuming that the string's
+ # encoding is entirely CP1252 or ISO-8859-1.
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#156
def tidy_bytes(force = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/multibyte/chars.rb#165
def tidy_bytes!(*args); end
+
+ # Capitalizes the first letter of every word, when possible.
+ #
+ # "ÉL QUE SE ENTERÓ".mb_chars.titleize.to_s # => "Él Que Se Enteró"
+ # "日本語".mb_chars.titleize.to_s # => "日本語"
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#122
def titlecase; end
+
+ # Capitalizes the first letter of every word, when possible.
+ #
+ # "ÉL QUE SE ENTERÓ".mb_chars.titleize.to_s # => "Él Que Se Enteró"
+ # "日本語".mb_chars.titleize.to_s # => "日本語"
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#122
def titleize; end
+
+ # Returns the value of attribute wrapped_string.
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#48
def to_s; end
+
+ # Returns the value of attribute wrapped_string.
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#48
def to_str; end
+
+ # Returns the value of attribute wrapped_string.
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#48
def wrapped_string; end
private
+ # source://activesupport//lib/active_support/multibyte/chars.rb#172
def chars(string); end
+
+ # Returns +true+ if _obj_ responds to the given method. Private methods
+ # are included in the search only if the optional second parameter
+ # evaluates to +true+.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/multibyte/chars.rb#73
def respond_to_missing?(method, include_private); end
end
+# source://activesupport//lib/active_support/multibyte/unicode.rb#5
module ActiveSupport::Multibyte::Unicode
extend ::ActiveSupport::Multibyte::Unicode
+ # Compose decomposed characters to the composed form.
+ #
+ # source://activesupport//lib/active_support/multibyte/unicode.rb#33
def compose(codepoints); end
+
+ # Decompose composed characters to the decomposed form.
+ #
+ # source://activesupport//lib/active_support/multibyte/unicode.rb#24
def decompose(type, codepoints); end
+
+ # source://activesupport//lib/active_support/multibyte/unicode.rb#11
def default_normalization_form; end
+
+ # source://activesupport//lib/active_support/multibyte/unicode.rb#17
def default_normalization_form=(_); end
+
+ # Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent
+ # resulting in a valid UTF-8 string.
+ #
+ # Passing +true+ will forcibly tidy all bytes, assuming that the string's
+ # encoding is entirely CP1252 or ISO-8859-1.
+ #
+ # source://activesupport//lib/active_support/multibyte/unicode.rb#44
def tidy_bytes(string, force = T.unsafe(nil)); end
private
+ # source://activesupport//lib/active_support/multibyte/unicode.rb#77
def recode_windows1252_chars(string); end
end
+# The Unicode version that is supported by the implementation
+#
+# source://activesupport//lib/active_support/multibyte/unicode.rb#9
ActiveSupport::Multibyte::Unicode::UNICODE_VERSION = T.let(T.unsafe(nil), String)
+# = Notifications
+#
+# ActiveSupport::Notifications provides an instrumentation API for
+# Ruby.
+#
+# == Instrumenters
+#
+# To instrument an event you just need to do:
+#
+# ActiveSupport::Notifications.instrument('render', extra: :information) do
+# render plain: 'Foo'
+# end
+#
+# That first executes the block and then notifies all subscribers once done.
+#
+# In the example above +render+ is the name of the event, and the rest is called
+# the _payload_. The payload is a mechanism that allows instrumenters to pass
+# extra information to subscribers. Payloads consist of a hash whose contents
+# are arbitrary and generally depend on the event.
+#
+# == Subscribers
+#
+# You can consume those events and the information they provide by registering
+# a subscriber.
+#
+# ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload|
+# name # => String, name of the event (such as 'render' from above)
+# start # => Time, when the instrumented block started execution
+# finish # => Time, when the instrumented block ended execution
+# id # => String, unique ID for the instrumenter that fired the event
+# payload # => Hash, the payload
+# end
+#
+# Here, the +start+ and +finish+ values represent wall-clock time. If you are
+# concerned about accuracy, you can register a monotonic subscriber.
+#
+# ActiveSupport::Notifications.monotonic_subscribe('render') do |name, start, finish, id, payload|
+# name # => String, name of the event (such as 'render' from above)
+# start # => Monotonic time, when the instrumented block started execution
+# finish # => Monotonic time, when the instrumented block ended execution
+# id # => String, unique ID for the instrumenter that fired the event
+# payload # => Hash, the payload
+# end
+#
+# The +start+ and +finish+ values above represent monotonic time.
+#
+# For instance, let's store all "render" events in an array:
+#
+# events = []
+#
+# ActiveSupport::Notifications.subscribe('render') do |*args|
+# events << ActiveSupport::Notifications::Event.new(*args)
+# end
+#
+# That code returns right away, you are just subscribing to "render" events.
+# The block is saved and will be called whenever someone instruments "render":
+#
+# ActiveSupport::Notifications.instrument('render', extra: :information) do
+# render plain: 'Foo'
+# end
+#
+# event = events.first
+# event.name # => "render"
+# event.duration # => 10 (in milliseconds)
+# event.payload # => { extra: :information }
+#
+# The block in the subscribe call gets the name of the event, start
+# timestamp, end timestamp, a string with a unique identifier for that event's instrumenter
+# (something like "535801666f04d0298cd6"), and a hash with the payload, in
+# that order.
+#
+# If an exception happens during that particular instrumentation the payload will
+# have a key :exception with an array of two elements as value: a string with
+# the name of the exception class, and the exception message.
+# The :exception_object key of the payload will have the exception
+# itself as the value:
+#
+# event.payload[:exception] # => ["ArgumentError", "Invalid value"]
+# event.payload[:exception_object] # => #
+#
+# As the earlier example depicts, the class ActiveSupport::Notifications::Event
+# is able to take the arguments as they come and provide an object-oriented
+# interface to that data.
+#
+# It is also possible to pass an object which responds to call method
+# as the second parameter to the subscribe method instead of a block:
+#
+# module ActionController
+# class PageRequest
+# def call(name, started, finished, unique_id, payload)
+# Rails.logger.debug ['notification:', name, started, finished, unique_id, payload].join(' ')
+# end
+# end
+# end
+#
+# ActiveSupport::Notifications.subscribe('process_action.action_controller', ActionController::PageRequest.new)
+#
+# resulting in the following output within the logs including a hash with the payload:
+#
+# notification: process_action.action_controller 2012-04-13 01:08:35 +0300 2012-04-13 01:08:35 +0300 af358ed7fab884532ec7 {
+# controller: "Devise::SessionsController",
+# action: "new",
+# params: {"action"=>"new", "controller"=>"devise/sessions"},
+# format: :html,
+# method: "GET",
+# path: "/login/sign_in",
+# status: 200,
+# view_runtime: 279.3080806732178,
+# db_runtime: 40.053
+# }
+#
+# You can also subscribe to all events whose name matches a certain regexp:
+#
+# ActiveSupport::Notifications.subscribe(/render/) do |*args|
+# ...
+# end
+#
+# and even pass no argument to subscribe, in which case you are subscribing
+# to all events.
+#
+# == Temporary Subscriptions
+#
+# Sometimes you do not want to subscribe to an event for the entire life of
+# the application. There are two ways to unsubscribe.
+#
+# WARNING: The instrumentation framework is designed for long-running subscribers,
+# use this feature sparingly because it wipes some internal caches and that has
+# a negative impact on performance.
+#
+# === Subscribe While a Block Runs
+#
+# You can subscribe to some event temporarily while some block runs. For
+# example, in
+#
+# callback = lambda {|*args| ... }
+# ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do
+# ...
+# end
+#
+# the callback will be called for all "sql.active_record" events instrumented
+# during the execution of the block. The callback is unsubscribed automatically
+# after that.
+#
+# To record +started+ and +finished+ values with monotonic time,
+# specify the optional :monotonic option to the
+# subscribed method. The :monotonic option is set
+# to +false+ by default.
+#
+# callback = lambda {|name, started, finished, unique_id, payload| ... }
+# ActiveSupport::Notifications.subscribed(callback, "sql.active_record", monotonic: true) do
+# ...
+# end
+#
+# === Manual Unsubscription
+#
+# The +subscribe+ method returns a subscriber object:
+#
+# subscriber = ActiveSupport::Notifications.subscribe("render") do |*args|
+# ...
+# end
+#
+# To prevent that block from being called anymore, just unsubscribe passing
+# that reference:
+#
+# ActiveSupport::Notifications.unsubscribe(subscriber)
+#
+# You can also unsubscribe by passing the name of the subscriber object. Note
+# that this will unsubscribe all subscriptions with the given name:
+#
+# ActiveSupport::Notifications.unsubscribe("render")
+#
+# Subscribers using a regexp or other pattern-matching object will remain subscribed
+# to all events that match their original pattern, unless those events match a string
+# passed to +unsubscribe+:
+#
+# subscriber = ActiveSupport::Notifications.subscribe(/render/) { }
+# ActiveSupport::Notifications.unsubscribe('render_template.action_view')
+# subscriber.matches?('render_template.action_view') # => false
+# subscriber.matches?('render_partial.action_view') # => true
+#
+# == Default Queue
+#
+# Notifications ships with a queue implementation that consumes and publishes events
+# to all log subscribers. You can use any queue implementation you want.
+#
+# source://activesupport//lib/active_support/notifications/instrumenter.rb#6
module ActiveSupport::Notifications
class << self
+ # source://activesupport//lib/active_support/notifications.rb#201
def instrument(name, payload = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/notifications.rb#253
def instrumenter; end
+
+ # source://activesupport//lib/active_support/notifications.rb#238
def monotonic_subscribe(pattern = T.unsafe(nil), callback = T.unsafe(nil), &block); end
+
+ # Returns the value of attribute notifier.
+ #
+ # source://activesupport//lib/active_support/notifications.rb#195
def notifier; end
+
+ # Sets the attribute notifier
+ #
+ # @param value the value to set the attribute notifier to.
+ #
+ # source://activesupport//lib/active_support/notifications.rb#195
def notifier=(_arg0); end
+
+ # source://activesupport//lib/active_support/notifications.rb#197
def publish(name, *args); end
+
+ # Subscribe to a given event name with the passed +block+.
+ #
+ # You can subscribe to events by passing a String to match exact event
+ # names, or by passing a Regexp to match all events that match a pattern.
+ #
+ # ActiveSupport::Notifications.subscribe(/render/) do |*args|
+ # @event = ActiveSupport::Notifications::Event.new(*args)
+ # end
+ #
+ # The +block+ will receive five parameters with information about the event:
+ #
+ # ActiveSupport::Notifications.subscribe('render') do |name, start, finish, id, payload|
+ # name # => String, name of the event (such as 'render' from above)
+ # start # => Time, when the instrumented block started execution
+ # finish # => Time, when the instrumented block ended execution
+ # id # => String, unique ID for the instrumenter that fired the event
+ # payload # => Hash, the payload
+ # end
+ #
+ # If the block passed to the method only takes one parameter,
+ # it will yield an event object to the block:
+ #
+ # ActiveSupport::Notifications.subscribe(/render/) do |event|
+ # @event = event
+ # end
+ #
+ # source://activesupport//lib/active_support/notifications.rb#234
def subscribe(pattern = T.unsafe(nil), callback = T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/notifications.rb#242
def subscribed(callback, pattern = T.unsafe(nil), monotonic: T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/notifications.rb#249
def unsubscribe(subscriber_or_name); end
end
end
+# source://activesupport//lib/active_support/notifications/instrumenter.rb#54
class ActiveSupport::Notifications::Event
+ # @return [Event] a new instance of Event
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#58
def initialize(name, start, ending, transaction_id, payload); end
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#119
def <<(event); end
+
+ # Returns the number of allocations made since the call to +start!+ and
+ # the call to +finish!+
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#99
def allocations; end
+
+ # Returns the value of attribute children.
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#55
def children; end
+
+ # Returns the CPU time (in milliseconds) passed since the call to
+ # +start!+ and the call to +finish!+
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#87
def cpu_time; end
+
+ # Returns the difference in milliseconds between when the execution of the
+ # event started and when it ended.
+ #
+ # ActiveSupport::Notifications.subscribe('wait') do |*args|
+ # @event = ActiveSupport::Notifications::Event.new(*args)
+ # end
+ #
+ # ActiveSupport::Notifications.instrument('wait') do
+ # sleep 1
+ # end
+ #
+ # @event.duration # => 1000.138
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#115
def duration; end
+
+ # Returns the value of attribute end.
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#55
def end; end
+
+ # Record information at the time this event finishes
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#79
def finish!; end
+
+ # Returns the idle time time (in milliseconds) passed since the call to
+ # +start!+ and the call to +finish!+
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#93
def idle_time; end
+
+ # Returns the value of attribute name.
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#55
def name; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#123
def parent_of?(event); end
+
+ # Returns the value of attribute payload.
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#56
def payload; end
+
+ # Sets the attribute payload
+ #
+ # @param value the value to set the attribute payload to.
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#56
def payload=(_arg0); end
+
+ # Record information at the time this event starts
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#72
def start!; end
+
+ # Returns the value of attribute time.
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#55
def time; end
+
+ # Returns the value of attribute transaction_id.
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#55
def transaction_id; end
private
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#128
def now; end
+
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#149
def now_allocations; end
+
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#139
def now_cpu; end
end
+# This is a default queue implementation that ships with Notifications.
+# It just pushes events to all registered log subscribers.
+#
+# This class is thread safe. All methods are reentrant.
+#
+# source://activesupport//lib/active_support/notifications/fanout.rb#14
class ActiveSupport::Notifications::Fanout
include ::Mutex_m
+ # @return [Fanout] a new instance of Fanout
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#17
def initialize; end
+ # source://activesupport//lib/active_support/notifications/fanout.rb#62
def finish(name, id, payload, listeners = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#70
def listeners_for(name); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#79
def listening?(name); end
+
+ # source://mutex_m/0.1.1/mutex_m.rb#93
def lock; end
+
+ # source://mutex_m/0.1.1/mutex_m.rb#83
def locked?; end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#66
def publish(name, *args); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#58
def start(name, id, payload); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#24
def subscribe(pattern = T.unsafe(nil), callable = T.unsafe(nil), monotonic: T.unsafe(nil), &block); end
+
+ # source://mutex_m/0.1.1/mutex_m.rb#78
def synchronize(&block); end
+
+ # source://mutex_m/0.1.1/mutex_m.rb#88
def try_lock; end
+
+ # source://mutex_m/0.1.1/mutex_m.rb#98
def unlock; end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#38
def unsubscribe(subscriber_or_name); end
+
+ # This is a sync queue, so there is no waiting.
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#84
def wait; end
end
+# source://activesupport//lib/active_support/notifications/fanout.rb#87
module ActiveSupport::Notifications::Fanout::Subscribers
class << self
+ # source://activesupport//lib/active_support/notifications/fanout.rb#88
def new(pattern, listener, monotonic); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#107
def wrap_all(pattern, subscriber); end
end
end
+# source://activesupport//lib/active_support/notifications/fanout.rb#229
class ActiveSupport::Notifications::Fanout::Subscribers::AllMessages
+ # @return [AllMessages] a new instance of AllMessages
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#230
def initialize(delegate); end
+ # source://activesupport//lib/active_support/notifications/fanout.rb#238
def finish(name, id, payload); end
+
def matches?(_arg0); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#242
def publish(name, *args); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#234
def start(name, id, payload); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#246
def subscribed_to?(name); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#250
def unsubscribe!(*_arg0); end
end
+# source://activesupport//lib/active_support/notifications/fanout.rb#207
class ActiveSupport::Notifications::Fanout::Subscribers::EventObject < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented
+ # source://activesupport//lib/active_support/notifications/fanout.rb#215
def finish(name, id, payload); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#208
def start(name, id, payload); end
private
+ # source://activesupport//lib/active_support/notifications/fanout.rb#224
def build_event(name, id, payload); end
end
+# source://activesupport//lib/active_support/notifications/fanout.rb#137
class ActiveSupport::Notifications::Fanout::Subscribers::Evented
+ # @return [Evented] a new instance of Evented
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#140
def initialize(pattern, delegate); end
+ # source://activesupport//lib/active_support/notifications/fanout.rb#156
def finish(name, id, payload); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#164
def matches?(name); end
+
+ # Returns the value of attribute pattern.
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#138
def pattern; end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#146
def publish(name, *args); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#152
def start(name, id, payload); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#160
def subscribed_to?(name); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#168
def unsubscribe!(name); end
end
+# source://activesupport//lib/active_support/notifications/fanout.rb#115
class ActiveSupport::Notifications::Fanout::Subscribers::Matcher
+ # @return [Matcher] a new instance of Matcher
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#123
def initialize(pattern); end
+ # source://activesupport//lib/active_support/notifications/fanout.rb#132
def ===(name); end
+
+ # Returns the value of attribute exclusions.
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#116
def exclusions; end
+
+ # Returns the value of attribute pattern.
+ #
+ # source://activesupport//lib/active_support/notifications/fanout.rb#116
def pattern; end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#128
def unsubscribe!(name); end
class << self
+ # source://activesupport//lib/active_support/notifications/fanout.rb#118
def wrap(pattern); end
end
end
+# source://activesupport//lib/active_support/notifications/fanout.rb#190
class ActiveSupport::Notifications::Fanout::Subscribers::MonotonicTimed < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented
+ # source://activesupport//lib/active_support/notifications/fanout.rb#200
def finish(name, id, payload); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#191
def publish(name, *args); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#195
def start(name, id, payload); end
end
+# source://activesupport//lib/active_support/notifications/fanout.rb#173
class ActiveSupport::Notifications::Fanout::Subscribers::Timed < ::ActiveSupport::Notifications::Fanout::Subscribers::Evented
+ # source://activesupport//lib/active_support/notifications/fanout.rb#183
def finish(name, id, payload); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#174
def publish(name, *args); end
+
+ # source://activesupport//lib/active_support/notifications/fanout.rb#178
def start(name, id, payload); end
end
+# This class is a registry which holds all of the +Instrumenter+ objects
+# in a particular thread local. To access the +Instrumenter+ object for a
+# particular +notifier+, you can call the following method:
+#
+# InstrumentationRegistry.instrumenter_for(notifier)
+#
+# The instrumenters for multiple notifiers are held in a single instance of
+# this class.
+#
+# source://activesupport//lib/active_support/notifications.rb#266
class ActiveSupport::Notifications::InstrumentationRegistry
extend ::ActiveSupport::PerThreadRegistry
+ # @return [InstrumentationRegistry] a new instance of InstrumentationRegistry
+ #
+ # source://activesupport//lib/active_support/notifications.rb#269
def initialize; end
+ # source://activesupport//lib/active_support/notifications.rb#273
def instrumenter_for(notifier); end
end
+# Instrumenters are stored in a thread local.
+#
+# source://activesupport//lib/active_support/notifications/instrumenter.rb#8
class ActiveSupport::Notifications::Instrumenter
+ # @return [Instrumenter] a new instance of Instrumenter
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#11
def initialize(notifier); end
+ # Send a finish notification with +name+ and +payload+.
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#40
def finish(name, payload); end
+
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#44
def finish_with_state(listeners_state, name, payload); end
+
+ # Returns the value of attribute id.
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#9
def id; end
+
+ # Given a block, instrument it by measuring the time taken to execute
+ # and publish it. Without a block, simply send a message via the
+ # notifier. Notice that events get sent even if an error occurs in the
+ # passed-in block.
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#20
def instrument(name, payload = T.unsafe(nil)); end
+
+ # Send a start notification with +name+ and +payload+.
+ #
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#35
def start(name, payload); end
private
+ # source://activesupport//lib/active_support/notifications/instrumenter.rb#49
def unique_id; end
end
+# source://activesupport//lib/active_support/number_helper.rb#4
module ActiveSupport::NumberHelper
extend ::ActiveSupport::Autoload
extend ::ActiveSupport::NumberHelper
+ # Formats a +number+ into a currency string (e.g., $13.65). You
+ # can customize the format in the +options+ hash.
+ #
+ # The currency unit and number formatting of the current locale will be used
+ # unless otherwise specified in the provided options. No currency conversion
+ # is performed. If the user is given a way to change their locale, they will
+ # also be able to change the relative value of the currency displayed with
+ # this helper. If your application will ever support multiple locales, you
+ # may want to specify a constant :locale option or consider
+ # using a library capable of currency conversion.
+ #
+ # ==== Options
+ #
+ # * :locale - Sets the locale to be used for formatting
+ # (defaults to current locale).
+ # * :precision - Sets the level of precision (defaults
+ # to 2).
+ # * :round_mode - Determine how rounding is performed
+ # (defaults to :default. See BigDecimal::mode)
+ # * :unit - Sets the denomination of the currency
+ # (defaults to "$").
+ # * :separator - Sets the separator between the units
+ # (defaults to ".").
+ # * :delimiter - Sets the thousands delimiter (defaults
+ # to ",").
+ # * :format - Sets the format for non-negative numbers
+ # (defaults to "%u%n"). Fields are %u for the
+ # currency, and %n for the number.
+ # * :negative_format - Sets the format for negative
+ # numbers (defaults to prepending a hyphen to the formatted
+ # number given by :format). Accepts the same fields
+ # than :format, except %n is here the
+ # absolute value of the number.
+ # * :strip_insignificant_zeros - If +true+ removes
+ # insignificant zeros after the decimal separator (defaults to
+ # +false+).
+ #
+ # ==== Examples
+ #
+ # number_to_currency(1234567890.50) # => "$1,234,567,890.50"
+ # number_to_currency(1234567890.506) # => "$1,234,567,890.51"
+ # number_to_currency(1234567890.506, precision: 3) # => "$1,234,567,890.506"
+ # number_to_currency(1234567890.506, locale: :fr) # => "1 234 567 890,51 €"
+ # number_to_currency('123a456') # => "$123a456"
+ #
+ # number_to_currency("123a456", raise: true) # => InvalidNumberError
+ #
+ # number_to_currency(-0.456789, precision: 0)
+ # # => "$0"
+ # number_to_currency(-1234567890.50, negative_format: '(%u%n)')
+ # # => "($1,234,567,890.50)"
+ # number_to_currency(1234567890.50, unit: '£', separator: ',', delimiter: '')
+ # # => "£1234567890,50"
+ # number_to_currency(1234567890.50, unit: '£', separator: ',', delimiter: '', format: '%n %u')
+ # # => "1234567890,50 £"
+ # number_to_currency(1234567890.50, strip_insignificant_zeros: true)
+ # # => "$1,234,567,890.5"
+ # number_to_currency(1234567890.50, precision: 0, round_mode: :up)
+ # # => "$1,234,567,891"
+ #
+ # source://activesupport//lib/active_support/number_helper.rb#116
def number_to_currency(number, options = T.unsafe(nil)); end
+
+ # Formats a +number+ with grouped thousands using +delimiter+
+ # (e.g., 12,324). You can customize the format in the +options+
+ # hash.
+ #
+ # ==== Options
+ #
+ # * :locale - Sets the locale to be used for formatting
+ # (defaults to current locale).
+ # * :delimiter - Sets the thousands delimiter (defaults
+ # to ",").
+ # * :separator - Sets the separator between the
+ # fractional and integer digits (defaults to ".").
+ # * :delimiter_pattern - Sets a custom regular expression used for
+ # deriving the placement of delimiter. Helpful when using currency formats
+ # like INR.
+ #
+ # ==== Examples
+ #
+ # number_to_delimited(12345678) # => "12,345,678"
+ # number_to_delimited('123456') # => "123,456"
+ # number_to_delimited(12345678.05) # => "12,345,678.05"
+ # number_to_delimited(12345678, delimiter: '.') # => "12.345.678"
+ # number_to_delimited(12345678, delimiter: ',') # => "12,345,678"
+ # number_to_delimited(12345678.05, separator: ' ') # => "12,345,678 05"
+ # number_to_delimited(12345678.05, locale: :fr) # => "12 345 678,05"
+ # number_to_delimited('112a') # => "112a"
+ # number_to_delimited(98765432.98, delimiter: ' ', separator: ',')
+ # # => "98 765 432,98"
+ # number_to_delimited("123456.78",
+ # delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/)
+ # # => "1,23,456.78"
+ #
+ # source://activesupport//lib/active_support/number_helper.rb#191
def number_to_delimited(number, options = T.unsafe(nil)); end
+
+ # Pretty prints (formats and approximates) a number in a way it
+ # is more readable by humans (e.g.: 1200000000 becomes "1.2
+ # Billion"). This is useful for numbers that can get very large
+ # (and too hard to read).
+ #
+ # See number_to_human_size if you want to print a file
+ # size.
+ #
+ # You can also define your own unit-quantifier names if you want
+ # to use other decimal units (e.g.: 1500 becomes "1.5
+ # kilometers", 0.150 becomes "150 milliliters", etc). You may
+ # define a wide range of unit quantifiers, even fractional ones
+ # (centi, deci, mili, etc).
+ #
+ # ==== Options
+ #
+ # * :locale - Sets the locale to be used for formatting
+ # (defaults to current locale).
+ # * :precision - Sets the precision of the number
+ # (defaults to 3).
+ # * :round_mode - Determine how rounding is performed
+ # (defaults to :default. See BigDecimal::mode)
+ # * :significant - If +true+, precision will be the number
+ # of significant_digits. If +false+, the number of fractional
+ # digits (defaults to +true+)
+ # * :separator - Sets the separator between the
+ # fractional and integer digits (defaults to ".").
+ # * :delimiter - Sets the thousands delimiter (defaults
+ # to "").
+ # * :strip_insignificant_zeros - If +true+ removes
+ # insignificant zeros after the decimal separator (defaults to
+ # +true+)
+ # * :units - A Hash of unit quantifier names. Or a
+ # string containing an i18n scope where to find this hash. It
+ # might have the following keys:
+ # * *integers*: :unit, :ten,
+ # :hundred, :thousand, :million,
+ # :billion, :trillion,
+ # :quadrillion
+ # * *fractionals*: :deci, :centi,
+ # :mili, :micro, :nano,
+ # :pico, :femto
+ # * :format - Sets the format of the output string
+ # (defaults to "%n %u"). The field types are:
+ # * %u - The quantifier (ex.: 'thousand')
+ # * %n - The number
+ #
+ # ==== Examples
+ #
+ # number_to_human(123) # => "123"
+ # number_to_human(1234) # => "1.23 Thousand"
+ # number_to_human(12345) # => "12.3 Thousand"
+ # number_to_human(1234567) # => "1.23 Million"
+ # number_to_human(1234567890) # => "1.23 Billion"
+ # number_to_human(1234567890123) # => "1.23 Trillion"
+ # number_to_human(1234567890123456) # => "1.23 Quadrillion"
+ # number_to_human(1234567890123456789) # => "1230 Quadrillion"
+ # number_to_human(489939, precision: 2) # => "490 Thousand"
+ # number_to_human(489939, precision: 4) # => "489.9 Thousand"
+ # number_to_human(489939, precision: 2
+ # , round_mode: :down) # => "480 Thousand"
+ # number_to_human(1234567, precision: 4,
+ # significant: false) # => "1.2346 Million"
+ # number_to_human(1234567, precision: 1,
+ # separator: ',',
+ # significant: false) # => "1,2 Million"
+ #
+ # number_to_human(500000000, precision: 5) # => "500 Million"
+ # number_to_human(12345012345, significant: false) # => "12.345 Billion"
+ #
+ # Non-significant zeros after the decimal separator are stripped
+ # out by default (set :strip_insignificant_zeros to
+ # +false+ to change that):
+ #
+ # number_to_human(12.00001) # => "12"
+ # number_to_human(12.00001, strip_insignificant_zeros: false) # => "12.0"
+ #
+ # ==== Custom Unit Quantifiers
+ #
+ # You can also use your own custom unit quantifiers:
+ # number_to_human(500000, units: { unit: 'ml', thousand: 'lt' }) # => "500 lt"
+ #
+ # If in your I18n locale you have:
+ #
+ # distance:
+ # centi:
+ # one: "centimeter"
+ # other: "centimeters"
+ # unit:
+ # one: "meter"
+ # other: "meters"
+ # thousand:
+ # one: "kilometer"
+ # other: "kilometers"
+ # billion: "gazillion-distance"
+ #
+ # Then you could do:
+ #
+ # number_to_human(543934, units: :distance) # => "544 kilometers"
+ # number_to_human(54393498, units: :distance) # => "54400 kilometers"
+ # number_to_human(54393498000, units: :distance) # => "54.4 gazillion-distance"
+ # number_to_human(343, units: :distance, precision: 1) # => "300 meters"
+ # number_to_human(1, units: :distance) # => "1 meter"
+ # number_to_human(0.34, units: :distance) # => "34 centimeters"
+ #
+ # source://activesupport//lib/active_support/number_helper.rb#393
def number_to_human(number, options = T.unsafe(nil)); end
+
+ # Formats the bytes in +number+ into a more understandable
+ # representation (e.g., giving it 1500 yields 1.46 KB). This
+ # method is useful for reporting file sizes to users. You can
+ # customize the format in the +options+ hash.
+ #
+ # See number_to_human if you want to pretty-print a
+ # generic number.
+ #
+ # ==== Options
+ #
+ # * :locale - Sets the locale to be used for formatting
+ # (defaults to current locale).
+ # * :precision - Sets the precision of the number
+ # (defaults to 3).
+ # * :round_mode - Determine how rounding is performed
+ # (defaults to :default. See BigDecimal::mode)
+ # * :significant - If +true+, precision will be the number
+ # of significant_digits. If +false+, the number of fractional
+ # digits (defaults to +true+)
+ # * :separator - Sets the separator between the
+ # fractional and integer digits (defaults to ".").
+ # * :delimiter - Sets the thousands delimiter (defaults
+ # to "").
+ # * :strip_insignificant_zeros - If +true+ removes
+ # insignificant zeros after the decimal separator (defaults to
+ # +true+)
+ #
+ # ==== Examples
+ #
+ # number_to_human_size(123) # => "123 Bytes"
+ # number_to_human_size(1234) # => "1.21 KB"
+ # number_to_human_size(12345) # => "12.1 KB"
+ # number_to_human_size(1234567) # => "1.18 MB"
+ # number_to_human_size(1234567890) # => "1.15 GB"
+ # number_to_human_size(1234567890123) # => "1.12 TB"
+ # number_to_human_size(1234567890123456) # => "1.1 PB"
+ # number_to_human_size(1234567890123456789) # => "1.07 EB"
+ # number_to_human_size(1234567, precision: 2) # => "1.2 MB"
+ # number_to_human_size(483989, precision: 2) # => "470 KB"
+ # number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
+ # number_to_human_size(1234567, precision: 2, separator: ',') # => "1,2 MB"
+ # number_to_human_size(1234567890123, precision: 5) # => "1.1228 TB"
+ # number_to_human_size(524288000, precision: 5) # => "500 MB"
+ #
+ # source://activesupport//lib/active_support/number_helper.rb#285
def number_to_human_size(number, options = T.unsafe(nil)); end
+
+ # Formats a +number+ as a percentage string (e.g., 65%). You can
+ # customize the format in the +options+ hash.
+ #
+ # ==== Options
+ #
+ # * :locale - Sets the locale to be used for formatting
+ # (defaults to current locale).
+ # * :precision - Sets the precision of the number
+ # (defaults to 3). Keeps the number's precision if +nil+.
+ # * :round_mode - Determine how rounding is performed
+ # (defaults to :default. See BigDecimal::mode)
+ # * :significant - If +true+, precision will be the number
+ # of significant_digits. If +false+, the number of fractional
+ # digits (defaults to +false+).
+ # * :separator - Sets the separator between the
+ # fractional and integer digits (defaults to ".").
+ # * :delimiter - Sets the thousands delimiter (defaults
+ # to "").
+ # * :strip_insignificant_zeros - If +true+ removes
+ # insignificant zeros after the decimal separator (defaults to
+ # +false+).
+ # * :format - Specifies the format of the percentage
+ # string The number field is %n (defaults to "%n%").
+ #
+ # ==== Examples
+ #
+ # number_to_percentage(100) # => "100.000%"
+ # number_to_percentage('98') # => "98.000%"
+ # number_to_percentage(100, precision: 0) # => "100%"
+ # number_to_percentage(1000, delimiter: '.', separator: ',') # => "1.000,000%"
+ # number_to_percentage(302.24398923423, precision: 5) # => "302.24399%"
+ # number_to_percentage(1000, locale: :fr) # => "1000,000%"
+ # number_to_percentage(1000, precision: nil) # => "1000%"
+ # number_to_percentage('98a') # => "98a%"
+ # number_to_percentage(100, format: '%n %') # => "100.000 %"
+ # number_to_percentage(302.24398923423, precision: 5, round_mode: :down) # => "302.24398%"
+ #
+ # source://activesupport//lib/active_support/number_helper.rb#156
def number_to_percentage(number, options = T.unsafe(nil)); end
+
+ # Formats a +number+ into a phone number (US by default e.g., (555)
+ # 123-9876). You can customize the format in the +options+ hash.
+ #
+ # ==== Options
+ #
+ # * :area_code - Adds parentheses around the area code.
+ # * :delimiter - Specifies the delimiter to use
+ # (defaults to "-").
+ # * :extension - Specifies an extension to add to the
+ # end of the generated number.
+ # * :country_code - Sets the country code for the phone
+ # number.
+ # * :pattern - Specifies how the number is divided into three
+ # groups with the custom regexp to override the default format.
+ # ==== Examples
+ #
+ # number_to_phone(5551234) # => "555-1234"
+ # number_to_phone('5551234') # => "555-1234"
+ # number_to_phone(1235551234) # => "123-555-1234"
+ # number_to_phone(1235551234, area_code: true) # => "(123) 555-1234"
+ # number_to_phone(1235551234, delimiter: ' ') # => "123 555 1234"
+ # number_to_phone(1235551234, area_code: true, extension: 555) # => "(123) 555-1234 x 555"
+ # number_to_phone(1235551234, country_code: 1) # => "+1-123-555-1234"
+ # number_to_phone('123a456') # => "123a456"
+ #
+ # number_to_phone(1235551234, country_code: 1, extension: 1343, delimiter: '.')
+ # # => "+1.123.555.1234 x 1343"
+ #
+ # number_to_phone(75561234567, pattern: /(\d{1,4})(\d{4})(\d{4})$/, area_code: true)
+ # # => "(755) 6123-4567"
+ # number_to_phone(13312345678, pattern: /(\d{3})(\d{4})(\d{4})$/)
+ # # => "133-1234-5678"
+ #
+ # source://activesupport//lib/active_support/number_helper.rb#53
def number_to_phone(number, options = T.unsafe(nil)); end
+
+ # Formats a +number+ with the specified level of
+ # :precision (e.g., 112.32 has a precision of 2 if
+ # +:significant+ is +false+, and 5 if +:significant+ is +true+).
+ # You can customize the format in the +options+ hash.
+ #
+ # ==== Options
+ #
+ # * :locale - Sets the locale to be used for formatting
+ # (defaults to current locale).
+ # * :precision - Sets the precision of the number
+ # (defaults to 3). Keeps the number's precision if +nil+.
+ # * :round_mode - Determine how rounding is performed
+ # (defaults to :default. See BigDecimal::mode)
+ # * :significant - If +true+, precision will be the number
+ # of significant_digits. If +false+, the number of fractional
+ # digits (defaults to +false+).
+ # * :separator - Sets the separator between the
+ # fractional and integer digits (defaults to ".").
+ # * :delimiter - Sets the thousands delimiter (defaults
+ # to "").
+ # * :strip_insignificant_zeros - If +true+ removes
+ # insignificant zeros after the decimal separator (defaults to
+ # +false+).
+ #
+ # ==== Examples
+ #
+ # number_to_rounded(111.2345) # => "111.235"
+ # number_to_rounded(111.2345, precision: 2) # => "111.23"
+ # number_to_rounded(13, precision: 5) # => "13.00000"
+ # number_to_rounded(389.32314, precision: 0) # => "389"
+ # number_to_rounded(111.2345, significant: true) # => "111"
+ # number_to_rounded(111.2345, precision: 1, significant: true) # => "100"
+ # number_to_rounded(13, precision: 5, significant: true) # => "13.000"
+ # number_to_rounded(13, precision: nil) # => "13"
+ # number_to_rounded(389.32314, precision: 0, round_mode: :up) # => "390"
+ # number_to_rounded(111.234, locale: :fr) # => "111,234"
+ #
+ # number_to_rounded(13, precision: 5, significant: true, strip_insignificant_zeros: true)
+ # # => "13"
+ #
+ # number_to_rounded(389.32314, precision: 4, significant: true) # => "389.3"
+ # number_to_rounded(1111.2345, precision: 2, separator: ',', delimiter: '.')
+ # # => "1.111,23"
+ #
+ # source://activesupport//lib/active_support/number_helper.rb#238
def number_to_rounded(number, options = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/number_helper/number_converter.rb#11
class ActiveSupport::NumberHelper::NumberConverter
+ # @return [NumberConverter] a new instance of NumberConverter
+ #
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#123
def initialize(number, options); end
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#128
def execute; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#13
def namespace; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#13
def namespace=(_arg0); end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#13
def namespace?; end
+
+ # Returns the value of attribute number.
+ #
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#18
def number; end
+
+ # Returns the value of attribute opts.
+ #
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#18
def opts; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#16
def validate_float; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#16
def validate_float=(_arg0); end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#16
def validate_float?; end
private
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#147
def default_format_options; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#172
def default_value(key); end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#143
def format_options; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#153
def i18n_format_options; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#139
def options; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#168
def translate_in_locale(key, **i18n_options); end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#164
def translate_number_value_with_default(key, **i18n_options); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#176
def valid_float?; end
class << self
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#119
def convert(number, options); end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#13
def namespace; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#13
def namespace=(value); end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#13
def namespace?; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#16
def validate_float; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#16
def validate_float=(value); end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#16
def validate_float?; end
end
end
+# source://activesupport//lib/active_support/number_helper/number_converter.rb#20
ActiveSupport::NumberHelper::NumberConverter::DEFAULTS = T.let(T.unsafe(nil), Hash)
+# source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#7
class ActiveSupport::NumberHelper::NumberToCurrencyConverter < ::ActiveSupport::NumberHelper::NumberConverter
+ # source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#10
def convert; end
private
+ # source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#33
def i18n_opts; end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_currency_converter.rb#24
def options; end
class << self
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#13
def namespace; end
end
end
+# source://activesupport//lib/active_support/number_helper/number_to_delimited_converter.rb#7
class ActiveSupport::NumberHelper::NumberToDelimitedConverter < ::ActiveSupport::NumberHelper::NumberConverter
+ # source://activesupport//lib/active_support/number_helper/number_to_delimited_converter.rb#12
def convert; end
private
+ # source://activesupport//lib/active_support/number_helper/number_to_delimited_converter.rb#25
def delimiter_pattern; end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_delimited_converter.rb#17
def parts; end
class << self
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#16
def validate_float; end
end
end
+# source://activesupport//lib/active_support/number_helper/number_to_delimited_converter.rb#10
ActiveSupport::NumberHelper::NumberToDelimitedConverter::DEFAULT_DELIMITER_REGEX = T.let(T.unsafe(nil), Regexp)
+# source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#7
class ActiveSupport::NumberHelper::NumberToHumanConverter < ::ActiveSupport::NumberHelper::NumberConverter
+ # source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#15
def convert; end
private
+ # source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#50
def calculate_exponent(units); end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#38
def determine_unit(units, exponent); end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#34
def format; end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#55
def unit_exponents(units); end
class << self
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#13
def namespace; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#16
def validate_float; end
end
end
+# source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#8
ActiveSupport::NumberHelper::NumberToHumanConverter::DECIMAL_UNITS = T.let(T.unsafe(nil), Hash)
+
+# source://activesupport//lib/active_support/number_helper/number_to_human_converter.rb#10
ActiveSupport::NumberHelper::NumberToHumanConverter::INVERTED_DECIMAL_UNITS = T.let(T.unsafe(nil), Hash)
+# source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#7
class ActiveSupport::NumberHelper::NumberToHumanSizeConverter < ::ActiveSupport::NumberHelper::NumberConverter
+ # source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#13
def convert; end
private
+ # source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#55
def base; end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#31
def conversion_format; end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#44
def exponent; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#51
def smaller_than_base?; end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#39
def storage_unit_key; end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#35
def unit; end
class << self
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#13
def namespace; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#16
def validate_float; end
end
end
+# source://activesupport//lib/active_support/number_helper/number_to_human_size_converter.rb#8
ActiveSupport::NumberHelper::NumberToHumanSizeConverter::STORAGE_UNITS = T.let(T.unsafe(nil), Array)
+# source://activesupport//lib/active_support/number_helper/number_to_percentage_converter.rb#7
class ActiveSupport::NumberHelper::NumberToPercentageConverter < ::ActiveSupport::NumberHelper::NumberConverter
+ # source://activesupport//lib/active_support/number_helper/number_to_percentage_converter.rb#10
def convert; end
class << self
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#13
def namespace; end
end
end
+# source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#7
class ActiveSupport::NumberHelper::NumberToPhoneConverter < ::ActiveSupport::NumberHelper::NumberConverter
+ # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#8
def convert; end
private
+ # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#15
def convert_to_phone_number(number); end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#23
def convert_with_area_code(number); end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#30
def convert_without_area_code(number); end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#46
def country_code(code); end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#42
def delimiter; end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#50
def phone_ext(ext); end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#54
def regexp_pattern(default_pattern); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/number_helper/number_to_phone_converter.rb#38
def start_with_delimiter?(number); end
end
+# source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#7
class ActiveSupport::NumberHelper::NumberToRoundedConverter < ::ActiveSupport::NumberHelper::NumberConverter
+ # source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#11
def convert; end
private
+ # source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#49
def format_number(number); end
+
+ # source://activesupport//lib/active_support/number_helper/number_to_rounded_converter.rb#45
def strip_insignificant_zeros; end
class << self
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#13
def namespace; end
+
+ # source://activesupport//lib/active_support/number_helper/number_converter.rb#16
def validate_float; end
end
end
+# source://activesupport//lib/active_support/number_helper/rounding_helper.rb#5
class ActiveSupport::NumberHelper::RoundingHelper
+ # @return [RoundingHelper] a new instance of RoundingHelper
+ #
+ # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#8
def initialize(options); end
+ # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#20
def digit_count(number); end
+
+ # Returns the value of attribute options.
+ #
+ # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#6
def options; end
+
+ # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#12
def round(number); end
private
+ # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#37
def absolute_precision(number); end
+
+ # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#26
def convert_to_decimal(number); end
+
+ # source://activesupport//lib/active_support/number_helper/rounding_helper.rb#45
def significant; end
end
+# source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#7
module ActiveSupport::NumericWithFormat
+ # Provides options for converting numbers into formatted strings.
+ # Options are provided for phone numbers, currency, percentage,
+ # precision, positional notation, file size and pretty printing.
+ #
+ # ==== Options
+ #
+ # For details on which formats use which options, see ActiveSupport::NumberHelper
+ #
+ # ==== Examples
+ #
+ # Phone Numbers:
+ # 5551234.to_s(:phone) # => "555-1234"
+ # 1235551234.to_s(:phone) # => "123-555-1234"
+ # 1235551234.to_s(:phone, area_code: true) # => "(123) 555-1234"
+ # 1235551234.to_s(:phone, delimiter: ' ') # => "123 555 1234"
+ # 1235551234.to_s(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555"
+ # 1235551234.to_s(:phone, country_code: 1) # => "+1-123-555-1234"
+ # 1235551234.to_s(:phone, country_code: 1, extension: 1343, delimiter: '.')
+ # # => "+1.123.555.1234 x 1343"
+ #
+ # Currency:
+ # 1234567890.50.to_s(:currency) # => "$1,234,567,890.50"
+ # 1234567890.506.to_s(:currency) # => "$1,234,567,890.51"
+ # 1234567890.506.to_s(:currency, precision: 3) # => "$1,234,567,890.506"
+ # 1234567890.506.to_s(:currency, round_mode: :down) # => "$1,234,567,890.50"
+ # 1234567890.506.to_s(:currency, locale: :fr) # => "1 234 567 890,51 €"
+ # -1234567890.50.to_s(:currency, negative_format: '(%u%n)')
+ # # => "($1,234,567,890.50)"
+ # 1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '')
+ # # => "£1234567890,50"
+ # 1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '', format: '%n %u')
+ # # => "1234567890,50 £"
+ #
+ # Percentage:
+ # 100.to_s(:percentage) # => "100.000%"
+ # 100.to_s(:percentage, precision: 0) # => "100%"
+ # 1000.to_s(:percentage, delimiter: '.', separator: ',') # => "1.000,000%"
+ # 302.24398923423.to_s(:percentage, precision: 5) # => "302.24399%"
+ # 302.24398923423.to_s(:percentage, round_mode: :down) # => "302.243%"
+ # 1000.to_s(:percentage, locale: :fr) # => "1 000,000%"
+ # 100.to_s(:percentage, format: '%n %') # => "100.000 %"
+ #
+ # Delimited:
+ # 12345678.to_s(:delimited) # => "12,345,678"
+ # 12345678.05.to_s(:delimited) # => "12,345,678.05"
+ # 12345678.to_s(:delimited, delimiter: '.') # => "12.345.678"
+ # 12345678.to_s(:delimited, delimiter: ',') # => "12,345,678"
+ # 12345678.05.to_s(:delimited, separator: ' ') # => "12,345,678 05"
+ # 12345678.05.to_s(:delimited, locale: :fr) # => "12 345 678,05"
+ # 98765432.98.to_s(:delimited, delimiter: ' ', separator: ',')
+ # # => "98 765 432,98"
+ #
+ # Rounded:
+ # 111.2345.to_s(:rounded) # => "111.235"
+ # 111.2345.to_s(:rounded, precision: 2) # => "111.23"
+ # 111.2345.to_s(:rounded, precision: 2, round_mode: :up) # => "111.24"
+ # 13.to_s(:rounded, precision: 5) # => "13.00000"
+ # 389.32314.to_s(:rounded, precision: 0) # => "389"
+ # 111.2345.to_s(:rounded, significant: true) # => "111"
+ # 111.2345.to_s(:rounded, precision: 1, significant: true) # => "100"
+ # 13.to_s(:rounded, precision: 5, significant: true) # => "13.000"
+ # 111.234.to_s(:rounded, locale: :fr) # => "111,234"
+ # 13.to_s(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true)
+ # # => "13"
+ # 389.32314.to_s(:rounded, precision: 4, significant: true) # => "389.3"
+ # 1111.2345.to_s(:rounded, precision: 2, separator: ',', delimiter: '.')
+ # # => "1.111,23"
+ #
+ # Human-friendly size in Bytes:
+ # 123.to_s(:human_size) # => "123 Bytes"
+ # 1234.to_s(:human_size) # => "1.21 KB"
+ # 12345.to_s(:human_size) # => "12.1 KB"
+ # 1234567.to_s(:human_size) # => "1.18 MB"
+ # 1234567890.to_s(:human_size) # => "1.15 GB"
+ # 1234567890123.to_s(:human_size) # => "1.12 TB"
+ # 1234567890123456.to_s(:human_size) # => "1.1 PB"
+ # 1234567890123456789.to_s(:human_size) # => "1.07 EB"
+ # 1234567.to_s(:human_size, precision: 2) # => "1.2 MB"
+ # 1234567.to_s(:human_size, precision: 2, round_mode: :up) # => "1.3 MB"
+ # 483989.to_s(:human_size, precision: 2) # => "470 KB"
+ # 1234567.to_s(:human_size, precision: 2, separator: ',') # => "1,2 MB"
+ # 1234567890123.to_s(:human_size, precision: 5) # => "1.1228 TB"
+ # 524288000.to_s(:human_size, precision: 5) # => "500 MB"
+ #
+ # Human-friendly format:
+ # 123.to_s(:human) # => "123"
+ # 1234.to_s(:human) # => "1.23 Thousand"
+ # 12345.to_s(:human) # => "12.3 Thousand"
+ # 1234567.to_s(:human) # => "1.23 Million"
+ # 1234567890.to_s(:human) # => "1.23 Billion"
+ # 1234567890123.to_s(:human) # => "1.23 Trillion"
+ # 1234567890123456.to_s(:human) # => "1.23 Quadrillion"
+ # 1234567890123456789.to_s(:human) # => "1230 Quadrillion"
+ # 489939.to_s(:human, precision: 2) # => "490 Thousand"
+ # 489939.to_s(:human, precision: 2, round_mode: :down) # => "480 Thousand"
+ # 489939.to_s(:human, precision: 4) # => "489.9 Thousand"
+ # 1234567.to_s(:human, precision: 4,
+ # significant: false) # => "1.2346 Million"
+ # 1234567.to_s(:human, precision: 1,
+ # separator: ',',
+ # significant: false) # => "1,2 Million"
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#109
def to_s(format = T.unsafe(nil), options = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/option_merger.rb#7
class ActiveSupport::OptionMerger
+ # @return [OptionMerger] a new instance of OptionMerger
+ #
+ # source://activesupport//lib/active_support/option_merger.rb#12
def initialize(context, options); end
private
+ # source://activesupport//lib/active_support/option_merger.rb#32
def invoke_method(method, arguments, options, &block); end
+
+ # source://activesupport//lib/active_support/option_merger.rb#17
def method_missing(method, *arguments, &block); end
end
+# DEPRECATED: ActiveSupport::OrderedHash implements a hash that preserves
+# insertion order.
+#
+# oh = ActiveSupport::OrderedHash.new
+# oh[:a] = 1
+# oh[:b] = 2
+# oh.keys # => [:a, :b], this order is guaranteed
+#
+# Also, maps the +omap+ feature for YAML files
+# (See https://yaml.org/type/omap.html) to support ordered items
+# when loading from yaml.
+#
+# ActiveSupport::OrderedHash is namespaced to prevent conflicts
+# with other implementations.
+#
+# source://activesupport//lib/active_support/ordered_hash.rb#24
class ActiveSupport::OrderedHash < ::Hash
+ # source://activesupport//lib/active_support/ordered_hash.rb#29
def encode_with(coder); end
+
+ # Returns true to make sure that this hash is extractable via Array#extract_options!
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/ordered_hash.rb#46
def extractable_options?; end
+
+ # source://activesupport//lib/active_support/ordered_hash.rb#41
def nested_under_indifferent_access; end
+
+ # source://activesupport//lib/active_support/ordered_hash.rb#37
def reject(*args, &block); end
+
+ # source://activesupport//lib/active_support/ordered_hash.rb#33
def select(*args, &block); end
+
+ # source://activesupport//lib/active_support/ordered_hash.rb#25
def to_yaml_type; end
end
+# +OrderedOptions+ inherits from +Hash+ and provides dynamic accessor methods.
+#
+# With a +Hash+, key-value pairs are typically managed like this:
+#
+# h = {}
+# h[:boy] = 'John'
+# h[:girl] = 'Mary'
+# h[:boy] # => 'John'
+# h[:girl] # => 'Mary'
+# h[:dog] # => nil
+#
+# Using +OrderedOptions+, the above code can be written as:
+#
+# h = ActiveSupport::OrderedOptions.new
+# h.boy = 'John'
+# h.girl = 'Mary'
+# h.boy # => 'John'
+# h.girl # => 'Mary'
+# h.dog # => nil
+#
+# To raise an exception when the value is blank, append a
+# bang to the key name, like:
+#
+# h.dog! # => raises KeyError: :dog is blank
+#
+# source://activesupport//lib/active_support/ordered_options.rb#31
class ActiveSupport::OrderedOptions < ::Hash
+ # source://activesupport//lib/active_support/ordered_options.rb#39
def [](key); end
+
+ # source://activesupport//lib/active_support/ordered_options.rb#35
def []=(key, value); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/ordered_options.rb#62
def extractable_options?; end
+
+ # source://activesupport//lib/active_support/ordered_options.rb#66
def inspect; end
+
+ # source://activesupport//lib/active_support/ordered_options.rb#43
def method_missing(name, *args); end
protected
+ # preserve the original #[] method
def _get(_arg0); end
private
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/ordered_options.rb#58
def respond_to_missing?(name, include_private); end
end
+# NOTE: This approach has been deprecated for end-user code in favor of {thread_mattr_accessor}[rdoc-ref:Module#thread_mattr_accessor] and friends.
+# Please use that approach instead.
+#
+# This module is used to encapsulate access to thread local variables.
+#
+# Instead of polluting the thread locals namespace:
+#
+# Thread.current[:connection_handler]
+#
+# you define a class that extends this module:
+#
+# module ActiveRecord
+# class RuntimeRegistry
+# extend ActiveSupport::PerThreadRegistry
+#
+# attr_accessor :connection_handler
+# end
+# end
+#
+# and invoke the declared instance accessors as class methods. So
+#
+# ActiveRecord::RuntimeRegistry.connection_handler = connection_handler
+#
+# sets a connection handler local to the current thread, and
+#
+# ActiveRecord::RuntimeRegistry.connection_handler
+#
+# returns a connection handler local to the current thread.
+#
+# This feature is accomplished by instantiating the class and storing the
+# instance as a thread local keyed by the class name. In the example above
+# a key "ActiveRecord::RuntimeRegistry" is stored in Thread.current.
+# The class methods proxy to said thread local instance.
+#
+# If the class has an initializer, it must accept no arguments.
+#
+# source://activesupport//lib/active_support/per_thread_registry.rb#41
module ActiveSupport::PerThreadRegistry
+ # source://activesupport//lib/active_support/per_thread_registry.rb#46
def instance; end
private
- def method_missing(name, *args, &block); end
+ # source://activesupport//lib/active_support/per_thread_registry.rb#51
+ def method_missing(name, *args, **_arg2, &block); end
class << self
+ # @private
+ #
+ # source://activesupport//lib/active_support/per_thread_registry.rb#42
def extended(object); end
end
end
+# A class with no predefined methods that behaves similarly to Builder's
+# BlankSlate. Used for proxy classes.
+#
+# source://activesupport//lib/active_support/proxy_object.rb#6
class ActiveSupport::ProxyObject < ::BasicObject
+ # Let ActiveSupport::ProxyObject at least raise exceptions.
+ #
+ # source://activesupport//lib/active_support/proxy_object.rb#11
def raise(*args); end
end
+# source://activesupport//lib/active_support/core_ext/range/conversions.rb#4
module ActiveSupport::RangeWithFormat
+ # Convert range to a formatted string. See RANGE_FORMATS for predefined formats.
+ #
+ # range = (1..100) # => 1..100
+ #
+ # range.to_s # => "1..100"
+ # range.to_s(:db) # => "BETWEEN '1' AND '100'"
+ #
+ # == Adding your own range formats to to_s
+ # You can add your own formats to the Range::RANGE_FORMATS hash.
+ # Use the format name as the hash key and a Proc instance.
+ #
+ # # config/initializers/range_formats.rb
+ # Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_s(:db)} and #{stop.to_s(:db)}" }
+ #
+ # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28
def to_default_s(format = T.unsafe(nil)); end
+
+ # Convert range to a formatted string. See RANGE_FORMATS for predefined formats.
+ #
+ # range = (1..100) # => 1..100
+ #
+ # range.to_s # => "1..100"
+ # range.to_s(:db) # => "BETWEEN '1' AND '100'"
+ #
+ # == Adding your own range formats to to_s
+ # You can add your own formats to the Range::RANGE_FORMATS hash.
+ # Use the format name as the hash key and a Proc instance.
+ #
+ # # config/initializers/range_formats.rb
+ # Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_s(:db)} and #{stop.to_s(:db)}" }
+ #
+ # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28
def to_formatted_s(format = T.unsafe(nil)); end
+
+ # Convert range to a formatted string. See RANGE_FORMATS for predefined formats.
+ #
+ # range = (1..100) # => 1..100
+ #
+ # range.to_s # => "1..100"
+ # range.to_s(:db) # => "BETWEEN '1' AND '100'"
+ #
+ # == Adding your own range formats to to_s
+ # You can add your own formats to the Range::RANGE_FORMATS hash.
+ # Use the format name as the hash key and a Proc instance.
+ #
+ # # config/initializers/range_formats.rb
+ # Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_s(:db)} and #{stop.to_s(:db)}" }
+ #
+ # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28
def to_s(format = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/core_ext/range/conversions.rb#5
ActiveSupport::RangeWithFormat::RANGE_FORMATS = T.let(T.unsafe(nil), Hash)
+# --
+# This class defines several callbacks:
+#
+# to_prepare -- Run once at application startup, and also from
+# +to_run+.
+#
+# to_run -- Run before a work run that is reloading. If
+# +reload_classes_only_on_change+ is true (the default), the class
+# unload will have already occurred.
+#
+# to_complete -- Run after a work run that has reloaded. If
+# +reload_classes_only_on_change+ is false, the class unload will
+# have occurred after the work run, but before this callback.
+#
+# before_class_unload -- Run immediately before the classes are
+# unloaded.
+#
+# after_class_unload -- Run immediately after the classes are
+# unloaded.
+#
+# source://activesupport//lib/active_support/reloader.rb#27
class ActiveSupport::Reloader < ::ActiveSupport::ExecutionWrapper
+ # @return [Reloader] a new instance of Reloader
+ #
+ # source://activesupport//lib/active_support/reloader.rb#91
def initialize; end
+ # source://activesupport//lib/active_support/callbacks.rb#835
def _class_unload_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#835
def _prepare_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#823
def _run_class_unload_callbacks(&block); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#823
def _run_prepare_callbacks(&block); end
+
+ # source://activesupport//lib/active_support/reloader.rb#77
def check; end
+
+ # source://activesupport//lib/active_support/reloader.rb#77
def check=(_arg0); end
+
+ # source://activesupport//lib/active_support/reloader.rb#77
def check?; end
+
+ # source://activesupport//lib/active_support/reloader.rb#118
def class_unload!(&block); end
+
+ # source://activesupport//lib/active_support/reloader.rb#123
def complete!; end
+
+ # source://activesupport//lib/active_support/reloader.rb#76
def executor; end
+
+ # source://activesupport//lib/active_support/reloader.rb#76
def executor=(_arg0); end
+
+ # source://activesupport//lib/active_support/reloader.rb#76
def executor?; end
+
+ # Release the unload lock if it has been previously obtained
+ #
+ # source://activesupport//lib/active_support/reloader.rb#106
def release_unload_lock!; end
+
+ # Acquire the ActiveSupport::Dependencies::Interlock unload lock,
+ # ensuring it will be released automatically
+ #
+ # source://activesupport//lib/active_support/reloader.rb#98
def require_unload_lock!; end
+
+ # source://activesupport//lib/active_support/reloader.rb#113
def run!; end
class << self
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#827
def _class_unload_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#831
def _class_unload_callbacks=(value); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#827
def _prepare_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#831
def _prepare_callbacks=(value); end
+
+ # Registers a callback that will run immediately after the classes are unloaded.
+ #
+ # source://activesupport//lib/active_support/reloader.rb#43
def after_class_unload(*args, &block); end
+
+ # Registers a callback that will run immediately before the classes are unloaded.
+ #
+ # source://activesupport//lib/active_support/reloader.rb#38
def before_class_unload(*args, &block); end
+
+ # source://activesupport//lib/active_support/reloader.rb#77
def check; end
+
+ # source://activesupport//lib/active_support/reloader.rb#79
def check!; end
+
+ # source://activesupport//lib/active_support/reloader.rb#77
def check=(value); end
+
+ # source://activesupport//lib/active_support/reloader.rb#77
def check?; end
+
+ # source://activesupport//lib/active_support/reloader.rb#76
def executor; end
+
+ # source://activesupport//lib/active_support/reloader.rb#76
def executor=(value); end
+
+ # source://activesupport//lib/active_support/reloader.rb#76
def executor?; end
+
+ # source://activesupport//lib/active_support/reloader.rb#87
def prepare!; end
+
+ # Initiate a manual reload
+ #
+ # source://activesupport//lib/active_support/reloader.rb#50
def reload!; end
+
+ # source://activesupport//lib/active_support/reloader.rb#83
def reloaded!; end
+
+ # source://activesupport//lib/active_support/reloader.rb#61
def run!(reset: T.unsafe(nil)); end
+
+ # Registers a callback that will run once at application startup and every time the code is reloaded.
+ #
+ # source://activesupport//lib/active_support/reloader.rb#33
def to_prepare(*args, &block); end
+
+ # Run the supplied block as a work unit, reloading code as needed
+ #
+ # source://activesupport//lib/active_support/reloader.rb#70
def wrap; end
end
end
+# Rescuable module adds support for easier exception handling.
+#
+# source://activesupport//lib/active_support/rescuable.rb#9
module ActiveSupport::Rescuable
extend ::ActiveSupport::Concern
include GeneratedInstanceMethods
@@ -2251,7 +9165,16 @@ module ActiveSupport::Rescuable
mixes_in_class_methods GeneratedClassMethods
mixes_in_class_methods ::ActiveSupport::Rescuable::ClassMethods
+ # Internal handler lookup. Delegates to class method. Some libraries call
+ # this directly, so keeping it around for compatibility.
+ #
+ # source://activesupport//lib/active_support/rescuable.rb#170
def handler_for_rescue(exception); end
+
+ # Delegates to the class method, but uses the instance as the subject for
+ # rescue_from handlers (method calls, instance_exec blocks).
+ #
+ # source://activesupport//lib/active_support/rescuable.rb#164
def rescue_with_handler(exception); end
module GeneratedClassMethods
@@ -2267,202 +9190,637 @@ module ActiveSupport::Rescuable
end
end
+# source://activesupport//lib/active_support/rescuable.rb#16
module ActiveSupport::Rescuable::ClassMethods
+ # source://activesupport//lib/active_support/rescuable.rb#103
def handler_for_rescue(exception, object: T.unsafe(nil)); end
+
+ # Registers exception classes with a handler to be called by rescue_with_handler.
+ #
+ # rescue_from receives a series of exception classes or class
+ # names, and an exception handler specified by a trailing :with
+ # option containing the name of a method or a Proc object. Alternatively, a block
+ # can be given as the handler.
+ #
+ # Handlers that take one argument will be called with the exception, so
+ # that the exception can be inspected when dealing with it.
+ #
+ # Handlers are inherited. They are searched from right to left, from
+ # bottom to top, and up the hierarchy. The handler of the first class for
+ # which exception.is_a?(klass) holds true is the one invoked, if
+ # any.
+ #
+ # class ApplicationController < ActionController::Base
+ # rescue_from User::NotAuthorized, with: :deny_access # self defined exception
+ # rescue_from ActiveRecord::RecordInvalid, with: :show_errors
+ #
+ # rescue_from 'MyAppError::Base' do |exception|
+ # render xml: exception, status: 500
+ # end
+ #
+ # private
+ # def deny_access
+ # ...
+ # end
+ #
+ # def show_errors(exception)
+ # exception.record.new_record? ? ...
+ # end
+ # end
+ #
+ # Exceptions raised inside exception handlers are not propagated up.
+ #
+ # source://activesupport//lib/active_support/rescuable.rb#51
def rescue_from(*klasses, with: T.unsafe(nil), &block); end
+
+ # Matches an exception to a handler based on the exception class.
+ #
+ # If no handler matches the exception, check for a handler matching the
+ # (optional) exception.cause. If no handler matches the exception or its
+ # cause, this returns +nil+, so you can deal with unhandled exceptions.
+ # Be sure to re-raise unhandled exceptions if this is what you expect.
+ #
+ # begin
+ # …
+ # rescue => exception
+ # rescue_with_handler(exception) || raise
+ # end
+ #
+ # Returns the exception if it was handled and +nil+ if it was not.
+ #
+ # source://activesupport//lib/active_support/rescuable.rb#88
def rescue_with_handler(exception, object: T.unsafe(nil), visited_exceptions: T.unsafe(nil)); end
private
+ # source://activesupport//lib/active_support/rescuable.rb#137
def constantize_rescue_handler_class(class_or_name); end
+
+ # source://activesupport//lib/active_support/rescuable.rb#122
def find_rescue_handler(exception); end
end
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#162
class ActiveSupport::SafeBuffer < ::String
+ # @return [SafeBuffer] a new instance of SafeBuffer
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#200
def initialize(str = T.unsafe(nil)); end
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#254
def %(args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#247
def *(*_arg0); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#243
def +(other); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#214
def <<(value); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#181
def [](*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#235
def []=(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#219
def bytesplice(*args, value); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def capitalize(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def capitalize!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def chomp(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def chomp!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def chop(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def chop!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#210
def clone_empty; end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#214
def concat(value); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def delete(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def delete!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def delete_prefix(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def delete_prefix!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def delete_suffix(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def delete_suffix!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def downcase(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def downcase!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#277
def encode_with(coder); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#299
def gsub(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#310
def gsub!(*args, &block); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#265
def html_safe?; end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#223
def insert(index, value); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def lstrip(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def lstrip!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def next(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def next!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#227
def prepend(value); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#231
def replace(value); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def reverse(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def reverse!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def rstrip(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def rstrip!(*args); end
+
+ # @raise [SafeConcatError]
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#195
def safe_concat(value); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def scrub(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def scrub!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def slice(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def slice!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def squeeze(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def squeeze!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def strip(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def strip!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#299
def sub(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#310
def sub!(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def succ(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def succ!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def swapcase(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def swapcase!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#273
def to_param; end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#269
def to_s; end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def tr(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def tr!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def tr_s(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def tr_s!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def unicode_normalize(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def unicode_normalize!(*args); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#284
def upcase(*args, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#288
def upcase!(*args); end
private
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#326
def html_escape_interpolated_argument(arg); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#205
def initialize_copy(other); end
+
def original_concat(*_arg0); end
+
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#330
def set_block_back_references(block, match_data); end
end
+# Raised when ActiveSupport::SafeBuffer#safe_concat is called on unsafe buffers.
+#
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#175
class ActiveSupport::SafeBuffer::SafeConcatError < ::StandardError
+ # @return [SafeConcatError] a new instance of SafeConcatError
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#176
def initialize; end
end
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#163
ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS = T.let(T.unsafe(nil), Array)
+
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#169
ActiveSupport::SafeBuffer::UNSAFE_STRING_METHODS_WITH_BACKREF = T.let(T.unsafe(nil), Array)
+# The ActiveSupport::SecureCompareRotator is a wrapper around +ActiveSupport::SecurityUtils.secure_compare+
+# and allows you to rotate a previously defined value to a new one.
+#
+# It can be used as follow:
+#
+# rotator = ActiveSupport::SecureCompareRotator.new('new_production_value')
+# rotator.rotate('previous_production_value')
+# rotator.secure_compare!('previous_production_value')
+#
+# One real use case example would be to rotate a basic auth credentials:
+#
+# class MyController < ApplicationController
+# def authenticate_request
+# rotator = ActiveSupport::SecureComparerotator.new('new_password')
+# rotator.rotate('old_password')
+#
+# authenticate_or_request_with_http_basic do |username, password|
+# rotator.secure_compare!(password)
+# rescue ActiveSupport::SecureCompareRotator::InvalidMatch
+# false
+# end
+# end
+# end
+#
+# source://activesupport//lib/active_support/secure_compare_rotator.rb#30
class ActiveSupport::SecureCompareRotator
include ::ActiveSupport::Messages::Rotator
include ::ActiveSupport::SecurityUtils
+ # @return [SecureCompareRotator] a new instance of SecureCompareRotator
+ #
+ # source://activesupport//lib/active_support/messages/rotator.rb#6
+ def initialize(*secrets, on_rotation: T.unsafe(nil), **options); end
+
+ # source://activesupport//lib/active_support/secure_compare_rotator.rb#40
def secure_compare!(other_value, on_rotation: T.unsafe(nil)); end
private
+ # source://activesupport//lib/active_support/secure_compare_rotator.rb#47
def build_rotation(previous_value, _options); end
end
+# source://activesupport//lib/active_support/secure_compare_rotator.rb#34
class ActiveSupport::SecureCompareRotator::InvalidMatch < ::StandardError; end
+# source://activesupport//lib/active_support/security_utils.rb#4
module ActiveSupport::SecurityUtils
private
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/security_utils.rb#11
def fixed_length_secure_compare(a, b); end
+
+ # Secure string comparison for strings of variable length.
+ #
+ # While a timing attack would not be able to discern the content of
+ # a secret compared via secure_compare, it is possible to determine
+ # the secret length. This should be considered when using secure_compare
+ # to compare weak, short secrets to user input.
+ #
+ # source://activesupport//lib/active_support/security_utils.rb#33
def secure_compare(a, b); end
class << self
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/security_utils.rb#11
def fixed_length_secure_compare(a, b); end
+
+ # Secure string comparison for strings of variable length.
+ #
+ # While a timing attack would not be able to discern the content of
+ # a secret compared via secure_compare, it is possible to determine
+ # the secret length. This should be considered when using secure_compare
+ # to compare weak, short secrets to user input.
+ #
+ # source://activesupport//lib/active_support/security_utils.rb#33
def secure_compare(a, b); end
end
end
+# Wrapping a string in this class gives you a prettier way to test
+# for equality. The value returned by Rails.env is wrapped
+# in a StringInquirer object, so instead of calling this:
+#
+# Rails.env == 'production'
+#
+# you can call this:
+#
+# Rails.env.production?
+#
+# == Instantiating a new StringInquirer
+#
+# vehicle = ActiveSupport::StringInquirer.new('car')
+# vehicle.car? # => true
+# vehicle.bike? # => false
+#
+# source://activesupport//lib/active_support/string_inquirer.rb#21
class ActiveSupport::StringInquirer < ::String
private
+ # source://activesupport//lib/active_support/string_inquirer.rb#27
def method_missing(method_name, *arguments); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/string_inquirer.rb#23
def respond_to_missing?(method_name, include_private = T.unsafe(nil)); end
end
+# ActiveSupport::Subscriber is an object set to consume
+# ActiveSupport::Notifications. The subscriber dispatches notifications to
+# a registered object based on its given namespace.
+#
+# An example would be an Active Record subscriber responsible for collecting
+# statistics about queries:
+#
+# module ActiveRecord
+# class StatsSubscriber < ActiveSupport::Subscriber
+# attach_to :active_record
+#
+# def sql(event)
+# Statsd.timing("sql.#{event.payload[:name]}", event.duration)
+# end
+# end
+# end
+#
+# After configured, whenever a "sql.active_record" notification is published,
+# it will properly dispatch the event (ActiveSupport::Notifications::Event) to
+# the +sql+ method.
+#
+# We can detach a subscriber as well:
+#
+# ActiveRecord::StatsSubscriber.detach_from(:active_record)
+#
+# source://activesupport//lib/active_support/subscriber.rb#31
class ActiveSupport::Subscriber
+ # @return [Subscriber] a new instance of Subscriber
+ #
+ # source://activesupport//lib/active_support/subscriber.rb#129
def initialize; end
+ # source://activesupport//lib/active_support/subscriber.rb#144
def finish(name, id, payload); end
+
+ # source://activesupport//lib/active_support/subscriber.rb#127
def patterns; end
+
+ # source://activesupport//lib/active_support/subscriber.rb#135
def start(name, id, payload); end
private
+ # source://activesupport//lib/active_support/subscriber.rb#154
def event_stack; end
class << self
+ # Attach the subscriber to a namespace.
+ #
+ # source://activesupport//lib/active_support/subscriber.rb#34
def attach_to(namespace, subscriber = T.unsafe(nil), notifier = T.unsafe(nil), inherit_all: T.unsafe(nil)); end
+
+ # Detach the subscriber from a namespace.
+ #
+ # source://activesupport//lib/active_support/subscriber.rb#49
def detach_from(namespace, notifier = T.unsafe(nil)); end
+
+ # Adds event subscribers for all new methods added to the class.
+ #
+ # source://activesupport//lib/active_support/subscriber.rb#68
def method_added(event); end
+
+ # source://activesupport//lib/active_support/subscriber.rb#77
def subscribers; end
private
+ # source://activesupport//lib/active_support/subscriber.rb#84
def add_event_subscriber(event); end
+
+ # source://activesupport//lib/active_support/subscriber.rb#122
def fetch_public_methods(subscriber, inherit_all); end
+
+ # source://activesupport//lib/active_support/subscriber.rb#106
def find_attached_subscriber; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/subscriber.rb#110
def invalid_event?(event); end
+
+ # Returns the value of attribute namespace.
+ #
+ # source://activesupport//lib/active_support/subscriber.rb#82
def namespace; end
+
+ # Returns the value of attribute notifier.
+ #
+ # source://activesupport//lib/active_support/subscriber.rb#82
def notifier; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/subscriber.rb#118
def pattern_subscribed?(pattern); end
+
+ # source://activesupport//lib/active_support/subscriber.rb#114
def prepare_pattern(event); end
+
+ # source://activesupport//lib/active_support/subscriber.rb#95
def remove_event_subscriber(event); end
+
+ # Returns the value of attribute subscriber.
+ #
+ # source://activesupport//lib/active_support/subscriber.rb#82
def subscriber; end
end
end
+# This is a registry for all the event stacks kept for subscribers.
+#
+# See the documentation of ActiveSupport::PerThreadRegistry
+# for further details.
+#
+# source://activesupport//lib/active_support/subscriber.rb#163
class ActiveSupport::SubscriberQueueRegistry
extend ::ActiveSupport::PerThreadRegistry
+ # @return [SubscriberQueueRegistry] a new instance of SubscriberQueueRegistry
+ #
+ # source://activesupport//lib/active_support/subscriber.rb#166
def initialize; end
+ # source://activesupport//lib/active_support/subscriber.rb#170
def get_queue(queue_key); end
end
+# Wraps any standard Logger object to provide tagging capabilities.
+#
+# May be called with a block:
+#
+# logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
+# logger.tagged('BCX') { logger.info 'Stuff' } # Logs "[BCX] Stuff"
+# logger.tagged('BCX', "Jason") { logger.info 'Stuff' } # Logs "[BCX] [Jason] Stuff"
+# logger.tagged('BCX') { logger.tagged('Jason') { logger.info 'Stuff' } } # Logs "[BCX] [Jason] Stuff"
+#
+# If called without a block, a new logger will be returned with applied tags:
+#
+# logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
+# logger.tagged("BCX").info "Stuff" # Logs "[BCX] Stuff"
+# logger.tagged("BCX", "Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff"
+# logger.tagged("BCX").tagged("Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff"
+#
+# This is used by the default Rails.logger as configured by Railties to make
+# it easy to stamp log lines with subdomains, request ids, and anything else
+# to aid debugging of multi-user production applications.
+#
+# source://activesupport//lib/active_support/tagged_logging.rb#28
module ActiveSupport::TaggedLogging
- def clear_tags!(*args, &block); end
+ # source://activesupport//lib/active_support/tagged_logging.rb#95
+ def clear_tags!(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/tagged_logging.rb#108
def flush; end
- def pop_tags(*args, &block); end
- def push_tags(*args, &block); end
+
+ # source://activesupport//lib/active_support/tagged_logging.rb#95
+ def pop_tags(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/tagged_logging.rb#95
+ def push_tags(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/tagged_logging.rb#97
def tagged(*tags); end
class << self
+ # source://activesupport//lib/active_support/tagged_logging.rb#81
def new(logger); end
end
end
+# source://activesupport//lib/active_support/tagged_logging.rb#29
module ActiveSupport::TaggedLogging::Formatter
+ # This method is invoked when a log event occurs.
+ #
+ # source://activesupport//lib/active_support/tagged_logging.rb#31
def call(severity, timestamp, progname, msg); end
+
+ # source://activesupport//lib/active_support/tagged_logging.rb#53
def clear_tags!; end
+
+ # source://activesupport//lib/active_support/tagged_logging.rb#57
def current_tags; end
+
+ # source://activesupport//lib/active_support/tagged_logging.rb#49
def pop_tags(size = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/tagged_logging.rb#42
def push_tags(*tags); end
+
+ # source://activesupport//lib/active_support/tagged_logging.rb#35
def tagged(*tags); end
+
+ # source://activesupport//lib/active_support/tagged_logging.rb#63
def tags_text; end
end
+# source://activesupport//lib/active_support/tagged_logging.rb#73
module ActiveSupport::TaggedLogging::LocalTagStorage
+ # Returns the value of attribute current_tags.
+ #
+ # source://activesupport//lib/active_support/tagged_logging.rb#74
def current_tags; end
+
+ # Sets the attribute current_tags
+ #
+ # @param value the value to set the attribute current_tags to.
+ #
+ # source://activesupport//lib/active_support/tagged_logging.rb#74
def current_tags=(_arg0); end
class << self
+ # @private
+ #
+ # source://activesupport//lib/active_support/tagged_logging.rb#76
def extended(base); end
end
end
+# source://activesupport//lib/active_support/test_case.rb#18
class ActiveSupport::TestCase < ::Minitest::Test
include ::ActiveSupport::Testing::SetupAndTeardown
include ::ActiveSupport::Testing::TaggedLogging
@@ -2476,89 +9834,456 @@ class ActiveSupport::TestCase < ::Minitest::Test
extend ::ActiveSupport::Testing::SetupAndTeardown::ClassMethods
extend ::ActiveSupport::Testing::Declarative
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks?; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#823
def _run_setup_callbacks(&block); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#823
def _run_teardown_callbacks(&block); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#835
def _setup_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#835
def _teardown_callbacks; end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#735
def assert_no_match(matcher, obj, msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#664
def assert_not_empty(obj, msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#675
def assert_not_equal(exp, act, msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#687
def assert_not_in_delta(exp, act, delta = T.unsafe(nil), msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#699
def assert_not_in_epsilon(a, b, epsilon = T.unsafe(nil), msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#706
def assert_not_includes(collection, obj, msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#717
def assert_not_instance_of(cls, obj, msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#727
def assert_not_kind_of(cls, obj, msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#745
def assert_not_nil(obj, msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#780
def assert_not_operator(o1, op, o2 = T.unsafe(nil), msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#803
def assert_not_predicate(o1, op, msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#811
def assert_not_respond_to(obj, meth, msg = T.unsafe(nil)); end
+
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#820
def assert_not_same(exp, act, msg = T.unsafe(nil)); end
+
+ # test/unit backwards compatibility methods
+ #
+ # source://minitest/5.20.0/lib/minitest/assertions.rb#422
def assert_raise(*exp); end
+
+ # source://activesupport//lib/active_support/testing/file_fixtures.rb#20
def file_fixture_path; end
+
+ # source://activesupport//lib/active_support/testing/file_fixtures.rb#20
def file_fixture_path?; end
+
+ # source://minitest/5.20.0/lib/minitest.rb#307
def method_name; end
class << self
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks=(value); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#67
def __callbacks?; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#827
def _setup_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#831
def _setup_callbacks=(value); end
+
+ # source://activesupport//lib/active_support/callbacks.rb#827
def _teardown_callbacks; end
+
+ # source://activesupport//lib/active_support/callbacks.rb#831
def _teardown_callbacks=(value); end
+
+ # source://activesupport//lib/active_support/testing/file_fixtures.rb#20
def file_fixture_path; end
+
+ # source://activesupport//lib/active_support/testing/file_fixtures.rb#20
def file_fixture_path=(value); end
+
+ # source://activesupport//lib/active_support/testing/file_fixtures.rb#20
def file_fixture_path?; end
+
+ # Parallelizes the test suite.
+ #
+ # Takes a +workers+ argument that controls how many times the process
+ # is forked. For each process a new database will be created suffixed
+ # with the worker number.
+ #
+ # test-database-0
+ # test-database-1
+ #
+ # If ENV["PARALLEL_WORKERS"] is set the workers argument will be ignored
+ # and the environment variable will be used instead. This is useful for CI
+ # environments, or other environments where you may need more workers than
+ # you do for local testing.
+ #
+ # If the number of workers is set to +1+ or fewer, the tests will not be
+ # parallelized.
+ #
+ # If +workers+ is set to +:number_of_processors+, the number of workers will be
+ # set to the actual core count on the machine you are on.
+ #
+ # The default parallelization method is to fork processes. If you'd like to
+ # use threads instead you can pass with: :threads to the +parallelize+
+ # method. Note the threaded parallelization does not create multiple
+ # database and will not work with system tests at this time.
+ #
+ # parallelize(workers: :number_of_processors, with: :threads)
+ #
+ # The threaded parallelization uses minitest's parallel executor directly.
+ # The processes parallelization uses a Ruby DRb server.
+ #
+ # source://activesupport//lib/active_support/test_case.rb#74
def parallelize(workers: T.unsafe(nil), with: T.unsafe(nil)); end
+
+ # Set up hook for parallel testing. This can be used if you have multiple
+ # databases or any behavior that needs to be run after the process is forked
+ # but before the tests run.
+ #
+ # Note: this feature is not available with the threaded parallelization.
+ #
+ # In your +test_helper.rb+ add the following:
+ #
+ # class ActiveSupport::TestCase
+ # parallelize_setup do
+ # # create databases
+ # end
+ # end
+ #
+ # source://activesupport//lib/active_support/test_case.rb#109
def parallelize_setup(&block); end
+
+ # Clean up hook for parallel testing. This can be used to drop databases
+ # if your app uses multiple write/read databases or other clean up before
+ # the tests finish. This runs before the forked process is closed.
+ #
+ # Note: this feature is not available with the threaded parallelization.
+ #
+ # In your +test_helper.rb+ add the following:
+ #
+ # class ActiveSupport::TestCase
+ # parallelize_teardown do
+ # # drop databases
+ # end
+ # end
+ #
+ # source://activesupport//lib/active_support/test_case.rb#128
def parallelize_teardown(&block); end
+
+ # Returns the order in which test cases are run.
+ #
+ # ActiveSupport::TestCase.test_order # => :random
+ #
+ # Possible values are +:random+, +:parallel+, +:alpha+, +:sorted+.
+ # Defaults to +:random+.
+ #
+ # source://activesupport//lib/active_support/test_case.rb#41
def test_order; end
+
+ # Sets the order in which test cases are run.
+ #
+ # ActiveSupport::TestCase.test_order = :random # => :random
+ #
+ # Valid values are:
+ # * +:random+ (to run tests in random order)
+ # * +:parallel+ (to run tests in parallel)
+ # * +:sorted+ (to run tests alphabetically by method name)
+ # * +:alpha+ (equivalent to +:sorted+)
+ #
+ # source://activesupport//lib/active_support/test_case.rb#31
def test_order=(new_order); end
end
end
+# source://activesupport//lib/active_support/test_case.rb#19
ActiveSupport::TestCase::Assertion = Minitest::Assertion
+
+# source://activesupport//lib/active_support/testing/tagged_logging.rb#4
module ActiveSupport::Testing; end
+# source://activesupport//lib/active_support/testing/assertions.rb#7
module ActiveSupport::Testing::Assertions
+ # Assertion that the result of evaluating an expression is changed before
+ # and after invoking the passed in block.
+ #
+ # assert_changes 'Status.all_good?' do
+ # post :create, params: { status: { ok: false } }
+ # end
+ #
+ # You can pass the block as a string to be evaluated in the context of
+ # the block. A lambda can be passed for the block as well.
+ #
+ # assert_changes -> { Status.all_good? } do
+ # post :create, params: { status: { ok: false } }
+ # end
+ #
+ # The assertion is useful to test side effects. The passed block can be
+ # anything that can be converted to string with #to_s.
+ #
+ # assert_changes :@object do
+ # @object = 42
+ # end
+ #
+ # The keyword arguments :from and :to can be given to specify the
+ # expected initial value and the expected value after the block was
+ # executed.
+ #
+ # assert_changes :@object, from: nil, to: :foo do
+ # @object = :foo
+ # end
+ #
+ # An error message can be specified.
+ #
+ # assert_changes -> { Status.all_good? }, 'Expected the status to be bad' do
+ # post :create, params: { status: { incident: true } }
+ # end
+ #
+ # source://activesupport//lib/active_support/testing/assertions.rb#175
def assert_changes(expression, message = T.unsafe(nil), from: T.unsafe(nil), to: T.unsafe(nil), &block); end
+
+ # Test numeric difference between the return value of an expression as a
+ # result of what is evaluated in the yielded block.
+ #
+ # assert_difference 'Article.count' do
+ # post :create, params: { article: {...} }
+ # end
+ #
+ # An arbitrary expression is passed in and evaluated.
+ #
+ # assert_difference 'Article.last.comments(:reload).size' do
+ # post :create, params: { comment: {...} }
+ # end
+ #
+ # An arbitrary positive or negative difference can be specified.
+ # The default is 1.
+ #
+ # assert_difference 'Article.count', -1 do
+ # post :delete, params: { id: ... }
+ # end
+ #
+ # An array of expressions can also be passed in and evaluated.
+ #
+ # assert_difference [ 'Article.count', 'Post.count' ], 2 do
+ # post :create, params: { article: {...} }
+ # end
+ #
+ # A hash of expressions/numeric differences can also be passed in and evaluated.
+ #
+ # assert_difference ->{ Article.count } => 1, ->{ Notification.count } => 2 do
+ # post :create, params: { article: {...} }
+ # end
+ #
+ # A lambda or a list of lambdas can be passed in and evaluated:
+ #
+ # assert_difference ->{ Article.count }, 2 do
+ # post :create, params: { article: {...} }
+ # end
+ #
+ # assert_difference [->{ Article.count }, ->{ Post.count }], 2 do
+ # post :create, params: { article: {...} }
+ # end
+ #
+ # An error message can be specified.
+ #
+ # assert_difference 'Article.count', -1, 'An Article should be destroyed' do
+ # post :delete, params: { id: ... }
+ # end
+ #
+ # source://activesupport//lib/active_support/testing/assertions.rb#86
def assert_difference(expression, *args, &block); end
+
+ # Assertion that the result of evaluating an expression is not changed before
+ # and after invoking the passed in block.
+ #
+ # assert_no_changes 'Status.all_good?' do
+ # post :create, params: { status: { ok: true } }
+ # end
+ #
+ # An error message can be specified.
+ #
+ # assert_no_changes -> { Status.all_good? }, 'Expected the status to be good' do
+ # post :create, params: { status: { ok: false } }
+ # end
+ #
+ # source://activesupport//lib/active_support/testing/assertions.rb#215
def assert_no_changes(expression, message = T.unsafe(nil), &block); end
+
+ # Assertion that the numeric result of evaluating an expression is not
+ # changed before and after invoking the passed in block.
+ #
+ # assert_no_difference 'Article.count' do
+ # post :create, params: { article: invalid_attributes }
+ # end
+ #
+ # A lambda can be passed in and evaluated.
+ #
+ # assert_no_difference -> { Article.count } do
+ # post :create, params: { article: invalid_attributes }
+ # end
+ #
+ # An error message can be specified.
+ #
+ # assert_no_difference 'Article.count', 'An Article should not be created' do
+ # post :create, params: { article: invalid_attributes }
+ # end
+ #
+ # An array of expressions can also be passed in and evaluated.
+ #
+ # assert_no_difference [ 'Article.count', -> { Post.count } ] do
+ # post :create, params: { article: invalid_attributes }
+ # end
+ #
+ # source://activesupport//lib/active_support/testing/assertions.rb#137
def assert_no_difference(expression, message = T.unsafe(nil), &block); end
+
+ # Asserts that an expression is not truthy. Passes if object is
+ # +nil+ or +false+. "Truthy" means "considered true in a conditional"
+ # like if foo.
+ #
+ # assert_not nil # => true
+ # assert_not false # => true
+ # assert_not 'foo' # => Expected "foo" to be nil or false
+ #
+ # An error message can be specified.
+ #
+ # assert_not foo, 'foo should be false'
+ #
+ # source://activesupport//lib/active_support/testing/assertions.rb#21
def assert_not(object, message = T.unsafe(nil)); end
+
+ # Assertion that the block should not raise an exception.
+ #
+ # Passes if evaluated code in the yielded block raises no exception.
+ #
+ # assert_nothing_raised do
+ # perform_service(param: 'no_exception')
+ # end
+ #
+ # source://activesupport//lib/active_support/testing/assertions.rb#33
def assert_nothing_raised; end
end
+# source://activesupport//lib/active_support/testing/assertions.rb#8
ActiveSupport::Testing::Assertions::UNTRACKED = T.let(T.unsafe(nil), Object)
+# Resolves a constant from a minitest spec name.
+#
+# Given the following spec-style test:
+#
+# describe WidgetsController, :index do
+# describe "authenticated user" do
+# describe "returns widgets" do
+# it "has a controller that exists" do
+# assert_kind_of WidgetsController, @controller
+# end
+# end
+# end
+# end
+#
+# The test will have the following name:
+#
+# "WidgetsController::index::authenticated user::returns widgets"
+#
+# The constant WidgetsController can be resolved from the name.
+# The following code will resolve the constant:
+#
+# controller = determine_constant_from_test_name(name) do |constant|
+# Class === constant && constant < ::ActionController::Metal
+# end
+#
+# source://activesupport//lib/active_support/testing/constant_lookup.rb#32
module ActiveSupport::Testing::ConstantLookup
extend ::ActiveSupport::Concern
mixes_in_class_methods ::ActiveSupport::Testing::ConstantLookup::ClassMethods
end
+# source://activesupport//lib/active_support/testing/constant_lookup.rb#35
module ActiveSupport::Testing::ConstantLookup::ClassMethods
+ # source://activesupport//lib/active_support/testing/constant_lookup.rb#36
def determine_constant_from_test_name(test_name); end
end
+# source://activesupport//lib/active_support/testing/declarative.rb#5
module ActiveSupport::Testing::Declarative
+ # Helper to define a test method using a String. Under the hood, it replaces
+ # spaces with underscores and defines the test method.
+ #
+ # test "verify something" do
+ # ...
+ # end
+ #
+ # source://activesupport//lib/active_support/testing/declarative.rb#13
def test(name, &block); end
end
+# source://activesupport//lib/active_support/testing/deprecation.rb#7
module ActiveSupport::Testing::Deprecation
+ # source://activesupport//lib/active_support/testing/deprecation.rb#8
def assert_deprecated(match = T.unsafe(nil), deprecator = T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/testing/deprecation.rb#18
def assert_not_deprecated(deprecator = T.unsafe(nil), &block); end
+
+ # source://activesupport//lib/active_support/testing/deprecation.rb#24
def collect_deprecations(deprecator = T.unsafe(nil)); end
end
+# Adds simple access to sample files called file fixtures.
+# File fixtures are normal files stored in
+# ActiveSupport::TestCase.file_fixture_path.
+#
+# File fixtures are represented as +Pathname+ objects.
+# This makes it easy to extract specific information:
+#
+# file_fixture("example.txt").read # get the file's content
+# file_fixture("example.mp3").size # get the file size
+#
+# source://activesupport//lib/active_support/testing/file_fixtures.rb#16
module ActiveSupport::Testing::FileFixtures
extend ::ActiveSupport::Concern
include GeneratedInstanceMethods
mixes_in_class_methods GeneratedClassMethods
+ # Returns a +Pathname+ to the fixture file named +fixture_name+.
+ #
+ # Raises +ArgumentError+ if +fixture_name+ can't be found.
+ #
+ # source://activesupport//lib/active_support/testing/file_fixtures.rb#26
def file_fixture(fixture_name); end
module GeneratedClassMethods
@@ -2573,814 +10298,4576 @@ module ActiveSupport::Testing::FileFixtures
end
end
+# source://activesupport//lib/active_support/testing/isolation.rb#5
module ActiveSupport::Testing::Isolation
include ::ActiveSupport::Testing::Isolation::Forking
+ # source://activesupport//lib/active_support/testing/isolation.rb#18
def run; end
class << self
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/testing/isolation.rb#14
def forking_env?; end
+
+ # source://activesupport//lib/active_support/testing/isolation.rb#8
def included(klass); end
end
end
+# source://activesupport//lib/active_support/testing/isolation.rb#26
module ActiveSupport::Testing::Isolation::Forking
+ # source://activesupport//lib/active_support/testing/isolation.rb#27
def run_in_isolation(&blk); end
end
+# source://activesupport//lib/active_support/testing/isolation.rb#63
module ActiveSupport::Testing::Isolation::Subprocess
+ # Crazy H4X to get this working in windows / jruby with
+ # no forking.
+ #
+ # source://activesupport//lib/active_support/testing/isolation.rb#68
def run_in_isolation(&blk); end
end
+# source://activesupport//lib/active_support/testing/isolation.rb#64
ActiveSupport::Testing::Isolation::Subprocess::ORIG_ARGV = T.let(T.unsafe(nil), Array)
+# source://activesupport//lib/active_support/testing/parallelization/server.rb#8
class ActiveSupport::Testing::Parallelization
+ # @return [Parallelization] a new instance of Parallelization
+ #
+ # source://activesupport//lib/active_support/testing/parallelization.rb#28
def initialize(worker_count); end
+ # source://activesupport//lib/active_support/testing/parallelization.rb#41
def <<(work); end
+
+ # source://activesupport//lib/active_support/testing/parallelization.rb#18
def after_fork_hooks; end
+
+ # source://activesupport//lib/active_support/testing/parallelization.rb#26
def run_cleanup_hooks; end
+
+ # source://activesupport//lib/active_support/testing/parallelization.rb#45
def shutdown; end
+
+ # source://activesupport//lib/active_support/testing/parallelization.rb#35
def start; end
class << self
+ # source://activesupport//lib/active_support/testing/parallelization.rb#14
def after_fork_hook(&blk); end
+
+ # source://activesupport//lib/active_support/testing/parallelization.rb#18
def after_fork_hooks; end
+
+ # source://activesupport//lib/active_support/testing/parallelization.rb#22
def run_cleanup_hook(&blk); end
+
+ # source://activesupport//lib/active_support/testing/parallelization.rb#26
def run_cleanup_hooks; end
end
end
+# source://activesupport//lib/active_support/testing/parallelization/server.rb#9
class ActiveSupport::Testing::Parallelization::Server
include ::DRb::DRbUndumped
+ # @return [Server] a new instance of Server
+ #
+ # source://activesupport//lib/active_support/testing/parallelization/server.rb#12
def initialize; end
+ # source://activesupport//lib/active_support/testing/parallelization/server.rb#28
def <<(o); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/testing/parallelization/server.rb#48
def active_workers?; end
+
+ # source://activesupport//lib/active_support/testing/parallelization/server.rb#33
def pop; end
+
+ # @raise [DRb::DRbConnError]
+ #
+ # source://activesupport//lib/active_support/testing/parallelization/server.rb#18
def record(reporter, result); end
+
+ # source://activesupport//lib/active_support/testing/parallelization/server.rb#52
def shutdown; end
+
+ # source://activesupport//lib/active_support/testing/parallelization/server.rb#40
def start_worker(worker_id); end
+
+ # source://activesupport//lib/active_support/testing/parallelization/server.rb#44
def stop_worker(worker_id); end
end
+# source://activesupport//lib/active_support/testing/parallelization/worker.rb#6
class ActiveSupport::Testing::Parallelization::Worker
+ # @return [Worker] a new instance of Worker
+ #
+ # source://activesupport//lib/active_support/testing/parallelization/worker.rb#7
def initialize(number, url); end
+ # source://activesupport//lib/active_support/testing/parallelization/worker.rb#77
def after_fork; end
+
+ # source://activesupport//lib/active_support/testing/parallelization/worker.rb#42
def perform_job(job); end
+
+ # source://activesupport//lib/active_support/testing/parallelization/worker.rb#83
def run_cleanup; end
+
+ # source://activesupport//lib/active_support/testing/parallelization/worker.rb#56
def safe_record(reporter, result); end
+
+ # source://activesupport//lib/active_support/testing/parallelization/worker.rb#14
def start; end
+
+ # source://activesupport//lib/active_support/testing/parallelization/worker.rb#36
def work_from_queue; end
private
+ # source://activesupport//lib/active_support/testing/parallelization/worker.rb#90
def add_setup_exception(result); end
+
+ # source://activesupport//lib/active_support/testing/parallelization/worker.rb#94
def set_process_title(status); end
end
+# Adds support for +setup+ and +teardown+ callbacks.
+# These callbacks serve as a replacement to overwriting the
+# #setup and #teardown methods of your TestCase.
+#
+# class ExampleTest < ActiveSupport::TestCase
+# setup do
+# # ...
+# end
+#
+# teardown do
+# # ...
+# end
+# end
+#
+# source://activesupport//lib/active_support/testing/setup_and_teardown.rb#20
module ActiveSupport::Testing::SetupAndTeardown
+ # source://activesupport//lib/active_support/testing/setup_and_teardown.rb#44
def after_teardown; end
+
+ # source://activesupport//lib/active_support/testing/setup_and_teardown.rb#39
def before_setup; end
class << self
+ # source://activesupport//lib/active_support/testing/setup_and_teardown.rb#21
def prepended(klass); end
end
end
+# source://activesupport//lib/active_support/testing/setup_and_teardown.rb#27
module ActiveSupport::Testing::SetupAndTeardown::ClassMethods
+ # Add a callback, which runs before TestCase#setup.
+ #
+ # source://activesupport//lib/active_support/testing/setup_and_teardown.rb#29
def setup(*args, &block); end
+
+ # Add a callback, which runs after TestCase#teardown.
+ #
+ # source://activesupport//lib/active_support/testing/setup_and_teardown.rb#34
def teardown(*args, &block); end
end
+# Manages stubs for TimeHelpers
+#
+# source://activesupport//lib/active_support/testing/time_helpers.rb#10
class ActiveSupport::Testing::SimpleStubs
+ # @return [SimpleStubs] a new instance of SimpleStubs
+ #
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#13
def initialize; end
+ # Stubs object.method_name with the given block
+ # If the method is already stubbed, remove that stub
+ # so that removing this stub will restore the original implementation.
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ # target = Time.zone.local(2004, 11, 24, 1, 4, 44)
+ # simple_stubs.stub_object(Time, :now) { at(target.to_i) }
+ # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
+ #
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#24
def stub_object(object, method_name, &block); end
+
+ # Returns true if any stubs are set, false if there are none
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#54
def stubbed?; end
+
+ # Returns the Stub for object#method_name
+ # (nil if it is not stubbed)
+ #
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#49
def stubbing(object, method_name); end
+
+ # Remove all object-method stubs held by this instance
+ #
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#38
def unstub_all!; end
private
+ # Restores the original object.method described by the Stub
+ #
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#60
def unstub_object(stub); end
end
+# source://activesupport//lib/active_support/testing/time_helpers.rb#11
class ActiveSupport::Testing::SimpleStubs::Stub < ::Struct
+ # Returns the value of attribute method_name
+ #
+ # @return [Object] the current value of method_name
def method_name; end
+
+ # Sets the attribute method_name
+ #
+ # @param value [Object] the value to set the attribute method_name to.
+ # @return [Object] the newly set value
def method_name=(_); end
+
+ # Returns the value of attribute object
+ #
+ # @return [Object] the current value of object
def object; end
+
+ # Sets the attribute object
+ #
+ # @param value [Object] the value to set the attribute object to.
+ # @return [Object] the newly set value
def object=(_); end
+
+ # Returns the value of attribute original_method
+ #
+ # @return [Object] the current value of original_method
def original_method; end
+
+ # Sets the attribute original_method
+ #
+ # @param value [Object] the value to set the attribute original_method to.
+ # @return [Object] the newly set value
def original_method=(_); end
class << self
def [](*_arg0); end
def inspect; end
+ def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
+# Logs a "PostsControllerTest: test name" heading before each test to
+# make test.log easier to search and follow along with.
+#
+# source://activesupport//lib/active_support/testing/tagged_logging.rb#7
module ActiveSupport::Testing::TaggedLogging
+ # source://activesupport//lib/active_support/testing/tagged_logging.rb#10
def before_setup; end
+
+ # source://activesupport//lib/active_support/testing/tagged_logging.rb#8
def tagged_logger=(_arg0); end
private
+ # source://activesupport//lib/active_support/testing/tagged_logging.rb#22
def tagged_logger; end
end
+# Contains helpers that help you test passage of time.
+#
+# source://activesupport//lib/active_support/testing/time_helpers.rb#69
module ActiveSupport::Testing::TimeHelpers
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#70
def after_teardown; end
+
+ # Calls +travel_to+ with +Time.now+.
+ #
+ # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00
+ # freeze_time
+ # sleep(1)
+ # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00
+ #
+ # This method also accepts a block, which will return the current time back to its original
+ # state at the end of the block:
+ #
+ # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00
+ # freeze_time do
+ # sleep(1)
+ # User.create.created_at # => Sun, 09 Jul 2017 15:34:49 EST -05:00
+ # end
+ # Time.current # => Sun, 09 Jul 2017 15:34:50 EST -05:00
+ #
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#225
def freeze_time(&block); end
+
+ # Changes current time to the time in the future or in the past by a given time difference by
+ # stubbing +Time.now+, +Date.today+, and +DateTime.now+. The stubs are automatically removed
+ # at the end of the test.
+ #
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ # travel 1.day
+ # Time.current # => Sun, 10 Nov 2013 15:34:49 EST -05:00
+ # Date.current # => Sun, 10 Nov 2013
+ # DateTime.current # => Sun, 10 Nov 2013 15:34:49 -0500
+ #
+ # This method also accepts a block, which will return the current time back to its original
+ # state at the end of the block:
+ #
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ # travel 1.day do
+ # User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00
+ # end
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ #
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#93
def travel(duration, &block); end
+
+ # Returns the current time back to its original state, by removing the stubs added by
+ # +travel+, +travel_to+, and +freeze_time+.
+ #
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ #
+ # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
+ # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
+ #
+ # travel_back
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ #
+ # This method also accepts a block, which brings the stubs back at the end of the block:
+ #
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ #
+ # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
+ # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
+ #
+ # travel_back do
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ # end
+ #
+ # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
+ #
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#199
def travel_back; end
+
+ # Changes current time to the given time by stubbing +Time.now+,
+ # +Date.today+, and +DateTime.now+ to return the time or date passed into this method.
+ # The stubs are automatically removed at the end of the test.
+ #
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
+ # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
+ # Date.current # => Wed, 24 Nov 2004
+ # DateTime.current # => Wed, 24 Nov 2004 01:04:44 -0500
+ #
+ # Dates are taken as their timestamp at the beginning of the day in the
+ # application time zone. Time.current returns said timestamp,
+ # and Time.now its equivalent in the system time zone. Similarly,
+ # Date.current returns a date equal to the argument, and
+ # Date.today the date according to Time.now, which may
+ # be different. (Note that you rarely want to deal with Time.now,
+ # or Date.today, in order to honor the application time zone
+ # please always use Time.current and Date.current.)
+ #
+ # Note that the usec for the time passed will be set to 0 to prevent rounding
+ # errors with external services, like MySQL (which will round instead of floor,
+ # leading to off-by-one-second errors).
+ #
+ # This method also accepts a block, which will return the current time back to its original
+ # state at the end of the block:
+ #
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44) do
+ # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
+ # end
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ #
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#128
def travel_to(date_or_time); end
+
+ # Returns the current time back to its original state, by removing the stubs added by
+ # +travel+, +travel_to+, and +freeze_time+.
+ #
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ #
+ # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
+ # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
+ #
+ # travel_back
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ #
+ # This method also accepts a block, which brings the stubs back at the end of the block:
+ #
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ #
+ # travel_to Time.zone.local(2004, 11, 24, 1, 4, 44)
+ # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
+ #
+ # travel_back do
+ # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
+ # end
+ #
+ # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
+ #
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#199
def unfreeze_time; end
private
+ # source://activesupport//lib/active_support/testing/time_helpers.rb#230
def simple_stubs; end
end
+# A Time-like class that can represent a time in any time zone. Necessary
+# because standard Ruby Time instances are limited to UTC and the
+# system's ENV['TZ'] zone.
+#
+# You shouldn't ever need to create a TimeWithZone instance directly via +new+.
+# Instead use methods +local+, +parse+, +at+ and +now+ on TimeZone instances,
+# and +in_time_zone+ on Time and DateTime instances.
+#
+# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+# Time.zone.local(2007, 2, 10, 15, 30, 45) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00
+# Time.zone.parse('2007-02-10 15:30:45') # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00
+# Time.zone.at(1171139445) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00
+# Time.zone.now # => Sun, 18 May 2008 13:07:55.754107581 EDT -04:00
+# Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00
+#
+# See Time and TimeZone for further documentation of these methods.
+#
+# TimeWithZone instances implement the same API as Ruby Time instances, so
+# that Time and TimeWithZone instances are interchangeable.
+#
+# t = Time.zone.now # => Sun, 18 May 2008 13:27:25.031505668 EDT -04:00
+# t.hour # => 13
+# t.dst? # => true
+# t.utc_offset # => -14400
+# t.zone # => "EDT"
+# t.to_s(:rfc822) # => "Sun, 18 May 2008 13:27:25 -0400"
+# t + 1.day # => Mon, 19 May 2008 13:27:25.031505668 EDT -04:00
+# t.beginning_of_year # => Tue, 01 Jan 2008 00:00:00.000000000 EST -05:00
+# t > Time.utc(1999) # => true
+# t.is_a?(Time) # => true
+# t.is_a?(ActiveSupport::TimeWithZone) # => true
+#
+# source://activesupport//lib/active_support/time_with_zone.rb#40
class ActiveSupport::TimeWithZone
include ::DateAndTime::Compatibility
include ::Comparable
+ # @return [TimeWithZone] a new instance of TimeWithZone
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#52
def initialize(utc_time, time_zone, local_time = T.unsafe(nil), period = T.unsafe(nil)); end
+ # Adds an interval of time to the current object's time and returns that
+ # value as a new TimeWithZone object.
+ #
+ # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+ # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00
+ # now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00
+ #
+ # If we're adding a Duration of variable length (i.e., years, months, days),
+ # move forward from #time, otherwise move forward from #utc, for accuracy
+ # when moving across DST boundaries.
+ #
+ # For instance, a time + 24.hours will advance exactly 24 hours, while a
+ # time + 1.day will advance 23-25 hours, depending on the day.
+ #
+ # now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00
+ # now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#292
def +(other); end
+
+ # Subtracts an interval of time and returns a new TimeWithZone object unless
+ # the other value +acts_like?+ time. Then it will return a Float of the difference
+ # between the two times that represents the difference between the current
+ # object's time and the +other+ time.
+ #
+ # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+ # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00
+ # now - 1000 # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00
+ #
+ # If subtracting a Duration of variable length (i.e., years, months, days),
+ # move backward from #time, otherwise move backward from #utc, for accuracy
+ # when moving across DST boundaries.
+ #
+ # For instance, a time - 24.hours will go subtract exactly 24 hours, while a
+ # time - 1.day will subtract 23-25 hours, depending on the day.
+ #
+ # now - 24.hours # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00
+ # now - 1.day # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00
+ #
+ # If both the TimeWithZone object and the other value act like Time, a Float
+ # will be returned.
+ #
+ # Time.zone.now - 1.day.ago # => 86399.999967
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#327
def -(other); end
+
+ # Use the time in UTC for comparisons.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#225
def <=>(other); end
+
+ # So that +self+ acts_like?(:time).
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#488
def acts_like_time?; end
+
+ # Uses Date to provide precise Time calculations for years, months, and days
+ # according to the proleptic Gregorian calendar. The result is returned as a
+ # new TimeWithZone object.
+ #
+ # The +options+ parameter takes a hash with any of these keys:
+ # :years, :months, :weeks, :days,
+ # :hours, :minutes, :seconds.
+ #
+ # If advancing by a value of variable length (i.e., years, weeks, months,
+ # days), move forward from #time, otherwise move forward from #utc, for
+ # accuracy when moving across DST boundaries.
+ #
+ # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+ # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.558049687 EDT -04:00
+ # now.advance(seconds: 1) # => Sun, 02 Nov 2014 01:26:29.558049687 EDT -04:00
+ # now.advance(minutes: 1) # => Sun, 02 Nov 2014 01:27:28.558049687 EDT -04:00
+ # now.advance(hours: 1) # => Sun, 02 Nov 2014 01:26:28.558049687 EST -05:00
+ # now.advance(days: 1) # => Mon, 03 Nov 2014 01:26:28.558049687 EST -05:00
+ # now.advance(weeks: 1) # => Sun, 09 Nov 2014 01:26:28.558049687 EST -05:00
+ # now.advance(months: 1) # => Tue, 02 Dec 2014 01:26:28.558049687 EST -05:00
+ # now.advance(years: 1) # => Mon, 02 Nov 2015 01:26:28.558049687 EST -05:00
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#416
def advance(options); end
+
def after?(_arg0); end
+
+ # Subtracts an interval of time from the current object's time and returns
+ # the result as a new TimeWithZone object.
+ #
+ # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+ # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00
+ # now.ago(1000) # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00
+ #
+ # If we're subtracting a Duration of variable length (i.e., years, months,
+ # days), move backward from #time, otherwise move backward from #utc, for
+ # accuracy when moving across DST boundaries.
+ #
+ # For instance, time.ago(24.hours) will move back exactly 24 hours,
+ # while time.ago(1.day) will move back 23-25 hours, depending on
+ # the day.
+ #
+ # now.ago(24.hours) # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00
+ # now.ago(1.day) # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#355
def ago(other); end
+
+ # Coerces time to a string for JSON encoding. The default format is ISO 8601.
+ # You can get %Y/%m/%d %H:%M:%S +offset style by setting
+ # ActiveSupport::JSON::Encoding.use_standard_json_time_format
+ # to +false+.
+ #
+ # # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = true
+ # Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").to_json
+ # # => "2005-02-01T05:15:10.000-10:00"
+ #
+ # # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = false
+ # Time.utc(2005,2,1,15,15,10).in_time_zone("Hawaii").to_json
+ # # => "2005/02/01 05:15:10 -1000"
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#167
def as_json(options = T.unsafe(nil)); end
+
def before?(_arg0); end
+
+ # Returns true if the current object's time is within the specified
+ # +min+ and +max+ time.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#233
def between?(min, max); end
+
+ # An instance of ActiveSupport::TimeWithZone is never blank
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#499
def blank?; end
+
+ # Returns a new +ActiveSupport::TimeWithZone+ where one or more of the elements have
+ # been changed according to the +options+ parameter. The time options (:hour,
+ # :min, :sec, :usec, :nsec) reset cascadingly,
+ # so if only the hour is passed, then minute, sec, usec and nsec is set to 0. If the
+ # hour and minute is passed, then sec, usec and nsec is set to 0. The +options+
+ # parameter takes a hash with any of these keys: :year, :month,
+ # :day, :hour, :min, :sec, :usec,
+ # :nsec, :offset, :zone. Pass either :usec
+ # or :nsec, not both. Similarly, pass either :zone or
+ # :offset, not both.
+ #
+ # t = Time.zone.now # => Fri, 14 Apr 2017 11:45:15.116992711 EST -05:00
+ # t.change(year: 2020) # => Tue, 14 Apr 2020 11:45:15.116992711 EST -05:00
+ # t.change(hour: 12) # => Fri, 14 Apr 2017 12:00:00.116992711 EST -05:00
+ # t.change(min: 30) # => Fri, 14 Apr 2017 11:30:00.116992711 EST -05:00
+ # t.change(offset: "-10:00") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00
+ # t.change(zone: "Hawaii") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#376
def change(options); end
+
+ # Returns a Time instance of the simultaneous time in the UTC timezone.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#64
def comparable_time; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def day; end
+
+ # Returns true if the current time is within Daylight Savings Time for the
+ # specified time zone.
+ #
+ # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+ # Time.zone.parse("2012-5-30").dst? # => true
+ # Time.zone.parse("2012-11-30").dst? # => false
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#95
def dst?; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#179
def encode_with(coder); end
+
+ # Returns +true+ if +other+ is equal to current object.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#268
def eql?(other); end
+
+ # Returns a formatted string of the offset from UTC, or an alternative
+ # string if the time zone is already UTC.
+ #
+ # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)"
+ # Time.zone.now.formatted_offset(true) # => "-05:00"
+ # Time.zone.now.formatted_offset(false) # => "-0500"
+ # Time.zone = 'UTC' # => "UTC"
+ # Time.zone.now.formatted_offset(true, "0") # => "0"
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#126
def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#503
def freeze; end
+
+ # Returns true if the current object's time is in the future.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#263
def future?; end
+
+ # Returns a Time instance of the simultaneous time in the UTC timezone.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#64
def getgm; end
+
+ # Returns a Time instance of the simultaneous time in the system timezone.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#84
def getlocal(utc_offset = T.unsafe(nil)); end
+
+ # Returns a Time instance of the simultaneous time in the UTC timezone.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#64
def getutc; end
+
+ # Returns true if the current time zone is set to UTC.
+ #
+ # Time.zone = 'UTC' # => 'UTC'
+ # Time.zone.now.utc? # => true
+ # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+ # Time.zone.now.utc? # => false
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#106
def gmt?; end
+
+ # Returns the offset from current time to UTC time in seconds.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#112
def gmt_offset; end
+
+ # Returns a Time instance of the simultaneous time in the UTC timezone.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#64
def gmtime; end
+
+ # Returns the offset from current time to UTC time in seconds.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#112
def gmtoff; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#272
def hash; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def hour; end
+
+ # Returns a string of the object's date and time in the format used by
+ # HTTP requests.
+ #
+ # Time.zone.now.httpdate # => "Tue, 01 Jan 2013 04:39:43 GMT"
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#188
def httpdate; end
+
+ # Adds an interval of time to the current object's time and returns that
+ # value as a new TimeWithZone object.
+ #
+ # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+ # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00
+ # now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00
+ #
+ # If we're adding a Duration of variable length (i.e., years, months, days),
+ # move forward from #time, otherwise move forward from #utc, for accuracy
+ # when moving across DST boundaries.
+ #
+ # For instance, a time + 24.hours will advance exactly 24 hours, while a
+ # time + 1.day will advance 23-25 hours, depending on the day.
+ #
+ # now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00
+ # now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#292
def in(other); end
+
+ # Returns the simultaneous time in Time.zone, or the specified zone.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#78
def in_time_zone(new_zone = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#175
def init_with(coder); end
+
+ # Returns a string of the object's date, time, zone, and offset from UTC.
+ #
+ # Time.zone.now.inspect # => "Thu, 04 Dec 2014 11:00:25.624541392 EST -05:00"
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#141
def inspect; end
+
+ # Say we're a Time to thwart type checking.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#493
def is_a?(klass); end
+
+ # Returns true if the current time is within Daylight Savings Time for the
+ # specified time zone.
+ #
+ # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+ # Time.zone.parse("2012-5-30").dst? # => true
+ # Time.zone.parse("2012-11-30").dst? # => false
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#95
def isdst; end
+
+ # Returns a string of the object's date and time in the ISO 8601 standard
+ # format.
+ #
+ # Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00"
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#149
def iso8601(fraction_digits = T.unsafe(nil)); end
+
+ # Say we're a Time to thwart type checking.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#493
def kind_of?(klass); end
+
+ # Returns a Time instance of the simultaneous time in the system timezone.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#84
def localtime(utc_offset = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#509
def marshal_dump; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#513
def marshal_load(variables); end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def mday; end
+
+ # Send the missing method to +time+ instance, and wrap result in a new
+ # TimeWithZone with the existing +time_zone+.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#534
def method_missing(sym, *args, &block); end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def min; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def mon; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def month; end
+
+ # Returns true if the current object's time falls within
+ # the next day (tomorrow).
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#250
def next_day?; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def nsec; end
+
+ # Returns true if the current object's time is in the past.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#238
def past?; end
+
+ # Returns the underlying TZInfo::TimezonePeriod.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#73
def period; end
+
+ # Returns true if the current object's time falls within
+ # the previous day (yesterday).
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#257
def prev_day?; end
+
+ # respond_to_missing? is not called in some cases, such as when type conversion is
+ # performed with Kernel#String
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#519
def respond_to?(sym, include_priv = T.unsafe(nil)); end
+
+ # Returns a string of the object's date and time in the RFC 2822 standard
+ # format.
+ #
+ # Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000"
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#196
def rfc2822; end
+
+ # Returns a string of the object's date and time in the ISO 8601 standard
+ # format.
+ #
+ # Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00"
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#149
def rfc3339(fraction_digits = T.unsafe(nil)); end
+
+ # Returns a string of the object's date and time in the RFC 2822 standard
+ # format.
+ #
+ # Time.zone.now.rfc2822 # => "Tue, 01 Jan 2013 04:51:39 +0000"
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#196
def rfc822; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def sec; end
+
+ # Adds an interval of time to the current object's time and returns that
+ # value as a new TimeWithZone object.
+ #
+ # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+ # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00
+ # now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00
+ #
+ # If we're adding a Duration of variable length (i.e., years, months, days),
+ # move forward from #time, otherwise move forward from #utc, for accuracy
+ # when moving across DST boundaries.
+ #
+ # For instance, a time + 24.hours will advance exactly 24 hours, while a
+ # time + 1.day will advance 23-25 hours, depending on the day.
+ #
+ # now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00
+ # now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#292
def since(other); end
+
+ # Replaces %Z directive with +zone before passing to Time#strftime,
+ # so that zone information is correct.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#219
def strftime(format); end
+
+ # Returns a Time instance that represents the time in +time_zone+.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#59
def time; end
+
+ # Returns the value of attribute time_zone.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#50
def time_zone; end
+
+ # Returns Array of parts of Time in sequence of
+ # [seconds, minutes, hours, day, month, year, weekday, yearday, dst?, zone].
+ #
+ # now = Time.zone.now # => Tue, 18 Aug 2015 02:29:27.485278555 UTC +00:00
+ # now.to_a # => [27, 29, 2, 18, 8, 2015, 2, 230, false, "UTC"]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#439
def to_a; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def to_date; end
+
+ # Returns an instance of DateTime with the timezone's UTC offset
+ #
+ # Time.zone.now.to_datetime # => Tue, 18 Aug 2015 02:32:20 +0000
+ # Time.current.in_time_zone('Hawaii').to_datetime # => Mon, 17 Aug 2015 16:32:20 -1000
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#472
def to_datetime; end
+
+ # Returns the object's date and time as a floating point number of seconds
+ # since the Epoch (January 1, 1970 00:00 UTC).
+ #
+ # Time.zone.now.to_f # => 1417709320.285418
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#447
def to_f; end
+
+ # Returns a string of the object's date and time.
+ # Accepts an optional format:
+ # * :default - default value, mimics Ruby Time#to_s format.
+ # * :db - format outputs time in UTC :db time. See Time#to_formatted_s(:db).
+ # * Any key in Time::DATE_FORMATS can be used. See active_support/core_ext/time/conversions.rb.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#206
def to_formatted_s(format = T.unsafe(nil)); end
+
+ # Returns the object's date and time as an integer number of seconds
+ # since the Epoch (January 1, 1970 00:00 UTC).
+ #
+ # Time.zone.now.to_i # => 1417709320
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#455
def to_i; end
+
+ # Returns the object's date and time as a rational number of seconds
+ # since the Epoch (January 1, 1970 00:00 UTC).
+ #
+ # Time.zone.now.to_r # => (708854548642709/500000)
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#464
def to_r; end
+
+ # Returns a string of the object's date and time.
+ # Accepts an optional format:
+ # * :default - default value, mimics Ruby Time#to_s format.
+ # * :db - format outputs time in UTC :db time. See Time#to_formatted_s(:db).
+ # * Any key in Time::DATE_FORMATS can be used. See active_support/core_ext/time/conversions.rb.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#206
def to_s(format = T.unsafe(nil)); end
+
+ # Returns an instance of +Time+, either with the same UTC offset
+ # as +self+ or in the local system timezone depending on the setting
+ # of +ActiveSupport.to_time_preserves_timezone+.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#479
def to_time; end
+
+ # Returns true if the current object's time falls within
+ # the current day.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#244
def today?; end
+
+ # Returns true if the current object's time falls within
+ # the next day (tomorrow).
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#250
def tomorrow?; end
+
+ # Returns the object's date and time as an integer number of seconds
+ # since the Epoch (January 1, 1970 00:00 UTC).
+ #
+ # Time.zone.now.to_i # => 1417709320
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#455
def tv_sec; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def usec; end
+
+ # Returns a Time instance of the simultaneous time in the UTC timezone.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#64
def utc; end
+
+ # Returns true if the current time zone is set to UTC.
+ #
+ # Time.zone = 'UTC' # => 'UTC'
+ # Time.zone.now.utc? # => true
+ # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
+ # Time.zone.now.utc? # => false
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#106
def utc?; end
+
+ # Returns the offset from current time to UTC time in seconds.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#112
def utc_offset; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def wday; end
+
+ # Returns a string of the object's date and time in the ISO 8601 standard
+ # format.
+ #
+ # Time.zone.now.xmlschema # => "2014-12-04T11:02:37-05:00"
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#149
def xmlschema(fraction_digits = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def yday; end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#428
def year; end
+
+ # Returns true if the current object's time falls within
+ # the previous day (yesterday).
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#257
def yesterday?; end
+
+ # Returns the time zone abbreviation.
+ #
+ # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)"
+ # Time.zone.now.zone # => "EST"
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#134
def zone; end
private
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#570
def duration_of_variable_length?(obj); end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#551
def get_period_and_ensure_valid_local_time(period); end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#543
def incorporate_utc_offset(time, offset); end
+
+ # Ensure proxy class responds to all methods that underlying time instance
+ # responds to.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#527
def respond_to_missing?(sym, include_priv); end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#564
def transfer_time_values_to_utc_constructor(time); end
+
+ # source://activesupport//lib/active_support/time_with_zone.rb#574
def wrap_with_time_zone(time); end
class << self
+ # Report class name as 'Time' to thwart type checking.
+ #
+ # source://activesupport//lib/active_support/time_with_zone.rb#42
def name; end
end
end
+# source://activesupport//lib/active_support/time_with_zone.rb#46
ActiveSupport::TimeWithZone::PRECISIONS = T.let(T.unsafe(nil), Hash)
+
+# source://activesupport//lib/active_support/time_with_zone.rb#541
ActiveSupport::TimeWithZone::SECONDS_PER_DAY = T.let(T.unsafe(nil), Integer)
+# The TimeZone class serves as a wrapper around TZInfo::Timezone instances.
+# It allows us to do the following:
+#
+# * Limit the set of zones provided by TZInfo to a meaningful subset of 134
+# zones.
+# * Retrieve and display zones with a friendlier name
+# (e.g., "Eastern Time (US & Canada)" instead of "America/New_York").
+# * Lazily load TZInfo::Timezone instances only when they're needed.
+# * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+,
+# +parse+, +at+ and +now+ methods.
+#
+# If you set config.time_zone in the Rails Application, you can
+# access this TimeZone object via Time.zone:
+#
+# # application.rb:
+# class Application < Rails::Application
+# config.time_zone = 'Eastern Time (US & Canada)'
+# end
+#
+# Time.zone # => #
+# Time.zone.name # => "Eastern Time (US & Canada)"
+# Time.zone.now # => Sun, 18 May 2008 14:30:44 EDT -04:00
+#
+# source://activesupport//lib/active_support/values/time_zone.rb#29
class ActiveSupport::TimeZone
include ::Comparable
+ # Create a new TimeZone object with the given name and offset. The
+ # offset is the number of seconds that this time zone is offset from UTC
+ # (GMT). Seconds were chosen as the offset unit because that is the unit
+ # that Ruby uses to represent time zone offsets (see Time#utc_offset).
+ #
+ # @return [TimeZone] a new instance of TimeZone
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#297
def initialize(name, utc_offset = T.unsafe(nil), tzinfo = T.unsafe(nil)); end
+ # Compare this time zone to the parameter. The two are compared first on
+ # their offsets, and then by name.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#320
def <=>(zone); end
+
+ # Compare #name and TZInfo identifier to a supplied regexp, returning +true+
+ # if a match is found.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#329
def =~(re); end
+
+ # Method for creating new ActiveSupport::TimeWithZone instance in time zone
+ # of +self+ from number of seconds since the Unix epoch.
+ #
+ # Time.zone = 'Hawaii' # => "Hawaii"
+ # Time.utc(2000).to_f # => 946684800.0
+ # Time.zone.at(946684800.0) # => Fri, 31 Dec 1999 14:00:00 HST -10:00
+ #
+ # A second argument can be supplied to specify sub-second precision.
+ #
+ # Time.zone = 'Hawaii' # => "Hawaii"
+ # Time.at(946684800, 123456.789).nsec # => 123456789
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#366
def at(*args); end
+
+ # source://activesupport//lib/active_support/values/time_zone.rb#547
def encode_with(coder); end
+
+ # Returns a formatted string of the offset from UTC, or an alternative
+ # string if the time zone is already UTC.
+ #
+ # zone = ActiveSupport::TimeZone['Central Time (US & Canada)']
+ # zone.formatted_offset # => "-06:00"
+ # zone.formatted_offset(false) # => "-0600"
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#314
def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/values/time_zone.rb#543
def init_with(coder); end
+
+ # Method for creating new ActiveSupport::TimeWithZone instance in time zone
+ # of +self+ from an ISO 8601 string.
+ #
+ # Time.zone = 'Hawaii' # => "Hawaii"
+ # Time.zone.iso8601('1999-12-31T14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
+ #
+ # If the time components are missing then they will be set to zero.
+ #
+ # Time.zone = 'Hawaii' # => "Hawaii"
+ # Time.zone.iso8601('1999-12-31') # => Fri, 31 Dec 1999 00:00:00 HST -10:00
+ #
+ # If the string is invalid then an +ArgumentError+ will be raised unlike +parse+
+ # which usually returns +nil+ when given an invalid date string.
+ #
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#383
def iso8601(str); end
+
+ # Method for creating new ActiveSupport::TimeWithZone instance in time zone
+ # of +self+ from given values.
+ #
+ # Time.zone = 'Hawaii' # => "Hawaii"
+ # Time.zone.local(2007, 2, 1, 15, 30, 45) # => Thu, 01 Feb 2007 15:30:45 HST -10:00
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#350
def local(*args); end
+
+ # Adjust the given time to the simultaneous time in UTC. Returns a
+ # Time.utc() instance.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#523
def local_to_utc(time, dst = T.unsafe(nil)); end
+
+ # Compare #name and TZInfo identifier to a supplied regexp, returning +true+
+ # if a match is found.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#335
def match?(re); end
+
+ # Returns the value of attribute name.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#290
def name; end
+
+ # Returns an ActiveSupport::TimeWithZone instance representing the current
+ # time in the time zone represented by +self+.
+ #
+ # Time.zone = 'Hawaii' # => "Hawaii"
+ # Time.zone.now # => Wed, 23 Jan 2008 20:24:27 HST -10:00
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#488
def now; end
+
+ # Method for creating new ActiveSupport::TimeWithZone instance in time zone
+ # of +self+ from parsed string.
+ #
+ # Time.zone = 'Hawaii' # => "Hawaii"
+ # Time.zone.parse('1999-12-31 14:00:00') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
+ #
+ # If upper components are missing from the string, they are supplied from
+ # TimeZone#now:
+ #
+ # Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00
+ # Time.zone.parse('22:30:00') # => Fri, 31 Dec 1999 22:30:00 HST -10:00
+ #
+ # However, if the date component is not provided, but any other upper
+ # components are supplied, then the day of the month defaults to 1:
+ #
+ # Time.zone.parse('Mar 2000') # => Wed, 01 Mar 2000 00:00:00 HST -10:00
+ #
+ # If the string is invalid then an +ArgumentError+ could be raised.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#425
def parse(str, now = T.unsafe(nil)); end
+
+ # Available so that TimeZone instances respond like TZInfo::Timezone
+ # instances.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#535
def period_for_local(time, dst = T.unsafe(nil)); end
+
+ # Available so that TimeZone instances respond like TZInfo::Timezone
+ # instances.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#529
def period_for_utc(time); end
+
+ # source://activesupport//lib/active_support/values/time_zone.rb#539
def periods_for_local(time); end
+
+ # Method for creating new ActiveSupport::TimeWithZone instance in time zone
+ # of +self+ from an RFC 3339 string.
+ #
+ # Time.zone = 'Hawaii' # => "Hawaii"
+ # Time.zone.rfc3339('2000-01-01T00:00:00Z') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
+ #
+ # If the time or zone components are missing then an +ArgumentError+ will
+ # be raised. This is much stricter than either +parse+ or +iso8601+ which
+ # allow for missing components.
+ #
+ # Time.zone = 'Hawaii' # => "Hawaii"
+ # Time.zone.rfc3339('1999-12-31') # => ArgumentError: invalid date
+ #
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#441
def rfc3339(str); end
+
+ # Parses +str+ according to +format+ and returns an ActiveSupport::TimeWithZone.
+ #
+ # Assumes that +str+ is a time in the time zone +self+,
+ # unless +format+ includes an explicit time zone.
+ # (This is the same behavior as +parse+.)
+ # In either case, the returned TimeWithZone has the timezone of +self+.
+ #
+ # Time.zone = 'Hawaii' # => "Hawaii"
+ # Time.zone.strptime('1999-12-31 14:00:00', '%Y-%m-%d %H:%M:%S') # => Fri, 31 Dec 1999 14:00:00 HST -10:00
+ #
+ # If upper components are missing from the string, they are supplied from
+ # TimeZone#now:
+ #
+ # Time.zone.now # => Fri, 31 Dec 1999 14:00:00 HST -10:00
+ # Time.zone.strptime('22:30:00', '%H:%M:%S') # => Fri, 31 Dec 1999 22:30:00 HST -10:00
+ #
+ # However, if the date component is not provided, but any other upper
+ # components are supplied, then the day of the month defaults to 1:
+ #
+ # Time.zone.strptime('Mar 2000', '%b %Y') # => Wed, 01 Mar 2000 00:00:00 HST -10:00
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#479
def strptime(str, format, now = T.unsafe(nil)); end
+
+ # Returns a textual representation of this time zone.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#341
def to_s; end
+
+ # Returns the current date in this time zone.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#493
def today; end
+
+ # Returns the next date in this time zone.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#498
def tomorrow; end
+
+ # Returns the value of attribute tzinfo.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#291
def tzinfo; end
+
+ # Returns the offset of this time zone from UTC in seconds.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#304
def utc_offset; end
+
+ # Adjust the given time to the simultaneous time in the time zone
+ # represented by +self+. Returns a local time with the appropriate offset
+ # -- if you want an ActiveSupport::TimeWithZone instance, use
+ # Time#in_time_zone() instead.
+ #
+ # As of tzinfo 2, utc_to_local returns a Time with a non-zero utc_offset.
+ # See the +utc_to_local_returns_utc_offset_times+ config for more info.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#514
def utc_to_local(time); end
+
+ # Returns the previous date in this time zone.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#503
def yesterday; end
private
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#553
def parts_to_time(parts, now); end
+
+ # source://activesupport//lib/active_support/values/time_zone.rb#578
def time_now; end
class << self
+ # Locate a specific time zone object. If the argument is a string, it
+ # is interpreted to mean the name of the timezone to locate. If it is a
+ # numeric value it is either the hour offset, or the second offset, of the
+ # timezone to find. (The first one with that offset will be returned.)
+ # Returns +nil+ if no such time zone is known to the system.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#230
def [](arg); end
+
+ # Returns an array of all TimeZone objects. There are multiple
+ # TimeZone objects per time zone, in many cases, to make it easier
+ # for users to find their own time zone.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#221
def all; end
+
+ # source://activesupport//lib/active_support/values/time_zone.rb#259
def clear; end
+
+ # A convenience method for returning a collection of TimeZone objects
+ # for time zones in the country specified by its ISO 3166-1 Alpha2 code.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#254
def country_zones(country_code); end
+
def create(*_arg0); end
+
+ # source://activesupport//lib/active_support/values/time_zone.rb#205
def find_tzinfo(name); end
+
+ # Returns a TimeZone instance with the given name, or +nil+ if no
+ # such TimeZone instance exists. (This exists to support the use of
+ # this class with the +composed_of+ macro.)
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#214
def new(name); end
+
+ # Assumes self represents an offset from UTC in seconds (as returned from
+ # Time#utc_offset) and turns this into an +HH:MM formatted string.
+ #
+ # ActiveSupport::TimeZone.seconds_to_utc_offset(-21_600) # => "-06:00"
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#197
def seconds_to_utc_offset(seconds, colon = T.unsafe(nil)); end
+
+ # A convenience method for returning a collection of TimeZone objects
+ # for time zones in the USA.
+ #
+ # source://activesupport//lib/active_support/values/time_zone.rb#248
def us_zones; end
private
+ # source://activesupport//lib/active_support/values/time_zone.rb#267
def load_country_zones(code); end
+
+ # source://activesupport//lib/active_support/values/time_zone.rb#281
def zones_map; end
end
end
+# Keys are Rails TimeZone names, values are TZInfo identifiers.
+#
+# source://activesupport//lib/active_support/values/time_zone.rb#31
ActiveSupport::TimeZone::MAPPING = T.let(T.unsafe(nil), Hash)
+
+# source://activesupport//lib/active_support/values/time_zone.rb#186
ActiveSupport::TimeZone::UTC_OFFSET_WITHOUT_COLON = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/values/time_zone.rb#185
ActiveSupport::TimeZone::UTC_OFFSET_WITH_COLON = T.let(T.unsafe(nil), String)
+# source://activesupport//lib/active_support/core_ext/object/json.rb#36
module ActiveSupport::ToJsonWithActiveSupportEncoder
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#37
def to_json(options = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/core_ext/object/try.rb#6
module ActiveSupport::Tryable
- def try(method_name = T.unsafe(nil), *args, &b); end
- def try!(method_name = T.unsafe(nil), *args, &b); end
+ # source://activesupport//lib/active_support/core_ext/object/try.rb#7
+ def try(method_name = T.unsafe(nil), *args, **_arg2, &b); end
+
+ # source://activesupport//lib/active_support/core_ext/object/try.rb#20
+ def try!(method_name = T.unsafe(nil), *args, **_arg2, &b); end
end
+# source://activesupport//lib/active_support/gem_version.rb#9
module ActiveSupport::VERSION; end
+
+# source://activesupport//lib/active_support/gem_version.rb#10
ActiveSupport::VERSION::MAJOR = T.let(T.unsafe(nil), Integer)
+
+# source://activesupport//lib/active_support/gem_version.rb#11
ActiveSupport::VERSION::MINOR = T.let(T.unsafe(nil), Integer)
+
+# source://activesupport//lib/active_support/gem_version.rb#13
ActiveSupport::VERSION::PRE = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/gem_version.rb#15
ActiveSupport::VERSION::STRING = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/gem_version.rb#12
ActiveSupport::VERSION::TINY = T.let(T.unsafe(nil), Integer)
+# source://activesupport//lib/active_support/core_ext/hash/conversions.rb#141
class ActiveSupport::XMLConverter
+ # @return [XMLConverter] a new instance of XMLConverter
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#152
def initialize(xml, disallowed_types = T.unsafe(nil)); end
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#157
def to_h; end
private
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#223
def become_array?(value); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#219
def become_content?(value); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#227
def become_empty_string?(value); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#233
def become_hash?(value); end
+
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#173
def deep_to_h(value); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#242
def garbage?(value); end
+
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#162
def normalize_keys(params); end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#237
def nothing?(value); end
+
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#258
def process_array(value); end
+
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#249
def process_content(value); end
+
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#186
def process_hash(value); end
end
+# source://activesupport//lib/active_support/core_ext/hash/conversions.rb#150
ActiveSupport::XMLConverter::DISALLOWED_TYPES = T.let(T.unsafe(nil), Array)
+# Raised if the XML contains attributes with type="yaml" or
+# type="symbol". Read Hash#from_xml for more details.
+#
+# source://activesupport//lib/active_support/core_ext/hash/conversions.rb#144
class ActiveSupport::XMLConverter::DisallowedType < ::StandardError
+ # @return [DisallowedType] a new instance of DisallowedType
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#145
def initialize(type); end
end
+# = XmlMini
+#
+# To use the much faster libxml parser:
+# gem 'libxml-ruby', '=0.9.7'
+# XmlMini.backend = 'LibXML'
+#
+# source://activesupport//lib/active_support/xml_mini.rb#17
module ActiveSupport::XmlMini
extend ::ActiveSupport::XmlMini
+ # source://activesupport//lib/active_support/xml_mini.rb#96
def backend; end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#100
def backend=(name); end
+
+ # Returns the value of attribute depth.
+ #
+ # source://activesupport//lib/active_support/xml_mini.rb#91
def depth; end
+
+ # Sets the attribute depth
+ #
+ # @param value the value to set the attribute depth to.
+ #
+ # source://activesupport//lib/active_support/xml_mini.rb#91
def depth=(_arg0); end
- def parse(*args, &block); end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#94
+ def parse(*_arg0, **_arg1, &_arg2); end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#147
def rename_key(key, options = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#114
def to_tag(key, value, options); end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#106
def with_backend(name); end
private
+ # source://activesupport//lib/active_support/xml_mini.rb#158
def _dasherize(key); end
+
+ # TODO: Add support for other encodings
+ #
+ # source://activesupport//lib/active_support/xml_mini.rb#165
def _parse_binary(bin, entity); end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#174
def _parse_file(file, entity); end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#190
def cast_backend_name_to_module(name); end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#182
def current_thread_backend; end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#186
def current_thread_backend=(name); end
end
+# source://activesupport//lib/active_support/xml_mini.rb#34
ActiveSupport::XmlMini::DEFAULT_ENCODINGS = T.let(T.unsafe(nil), Hash)
+
+# source://activesupport//lib/active_support/xml_mini.rb#54
ActiveSupport::XmlMini::FORMATTING = T.let(T.unsafe(nil), Hash)
+# This module decorates files deserialized using Hash.from_xml with
+# the original_filename and content_type methods.
+#
+# source://activesupport//lib/active_support/xml_mini.rb#22
module ActiveSupport::XmlMini::FileLike
+ # source://activesupport//lib/active_support/xml_mini.rb#29
def content_type; end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#23
def content_type=(_arg0); end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#25
def original_filename; end
+
+ # source://activesupport//lib/active_support/xml_mini.rb#23
def original_filename=(_arg0); end
end
+# source://activesupport//lib/active_support/xml_mini.rb#64
ActiveSupport::XmlMini::PARSING = T.let(T.unsafe(nil), Hash)
+
+# source://activesupport//lib/active_support/xml_mini.rb#39
ActiveSupport::XmlMini::TYPE_NAMES = T.let(T.unsafe(nil), Hash)
+# source://activesupport//lib/active_support/xml_mini/rexml.rb#8
module ActiveSupport::XmlMini_REXML
extend ::ActiveSupport::XmlMini_REXML
+ # Parse an XML Document string or IO into a simple hash.
+ #
+ # Same as XmlSimple::xml_in but doesn't shoot itself in the foot,
+ # and uses the defaults from Active Support.
+ #
+ # data::
+ # XML Document string or IO to parse
+ #
+ # source://activesupport//lib/active_support/xml_mini/rexml.rb#20
def parse(data); end
private
+ # Actually converts an XML document element into a data structure.
+ #
+ # element::
+ # The document element to be collapsed.
+ #
+ # source://activesupport//lib/active_support/xml_mini/rexml.rb#63
def collapse(element, depth); end
+
+ # Determines if a document element has text content
+ #
+ # element::
+ # XML element to be checked.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/xml_mini/rexml.rb#133
def empty_content?(element); end
+
+ # Converts the attributes array of an XML element into a hash.
+ # Returns an empty Hash if node has no attributes.
+ #
+ # element::
+ # XML element to extract attributes from.
+ #
+ # source://activesupport//lib/active_support/xml_mini/rexml.rb#123
def get_attributes(element); end
+
+ # Adds a new key/value pair to an existing Hash. If the key to be added
+ # already exists and the existing value associated with key is not
+ # an Array, it will be wrapped in an Array. Then the new value is
+ # appended to that Array.
+ #
+ # hash::
+ # Hash to add key/value pair to.
+ # key::
+ # Key to be added.
+ # value::
+ # Value to be associated with key.
+ #
+ # source://activesupport//lib/active_support/xml_mini/rexml.rb#103
def merge!(hash, key, value); end
+
+ # Convert an XML element and merge into the hash
+ #
+ # hash::
+ # Hash to merge the converted element into.
+ # element::
+ # XML element to merge into hash
+ #
+ # @raise [REXML::ParseException]
+ #
+ # source://activesupport//lib/active_support/xml_mini/rexml.rb#54
def merge_element!(hash, element, depth); end
+
+ # Merge all the texts of an element into the hash
+ #
+ # hash::
+ # Hash to add the converted element to.
+ # element::
+ # XML element whose texts are to me merged into the hash
+ #
+ # source://activesupport//lib/active_support/xml_mini/rexml.rb#81
def merge_texts!(hash, element); end
+
+ # source://activesupport//lib/active_support/xml_mini/rexml.rb#41
def require_rexml; end
end
+# source://activesupport//lib/active_support/xml_mini/rexml.rb#11
ActiveSupport::XmlMini_REXML::CONTENT_KEY = T.let(T.unsafe(nil), String)
+# source://activesupport//lib/active_support/core_ext/object/blank.rb#83
class Array
include ::Enumerable
- include ::JSON::Ext::Generator::GeneratorMethods::Array
- include ::Plist::Emit
- include ::MessagePack::CoreExt
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#153
def as_json(options = T.unsafe(nil)); end
+
+ # Removes all blank elements from the +Array+ in place and returns self.
+ # Uses Object#blank? for determining if an item is blank.
+ #
+ # a = [1, "", nil, 2, " ", [], {}, false, true]
+ # a.compact_blank!
+ # # => [1, 2, true]
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#256
def compact_blank!; end
+
+ # Returns a deep copy of array.
+ #
+ # array = [1, [2, 3]]
+ # dup = array.deep_dup
+ # dup[1][2] = 4
+ #
+ # array[1][2] # => nil
+ # dup[1][2] # => 4
+ #
+ # source://activesupport//lib/active_support/core_ext/object/deep_dup.rb#29
def deep_dup; end
+
+ # Returns a copy of the Array excluding the specified elements.
+ #
+ # ["David", "Rafael", "Aaron", "Todd"].excluding("Aaron", "Todd") # => ["David", "Rafael"]
+ # [ [ 0, 1 ], [ 1, 0 ] ].excluding([ [ 1, 0 ] ]) # => [ [ 0, 1 ] ]
+ #
+ # Note: This is an optimization of Enumerable#excluding that uses Array#-
+ # instead of Array#reject for performance reasons.
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#47
def excluding(*elements); end
+
+ # Removes and returns the elements for which the block returns a true value.
+ # If no block is given, an Enumerator is returned instead.
+ #
+ # numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ # odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
+ # numbers # => [0, 2, 4, 6, 8]
+ #
+ # source://activesupport//lib/active_support/core_ext/array/extract.rb#10
def extract!; end
+
+ # Extracts options from a set of arguments. Removes and returns the last
+ # element in the array if it's a hash, otherwise returns a blank hash.
+ #
+ # def options(*args)
+ # args.extract_options!
+ # end
+ #
+ # options(1, 2) # => {}
+ # options(1, 2, a: :b) # => {:a=>:b}
+ #
+ # source://activesupport//lib/active_support/core_ext/array/extract_options.rb#24
def extract_options!; end
+
+ # Equal to self[4].
+ #
+ # %w( a b c d e ).fifth # => "e"
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#80
def fifth; end
+
+ # Equal to self[41]. Also known as accessing "the reddit".
+ #
+ # (1..42).to_a.forty_two # => 42
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#87
def forty_two; end
+
+ # Equal to self[3].
+ #
+ # %w( a b c d e ).fourth # => "d"
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#73
def fourth; end
+
+ # Returns the tail of the array from +position+.
+ #
+ # %w( a b c d ).from(0) # => ["a", "b", "c", "d"]
+ # %w( a b c d ).from(2) # => ["c", "d"]
+ # %w( a b c d ).from(10) # => []
+ # %w().from(0) # => []
+ # %w( a b c d ).from(-2) # => ["c", "d"]
+ # %w( a b c ).from(-10) # => []
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#12
def from(position); end
+
+ # Splits or iterates over the array in +number+ of groups, padding any
+ # remaining slots with +fill_with+ unless it is +false+.
+ #
+ # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3) {|group| p group}
+ # ["1", "2", "3", "4"]
+ # ["5", "6", "7", nil]
+ # ["8", "9", "10", nil]
+ #
+ # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3, ' ') {|group| p group}
+ # ["1", "2", "3", "4"]
+ # ["5", "6", "7", " "]
+ # ["8", "9", "10", " "]
+ #
+ # %w(1 2 3 4 5 6 7).in_groups(3, false) {|group| p group}
+ # ["1", "2", "3"]
+ # ["4", "5"]
+ # ["6", "7"]
+ #
+ # source://activesupport//lib/active_support/core_ext/array/grouping.rb#62
def in_groups(number, fill_with = T.unsafe(nil)); end
+
+ # Splits or iterates over the array in groups of size +number+,
+ # padding any remaining slots with +fill_with+ unless it is +false+.
+ #
+ # %w(1 2 3 4 5 6 7 8 9 10).in_groups_of(3) {|group| p group}
+ # ["1", "2", "3"]
+ # ["4", "5", "6"]
+ # ["7", "8", "9"]
+ # ["10", nil, nil]
+ #
+ # %w(1 2 3 4 5).in_groups_of(2, ' ') {|group| p group}
+ # ["1", "2"]
+ # ["3", "4"]
+ # ["5", " "]
+ #
+ # %w(1 2 3 4 5).in_groups_of(2, false) {|group| p group}
+ # ["1", "2"]
+ # ["3", "4"]
+ # ["5"]
+ #
+ # source://activesupport//lib/active_support/core_ext/array/grouping.rb#22
def in_groups_of(number, fill_with = T.unsafe(nil)); end
+
+ # Returns a new array that includes the passed elements.
+ #
+ # [ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
+ # [ [ 0, 1 ] ].including([ [ 1, 0 ] ]) # => [ [ 0, 1 ], [ 1, 0 ] ]
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#36
def including(*elements); end
+
+ # Wraps the array in an +ArrayInquirer+ object, which gives a friendlier way
+ # to check its string-like contents.
+ #
+ # pets = [:cat, :dog].inquiry
+ #
+ # pets.cat? # => true
+ # pets.ferret? # => false
+ #
+ # pets.any?(:cat, :ferret) # => true
+ # pets.any?(:ferret, :alligator) # => false
+ #
+ # source://activesupport//lib/active_support/core_ext/array/inquiry.rb#16
def inquiry; end
+
+ # Equal to self[1].
+ #
+ # %w( a b c d e ).second # => "b"
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#59
def second; end
+
+ # Equal to self[-2].
+ #
+ # %w( a b c d e ).second_to_last # => "d"
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#101
def second_to_last; end
+
+ # Divides the array into one or more subarrays based on a delimiting +value+
+ # or the result of an optional block.
+ #
+ # [1, 2, 3, 4, 5].split(3) # => [[1, 2], [4, 5]]
+ # (1..10).to_a.split { |i| i % 3 == 0 } # => [[1, 2], [4, 5], [7, 8], [10]]
+ #
+ # source://activesupport//lib/active_support/core_ext/array/grouping.rb#93
def split(value = T.unsafe(nil)); end
+
+ # Array#sum was added in Ruby 2.4 but it only works with Numeric elements.
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#241
def sum(init = T.unsafe(nil), &block); end
+
+ # Equal to self[2].
+ #
+ # %w( a b c d e ).third # => "c"
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#66
def third; end
+
+ # Equal to self[-3].
+ #
+ # %w( a b c d e ).third_to_last # => "c"
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#94
def third_to_last; end
+
+ # Returns the beginning of the array up to +position+.
+ #
+ # %w( a b c d ).to(0) # => ["a"]
+ # %w( a b c d ).to(2) # => ["a", "b", "c"]
+ # %w( a b c d ).to(10) # => ["a", "b", "c", "d"]
+ # %w().to(0) # => []
+ # %w( a b c d ).to(-2) # => ["a", "b", "c"]
+ # %w( a b c ).to(-10) # => []
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#24
def to(position); end
+
+ # Extends Array#to_s to convert a collection of elements into a
+ # comma separated id list if :db argument is given as the format.
+ #
+ # Blog.all.to_formatted_s(:db) # => "1,2,3"
+ # Blog.none.to_formatted_s(:db) # => "null"
+ # [1,2].to_formatted_s # => "[1, 2]"
+ #
+ # source://activesupport//lib/active_support/core_ext/array/conversions.rb#93
def to_formatted_s(format = T.unsafe(nil)); end
+
+ # Calls to_param on all its elements and joins the result with
+ # slashes. This is used by url_for in Action Pack.
+ #
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#42
def to_param; end
+
+ # Converts an array into a string suitable for use as a URL query string,
+ # using the given +key+ as the param name.
+ #
+ # ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding"
+ #
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#50
def to_query(key); end
+
+ # Extends Array#to_s to convert a collection of elements into a
+ # comma separated id list if :db argument is given as the format.
+ #
+ # Blog.all.to_formatted_s(:db) # => "1,2,3"
+ # Blog.none.to_formatted_s(:db) # => "null"
+ # [1,2].to_formatted_s # => "[1, 2]"
+ #
+ # source://activesupport//lib/active_support/core_ext/array/conversions.rb#93
def to_s(format = T.unsafe(nil)); end
+
+ # Converts the array to a comma-separated sentence where the last element is
+ # joined by the connector word.
+ #
+ # You can pass the following options to change the default behavior. If you
+ # pass an option key that doesn't exist in the list below, it will raise an
+ # ArgumentError.
+ #
+ # ==== Options
+ #
+ # * :words_connector - The sign or word used to join the elements
+ # in arrays with two or more elements (default: ", ").
+ # * :two_words_connector - The sign or word used to join the elements
+ # in arrays with two elements (default: " and ").
+ # * :last_word_connector - The sign or word used to join the last element
+ # in arrays with three or more elements (default: ", and ").
+ # * :locale - If +i18n+ is available, you can set a locale and use
+ # the connector options defined on the 'support.array' namespace in the
+ # corresponding dictionary file.
+ #
+ # ==== Examples
+ #
+ # [].to_sentence # => ""
+ # ['one'].to_sentence # => "one"
+ # ['one', 'two'].to_sentence # => "one and two"
+ # ['one', 'two', 'three'].to_sentence # => "one, two, and three"
+ #
+ # ['one', 'two'].to_sentence(passing: 'invalid option')
+ # # => ArgumentError: Unknown key: :passing. Valid keys are: :words_connector, :two_words_connector, :last_word_connector, :locale
+ #
+ # ['one', 'two'].to_sentence(two_words_connector: '-')
+ # # => "one-two"
+ #
+ # ['one', 'two', 'three'].to_sentence(words_connector: ' or ', last_word_connector: ' or at least ')
+ # # => "one or two or at least three"
+ #
+ # Using :locale option:
+ #
+ # # Given this locale dictionary:
+ # #
+ # # es:
+ # # support:
+ # # array:
+ # # words_connector: " o "
+ # # two_words_connector: " y "
+ # # last_word_connector: " o al menos "
+ #
+ # ['uno', 'dos'].to_sentence(locale: :es)
+ # # => "uno y dos"
+ #
+ # ['uno', 'dos', 'tres'].to_sentence(locale: :es)
+ # # => "uno o dos o al menos tres"
+ #
+ # source://activesupport//lib/active_support/core_ext/array/conversions.rb#61
def to_sentence(options = T.unsafe(nil)); end
+
+ # Returns a string that represents the array in XML by invoking +to_xml+
+ # on each element. Active Record collections delegate their representation
+ # in XML to this method.
+ #
+ # All elements are expected to respond to +to_xml+, if any of them does
+ # not then an exception is raised.
+ #
+ # The root node reflects the class name of the first element in plural
+ # if all elements belong to the same type and that's not Hash:
+ #
+ # customer.projects.to_xml
+ #
+ #
+ #
+ #
+ # 20000.0
+ # 1567
+ # 2008-04-09
+ # ...
+ #
+ #
+ # 57230.0
+ # 1567
+ # 2008-04-15
+ # ...
+ #
+ #
+ #
+ # Otherwise the root element is "objects":
+ #
+ # [{ foo: 1, bar: 2}, { baz: 3}].to_xml
+ #
+ #
+ #
+ #
+ #
+ #
+ #
+ # If the collection is empty the root element is "nil-classes" by default:
+ #
+ # [].to_xml
+ #
+ #
+ #
+ #
+ # To ensure a meaningful root element use the :root option:
+ #
+ # customer_with_no_projects.projects.to_xml(root: 'projects')
+ #
+ #
+ #
+ #
+ # By default name of the node for the children of root is root.singularize.
+ # You can change it with the :children option.
+ #
+ # The +options+ hash is passed downwards:
+ #
+ # Message.all.to_xml(skip_types: true)
+ #
+ #
+ #
+ #
+ # 2008-03-07T09:58:18+01:00
+ # 1
+ # 1
+ # 2008-03-07T09:58:18+01:00
+ # 1
+ #
+ #
+ #
+ # source://activesupport//lib/active_support/core_ext/array/conversions.rb#183
def to_xml(options = T.unsafe(nil)); end
+
+ # Alias for #excluding.
+ #
+ # source://activesupport//lib/active_support/core_ext/array/access.rb#52
def without(*elements); end
class << self
+ # Wraps its argument in an array unless it is already an array (or array-like).
+ #
+ # Specifically:
+ #
+ # * If the argument is +nil+ an empty array is returned.
+ # * Otherwise, if the argument responds to +to_ary+ it is invoked, and its result returned.
+ # * Otherwise, returns an array with the argument as its single element.
+ #
+ # Array.wrap(nil) # => []
+ # Array.wrap([1, 2, 3]) # => [1, 2, 3]
+ # Array.wrap(0) # => [0]
+ #
+ # This method is similar in purpose to Kernel#Array, but there are some differences:
+ #
+ # * If the argument responds to +to_ary+ the method is invoked. Kernel#Array
+ # moves on to try +to_a+ if the returned value is +nil+, but Array.wrap returns
+ # an array with the argument as its single element right away.
+ # * If the returned value from +to_ary+ is neither +nil+ nor an +Array+ object, Kernel#Array
+ # raises an exception, while Array.wrap does not, it just returns the value.
+ # * It does not call +to_a+ on the argument, if the argument does not respond to +to_ary+
+ # it returns an array with the argument as its single element.
+ #
+ # The last point is easily explained with some enumerables:
+ #
+ # Array(foo: :bar) # => [[:foo, :bar]]
+ # Array.wrap(foo: :bar) # => [{:foo=>:bar}]
+ #
+ # There's also a related idiom that uses the splat operator:
+ #
+ # [*object]
+ #
+ # which returns [] for +nil+, but calls to Array(object) otherwise.
+ #
+ # The differences with Kernel#Array explained above
+ # apply to the rest of objects.
+ #
+ # source://activesupport//lib/active_support/core_ext/array/wrap.rb#39
def wrap(object); end
end
end
+# source://activesupport//lib/active_support/core_ext/object/json.rb#113
class BigDecimal < ::Numeric
include ::ActiveSupport::BigDecimalWithDefaultFormat
include ::ActiveSupport::NumericWithFormat
- extend ::BigDecimal::Deprecation
+ # A BigDecimal would be naturally represented as a JSON number. Most libraries,
+ # however, parse non-integer JSON numbers directly as floats. Clients using
+ # those libraries would get in general a wrong number and no way to recover
+ # other than manually inspecting the string with the JSON code itself.
+ #
+ # That's why a JSON string is returned. The JSON literal is not numeric, but
+ # if the other end knows by contract that the data is supposed to be a
+ # BigDecimal, it still has the chance to post-process the string and get the
+ # real value.
+ #
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#123
def as_json(options = T.unsafe(nil)); end
-end
-BigDecimal::EXCEPTION_NaN = T.let(T.unsafe(nil), Integer)
-BigDecimal::VERSION = T.let(T.unsafe(nil), String)
+ # source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#109
+ def to_s(format = T.unsafe(nil), options = T.unsafe(nil)); end
+end
+# source://activesupport//lib/active_support/core_ext/class/attribute.rb#5
class Class < ::Module
+ # Declare a class-level attribute whose value is inheritable by subclasses.
+ # Subclasses can change their own value and it will not impact parent class.
+ #
+ # ==== Options
+ #
+ # * :instance_reader - Sets the instance reader method (defaults to true).
+ # * :instance_writer - Sets the instance writer method (defaults to true).
+ # * :instance_accessor - Sets both instance methods (defaults to true).
+ # * :instance_predicate - Sets a predicate method (defaults to true).
+ # * :default - Sets a default value for the attribute (defaults to nil).
+ #
+ # ==== Examples
+ #
+ # class Base
+ # class_attribute :setting
+ # end
+ #
+ # class Subclass < Base
+ # end
+ #
+ # Base.setting = true
+ # Subclass.setting # => true
+ # Subclass.setting = false
+ # Subclass.setting # => false
+ # Base.setting # => true
+ #
+ # In the above case as long as Subclass does not assign a value to setting
+ # by performing Subclass.setting = _something_, Subclass.setting
+ # would read value assigned to parent class. Once Subclass assigns a value then
+ # the value assigned by Subclass would be returned.
+ #
+ # This matches normal Ruby method inheritance: think of writing an attribute
+ # on a subclass as overriding the reader method. However, you need to be aware
+ # when using +class_attribute+ with mutable structures as +Array+ or +Hash+.
+ # In such cases, you don't want to do changes in place. Instead use setters:
+ #
+ # Base.setting = []
+ # Base.setting # => []
+ # Subclass.setting # => []
+ #
+ # # Appending in child changes both parent and child because it is the same object:
+ # Subclass.setting << :foo
+ # Base.setting # => [:foo]
+ # Subclass.setting # => [:foo]
+ #
+ # # Use setters to not propagate changes:
+ # Base.setting = []
+ # Subclass.setting += [:foo]
+ # Base.setting # => []
+ # Subclass.setting # => [:foo]
+ #
+ # For convenience, an instance predicate method is defined as well.
+ # To skip it, pass instance_predicate: false.
+ #
+ # Subclass.setting? # => false
+ #
+ # Instances may overwrite the class value in the same way:
+ #
+ # Base.setting = true
+ # object = Base.new
+ # object.setting # => true
+ # object.setting = false
+ # object.setting # => false
+ # Base.setting # => true
+ #
+ # To opt out of the instance reader method, pass instance_reader: false.
+ #
+ # object.setting # => NoMethodError
+ # object.setting? # => NoMethodError
+ #
+ # To opt out of the instance writer method, pass instance_writer: false.
+ #
+ # object.setting = false # => NoMethodError
+ #
+ # To opt out of both instance methods, pass instance_accessor: false.
+ #
+ # To set a default value for the attribute, pass default:, like so:
+ #
+ # class_attribute :settings, default: {}
+ #
+ # source://activesupport//lib/active_support/core_ext/class/attribute.rb#85
def class_attribute(*attrs, instance_accessor: T.unsafe(nil), instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_predicate: T.unsafe(nil), default: T.unsafe(nil)); end
+
+ # Returns an array with all classes that are < than its receiver.
+ #
+ # class C; end
+ # C.descendants # => []
+ #
+ # class B < C; end
+ # C.descendants # => [B]
+ #
+ # class A < B; end
+ # C.descendants # => [B, A]
+ #
+ # class D < C; end
+ # C.descendants # => [B, A, D]
+ #
+ # source://activesupport//lib/active_support/core_ext/class/subclasses.rb#17
def descendants; end
+
+ # Returns an array with the direct children of +self+.
+ #
+ # class Foo; end
+ # class Bar < Foo; end
+ # class Baz < Bar; end
+ #
+ # Foo.subclasses # => [Bar]
+ #
+ # source://activesupport//lib/active_support/core_ext/class/subclasses.rb#30
def subclasses; end
end
+# source://activesupport//lib/active_support/core_ext/date/zones.rb#6
class Date
include ::Comparable
include ::DateAndTime::Zones
include ::DateAndTime::Calculations
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#90
def +(other); end
+
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#100
def -(other); end
+
+ # Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there.
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#137
def <=>(other); end
+
+ # Duck-types as a Date-like class. See Object#acts_like?.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date/acts_like.rb#7
def acts_like_date?; end
+
+ # Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with
+ # any of these keys: :years, :months, :weeks, :days.
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#112
def advance(options); end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
+ # and then subtracts the specified number of seconds.
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#55
def ago(seconds); end
+
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#192
def as_json(options = T.unsafe(nil)); end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#67
def at_beginning_of_day; end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the end of the day (23:59:59)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#85
def at_end_of_day; end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def at_midday; end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def at_middle_of_day; end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#67
def at_midnight; end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def at_noon; end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#67
def beginning_of_day; end
+
+ # No Date is blank:
+ #
+ # Date.today.blank? # => false
+ #
+ # @return [false]
+ #
+ # source://activesupport//lib/active_support/core_ext/date/blank.rb#11
def blank?; end
+
+ # Returns a new Date where one or more of the elements have been changed according to the +options+ parameter.
+ # The +options+ parameter is a hash with a combination of these keys: :year, :month, :day.
+ #
+ # Date.new(2007, 5, 12).change(day: 1) # => Date.new(2007, 5, 1)
+ # Date.new(2007, 5, 12).change(year: 2005, month: 1) # => Date.new(2005, 1, 12)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#128
def change(options); end
+
+ # Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there.
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#137
def compare_with_coercion(other); end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the end of the day (23:59:59)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#85
def end_of_day; end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
+ # and then adds the specified number of seconds
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#61
def in(seconds); end
+
+ # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005"
+ #
+ # source://activesupport//lib/active_support/core_ext/date/conversions.rb#62
def inspect; end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def midday; end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def middle_of_day; end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#67
def midnight; end
+
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#100
def minus_with_duration(other); end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#75
def noon; end
+
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#90
def plus_with_duration(other); end
+
+ # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005"
+ #
+ # source://activesupport//lib/active_support/core_ext/date/conversions.rb#62
def readable_inspect; end
+
+ # Converts Date to a Time (or DateTime if necessary) with the time portion set to the beginning of the day (0:00)
+ # and then adds the specified number of seconds
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#61
def since(seconds); end
+
+ # Convert to a formatted string. See DATE_FORMATS for predefined formats.
+ #
+ # This method is aliased to to_s.
+ #
+ # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007
+ #
+ # date.to_formatted_s(:db) # => "2007-11-10"
+ # date.to_s(:db) # => "2007-11-10"
+ #
+ # date.to_formatted_s(:short) # => "10 Nov"
+ # date.to_formatted_s(:number) # => "20071110"
+ # date.to_formatted_s(:long) # => "November 10, 2007"
+ # date.to_formatted_s(:long_ordinal) # => "November 10th, 2007"
+ # date.to_formatted_s(:rfc822) # => "10 Nov 2007"
+ # date.to_formatted_s(:iso8601) # => "2007-11-10"
+ #
+ # == Adding your own date formats to to_formatted_s
+ # You can add your own formats to the Date::DATE_FORMATS hash.
+ # Use the format name as the hash key and either a strftime string
+ # or Proc instance that takes a date argument as the value.
+ #
+ # # config/initializers/date_formats.rb
+ # Date::DATE_FORMATS[:month_and_year] = '%B %Y'
+ # Date::DATE_FORMATS[:short_ordinal] = ->(date) { date.strftime("%B #{date.day.ordinalize}") }
+ #
+ # source://activesupport//lib/active_support/core_ext/date/conversions.rb#47
def to_formatted_s(format = T.unsafe(nil)); end
+
+ # Convert to a formatted string. See DATE_FORMATS for predefined formats.
+ #
+ # This method is aliased to to_s.
+ #
+ # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007
+ #
+ # date.to_formatted_s(:db) # => "2007-11-10"
+ # date.to_s(:db) # => "2007-11-10"
+ #
+ # date.to_formatted_s(:short) # => "10 Nov"
+ # date.to_formatted_s(:number) # => "20071110"
+ # date.to_formatted_s(:long) # => "November 10, 2007"
+ # date.to_formatted_s(:long_ordinal) # => "November 10th, 2007"
+ # date.to_formatted_s(:rfc822) # => "10 Nov 2007"
+ # date.to_formatted_s(:iso8601) # => "2007-11-10"
+ #
+ # == Adding your own date formats to to_formatted_s
+ # You can add your own formats to the Date::DATE_FORMATS hash.
+ # Use the format name as the hash key and either a strftime string
+ # or Proc instance that takes a date argument as the value.
+ #
+ # # config/initializers/date_formats.rb
+ # Date::DATE_FORMATS[:month_and_year] = '%B %Y'
+ # Date::DATE_FORMATS[:short_ordinal] = ->(date) { date.strftime("%B #{date.day.ordinalize}") }
+ #
+ # source://activesupport//lib/active_support/core_ext/date/conversions.rb#47
def to_s(format = T.unsafe(nil)); end
+
+ # Converts a Date instance to a Time, where the time is set to the beginning of the day.
+ # The timezone can be either :local or :utc (default :local).
+ #
+ # date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007
+ #
+ # date.to_time # => 2007-11-10 00:00:00 0800
+ # date.to_time(:local) # => 2007-11-10 00:00:00 0800
+ #
+ # date.to_time(:utc) # => 2007-11-10 00:00:00 UTC
+ #
+ # NOTE: The :local timezone is Ruby's *process* timezone, i.e. ENV['TZ'].
+ # If the *application's* timezone is needed, then use +in_time_zone+ instead.
+ #
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/core_ext/date/conversions.rb#82
def to_time(form = T.unsafe(nil)); end
+
+ # Returns a string which represents the time in used time zone as DateTime
+ # defined by XML Schema:
+ #
+ # date = Date.new(2015, 05, 23) # => Sat, 23 May 2015
+ # date.xmlschema # => "2015-05-23T00:00:00+04:00"
+ #
+ # source://activesupport//lib/active_support/core_ext/date/conversions.rb#94
def xmlschema; end
class << self
+ # Returns the week start (e.g. :monday) for the current request, if this has been set (via Date.beginning_of_week=).
+ # If Date.beginning_of_week has not been set for the current request, returns the week start specified in config.beginning_of_week.
+ # If no config.beginning_of_week was specified, returns :monday.
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#19
def beginning_of_week; end
+
+ # Sets Date.beginning_of_week to a week start (e.g. :monday) for current request/thread.
+ #
+ # This method accepts any of the following day symbols:
+ # :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#27
def beginning_of_week=(week_start); end
+
+ # Returns the value of attribute beginning_of_week_default.
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#14
def beginning_of_week_default; end
+
+ # Sets the attribute beginning_of_week_default
+ #
+ # @param value the value to set the attribute beginning_of_week_default to.
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#14
def beginning_of_week_default=(_arg0); end
+
+ # Returns Time.zone.today when Time.zone or config.time_zone are set, otherwise just returns Date.today.
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#48
def current; end
+
+ # Returns week start day symbol (e.g. :monday), or raises an +ArgumentError+ for invalid day symbol.
+ #
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#32
def find_beginning_of_week!(week_start); end
+
+ # Returns a new Date representing the date 1 day after today (i.e. tomorrow's date).
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#43
def tomorrow; end
+
+ # Returns a new Date representing the date 1 day ago (i.e. yesterday's date).
+ #
+ # source://activesupport//lib/active_support/core_ext/date/calculations.rb#38
def yesterday; end
end
end
+# source://activesupport//lib/active_support/core_ext/date/conversions.rb#9
Date::DATE_FORMATS = T.let(T.unsafe(nil), Hash)
-Date::VERSION = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#5
module DateAndTime; end
+# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#7
module DateAndTime::Calculations
+ # Returns true if the date/time falls after date_or_time.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#72
def after?(date_or_time); end
+
+ # Returns a Range representing the whole day of the current date/time.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#300
def all_day; end
+
+ # Returns a Range representing the whole month of the current date/time.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#311
def all_month; end
+
+ # Returns a Range representing the whole quarter of the current date/time.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#316
def all_quarter; end
+
+ # Returns a Range representing the whole week of the current date/time.
+ # Week starts on start_day, default is Date.beginning_of_week or config.beginning_of_week when set.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#306
def all_week(start_day = T.unsafe(nil)); end
+
+ # Returns a Range representing the whole year of the current date/time.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#321
def all_year; end
+
+ # Returns a new date/time at the start of the month.
+ #
+ # today = Date.today # => Thu, 18 Jun 2015
+ # today.beginning_of_month # => Mon, 01 Jun 2015
+ #
+ # +DateTime+ objects will have a time set to 0:00.
+ #
+ # now = DateTime.current # => Thu, 18 Jun 2015 15:23:13 +0000
+ # now.beginning_of_month # => Mon, 01 Jun 2015 00:00:00 +0000
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#125
def at_beginning_of_month; end
+
+ # Returns a new date/time at the start of the quarter.
+ #
+ # today = Date.today # => Fri, 10 Jul 2015
+ # today.beginning_of_quarter # => Wed, 01 Jul 2015
+ #
+ # +DateTime+ objects will have a time set to 0:00.
+ #
+ # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
+ # now.beginning_of_quarter # => Wed, 01 Jul 2015 00:00:00 +0000
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#139
def at_beginning_of_quarter; end
+
+ # Returns a new date/time representing the start of this week on the given day.
+ # Week is assumed to start on +start_day+, default is
+ # +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
+ # +DateTime+ objects have their time set to 0:00.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#257
def at_beginning_of_week(start_day = T.unsafe(nil)); end
+
+ # Returns a new date/time at the beginning of the year.
+ #
+ # today = Date.today # => Fri, 10 Jul 2015
+ # today.beginning_of_year # => Thu, 01 Jan 2015
+ #
+ # +DateTime+ objects will have a time set to 0:00.
+ #
+ # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
+ # now.beginning_of_year # => Thu, 01 Jan 2015 00:00:00 +0000
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#169
def at_beginning_of_year; end
+
+ # Returns a new date/time representing the end of the month.
+ # DateTime objects will have a time set to 23:59:59.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#286
def at_end_of_month; end
+
+ # Returns a new date/time at the end of the quarter.
+ #
+ # today = Date.today # => Fri, 10 Jul 2015
+ # today.end_of_quarter # => Wed, 30 Sep 2015
+ #
+ # +DateTime+ objects will have a time set to 23:59:59.
+ #
+ # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
+ # now.end_of_quarter # => Wed, 30 Sep 2015 23:59:59 +0000
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#154
def at_end_of_quarter; end
+
+ # Returns a new date/time representing the end of this week on the given day.
+ # Week is assumed to start on +start_day+, default is
+ # +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
+ # DateTime objects have their time set to 23:59:59.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#273
def at_end_of_week(start_day = T.unsafe(nil)); end
+
+ # Returns a new date/time representing the end of the year.
+ # DateTime objects will have a time set to 23:59:59.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#294
def at_end_of_year; end
+
+ # Returns true if the date/time falls before date_or_time.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#67
def before?(date_or_time); end
+
+ # Returns a new date/time at the start of the month.
+ #
+ # today = Date.today # => Thu, 18 Jun 2015
+ # today.beginning_of_month # => Mon, 01 Jun 2015
+ #
+ # +DateTime+ objects will have a time set to 0:00.
+ #
+ # now = DateTime.current # => Thu, 18 Jun 2015 15:23:13 +0000
+ # now.beginning_of_month # => Mon, 01 Jun 2015 00:00:00 +0000
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#125
def beginning_of_month; end
+
+ # Returns a new date/time at the start of the quarter.
+ #
+ # today = Date.today # => Fri, 10 Jul 2015
+ # today.beginning_of_quarter # => Wed, 01 Jul 2015
+ #
+ # +DateTime+ objects will have a time set to 0:00.
+ #
+ # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
+ # now.beginning_of_quarter # => Wed, 01 Jul 2015 00:00:00 +0000
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#139
def beginning_of_quarter; end
+
+ # Returns a new date/time representing the start of this week on the given day.
+ # Week is assumed to start on +start_day+, default is
+ # +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
+ # +DateTime+ objects have their time set to 0:00.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#257
def beginning_of_week(start_day = T.unsafe(nil)); end
+
+ # Returns a new date/time at the beginning of the year.
+ #
+ # today = Date.today # => Fri, 10 Jul 2015
+ # today.beginning_of_year # => Thu, 01 Jan 2015
+ #
+ # +DateTime+ objects will have a time set to 0:00.
+ #
+ # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
+ # now.beginning_of_year # => Thu, 01 Jan 2015 00:00:00 +0000
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#169
def beginning_of_year; end
+
+ # Returns a new date/time the specified number of days ago.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#77
def days_ago(days); end
+
+ # Returns a new date/time the specified number of days in the future.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#82
def days_since(days); end
+
+ # Returns the number of days to the start of the week on the given day.
+ # Week is assumed to start on +start_day+, default is
+ # +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#248
def days_to_week_start(start_day = T.unsafe(nil)); end
+
+ # Returns a new date/time representing the end of the month.
+ # DateTime objects will have a time set to 23:59:59.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#286
def end_of_month; end
+
+ # Returns a new date/time at the end of the quarter.
+ #
+ # today = Date.today # => Fri, 10 Jul 2015
+ # today.end_of_quarter # => Wed, 30 Sep 2015
+ #
+ # +DateTime+ objects will have a time set to 23:59:59.
+ #
+ # now = DateTime.current # => Fri, 10 Jul 2015 18:41:29 +0000
+ # now.end_of_quarter # => Wed, 30 Sep 2015 23:59:59 +0000
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#154
def end_of_quarter; end
+
+ # Returns a new date/time representing the end of this week on the given day.
+ # Week is assumed to start on +start_day+, default is
+ # +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
+ # DateTime objects have their time set to 23:59:59.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#273
def end_of_week(start_day = T.unsafe(nil)); end
+
+ # Returns a new date/time representing the end of the year.
+ # DateTime objects will have a time set to 23:59:59.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#294
def end_of_year; end
+
+ # Returns true if the date/time is in the future.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#52
def future?; end
+
+ # Short-hand for months_ago(1).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#230
def last_month; end
+
+ # Short-hand for months_ago(3).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#235
def last_quarter; end
+
+ # Returns a new date/time representing the given day in the previous week.
+ # Week is assumed to start on +start_day+, default is
+ # +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
+ # DateTime objects have their time set to 0:00 unless +same_time+ is true.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#213
def last_week(start_day = T.unsafe(nil), same_time: T.unsafe(nil)); end
+
+ # Returns a new date/time representing the previous weekday.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#220
def last_weekday; end
+
+ # Short-hand for years_ago(1).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#241
def last_year; end
+
+ # Returns Monday of this week assuming that week starts on Monday.
+ # +DateTime+ objects have their time set to 0:00.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#265
def monday; end
+
+ # Returns a new date/time the specified number of months ago.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#97
def months_ago(months); end
+
+ # Returns a new date/time the specified number of months in the future.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#102
def months_since(months); end
+
+ # Returns true if the date/time is tomorrow.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#35
def next_day?; end
+
+ # Returns a new date/time representing the next occurrence of the specified day of week.
+ #
+ # today = Date.today # => Thu, 14 Dec 2017
+ # today.next_occurring(:monday) # => Mon, 18 Dec 2017
+ # today.next_occurring(:thursday) # => Thu, 21 Dec 2017
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#330
def next_occurring(day_of_week); end
+
+ # Short-hand for months_since(3)
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#205
def next_quarter; end
+
+ # Returns a new date/time representing the given day in the next week.
+ #
+ # today = Date.today # => Thu, 07 May 2015
+ # today.next_week # => Mon, 11 May 2015
+ #
+ # The +given_day_in_next_week+ defaults to the beginning of the week
+ # which is determined by +Date.beginning_of_week+ or +config.beginning_of_week+
+ # when set.
+ #
+ # today = Date.today # => Thu, 07 May 2015
+ # today.next_week(:friday) # => Fri, 15 May 2015
+ #
+ # +DateTime+ objects have their time set to 0:00 unless +same_time+ is true.
+ #
+ # now = DateTime.current # => Thu, 07 May 2015 13:31:16 +0000
+ # now.next_week # => Mon, 11 May 2015 00:00:00 +0000
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#190
def next_week(given_day_in_next_week = T.unsafe(nil), same_time: T.unsafe(nil)); end
+
+ # Returns a new date/time representing the next weekday.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#196
def next_weekday; end
+
+ # Returns true if the date/time does not fall on a Saturday or Sunday.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#62
def on_weekday?; end
+
+ # Returns true if the date/time falls on a Saturday or Sunday.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#57
def on_weekend?; end
+
+ # Returns true if the date/time is in the past.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#47
def past?; end
+
+ # Returns true if the date/time is yesterday.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#41
def prev_day?; end
+
+ # Returns a new date/time representing the previous occurrence of the specified day of week.
+ #
+ # today = Date.today # => Thu, 14 Dec 2017
+ # today.prev_occurring(:monday) # => Mon, 11 Dec 2017
+ # today.prev_occurring(:thursday) # => Thu, 07 Dec 2017
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#341
def prev_occurring(day_of_week); end
+
+ # Short-hand for months_ago(3).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#235
def prev_quarter; end
+
+ # Returns a new date/time representing the given day in the previous week.
+ # Week is assumed to start on +start_day+, default is
+ # +Date.beginning_of_week+ or +config.beginning_of_week+ when set.
+ # DateTime objects have their time set to 0:00 unless +same_time+ is true.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#213
def prev_week(start_day = T.unsafe(nil), same_time: T.unsafe(nil)); end
+
+ # Returns a new date/time representing the previous weekday.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#220
def prev_weekday; end
+
+ # Returns Sunday of this week assuming that week starts on Monday.
+ # +DateTime+ objects have their time set to 23:59:59.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#280
def sunday; end
+
+ # Returns true if the date/time is today.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#30
def today?; end
+
+ # Returns a new date/time representing tomorrow.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#25
def tomorrow; end
+
+ # Returns true if the date/time is tomorrow.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#35
def tomorrow?; end
+
+ # Returns a new date/time the specified number of weeks ago.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#87
def weeks_ago(weeks); end
+
+ # Returns a new date/time the specified number of weeks in the future.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#92
def weeks_since(weeks); end
+
+ # Returns a new date/time the specified number of years ago.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#107
def years_ago(years); end
+
+ # Returns a new date/time the specified number of years in the future.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#112
def years_since(years); end
+
+ # Returns a new date/time representing yesterday.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#20
def yesterday; end
+
+ # Returns true if the date/time is yesterday.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#41
def yesterday?; end
private
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#360
def copy_time_to(other); end
+
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#356
def days_span(day); end
+
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#348
def first_hour(date_or_time); end
+
+ # source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#352
def last_hour(date_or_time); end
end
+# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#8
DateAndTime::Calculations::DAYS_INTO_WEEK = T.let(T.unsafe(nil), Hash)
+
+# source://activesupport//lib/active_support/core_ext/date_and_time/calculations.rb#17
DateAndTime::Calculations::WEEKEND_DAYS = T.let(T.unsafe(nil), Array)
+# source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#6
module DateAndTime::Compatibility
+ # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#14
def preserve_timezone; end
+
+ # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#29
def utc_to_local_returns_utc_offset_times; end
class << self
+ # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#14
def preserve_timezone; end
+
+ # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#14
def preserve_timezone=(val); end
+
+ # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#29
def utc_to_local_returns_utc_offset_times; end
+
+ # source://activesupport//lib/active_support/core_ext/date_and_time/compatibility.rb#29
def utc_to_local_returns_utc_offset_times=(val); end
end
end
+# source://activesupport//lib/active_support/core_ext/date_and_time/zones.rb#4
module DateAndTime::Zones
+ # Returns the simultaneous time in Time.zone if a zone is given or
+ # if Time.zone_default is set. Otherwise, it returns the current time.
+ #
+ # Time.zone = 'Hawaii' # => 'Hawaii'
+ # Time.utc(2000).in_time_zone # => Fri, 31 Dec 1999 14:00:00 HST -10:00
+ # Date.new(2000).in_time_zone # => Sat, 01 Jan 2000 00:00:00 HST -10:00
+ #
+ # This method is similar to Time#localtime, except that it uses Time.zone as the local zone
+ # instead of the operating system's time zone.
+ #
+ # You can also pass in a TimeZone instance or string that identifies a TimeZone as an argument,
+ # and the conversion will be based on that zone instead of Time.zone.
+ #
+ # Time.utc(2000).in_time_zone('Alaska') # => Fri, 31 Dec 1999 15:00:00 AKST -09:00
+ # Date.new(2000).in_time_zone('Alaska') # => Sat, 01 Jan 2000 00:00:00 AKST -09:00
+ #
+ # source://activesupport//lib/active_support/core_ext/date_and_time/zones.rb#20
def in_time_zone(zone = T.unsafe(nil)); end
private
+ # source://activesupport//lib/active_support/core_ext/date_and_time/zones.rb#32
def time_with_zone(time, zone); end
end
+# source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#5
class DateTime < ::Date
include ::DateAndTime::Compatibility
+ # Layers additional behavior on DateTime#<=> so that Time and
+ # ActiveSupport::TimeWithZone instances can be compared with a DateTime.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#204
def <=>(other); end
+
+ # Duck-types as a Date-like class. See Object#acts_like?.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/acts_like.rb#8
def acts_like_date?; end
+
+ # Duck-types as a Time-like class. See Object#acts_like?.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/acts_like.rb#13
def acts_like_time?; end
+
+ # Uses Date to provide precise Time calculations for years, months, and days.
+ # The +options+ parameter takes a hash with any of these keys: :years,
+ # :months, :weeks, :days, :hours,
+ # :minutes, :seconds.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#78
def advance(options); end
+
+ # Returns a new DateTime representing the time a number of seconds ago.
+ # Do not use this method in combination with x.months, use months_ago instead!
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#105
def ago(seconds); end
+
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#202
def as_json(options = T.unsafe(nil)); end
+
+ # Returns a new DateTime representing the start of the day (0:00).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#118
def at_beginning_of_day; end
+
+ # Returns a new DateTime representing the start of the hour (hh:00:00).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#142
def at_beginning_of_hour; end
+
+ # Returns a new DateTime representing the start of the minute (hh:mm:00).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#154
def at_beginning_of_minute; end
+
+ # Returns a new DateTime representing the end of the day (23:59:59).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#136
def at_end_of_day; end
+
+ # Returns a new DateTime representing the end of the hour (hh:59:59).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#148
def at_end_of_hour; end
+
+ # Returns a new DateTime representing the end of the minute (hh:mm:59).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#160
def at_end_of_minute; end
+
+ # Returns a new DateTime representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#126
def at_midday; end
+
+ # Returns a new DateTime representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#126
def at_middle_of_day; end
+
+ # Returns a new DateTime representing the start of the day (0:00).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#118
def at_midnight; end
+
+ # Returns a new DateTime representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#126
def at_noon; end
+
+ # Returns a new DateTime representing the start of the day (0:00).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#118
def beginning_of_day; end
+
+ # Returns a new DateTime representing the start of the hour (hh:00:00).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#142
def beginning_of_hour; end
+
+ # Returns a new DateTime representing the start of the minute (hh:mm:00).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#154
def beginning_of_minute; end
+
+ # No DateTime is ever blank:
+ #
+ # DateTime.now.blank? # => false
+ #
+ # @return [false]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/blank.rb#11
def blank?; end
+
+ # Returns a new DateTime where one or more of the elements have been changed
+ # according to the +options+ parameter. The time options (:hour,
+ # :min, :sec) reset cascadingly, so if only the hour is
+ # passed, then minute and sec is set to 0. If the hour and minute is passed,
+ # then sec is set to 0. The +options+ parameter takes a hash with any of these
+ # keys: :year, :month, :day, :hour,
+ # :min, :sec, :offset, :start.
+ #
+ # DateTime.new(2012, 8, 29, 22, 35, 0).change(day: 1) # => DateTime.new(2012, 8, 1, 22, 35, 0)
+ # DateTime.new(2012, 8, 29, 22, 35, 0).change(year: 1981, day: 1) # => DateTime.new(1981, 8, 1, 22, 35, 0)
+ # DateTime.new(2012, 8, 29, 22, 35, 0).change(year: 1981, hour: 0) # => DateTime.new(1981, 8, 29, 0, 0, 0)
+ #
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#51
def change(options); end
+
+ # Returns a new DateTime representing the end of the day (23:59:59).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#136
def end_of_day; end
+
+ # Returns a new DateTime representing the end of the hour (hh:59:59).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#148
def end_of_hour; end
+
+ # Returns a new DateTime representing the end of the minute (hh:mm:59).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#160
def end_of_minute; end
+
+ # Returns a formatted string of the offset from UTC, or an alternative
+ # string if the time zone is already UTC.
+ #
+ # datetime = DateTime.civil(2000, 1, 1, 0, 0, 0, Rational(-6, 24))
+ # datetime.formatted_offset # => "-06:00"
+ # datetime.formatted_offset(false) # => "-0600"
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#51
def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end
+
+ # Returns a Time instance of the simultaneous time in the UTC timezone.
+ #
+ # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600
+ # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#180
def getgm; end
+
+ # Returns a Time instance of the simultaneous time in the system timezone.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#166
def getlocal(utc_offset = T.unsafe(nil)); end
+
+ # Returns a Time instance of the simultaneous time in the UTC timezone.
+ #
+ # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600
+ # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#180
def getutc; end
+
+ # Returns a Time instance of the simultaneous time in the UTC timezone.
+ #
+ # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600
+ # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#180
def gmtime; end
+
+ # Returns a new DateTime representing the time a number of seconds since the
+ # instance time. Do not use this method in combination with x.months, use
+ # months_since instead!
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#112
def in(seconds); end
+
+ # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000".
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#56
def inspect; end
+
+ # Returns a Time instance of the simultaneous time in the system timezone.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#166
def localtime(utc_offset = T.unsafe(nil)); end
+
+ # Returns a new DateTime representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#126
def midday; end
+
+ # Returns a new DateTime representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#126
def middle_of_day; end
+
+ # Returns a new DateTime representing the start of the day (0:00).
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#118
def midnight; end
+
+ # Returns a new DateTime representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#126
def noon; end
+
+ # Returns the fraction of a second as nanoseconds
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#94
def nsec; end
+
+ # Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005 14:30:00 +0000".
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#56
def readable_inspect; end
+
+ # Returns the number of seconds since 00:00:00.
+ #
+ # DateTime.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0
+ # DateTime.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296
+ # DateTime.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#20
def seconds_since_midnight; end
+
+ # Returns the number of seconds until 23:59:59.
+ #
+ # DateTime.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399
+ # DateTime.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103
+ # DateTime.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#29
def seconds_until_end_of_day; end
+
+ # Returns a new DateTime representing the time a number of seconds since the
+ # instance time. Do not use this method in combination with x.months, use
+ # months_since instead!
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#112
def since(seconds); end
+
+ # Returns the fraction of a second as a +Rational+
+ #
+ # DateTime.new(2012, 8, 29, 0, 0, 0.5).subsec # => (1/2)
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#36
def subsec; end
+
+ # Converts +self+ to a floating-point number of seconds, including fractional microseconds, since the Unix epoch.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#79
def to_f; end
+
+ # Convert to a formatted string. See Time::DATE_FORMATS for predefined formats.
+ #
+ # This method is aliased to to_s.
+ #
+ # === Examples
+ # datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000
+ #
+ # datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00"
+ # datetime.to_s(:db) # => "2007-12-04 00:00:00"
+ # datetime.to_s(:number) # => "20071204000000"
+ # datetime.to_formatted_s(:short) # => "04 Dec 00:00"
+ # datetime.to_formatted_s(:long) # => "December 04, 2007 00:00"
+ # datetime.to_formatted_s(:long_ordinal) # => "December 4th, 2007 00:00"
+ # datetime.to_formatted_s(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000"
+ # datetime.to_formatted_s(:iso8601) # => "2007-12-04T00:00:00+00:00"
+ #
+ # == Adding your own datetime formats to to_formatted_s
+ # DateTime formats are shared with Time. You can add your own to the
+ # Time::DATE_FORMATS hash. Use the format name as the hash key and
+ # either a strftime string or Proc instance that takes a time or
+ # datetime argument as the value.
+ #
+ # # config/initializers/time_formats.rb
+ # Time::DATE_FORMATS[:month_and_year] = '%B %Y'
+ # Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") }
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#35
def to_formatted_s(format = T.unsafe(nil)); end
+
+ # Converts +self+ to an integer number of seconds since the Unix epoch.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#84
def to_i; end
+
+ # Convert to a formatted string. See Time::DATE_FORMATS for predefined formats.
+ #
+ # This method is aliased to to_s.
+ #
+ # === Examples
+ # datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000
+ #
+ # datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00"
+ # datetime.to_s(:db) # => "2007-12-04 00:00:00"
+ # datetime.to_s(:number) # => "20071204000000"
+ # datetime.to_formatted_s(:short) # => "04 Dec 00:00"
+ # datetime.to_formatted_s(:long) # => "December 04, 2007 00:00"
+ # datetime.to_formatted_s(:long_ordinal) # => "December 4th, 2007 00:00"
+ # datetime.to_formatted_s(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000"
+ # datetime.to_formatted_s(:iso8601) # => "2007-12-04T00:00:00+00:00"
+ #
+ # == Adding your own datetime formats to to_formatted_s
+ # DateTime formats are shared with Time. You can add your own to the
+ # Time::DATE_FORMATS hash. Use the format name as the hash key and
+ # either a strftime string or Proc instance that takes a time or
+ # datetime argument as the value.
+ #
+ # # config/initializers/time_formats.rb
+ # Time::DATE_FORMATS[:month_and_year] = '%B %Y'
+ # Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") }
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#35
def to_s(format = T.unsafe(nil)); end
+
+ # Either return an instance of +Time+ with the same UTC offset
+ # as +self+ or an instance of +Time+ representing the same time
+ # in the local system timezone depending on the setting of
+ # on the setting of +ActiveSupport.to_time_preserves_timezone+.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/compatibility.rb#15
def to_time; end
+
+ # Returns the fraction of a second as microseconds
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#89
def usec; end
+
+ # Returns a Time instance of the simultaneous time in the UTC timezone.
+ #
+ # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600
+ # DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#180
def utc; end
+
+ # Returns +true+ if offset == 0.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#193
def utc?; end
+
+ # Returns the offset value in seconds.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#198
def utc_offset; end
private
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#99
def offset_in_seconds; end
+
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#103
def seconds_since_unix_epoch; end
class << self
+ # Returns DateTime with local offset for given year if format is local else
+ # offset is zero.
+ #
+ # DateTime.civil_from_format :local, 2012
+ # # => Sun, 01 Jan 2012 00:00:00 +0300
+ # DateTime.civil_from_format :local, 2012, 12, 17
+ # # => Mon, 17 Dec 2012 00:00:00 +0000
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/conversions.rb#69
def civil_from_format(utc_or_local, year, month = T.unsafe(nil), day = T.unsafe(nil), hour = T.unsafe(nil), min = T.unsafe(nil), sec = T.unsafe(nil)); end
+
+ # Returns Time.zone.now.to_datetime when Time.zone or
+ # config.time_zone are set, otherwise returns
+ # Time.now.to_datetime.
+ #
+ # source://activesupport//lib/active_support/core_ext/date_time/calculations.rb#10
def current; end
end
end
+# source://activesupport//lib/active_support/core_ext/object/try.rb#117
+class Delegator < ::BasicObject
+ include ::ActiveSupport::Tryable
+end
+
+# source://activesupport//lib/active_support/core_ext/digest/uuid.rb#7
module Digest::UUID
class << self
+ # Generates a v5 non-random UUID (Universally Unique IDentifier).
+ #
+ # Using Digest::MD5 generates version 3 UUIDs; Digest::SHA1 generates version 5 UUIDs.
+ # uuid_from_hash always generates the same UUID for a given name and namespace combination.
+ #
+ # See RFC 4122 for details of UUID at: https://www.ietf.org/rfc/rfc4122.txt
+ #
+ # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#19
def uuid_from_hash(hash_class, uuid_namespace, name); end
+
+ # Convenience method for uuid_from_hash using Digest::MD5.
+ #
+ # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#40
def uuid_v3(uuid_namespace, name); end
+
+ # Convenience method for SecureRandom.uuid.
+ #
+ # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#50
def uuid_v4; end
+
+ # Convenience method for uuid_from_hash using Digest::SHA1.
+ #
+ # source://activesupport//lib/active_support/core_ext/digest/uuid.rb#45
def uuid_v5(uuid_namespace, name); end
end
end
+# source://activesupport//lib/active_support/core_ext/digest/uuid.rb#8
Digest::UUID::DNS_NAMESPACE = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/core_ext/digest/uuid.rb#10
Digest::UUID::OID_NAMESPACE = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/core_ext/digest/uuid.rb#9
Digest::UUID::URL_NAMESPACE = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/core_ext/digest/uuid.rb#11
Digest::UUID::X500_NAMESPACE = T.let(T.unsafe(nil), String)
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#8
module ERB::Util
private
+ # A utility method for escaping HTML tag characters.
+ # This method is also aliased as h.
+ #
+ # puts html_escape('is a > 0 & a < 10?')
+ # # => is a > 0 & a < 10?
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#27
def h(s); end
+
+ # A utility method for escaping HTML tag characters.
+ # This method is also aliased as h.
+ #
+ # puts html_escape('is a > 0 & a < 10?')
+ # # => is a > 0 & a < 10?
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#27
def html_escape(s); end
+
+ # A utility method for escaping HTML without affecting existing escaped entities.
+ #
+ # html_escape_once('1 < 2 & 3')
+ # # => "1 < 2 & 3"
+ #
+ # html_escape_once('<< Accept & Checkout')
+ # # => "<< Accept & Checkout"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#58
def html_escape_once(s); end
+
+ # A utility method for escaping HTML entities in JSON strings. Specifically, the
+ # &, > and < characters are replaced with their equivalent unicode escaped form -
+ # \u0026, \u003e, and \u003c. The Unicode sequences \u2028 and \u2029 are also
+ # escaped as they are treated as newline characters in some JavaScript engines.
+ # These sequences have identical meaning as the original characters inside the
+ # context of a JSON string, so assuming the input is a valid and well-formed
+ # JSON value, the output will have equivalent meaning when parsed:
+ #
+ # json = JSON.generate({ name: ""})
+ # # => "{\"name\":\"\"}"
+ #
+ # json_escape(json)
+ # # => "{\"name\":\"\\u003C/script\\u003E\\u003Cscript\\u003Ealert('PWNED!!!')\\u003C/script\\u003E\"}"
+ #
+ # JSON.parse(json) == JSON.parse(json_escape(json))
+ # # => true
+ #
+ # The intended use case for this method is to escape JSON strings before including
+ # them inside a script tag to avoid XSS vulnerability:
+ #
+ #
+ #
+ # It is necessary to +raw+ the result of +json_escape+, so that quotation marks
+ # don't get converted to " entities. +json_escape+ doesn't
+ # automatically flag the result as HTML safe, since the raw value is unsafe to
+ # use inside HTML attributes.
+ #
+ # If your JSON is being used downstream for insertion into the DOM, be aware of
+ # whether or not it is being inserted via html(). Most jQuery plugins do this.
+ # If that is the case, be sure to +html_escape+ or +sanitize+ any user-generated
+ # content returned by your JSON.
+ #
+ # If you need to output JSON elsewhere in your HTML, you can just do something
+ # like this, as any unsafe characters (including quotation marks) will be
+ # automatically escaped for you:
+ #
+ #
...
+ #
+ # WARNING: this helper only works with valid JSON. Using this on non-JSON values
+ # will open up serious XSS vulnerabilities. For example, if you replace the
+ # +current_user.to_json+ in the example above with user input instead, the browser
+ # will happily eval() that string as JavaScript.
+ #
+ # The escaping performed in this method is identical to those performed in the
+ # Active Support JSON encoder when +ActiveSupport.escape_html_entities_in_json+ is
+ # set to true. Because this transformation is idempotent, this helper can be
+ # applied even if +ActiveSupport.escape_html_entities_in_json+ is already true.
+ #
+ # Therefore, when you are unsure if +ActiveSupport.escape_html_entities_in_json+
+ # is enabled, or if you are unsure where your JSON string originated from, it
+ # is recommended that you always apply this helper (other libraries, such as the
+ # JSON gem, do not provide this kind of protection by default; also some gems
+ # might override +to_json+ to bypass Active Support's encoder).
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#120
def json_escape(s); end
+
+ # HTML escapes strings but doesn't wrap them with an ActiveSupport::SafeBuffer.
+ # This method is not for public consumption! Seriously!
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#41
def unwrapped_html_escape(s); end
+
+ # A utility method for escaping XML names of tags and names of attributes.
+ #
+ # xml_name_escape('1 < 2 & 3')
+ # # => "1___2___3"
+ #
+ # It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#133
def xml_name_escape(name); end
class << self
+ # A utility method for escaping HTML tag characters.
+ # This method is also aliased as h.
+ #
+ # puts html_escape('is a > 0 & a < 10?')
+ # # => is a > 0 & a < 10?
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#27
def h(s); end
+
+ # A utility method for escaping HTML tag characters.
+ # This method is also aliased as h.
+ #
+ # puts html_escape('is a > 0 & a < 10?')
+ # # => is a > 0 & a < 10?
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#27
def html_escape(s); end
+
+ # A utility method for escaping HTML without affecting existing escaped entities.
+ #
+ # html_escape_once('1 < 2 & 3')
+ # # => "1 < 2 & 3"
+ #
+ # html_escape_once('<< Accept & Checkout')
+ # # => "<< Accept & Checkout"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#58
def html_escape_once(s); end
+
+ # A utility method for escaping HTML entities in JSON strings. Specifically, the
+ # &, > and < characters are replaced with their equivalent unicode escaped form -
+ # \u0026, \u003e, and \u003c. The Unicode sequences \u2028 and \u2029 are also
+ # escaped as they are treated as newline characters in some JavaScript engines.
+ # These sequences have identical meaning as the original characters inside the
+ # context of a JSON string, so assuming the input is a valid and well-formed
+ # JSON value, the output will have equivalent meaning when parsed:
+ #
+ # json = JSON.generate({ name: ""})
+ # # => "{\"name\":\"\"}"
+ #
+ # json_escape(json)
+ # # => "{\"name\":\"\\u003C/script\\u003E\\u003Cscript\\u003Ealert('PWNED!!!')\\u003C/script\\u003E\"}"
+ #
+ # JSON.parse(json) == JSON.parse(json_escape(json))
+ # # => true
+ #
+ # The intended use case for this method is to escape JSON strings before including
+ # them inside a script tag to avoid XSS vulnerability:
+ #
+ #
+ #
+ # It is necessary to +raw+ the result of +json_escape+, so that quotation marks
+ # don't get converted to " entities. +json_escape+ doesn't
+ # automatically flag the result as HTML safe, since the raw value is unsafe to
+ # use inside HTML attributes.
+ #
+ # If your JSON is being used downstream for insertion into the DOM, be aware of
+ # whether or not it is being inserted via html(). Most jQuery plugins do this.
+ # If that is the case, be sure to +html_escape+ or +sanitize+ any user-generated
+ # content returned by your JSON.
+ #
+ # If you need to output JSON elsewhere in your HTML, you can just do something
+ # like this, as any unsafe characters (including quotation marks) will be
+ # automatically escaped for you:
+ #
+ #
...
+ #
+ # WARNING: this helper only works with valid JSON. Using this on non-JSON values
+ # will open up serious XSS vulnerabilities. For example, if you replace the
+ # +current_user.to_json+ in the example above with user input instead, the browser
+ # will happily eval() that string as JavaScript.
+ #
+ # The escaping performed in this method is identical to those performed in the
+ # Active Support JSON encoder when +ActiveSupport.escape_html_entities_in_json+ is
+ # set to true. Because this transformation is idempotent, this helper can be
+ # applied even if +ActiveSupport.escape_html_entities_in_json+ is already true.
+ #
+ # Therefore, when you are unsure if +ActiveSupport.escape_html_entities_in_json+
+ # is enabled, or if you are unsure where your JSON string originated from, it
+ # is recommended that you always apply this helper (other libraries, such as the
+ # JSON gem, do not provide this kind of protection by default; also some gems
+ # might override +to_json+ to bypass Active Support's encoder).
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#120
def json_escape(s); end
+
+ # HTML escapes strings but doesn't wrap them with an ActiveSupport::SafeBuffer.
+ # This method is not for public consumption! Seriously!
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#41
def unwrapped_html_escape(s); end
+
+ # A utility method for escaping XML names of tags and names of attributes.
+ #
+ # xml_name_escape('1 < 2 & 3')
+ # # => "1___2___3"
+ #
+ # It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#133
def xml_name_escape(name); end
end
end
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#9
ERB::Util::HTML_ESCAPE = T.let(T.unsafe(nil), Hash)
+
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#11
ERB::Util::HTML_ESCAPE_ONCE_REGEXP = T.let(T.unsafe(nil), Regexp)
+
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#10
ERB::Util::JSON_ESCAPE = T.let(T.unsafe(nil), Hash)
+
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#12
ERB::Util::JSON_ESCAPE_REGEXP = T.let(T.unsafe(nil), Regexp)
+
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#19
ERB::Util::TAG_NAME_FOLLOWING_REGEXP = T.let(T.unsafe(nil), Regexp)
+
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#20
ERB::Util::TAG_NAME_REPLACEMENT_CHAR = T.let(T.unsafe(nil), String)
+
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#18
ERB::Util::TAG_NAME_START_REGEXP = T.let(T.unsafe(nil), Regexp)
+
+# Following XML requirements: https://www.w3.org/TR/REC-xml/#NT-Name
+#
+# source://activesupport//lib/active_support/core_ext/string/output_safety.rb#15
ERB::Util::TAG_NAME_START_REGEXP_SET = T.let(T.unsafe(nil), String)
+# source://activesupport//lib/active_support/core_ext/enumerable.rb#3
module Enumerable
+ include ::ActiveSupport::ToJsonWithActiveSupportEncoder
+
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#135
def as_json(options = T.unsafe(nil)); end
+
+ # Returns a new +Array+ without the blank items.
+ # Uses Object#blank? for determining if an item is blank.
+ #
+ # [1, "", nil, 2, " ", [], {}, false, true].compact_blank
+ # # => [1, 2, true]
+ #
+ # Set.new([nil, "", 1, 2])
+ # # => [2, 1] (or [1, 2])
+ #
+ # When called on a +Hash+, returns a new +Hash+ without the blank values.
+ #
+ # { a: "", b: 1, c: nil, d: [], e: false, f: true }.compact_blank
+ # #=> { b: 1, f: true }
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#191
def compact_blank; end
+
+ # The negative of the Enumerable#include?. Returns +true+ if the
+ # collection does not include the object.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#121
def exclude?(object); end
+
+ # Returns a copy of the enumerable excluding the specified elements.
+ #
+ # ["David", "Rafael", "Aaron", "Todd"].excluding "Aaron", "Todd"
+ # # => ["David", "Rafael"]
+ #
+ # ["David", "Rafael", "Aaron", "Todd"].excluding %w[ Aaron Todd ]
+ # # => ["David", "Rafael"]
+ #
+ # {foo: 1, bar: 2, baz: 3}.excluding :bar
+ # # => {foo: 1, baz: 3}
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#135
def excluding(*elements); end
+
+ # Returns a new array that includes the passed elements.
+ #
+ # [ 1, 2, 3 ].including(4, 5)
+ # # => [ 1, 2, 3, 4, 5 ]
+ #
+ # ["David", "Rafael"].including %w[ Aaron Todd ]
+ # # => ["David", "Rafael", "Aaron", "Todd"]
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#115
def including(*elements); end
+
+ # Convert an enumerable to a hash, using the block result as the key and the
+ # element as the value.
+ #
+ # people.index_by(&:login)
+ # # => { "nextangle" => , "chade-" => , ...}
+ #
+ # people.index_by { |person| "#{person.first_name} #{person.last_name}" }
+ # # => { "Chade- Fowlersburg-e" => , "David Heinemeier Hansson" => , ...}
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#55
def index_by; end
+
+ # Convert an enumerable to a hash, using the element as the key and the block
+ # result as the value.
+ #
+ # post = Post.new(title: "hey there", body: "what's up?")
+ #
+ # %i( title body ).index_with { |attr_name| post.public_send(attr_name) }
+ # # => { title: "hey there", body: "what's up?" }
+ #
+ # If an argument is passed instead of a block, it will be used as the value
+ # for all elements:
+ #
+ # %i( created_at updated_at ).index_with(Time.now)
+ # # => { created_at: 2020-03-09 22:31:47, updated_at: 2020-03-09 22:31:47 }
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#78
def index_with(default = T.unsafe(nil)); end
+
+ # Returns +true+ if the enumerable has more than 1 element. Functionally
+ # equivalent to enum.to_a.size > 1. Can be called with a block too,
+ # much like any?, so people.many? { |p| p.age > 26 } returns +true+
+ # if more than one person is over 26.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#96
def many?; end
+
+ # Extract the given key from the first element in the enumerable.
+ #
+ # [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pick(:name)
+ # # => "David"
+ #
+ # [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pick(:id, :name)
+ # # => [1, "David"]
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#168
def pick(*keys); end
+
+ # Extract the given key from each element in the enumerable.
+ #
+ # [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pluck(:name)
+ # # => ["David", "Rafael", "Aaron"]
+ #
+ # [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pluck(:id, :name)
+ # # => [[1, "David"], [2, "Rafael"]]
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#152
def pluck(*keys); end
+
+ # Calculates a sum from the elements.
+ #
+ # payments.sum { |p| p.price * p.tax_rate }
+ # payments.sum(&:price)
+ #
+ # The latter is a shortcut for:
+ #
+ # payments.inject(0) { |sum, p| sum + p.price }
+ #
+ # It can also calculate the sum without the use of a block.
+ #
+ # [5, 15, 10].sum # => 30
+ # ['foo', 'bar'].sum # => "foobar"
+ # [[1, 2], [3, 1, 5]].sum # => [1, 2, 3, 1, 5]
+ #
+ # The default sum of an empty list is zero. You can override this default:
+ #
+ # [].sum(Payment.new(0)) { |i| i.amount } # => Payment.new(0)
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#37
def sum(identity = T.unsafe(nil), &block); end
+
+ # Alias for #excluding.
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#141
def without(*elements); end
end
+# source://activesupport//lib/active_support/core_ext/enumerable.rb#4
Enumerable::INDEX_WITH_DEFAULT = T.let(T.unsafe(nil), Object)
+# source://activesupport//lib/active_support/core_ext/object/json.rb#235
class Exception
include ::ActiveSupport::Dependencies::Blamable
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#236
def as_json(options = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/core_ext/object/blank.rb#61
class FalseClass
- include ::JSON::Ext::Generator::GeneratorMethods::FalseClass
- include ::MessagePack::CoreExt
-
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#76
def as_json(options = T.unsafe(nil)); end
+
+ # +false+ is blank:
+ #
+ # false.blank? # => true
+ #
+ # @return [true]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/blank.rb#67
def blank?; end
+
+ # Returns +self+.
+ #
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#34
def to_param; end
end
+# source://activesupport//lib/active_support/core_ext/file/atomic.rb#5
+class File < ::IO
+ class << self
+ # Write to a file atomically. Useful for situations where you don't
+ # want other processes or threads to see half-written files.
+ #
+ # File.atomic_write('important.file') do |file|
+ # file.write('hello')
+ # end
+ #
+ # This method needs to create a temporary file. By default it will create it
+ # in the same directory as the destination file. If you don't like this
+ # behavior you can provide a different directory but it must be on the
+ # same physical filesystem as the file you're trying to write.
+ #
+ # File.atomic_write('/data/something.important', '/data/tmp') do |file|
+ # file.write('hello')
+ # end
+ #
+ # source://activesupport//lib/active_support/core_ext/file/atomic.rb#21
+ def atomic_write(file_name, temp_dir = T.unsafe(nil)); end
+
+ # Private utility method.
+ #
+ # source://activesupport//lib/active_support/core_ext/file/atomic.rb#56
+ def probe_stat_in(dir); end
+ end
+end
+
+# source://activesupport//lib/active_support/core_ext/object/json.rb#105
class Float < ::Numeric
include ::ActiveSupport::NumericWithFormat
- include ::JSON::Ext::Generator::GeneratorMethods::Float
- include ::MessagePack::CoreExt
+ # Encoding Infinity or NaN to JSON should return "null". The default returns
+ # "Infinity" or "NaN" which are not valid JSON.
+ #
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#108
def as_json(options = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#109
+ def to_s(format = T.unsafe(nil), options = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/core_ext/hash/deep_merge.rb#3
class Hash
include ::Enumerable
- include ::JSON::Ext::Generator::GeneratorMethods::Hash
- include ::Plist::Emit
- include ::MessagePack::CoreExt
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#159
def as_json(options = T.unsafe(nil)); end
+
+ # Validates all keys in a hash match *valid_keys, raising
+ # +ArgumentError+ on a mismatch.
+ #
+ # Note that keys are treated differently than HashWithIndifferentAccess,
+ # meaning that string and symbol keys will not match.
+ #
+ # { name: 'Rob', years: '28' }.assert_valid_keys(:name, :age) # => raises "ArgumentError: Unknown key: :years. Valid keys are: :name, :age"
+ # { name: 'Rob', age: '28' }.assert_valid_keys('name', 'age') # => raises "ArgumentError: Unknown key: :name. Valid keys are: 'name', 'age'"
+ # { name: 'Rob', age: '28' }.assert_valid_keys(:name, :age) # => passes, raises nothing
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#48
def assert_valid_keys(*valid_keys); end
+
+ # Hash#reject has its own definition, so this needs one too.
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#198
def compact_blank; end
+
+ # Removes all blank values from the +Hash+ in place and returns self.
+ # Uses Object#blank? for determining if a value is blank.
+ #
+ # h = { a: "", b: 1, c: nil, d: [], e: false, f: true }
+ # h.compact_blank!
+ # # => { b: 1, f: true }
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#208
def compact_blank!; end
+
+ # Returns a deep copy of hash.
+ #
+ # hash = { a: { b: 'b' } }
+ # dup = hash.deep_dup
+ # dup[:a][:c] = 'c'
+ #
+ # hash[:a][:c] # => nil
+ # dup[:a][:c] # => "c"
+ #
+ # source://activesupport//lib/active_support/core_ext/object/deep_dup.rb#43
def deep_dup; end
+
+ # Returns a new hash with +self+ and +other_hash+ merged recursively.
+ #
+ # h1 = { a: true, b: { c: [1, 2, 3] } }
+ # h2 = { a: false, b: { x: [3, 4, 5] } }
+ #
+ # h1.deep_merge(h2) # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } }
+ #
+ # Like with Hash#merge in the standard library, a block can be provided
+ # to merge values:
+ #
+ # h1 = { a: 100, b: 200, c: { c1: 100 } }
+ # h2 = { b: 250, c: { c1: 200 } }
+ # h1.deep_merge(h2) { |key, this_val, other_val| this_val + other_val }
+ # # => { a: 100, b: 450, c: { c1: 300 } }
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/deep_merge.rb#18
def deep_merge(other_hash, &block); end
+
+ # Same as +deep_merge+, but modifies +self+.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/deep_merge.rb#23
def deep_merge!(other_hash, &block); end
+
+ # Returns a new hash with all keys converted to strings.
+ # This includes the keys from the root hash and from all
+ # nested hashes and arrays.
+ #
+ # hash = { person: { name: 'Rob', age: '28' } }
+ #
+ # hash.deep_stringify_keys
+ # # => {"person"=>{"name"=>"Rob", "age"=>"28"}}
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#84
def deep_stringify_keys; end
+
+ # Destructively converts all keys to strings.
+ # This includes the keys from the root hash and from all
+ # nested hashes and arrays.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#91
def deep_stringify_keys!; end
+
+ # Returns a new hash with all keys converted to symbols, as long as
+ # they respond to +to_sym+. This includes the keys from the root hash
+ # and from all nested hashes and arrays.
+ #
+ # hash = { 'person' => { 'name' => 'Rob', 'age' => '28' } }
+ #
+ # hash.deep_symbolize_keys
+ # # => {:person=>{:name=>"Rob", :age=>"28"}}
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#103
def deep_symbolize_keys; end
+
+ # Destructively converts all keys to symbols, as long as they respond
+ # to +to_sym+. This includes the keys from the root hash and from all
+ # nested hashes and arrays.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#110
def deep_symbolize_keys!; end
+
+ # Returns a new hash with all keys converted by the block operation.
+ # This includes the keys from the root hash and from all
+ # nested hashes and arrays.
+ #
+ # hash = { person: { name: 'Rob', age: '28' } }
+ #
+ # hash.deep_transform_keys{ |key| key.to_s.upcase }
+ # # => {"PERSON"=>{"NAME"=>"Rob", "AGE"=>"28"}}
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#65
def deep_transform_keys(&block); end
+
+ # Destructively converts all keys by using the block operation.
+ # This includes the keys from the root hash and from all
+ # nested hashes and arrays.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#72
def deep_transform_keys!(&block); end
+
+ # Returns a new hash with all values converted by the block operation.
+ # This includes the values from the root hash and from all
+ # nested hashes and arrays.
+ #
+ # hash = { person: { name: 'Rob', age: '28' } }
+ #
+ # hash.deep_transform_values{ |value| value.to_s.upcase }
+ # # => {person: {name: "ROB", age: "28"}}
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/deep_transform_values.rb#12
def deep_transform_values(&block); end
+
+ # Destructively converts all values by using the block operation.
+ # This includes the values from the root hash and from all
+ # nested hashes and arrays.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/deep_transform_values.rb#19
def deep_transform_values!(&block); end
- def except(*keys); end
+
+ # Removes the given keys from hash and returns it.
+ # hash = { a: true, b: false, c: nil }
+ # hash.except!(:c) # => { a: true, b: false }
+ # hash # => { a: true, b: false }
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/except.rb#20
def except!(*keys); end
+
+ # Removes and returns the key/value pairs matching the given keys.
+ #
+ # hash = { a: 1, b: 2, c: 3, d: 4 }
+ # hash.extract!(:a, :b) # => {:a=>1, :b=>2}
+ # hash # => {:c=>3, :d=>4}
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/slice.rb#24
def extract!(*keys); end
+
+ # By default, only instances of Hash itself are extractable.
+ # Subclasses of Hash may implement this method and return
+ # true to declare themselves as extractable. If a Hash
+ # is extractable, Array#extract_options! pops it from
+ # the Array when it is the last element of the Array.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/array/extract_options.rb#9
def extractable_options?; end
+
+ # Returns an ActiveSupport::HashWithIndifferentAccess out of its receiver:
+ #
+ # { a: 1 }.with_indifferent_access['a'] # => 1
+ # Called when object is nested under an object that receives
+ # #with_indifferent_access. This method will be called on the current object
+ # by the enclosing object and is aliased to #with_indifferent_access by
+ # default. Subclasses of Hash may overwrite this method to return +self+ if
+ # converting to an ActiveSupport::HashWithIndifferentAccess would not be
+ # desirable.
+ #
+ # b = { b: 1 }
+ # { a: b }.with_indifferent_access['a'] # calls b.nested_under_indifferent_access
+ # # => {"b"=>1}
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/indifferent_access.rb#9
def nested_under_indifferent_access; end
+
+ # Merges the caller into +other_hash+. For example,
+ #
+ # options = options.reverse_merge(size: 25, velocity: 10)
+ #
+ # is equivalent to
+ #
+ # options = { size: 25, velocity: 10 }.merge(options)
+ #
+ # This is particularly useful for initializing an options hash
+ # with default values.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/reverse_merge.rb#14
def reverse_merge(other_hash); end
+
+ # Destructive +reverse_merge+.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/reverse_merge.rb#20
def reverse_merge!(other_hash); end
+
+ # Destructive +reverse_merge+.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/reverse_merge.rb#20
def reverse_update(other_hash); end
+
+ # Replaces the hash with only the given keys.
+ # Returns a hash containing the removed key/value pairs.
+ #
+ # hash = { a: 1, b: 2, c: 3, d: 4 }
+ # hash.slice!(:a, :b) # => {:c=>3, :d=>4}
+ # hash # => {:a=>1, :b=>2}
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/slice.rb#10
def slice!(*keys); end
+
+ # Returns a new hash with all keys converted to strings.
+ #
+ # hash = { name: 'Rob', age: '28' }
+ #
+ # hash.stringify_keys
+ # # => {"name"=>"Rob", "age"=>"28"}
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#10
def stringify_keys; end
+
+ # Destructively converts all keys to strings. Same as
+ # +stringify_keys+, but modifies +self+.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#16
def stringify_keys!; end
+
+ # Returns a new hash with all keys converted to symbols, as long as
+ # they respond to +to_sym+.
+ #
+ # hash = { 'name' => 'Rob', 'age' => '28' }
+ #
+ # hash.symbolize_keys
+ # # => {:name=>"Rob", :age=>"28"}
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#27
def symbolize_keys; end
+
+ # Destructively converts all keys to symbols, as long as they respond
+ # to +to_sym+. Same as +symbolize_keys+, but modifies +self+.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#34
def symbolize_keys!; end
+
+ # Returns a new hash with all keys converted to symbols, as long as
+ # they respond to +to_sym+.
+ #
+ # hash = { 'name' => 'Rob', 'age' => '28' }
+ #
+ # hash.symbolize_keys
+ # # => {:name=>"Rob", :age=>"28"}
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#27
def to_options; end
+
+ # Destructively converts all keys to symbols, as long as they respond
+ # to +to_sym+. Same as +symbolize_keys+, but modifies +self+.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#34
def to_options!; end
+
+ # Returns a string representation of the receiver suitable for use as a URL
+ # query string:
+ #
+ # {name: 'David', nationality: 'Danish'}.to_query
+ # # => "name=David&nationality=Danish"
+ #
+ # An optional namespace can be passed to enclose key names:
+ #
+ # {name: 'David', nationality: 'Danish'}.to_query('user')
+ # # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
+ #
+ # The string pairs "key=value" that conform the query string
+ # are sorted lexicographically in ascending order.
+ #
+ # This method is also aliased as +to_param+.
+ #
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#77
def to_param(namespace = T.unsafe(nil)); end
+
+ # Returns a string representation of the receiver suitable for use as a URL
+ # query string:
+ #
+ # {name: 'David', nationality: 'Danish'}.to_query
+ # # => "name=David&nationality=Danish"
+ #
+ # An optional namespace can be passed to enclose key names:
+ #
+ # {name: 'David', nationality: 'Danish'}.to_query('user')
+ # # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
+ #
+ # The string pairs "key=value" that conform the query string
+ # are sorted lexicographically in ascending order.
+ #
+ # This method is also aliased as +to_param+.
+ #
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#77
def to_query(namespace = T.unsafe(nil)); end
+
+ # Returns a string containing an XML representation of its receiver:
+ #
+ # { foo: 1, bar: 2 }.to_xml
+ # # =>
+ # #
+ # #
+ # # 1
+ # # 2
+ # #
+ #
+ # To do so, the method loops over the pairs and builds nodes that depend on
+ # the _values_. Given a pair +key+, +value+:
+ #
+ # * If +value+ is a hash there's a recursive call with +key+ as :root.
+ #
+ # * If +value+ is an array there's a recursive call with +key+ as :root,
+ # and +key+ singularized as :children.
+ #
+ # * If +value+ is a callable object it must expect one or two arguments. Depending
+ # on the arity, the callable is invoked with the +options+ hash as first argument
+ # with +key+ as :root, and +key+ singularized as second argument. The
+ # callable can add nodes by using options[:builder].
+ #
+ # {foo: lambda { |options, key| options[:builder].b(key) }}.to_xml
+ # # => "foo"
+ #
+ # * If +value+ responds to +to_xml+ the method is invoked with +key+ as :root.
+ #
+ # class Foo
+ # def to_xml(options)
+ # options[:builder].bar 'fooing!'
+ # end
+ # end
+ #
+ # { foo: Foo.new }.to_xml(skip_instruct: true)
+ # # =>
+ # #
+ # # fooing!
+ # #
+ #
+ # * Otherwise, a node with +key+ as tag is created with a string representation of
+ # +value+ as text node. If +value+ is +nil+ an attribute "nil" set to "true" is added.
+ # Unless the option :skip_types exists and is true, an attribute "type" is
+ # added as well according to the following mapping:
+ #
+ # XML_TYPE_NAMES = {
+ # "Symbol" => "symbol",
+ # "Integer" => "integer",
+ # "BigDecimal" => "decimal",
+ # "Float" => "float",
+ # "TrueClass" => "boolean",
+ # "FalseClass" => "boolean",
+ # "Date" => "date",
+ # "DateTime" => "dateTime",
+ # "Time" => "dateTime"
+ # }
+ #
+ # By default the root node is "hash", but that's configurable via the :root option.
+ #
+ # The default XML builder is a fresh instance of Builder::XmlMarkup. You can
+ # configure your own builder with the :builder option. The method also accepts
+ # options like :dasherize and friends, they are forwarded to the builder.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#75
def to_xml(options = T.unsafe(nil)); end
+
+ # Merges the caller into +other_hash+. For example,
+ #
+ # options = options.reverse_merge(size: 25, velocity: 10)
+ #
+ # is equivalent to
+ #
+ # options = { size: 25, velocity: 10 }.merge(options)
+ #
+ # This is particularly useful for initializing an options hash
+ # with default values.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/reverse_merge.rb#14
def with_defaults(other_hash); end
+
+ # Destructive +reverse_merge+.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/reverse_merge.rb#20
def with_defaults!(other_hash); end
+
+ # Returns an ActiveSupport::HashWithIndifferentAccess out of its receiver:
+ #
+ # { a: 1 }.with_indifferent_access['a'] # => 1
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/indifferent_access.rb#9
def with_indifferent_access; end
private
+ # Support methods for deep transforming nested hashes and arrays.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#116
def _deep_transform_keys_in_object(object, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/hash/keys.rb#129
def _deep_transform_keys_in_object!(object, &block); end
+
+ # Support methods for deep transforming nested hashes and arrays.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/deep_transform_values.rb#25
def _deep_transform_values_in_object(object, &block); end
+
+ # source://activesupport//lib/active_support/core_ext/hash/deep_transform_values.rb#36
def _deep_transform_values_in_object!(object, &block); end
class << self
+ # Builds a Hash from XML just like Hash.from_xml, but also allows Symbol and YAML.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#134
def from_trusted_xml(xml); end
+
+ # Returns a Hash containing a collection of pairs when the key is the node name and the value is
+ # its content
+ #
+ # xml = <<-XML
+ #
+ #
+ # 1
+ # 2
+ #
+ # XML
+ #
+ # hash = Hash.from_xml(xml)
+ # # => {"hash"=>{"foo"=>1, "bar"=>2}}
+ #
+ # +DisallowedType+ is raised if the XML contains attributes with type="yaml" or
+ # type="symbol". Use Hash.from_trusted_xml to
+ # parse this XML.
+ #
+ # Custom +disallowed_types+ can also be passed in the form of an
+ # array.
+ #
+ # xml = <<-XML
+ #
+ #
+ # 1
+ # "David"
+ #
+ # XML
+ #
+ # hash = Hash.from_xml(xml, ['integer'])
+ # # => ActiveSupport::XMLConverter::DisallowedType: Disallowed type attribute: "integer"
+ #
+ # Note that passing custom disallowed types will override the default types,
+ # which are Symbol and YAML.
+ #
+ # source://activesupport//lib/active_support/core_ext/hash/conversions.rb#129
def from_xml(xml, disallowed_types = T.unsafe(nil)); end
end
end
+# :stopdoc:
+#
+# source://activesupport//lib/active_support/hash_with_indifferent_access.rb#423
HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess
+# source://activesupport//lib/active_support/core_ext/object/json.rb#140
class IO
include ::Enumerable
include ::File::Constants
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#141
def as_json(options = T.unsafe(nil)); end
end
+class IO::Buffer
+ include ::Comparable
+
+ def initialize(*_arg0); end
+
+ def <=>(_arg0); end
+ def clear(*_arg0); end
+ def copy(*_arg0); end
+ def empty?; end
+ def external?; end
+ def free; end
+ def get_string(*_arg0); end
+ def get_value(_arg0, _arg1); end
+ def hexdump; end
+ def inspect; end
+ def internal?; end
+ def locked; end
+ def locked?; end
+ def mapped?; end
+ def null?; end
+ def pread(_arg0, _arg1, _arg2); end
+ def pwrite(_arg0, _arg1, _arg2); end
+ def read(_arg0, _arg1); end
+ def readonly?; end
+ def resize(_arg0); end
+ def set_string(*_arg0); end
+ def set_value(_arg0, _arg1, _arg2); end
+ def size; end
+ def slice(_arg0, _arg1); end
+ def to_s; end
+ def transfer; end
+ def valid?; end
+ def write(_arg0, _arg1); end
+
+ class << self
+ def for(_arg0); end
+ def map(*_arg0); end
+ end
+end
+
+class IO::Buffer::AccessError < ::RuntimeError; end
+class IO::Buffer::AllocationError < ::RuntimeError; end
+IO::Buffer::BIG_ENDIAN = T.let(T.unsafe(nil), Integer)
+IO::Buffer::DEFAULT_SIZE = T.let(T.unsafe(nil), Integer)
+IO::Buffer::EXTERNAL = T.let(T.unsafe(nil), Integer)
+IO::Buffer::HOST_ENDIAN = T.let(T.unsafe(nil), Integer)
+IO::Buffer::INTERNAL = T.let(T.unsafe(nil), Integer)
+class IO::Buffer::InvalidatedError < ::RuntimeError; end
+IO::Buffer::LITTLE_ENDIAN = T.let(T.unsafe(nil), Integer)
+IO::Buffer::LOCKED = T.let(T.unsafe(nil), Integer)
+class IO::Buffer::LockedError < ::RuntimeError; end
+IO::Buffer::MAPPED = T.let(T.unsafe(nil), Integer)
+IO::Buffer::NETWORK_ENDIAN = T.let(T.unsafe(nil), Integer)
+IO::Buffer::PAGE_SIZE = T.let(T.unsafe(nil), Integer)
+IO::Buffer::PRIVATE = T.let(T.unsafe(nil), Integer)
+IO::Buffer::READONLY = T.let(T.unsafe(nil), Integer)
+
+class IO::ConsoleMode
+ def echo=(_arg0); end
+ def raw(*_arg0); end
+ def raw!(*_arg0); end
+
+ private
+
+ def initialize_copy(_arg0); end
+end
+
class IO::EAGAINWaitReadable < ::Errno::EAGAIN
include ::IO::WaitReadable
end
@@ -3399,217 +14886,1892 @@ end
IO::EWOULDBLOCKWaitReadable = IO::EAGAINWaitReadable
IO::EWOULDBLOCKWaitWritable = IO::EAGAINWaitWritable
+IO::PRIORITY = T.let(T.unsafe(nil), Integer)
+IO::READABLE = T.let(T.unsafe(nil), Integer)
+IO::WRITABLE = T.let(T.unsafe(nil), Integer)
+# source://activesupport//lib/active_support/core_ext/object/json.rb#223
class IPAddr
- include ::Comparable
-
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#224
def as_json(options = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/core_ext/integer/time.rb#6
class Integer < ::Numeric
include ::ActiveSupport::NumericWithFormat
- include ::JSON::Ext::Generator::GeneratorMethods::Integer
- include ::MessagePack::CoreExt
+ # Returns a Duration instance matching the number of months provided.
+ #
+ # 2.months # => 2 months
+ #
+ # source://activesupport//lib/active_support/core_ext/integer/time.rb#10
def month; end
+
+ # Returns a Duration instance matching the number of months provided.
+ #
+ # 2.months # => 2 months
+ #
+ # source://activesupport//lib/active_support/core_ext/integer/time.rb#10
def months; end
+
+ # Check whether the integer is evenly divisible by the argument.
+ #
+ # 0.multiple_of?(0) # => true
+ # 6.multiple_of?(5) # => false
+ # 10.multiple_of?(2) # => true
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/integer/multiple.rb#9
def multiple_of?(number); end
+
+ # Ordinal returns the suffix used to denote the position
+ # in an ordered sequence such as 1st, 2nd, 3rd, 4th.
+ #
+ # 1.ordinal # => "st"
+ # 2.ordinal # => "nd"
+ # 1002.ordinal # => "nd"
+ # 1003.ordinal # => "rd"
+ # -11.ordinal # => "th"
+ # -1001.ordinal # => "st"
+ #
+ # source://activesupport//lib/active_support/core_ext/integer/inflections.rb#28
def ordinal; end
+
+ # Ordinalize turns a number into an ordinal string used to denote the
+ # position in an ordered sequence such as 1st, 2nd, 3rd, 4th.
+ #
+ # 1.ordinalize # => "1st"
+ # 2.ordinalize # => "2nd"
+ # 1002.ordinalize # => "1002nd"
+ # 1003.ordinalize # => "1003rd"
+ # -11.ordinalize # => "-11th"
+ # -1001.ordinalize # => "-1001st"
+ #
+ # source://activesupport//lib/active_support/core_ext/integer/inflections.rb#15
def ordinalize; end
+
+ # source://activesupport//lib/active_support/core_ext/numeric/conversions.rb#109
+ def to_s(format = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # Returns a Duration instance matching the number of years provided.
+ #
+ # 2.years # => 2 years
+ #
+ # source://activesupport//lib/active_support/core_ext/integer/time.rb#18
def year; end
+
+ # Returns a Duration instance matching the number of years provided.
+ #
+ # 2.years # => 2 years
+ #
+ # source://activesupport//lib/active_support/core_ext/integer/time.rb#18
def years; end
end
+# source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#3
module Kernel
- extend ::Forwardable
+ include ::ActiveSupport::ForkTracker::CoreExt
+ include ::ActiveSupport::ForkTracker::CoreExtPrivate
+ # class_eval on an object acts like singleton_class.class_eval.
+ #
+ # source://activesupport//lib/active_support/core_ext/kernel/singleton_class.rb#5
def class_eval(*args, &block); end
private
+ # A shortcut to define a toplevel concern, not within a module.
+ #
+ # See Module::Concerning for more.
+ #
+ # source://activesupport//lib/active_support/core_ext/kernel/concern.rb#11
def concern(topic, &module_definition); end
+
+ # Sets $VERBOSE to +true+ for the duration of the block and back to its
+ # original value afterwards.
+ #
+ # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#20
def enable_warnings; end
+
+ # source://activesupport//lib/active_support/fork_tracker.rb#26
+ def fork(*_arg0, **_arg1); end
+
+ # Sets $VERBOSE to +nil+ for the duration of the block and back to its original
+ # value afterwards.
+ #
+ # silence_warnings do
+ # value = noisy_call # no warning voiced
+ # end
+ #
+ # noisy_call # warning voiced
+ #
+ # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#14
def silence_warnings; end
+
+ # Blocks and ignores any exception passed as argument if raised within the block.
+ #
+ # suppress(ZeroDivisionError) do
+ # 1/0
+ # puts 'This code is NOT reached'
+ # end
+ #
+ # puts 'This code gets executed and nothing related to ZeroDivisionError was seen'
+ #
+ # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#41
def suppress(*exception_classes); end
+
+ # Sets $VERBOSE for the duration of the block and back to its original
+ # value afterwards.
+ #
+ # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#26
def with_warnings(flag); end
class << self
+ # A shortcut to define a toplevel concern, not within a module.
+ #
+ # See Module::Concerning for more.
+ #
+ # source://activesupport//lib/active_support/core_ext/kernel/concern.rb#11
def concern(topic, &module_definition); end
+
+ # Sets $VERBOSE to +true+ for the duration of the block and back to its
+ # original value afterwards.
+ #
+ # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#20
def enable_warnings; end
+
+ # source://activesupport//lib/active_support/fork_tracker.rb#6
+ def fork(*_arg0, **_arg1); end
+
+ # Sets $VERBOSE to +nil+ for the duration of the block and back to its original
+ # value afterwards.
+ #
+ # silence_warnings do
+ # value = noisy_call # no warning voiced
+ # end
+ #
+ # noisy_call # warning voiced
+ #
+ # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#14
def silence_warnings; end
+
+ # Blocks and ignores any exception passed as argument if raised within the block.
+ #
+ # suppress(ZeroDivisionError) do
+ # 1/0
+ # puts 'This code is NOT reached'
+ # end
+ #
+ # puts 'This code gets executed and nothing related to ZeroDivisionError was seen'
+ #
+ # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#41
def suppress(*exception_classes); end
+
+ # Sets $VERBOSE for the duration of the block and back to its original
+ # value afterwards.
+ #
+ # source://activesupport//lib/active_support/core_ext/kernel/reporting.rb#26
def with_warnings(flag); end
end
end
+# source://activesupport//lib/active_support/core_ext/load_error.rb#3
class LoadError < ::ScriptError
+ include ::DidYouMean::Correctable
+
+ # Returns true if the given path name (except perhaps for the ".rb"
+ # extension) is the missing file which caused the exception to be raised.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/load_error.rb#6
def is_missing?(location); end
end
-class Method
- include ::MethodSource::SourceLocation::MethodExtensions
- include ::MethodSource::MethodExtensions
+module Marshal
+ extend ::ActiveSupport::MarshalWithAutoloading
+end
+# source://activesupport//lib/active_support/core_ext/object/duplicable.rb#31
+class Method
+ # Methods are not duplicable:
+ #
+ # method(:puts).duplicable? # => false
+ # method(:puts).dup # => TypeError: allocator undefined for Method
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/duplicable.rb#36
def duplicable?; end
end
+# Extends the module object with class/module and instance accessors for
+# class/module attributes, just like the native attr* accessors for instance
+# attributes, but does so on a per-thread basis.
+#
+# So the values are scoped within the Thread.current space under the class name
+# of the module.
+#
+# source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#6
class Module
include ::Module::Concerning
include ::ActiveSupport::Dependencies::ModuleConstMissing
+ # Allows you to make aliases for attributes, which includes
+ # getter, setter, and a predicate.
+ #
+ # class Content < ActiveRecord::Base
+ # # has a title attribute
+ # end
+ #
+ # class Email < Content
+ # alias_attribute :subject, :title
+ # end
+ #
+ # e = Email.find(1)
+ # e.title # => "Superstars"
+ # e.subject # => "Superstars"
+ # e.subject? # => true
+ # e.subject = "Megastars"
+ # e.title # => "Megastars"
+ #
+ # source://activesupport//lib/active_support/core_ext/module/aliasing.rb#21
def alias_attribute(new_name, old_name); end
+
+ # A module may or may not have a name.
+ #
+ # module M; end
+ # M.name # => "M"
+ #
+ # m = Module.new
+ # m.name # => nil
+ #
+ # +anonymous?+ method returns true if module does not have a name, false otherwise:
+ #
+ # Module.new.anonymous? # => true
+ #
+ # module M; end
+ # M.anonymous? # => false
+ #
+ # A module gets a name when it is first assigned to a constant. Either
+ # via the +module+ or +class+ keyword or by an explicit assignment:
+ #
+ # m = Module.new # creates an anonymous module
+ # m.anonymous? # => true
+ # M = m # m gets a name here as a side-effect
+ # m.name # => "M"
+ # m.anonymous? # => false
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/module/anonymous.rb#27
def anonymous?; end
+
+ # Declares an attribute reader and writer backed by an internally-named instance
+ # variable.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#16
def attr_internal(*attrs); end
+
+ # Declares an attribute reader and writer backed by an internally-named instance
+ # variable.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#16
def attr_internal_accessor(*attrs); end
+
+ # Declares an attribute reader backed by an internally-named instance variable.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#5
def attr_internal_reader(*attrs); end
+
+ # Declares an attribute writer backed by an internally-named instance variable.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#10
def attr_internal_writer(*attrs); end
+
+ # Defines both class and instance accessors for class attributes.
+ # All class and instance methods created will be public, even if
+ # this method is called with a private or protected access modifier.
+ #
+ # module HairColors
+ # mattr_accessor :hair_colors
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # HairColors.hair_colors = [:brown, :black, :blonde, :red]
+ # HairColors.hair_colors # => [:brown, :black, :blonde, :red]
+ # Person.new.hair_colors # => [:brown, :black, :blonde, :red]
+ #
+ # If a subclass changes the value then that would also change the value for
+ # parent class. Similarly if parent class changes the value then that would
+ # change the value of subclasses too.
+ #
+ # class Citizen < Person
+ # end
+ #
+ # Citizen.new.hair_colors << :blue
+ # Person.new.hair_colors # => [:brown, :black, :blonde, :red, :blue]
+ #
+ # To omit the instance writer method, pass instance_writer: false.
+ # To omit the instance reader method, pass instance_reader: false.
+ #
+ # module HairColors
+ # mattr_accessor :hair_colors, instance_writer: false, instance_reader: false
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.new.hair_colors = [:brown] # => NoMethodError
+ # Person.new.hair_colors # => NoMethodError
+ #
+ # Or pass instance_accessor: false, to omit both instance methods.
+ #
+ # module HairColors
+ # mattr_accessor :hair_colors, instance_accessor: false
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.new.hair_colors = [:brown] # => NoMethodError
+ # Person.new.hair_colors # => NoMethodError
+ #
+ # You can set a default value for the attribute.
+ #
+ # module HairColors
+ # mattr_accessor :hair_colors, default: [:brown, :black, :blonde, :red]
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red]
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#200
def cattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), &blk); end
+
+ # Defines a class attribute and creates a class and instance reader methods.
+ # The underlying class variable is set to +nil+, if it is not previously
+ # defined. All class and instance methods created will be public, even if
+ # this method is called with a private or protected access modifier.
+ #
+ # module HairColors
+ # mattr_reader :hair_colors
+ # end
+ #
+ # HairColors.hair_colors # => nil
+ # HairColors.class_variable_set("@@hair_colors", [:brown, :black])
+ # HairColors.hair_colors # => [:brown, :black]
+ #
+ # The attribute name must be a valid method name in Ruby.
+ #
+ # module Foo
+ # mattr_reader :"1_Badname"
+ # end
+ # # => NameError: invalid attribute name: 1_Badname
+ #
+ # To omit the instance reader method, pass
+ # instance_reader: false or instance_accessor: false.
+ #
+ # module HairColors
+ # mattr_reader :hair_colors, instance_reader: false
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.new.hair_colors # => NoMethodError
+ #
+ # You can set a default value for the attribute.
+ #
+ # module HairColors
+ # mattr_reader :hair_colors, default: [:brown, :black, :blonde, :red]
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.new.hair_colors # => [:brown, :black, :blonde, :red]
+ #
+ # @raise [TypeError]
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#51
def cattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end
+
+ # Defines a class attribute and creates a class and instance writer methods to
+ # allow assignment to the attribute. All class and instance methods created
+ # will be public, even if this method is called with a private or protected
+ # access modifier.
+ #
+ # module HairColors
+ # mattr_writer :hair_colors
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # HairColors.hair_colors = [:brown, :black]
+ # Person.class_variable_get("@@hair_colors") # => [:brown, :black]
+ # Person.new.hair_colors = [:blonde, :red]
+ # HairColors.class_variable_get("@@hair_colors") # => [:blonde, :red]
+ #
+ # To omit the instance writer method, pass
+ # instance_writer: false or instance_accessor: false.
+ #
+ # module HairColors
+ # mattr_writer :hair_colors, instance_writer: false
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.new.hair_colors = [:blonde, :red] # => NoMethodError
+ #
+ # You can set a default value for the attribute.
+ #
+ # module HairColors
+ # mattr_writer :hair_colors, default: [:brown, :black, :blonde, :red]
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red]
+ #
+ # @raise [TypeError]
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#115
def cattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end
+
+ # Provides a +delegate+ class method to easily expose contained objects'
+ # public methods as your own.
+ #
+ # ==== Options
+ # * :to - Specifies the target object name as a symbol or string
+ # * :prefix - Prefixes the new method with the target name or a custom prefix
+ # * :allow_nil - If set to true, prevents a +Module::DelegationError+
+ # from being raised
+ # * :private - If set to true, changes method visibility to private
+ #
+ # The macro receives one or more method names (specified as symbols or
+ # strings) and the name of the target object via the :to option
+ # (also a symbol or string).
+ #
+ # Delegation is particularly useful with Active Record associations:
+ #
+ # class Greeter < ActiveRecord::Base
+ # def hello
+ # 'hello'
+ # end
+ #
+ # def goodbye
+ # 'goodbye'
+ # end
+ # end
+ #
+ # class Foo < ActiveRecord::Base
+ # belongs_to :greeter
+ # delegate :hello, to: :greeter
+ # end
+ #
+ # Foo.new.hello # => "hello"
+ # Foo.new.goodbye # => NoMethodError: undefined method `goodbye' for #
+ #
+ # Multiple delegates to the same target are allowed:
+ #
+ # class Foo < ActiveRecord::Base
+ # belongs_to :greeter
+ # delegate :hello, :goodbye, to: :greeter
+ # end
+ #
+ # Foo.new.goodbye # => "goodbye"
+ #
+ # Methods can be delegated to instance variables, class variables, or constants
+ # by providing them as a symbols:
+ #
+ # class Foo
+ # CONSTANT_ARRAY = [0,1,2,3]
+ # @@class_array = [4,5,6,7]
+ #
+ # def initialize
+ # @instance_array = [8,9,10,11]
+ # end
+ # delegate :sum, to: :CONSTANT_ARRAY
+ # delegate :min, to: :@@class_array
+ # delegate :max, to: :@instance_array
+ # end
+ #
+ # Foo.new.sum # => 6
+ # Foo.new.min # => 4
+ # Foo.new.max # => 11
+ #
+ # It's also possible to delegate a method to the class by using +:class+:
+ #
+ # class Foo
+ # def self.hello
+ # "world"
+ # end
+ #
+ # delegate :hello, to: :class
+ # end
+ #
+ # Foo.new.hello # => "world"
+ #
+ # Delegates can optionally be prefixed using the :prefix option. If the value
+ # is true, the delegate methods are prefixed with the name of the object being
+ # delegated to.
+ #
+ # Person = Struct.new(:name, :address)
+ #
+ # class Invoice < Struct.new(:client)
+ # delegate :name, :address, to: :client, prefix: true
+ # end
+ #
+ # john_doe = Person.new('John Doe', 'Vimmersvej 13')
+ # invoice = Invoice.new(john_doe)
+ # invoice.client_name # => "John Doe"
+ # invoice.client_address # => "Vimmersvej 13"
+ #
+ # It is also possible to supply a custom prefix.
+ #
+ # class Invoice < Struct.new(:client)
+ # delegate :name, :address, to: :client, prefix: :customer
+ # end
+ #
+ # invoice = Invoice.new(john_doe)
+ # invoice.customer_name # => 'John Doe'
+ # invoice.customer_address # => 'Vimmersvej 13'
+ #
+ # The delegated methods are public by default.
+ # Pass private: true to change that.
+ #
+ # class User < ActiveRecord::Base
+ # has_one :profile
+ # delegate :first_name, to: :profile
+ # delegate :date_of_birth, to: :profile, private: true
+ #
+ # def age
+ # Date.today.year - date_of_birth.year
+ # end
+ # end
+ #
+ # User.new.first_name # => "Tomas"
+ # User.new.date_of_birth # => NoMethodError: private method `date_of_birth' called for #
+ # User.new.age # => 2
+ #
+ # If the target is +nil+ and does not respond to the delegated method a
+ # +Module::DelegationError+ is raised. If you wish to instead return +nil+,
+ # use the :allow_nil option.
+ #
+ # class User < ActiveRecord::Base
+ # has_one :profile
+ # delegate :age, to: :profile
+ # end
+ #
+ # User.new.age
+ # # => Module::DelegationError: User#age delegated to profile.age, but profile is nil
+ #
+ # But if not having a profile yet is fine and should not be an error
+ # condition:
+ #
+ # class User < ActiveRecord::Base
+ # has_one :profile
+ # delegate :age, to: :profile, allow_nil: true
+ # end
+ #
+ # User.new.age # nil
+ #
+ # Note that if the target is not +nil+ then the call is attempted regardless of the
+ # :allow_nil option, and thus an exception is still raised if said object
+ # does not respond to the method:
+ #
+ # class Foo
+ # def initialize(bar)
+ # @bar = bar
+ # end
+ #
+ # delegate :name, to: :@bar, allow_nil: true
+ # end
+ #
+ # Foo.new("Bar").name # raises NoMethodError: undefined method `name'
+ #
+ # The target method must be public, otherwise it will raise +NoMethodError+.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/delegation.rb#171
def delegate(*methods, to: T.unsafe(nil), prefix: T.unsafe(nil), allow_nil: T.unsafe(nil), private: T.unsafe(nil)); end
+
+ # When building decorators, a common pattern may emerge:
+ #
+ # class Partition
+ # def initialize(event)
+ # @event = event
+ # end
+ #
+ # def person
+ # detail.person || creator
+ # end
+ #
+ # private
+ # def respond_to_missing?(name, include_private = false)
+ # @event.respond_to?(name, include_private)
+ # end
+ #
+ # def method_missing(method, *args, &block)
+ # @event.send(method, *args, &block)
+ # end
+ # end
+ #
+ # With Module#delegate_missing_to, the above is condensed to:
+ #
+ # class Partition
+ # delegate_missing_to :@event
+ #
+ # def initialize(event)
+ # @event = event
+ # end
+ #
+ # def person
+ # detail.person || creator
+ # end
+ # end
+ #
+ # The target can be anything callable within the object, e.g. instance
+ # variables, methods, constants, etc.
+ #
+ # The delegated method must be public on the target, otherwise it will
+ # raise +DelegationError+. If you wish to instead return +nil+,
+ # use the :allow_nil option.
+ #
+ # The marshal_dump and _dump methods are exempt from
+ # delegation due to possible interference when calling
+ # Marshal.dump(object), should the delegation target method
+ # of object add or remove instance variables.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/delegation.rb#295
def delegate_missing_to(target, allow_nil: T.unsafe(nil)); end
+
+ # deprecate :foo
+ # deprecate bar: 'message'
+ # deprecate :foo, :bar, baz: 'warning!', qux: 'gone!'
+ #
+ # You can also use custom deprecator instance:
+ #
+ # deprecate :foo, deprecator: MyLib::Deprecator.new
+ # deprecate :foo, bar: "warning!", deprecator: MyLib::Deprecator.new
+ #
+ # \Custom deprecators must respond to deprecation_warning(deprecated_method_name, message, caller_backtrace)
+ # method where you can implement your custom warning behavior.
+ #
+ # class MyLib::Deprecator
+ # def deprecation_warning(deprecated_method_name, message, caller_backtrace = nil)
+ # message = "#{deprecated_method_name} is deprecated and will be removed from MyLibrary | #{message}"
+ # Kernel.warn message
+ # end
+ # end
+ #
+ # source://activesupport//lib/active_support/core_ext/module/deprecation.rb#22
def deprecate(*method_names); end
+
+ # Defines both class and instance accessors for class attributes.
+ # All class and instance methods created will be public, even if
+ # this method is called with a private or protected access modifier.
+ #
+ # module HairColors
+ # mattr_accessor :hair_colors
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # HairColors.hair_colors = [:brown, :black, :blonde, :red]
+ # HairColors.hair_colors # => [:brown, :black, :blonde, :red]
+ # Person.new.hair_colors # => [:brown, :black, :blonde, :red]
+ #
+ # If a subclass changes the value then that would also change the value for
+ # parent class. Similarly if parent class changes the value then that would
+ # change the value of subclasses too.
+ #
+ # class Citizen < Person
+ # end
+ #
+ # Citizen.new.hair_colors << :blue
+ # Person.new.hair_colors # => [:brown, :black, :blonde, :red, :blue]
+ #
+ # To omit the instance writer method, pass instance_writer: false.
+ # To omit the instance reader method, pass instance_reader: false.
+ #
+ # module HairColors
+ # mattr_accessor :hair_colors, instance_writer: false, instance_reader: false
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.new.hair_colors = [:brown] # => NoMethodError
+ # Person.new.hair_colors # => NoMethodError
+ #
+ # Or pass instance_accessor: false, to omit both instance methods.
+ #
+ # module HairColors
+ # mattr_accessor :hair_colors, instance_accessor: false
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.new.hair_colors = [:brown] # => NoMethodError
+ # Person.new.hair_colors # => NoMethodError
+ #
+ # You can set a default value for the attribute.
+ #
+ # module HairColors
+ # mattr_accessor :hair_colors, default: [:brown, :black, :blonde, :red]
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red]
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#200
def mattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), &blk); end
+
+ # Defines a class attribute and creates a class and instance reader methods.
+ # The underlying class variable is set to +nil+, if it is not previously
+ # defined. All class and instance methods created will be public, even if
+ # this method is called with a private or protected access modifier.
+ #
+ # module HairColors
+ # mattr_reader :hair_colors
+ # end
+ #
+ # HairColors.hair_colors # => nil
+ # HairColors.class_variable_set("@@hair_colors", [:brown, :black])
+ # HairColors.hair_colors # => [:brown, :black]
+ #
+ # The attribute name must be a valid method name in Ruby.
+ #
+ # module Foo
+ # mattr_reader :"1_Badname"
+ # end
+ # # => NameError: invalid attribute name: 1_Badname
+ #
+ # To omit the instance reader method, pass
+ # instance_reader: false or instance_accessor: false.
+ #
+ # module HairColors
+ # mattr_reader :hair_colors, instance_reader: false
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.new.hair_colors # => NoMethodError
+ #
+ # You can set a default value for the attribute.
+ #
+ # module HairColors
+ # mattr_reader :hair_colors, default: [:brown, :black, :blonde, :red]
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.new.hair_colors # => [:brown, :black, :blonde, :red]
+ #
+ # @raise [TypeError]
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#51
def mattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end
+
+ # Defines a class attribute and creates a class and instance writer methods to
+ # allow assignment to the attribute. All class and instance methods created
+ # will be public, even if this method is called with a private or protected
+ # access modifier.
+ #
+ # module HairColors
+ # mattr_writer :hair_colors
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # HairColors.hair_colors = [:brown, :black]
+ # Person.class_variable_get("@@hair_colors") # => [:brown, :black]
+ # Person.new.hair_colors = [:blonde, :red]
+ # HairColors.class_variable_get("@@hair_colors") # => [:blonde, :red]
+ #
+ # To omit the instance writer method, pass
+ # instance_writer: false or instance_accessor: false.
+ #
+ # module HairColors
+ # mattr_writer :hair_colors, instance_writer: false
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.new.hair_colors = [:blonde, :red] # => NoMethodError
+ #
+ # You can set a default value for the attribute.
+ #
+ # module HairColors
+ # mattr_writer :hair_colors, default: [:brown, :black, :blonde, :red]
+ # end
+ #
+ # class Person
+ # include HairColors
+ # end
+ #
+ # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red]
+ #
+ # @raise [TypeError]
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors.rb#115
def mattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil), location: T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/core_ext/module/redefine_method.rb#30
def method_visibility(method); end
+
+ # Returns the module which contains this one according to its name.
+ #
+ # module M
+ # module N
+ # end
+ # end
+ # X = M::N
+ #
+ # M::N.module_parent # => M
+ # X.module_parent # => M
+ #
+ # The parent of top-level and anonymous modules is Object.
+ #
+ # M.module_parent # => Object
+ # Module.new.module_parent # => Object
+ #
+ # source://activesupport//lib/active_support/core_ext/module/introspection.rb#35
def module_parent; end
+
+ # Returns the name of the module containing this one.
+ #
+ # M::N.module_parent_name # => "M"
+ #
+ # source://activesupport//lib/active_support/core_ext/module/introspection.rb#10
def module_parent_name; end
+
+ # Returns all the parents of this module according to its name, ordered from
+ # nested outwards. The receiver is not contained within the result.
+ #
+ # module M
+ # module N
+ # end
+ # end
+ # X = M::N
+ #
+ # M.module_parents # => [Object]
+ # M::N.module_parents # => [M, Object]
+ # X.module_parents # => [M, Object]
+ #
+ # source://activesupport//lib/active_support/core_ext/module/introspection.rb#51
def module_parents; end
+
+ # Replaces the existing method definition, if there is one, with the passed
+ # block as its body.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/redefine_method.rb#17
def redefine_method(method, &block); end
+
+ # Replaces the existing singleton method definition, if there is one, with
+ # the passed block as its body.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/redefine_method.rb#26
def redefine_singleton_method(method, &block); end
+
+ # Removes the named method, if it exists.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/remove_method.rb#7
def remove_possible_method(method); end
+
+ # Removes the named singleton method, if it exists.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/remove_method.rb#14
def remove_possible_singleton_method(method); end
+
+ # Marks the named method as intended to be redefined, if it exists.
+ # Suppresses the Ruby method redefinition warning. Prefer
+ # #redefine_method where possible.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/redefine_method.rb#7
def silence_redefinition_of_method(method); end
+
+ # Defines both class and instance accessors for class attributes.
+ #
+ # class Account
+ # thread_mattr_accessor :user
+ # end
+ #
+ # Account.user = "DHH"
+ # Account.user # => "DHH"
+ # Account.new.user # => "DHH"
+ #
+ # If a subclass changes the value, the parent class' value is not changed.
+ # Similarly, if the parent class changes the value, the value of subclasses
+ # is not changed.
+ #
+ # class Customer < Account
+ # end
+ #
+ # Customer.user = "Rafael"
+ # Customer.user # => "Rafael"
+ # Account.user # => "DHH"
+ #
+ # To omit the instance writer method, pass instance_writer: false.
+ # To omit the instance reader method, pass instance_reader: false.
+ #
+ # class Current
+ # thread_mattr_accessor :user, instance_writer: false, instance_reader: false
+ # end
+ #
+ # Current.new.user = "DHH" # => NoMethodError
+ # Current.new.user # => NoMethodError
+ #
+ # Or pass instance_accessor: false, to omit both instance methods.
+ #
+ # class Current
+ # thread_mattr_accessor :user, instance_accessor: false
+ # end
+ #
+ # Current.new.user = "DHH" # => NoMethodError
+ # Current.new.user # => NoMethodError
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#143
def thread_cattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end
+
+ # Defines a per-thread class attribute and creates class and instance reader methods.
+ # The underlying per-thread class variable is set to +nil+, if it is not previously defined.
+ #
+ # module Current
+ # thread_mattr_reader :user
+ # end
+ #
+ # Current.user # => nil
+ # Thread.current[:attr_Current_user] = "DHH"
+ # Current.user # => "DHH"
+ #
+ # The attribute name must be a valid method name in Ruby.
+ #
+ # module Foo
+ # thread_mattr_reader :"1_Badname"
+ # end
+ # # => NameError: invalid attribute name: 1_Badname
+ #
+ # To omit the instance reader method, pass
+ # instance_reader: false or instance_accessor: false.
+ #
+ # class Current
+ # thread_mattr_reader :user, instance_reader: false
+ # end
+ #
+ # Current.new.user # => NoMethodError
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#36
def thread_cattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end
+
+ # Defines a per-thread class attribute and creates a class and instance writer methods to
+ # allow assignment to the attribute.
+ #
+ # module Current
+ # thread_mattr_writer :user
+ # end
+ #
+ # Current.user = "DHH"
+ # Thread.current[:attr_Current_user] # => "DHH"
+ #
+ # To omit the instance writer method, pass
+ # instance_writer: false or instance_accessor: false.
+ #
+ # class Current
+ # thread_mattr_writer :user, instance_writer: false
+ # end
+ #
+ # Current.new.user = "DHH" # => NoMethodError
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#79
def thread_cattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end
+
+ # Defines both class and instance accessors for class attributes.
+ #
+ # class Account
+ # thread_mattr_accessor :user
+ # end
+ #
+ # Account.user = "DHH"
+ # Account.user # => "DHH"
+ # Account.new.user # => "DHH"
+ #
+ # If a subclass changes the value, the parent class' value is not changed.
+ # Similarly, if the parent class changes the value, the value of subclasses
+ # is not changed.
+ #
+ # class Customer < Account
+ # end
+ #
+ # Customer.user = "Rafael"
+ # Customer.user # => "Rafael"
+ # Account.user # => "DHH"
+ #
+ # To omit the instance writer method, pass instance_writer: false.
+ # To omit the instance reader method, pass instance_reader: false.
+ #
+ # class Current
+ # thread_mattr_accessor :user, instance_writer: false, instance_reader: false
+ # end
+ #
+ # Current.new.user = "DHH" # => NoMethodError
+ # Current.new.user # => NoMethodError
+ #
+ # Or pass instance_accessor: false, to omit both instance methods.
+ #
+ # class Current
+ # thread_mattr_accessor :user, instance_accessor: false
+ # end
+ #
+ # Current.new.user = "DHH" # => NoMethodError
+ # Current.new.user # => NoMethodError
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#143
def thread_mattr_accessor(*syms, instance_reader: T.unsafe(nil), instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end
+
+ # Defines a per-thread class attribute and creates class and instance reader methods.
+ # The underlying per-thread class variable is set to +nil+, if it is not previously defined.
+ #
+ # module Current
+ # thread_mattr_reader :user
+ # end
+ #
+ # Current.user # => nil
+ # Thread.current[:attr_Current_user] = "DHH"
+ # Current.user # => "DHH"
+ #
+ # The attribute name must be a valid method name in Ruby.
+ #
+ # module Foo
+ # thread_mattr_reader :"1_Badname"
+ # end
+ # # => NameError: invalid attribute name: 1_Badname
+ #
+ # To omit the instance reader method, pass
+ # instance_reader: false or instance_accessor: false.
+ #
+ # class Current
+ # thread_mattr_reader :user, instance_reader: false
+ # end
+ #
+ # Current.new.user # => NoMethodError
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#36
def thread_mattr_reader(*syms, instance_reader: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end
+
+ # Defines a per-thread class attribute and creates a class and instance writer methods to
+ # allow assignment to the attribute.
+ #
+ # module Current
+ # thread_mattr_writer :user
+ # end
+ #
+ # Current.user = "DHH"
+ # Thread.current[:attr_Current_user] # => "DHH"
+ #
+ # To omit the instance writer method, pass
+ # instance_writer: false or instance_accessor: false.
+ #
+ # class Current
+ # thread_mattr_writer :user, instance_writer: false
+ # end
+ #
+ # Current.new.user = "DHH" # => NoMethodError
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attribute_accessors_per_thread.rb#79
def thread_mattr_writer(*syms, instance_writer: T.unsafe(nil), instance_accessor: T.unsafe(nil), default: T.unsafe(nil)); end
private
+ # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#30
def attr_internal_define(attr_name, type); end
+
+ # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#26
def attr_internal_ivar_name(attr); end
class << self
+ # Returns the value of attribute attr_internal_naming_format.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#22
def attr_internal_naming_format; end
+
+ # Sets the attribute attr_internal_naming_format
+ #
+ # @param value the value to set the attribute attr_internal_naming_format to.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/attr_internal.rb#22
def attr_internal_naming_format=(_arg0); end
end
end
+# = Bite-sized separation of concerns
+#
+# We often find ourselves with a medium-sized chunk of behavior that we'd
+# like to extract, but only mix in to a single class.
+#
+# Extracting a plain old Ruby object to encapsulate it and collaborate or
+# delegate to the original object is often a good choice, but when there's
+# no additional state to encapsulate or we're making DSL-style declarations
+# about the parent class, introducing new collaborators can obfuscate rather
+# than simplify.
+#
+# The typical route is to just dump everything in a monolithic class, perhaps
+# with a comment, as a least-bad alternative. Using modules in separate files
+# means tedious sifting to get a big-picture view.
+#
+# = Dissatisfying ways to separate small concerns
+#
+# == Using comments:
+#
+# class Todo < ApplicationRecord
+# # Other todo implementation
+# # ...
+#
+# ## Event tracking
+# has_many :events
+#
+# before_create :track_creation
+#
+# private
+# def track_creation
+# # ...
+# end
+# end
+#
+# == With an inline module:
+#
+# Noisy syntax.
+#
+# class Todo < ApplicationRecord
+# # Other todo implementation
+# # ...
+#
+# module EventTracking
+# extend ActiveSupport::Concern
+#
+# included do
+# has_many :events
+# before_create :track_creation
+# end
+#
+# private
+# def track_creation
+# # ...
+# end
+# end
+# include EventTracking
+# end
+#
+# == Mix-in noise exiled to its own file:
+#
+# Once our chunk of behavior starts pushing the scroll-to-understand-it
+# boundary, we give in and move it to a separate file. At this size, the
+# increased overhead can be a reasonable tradeoff even if it reduces our
+# at-a-glance perception of how things work.
+#
+# class Todo < ApplicationRecord
+# # Other todo implementation
+# # ...
+#
+# include TodoEventTracking
+# end
+#
+# = Introducing Module#concerning
+#
+# By quieting the mix-in noise, we arrive at a natural, low-ceremony way to
+# separate bite-sized concerns.
+#
+# class Todo < ApplicationRecord
+# # Other todo implementation
+# # ...
+#
+# concerning :EventTracking do
+# included do
+# has_many :events
+# before_create :track_creation
+# end
+#
+# private
+# def track_creation
+# # ...
+# end
+# end
+# end
+#
+# Todo.ancestors
+# # => [Todo, Todo::EventTracking, ApplicationRecord, Object]
+#
+# This small step has some wonderful ripple effects. We can
+# * grok the behavior of our class in one glance,
+# * clean up monolithic junk-drawer classes by separating their concerns, and
+# * stop leaning on protected/private for crude "this is internal stuff" modularity.
+#
+# === Prepending concerning
+#
+# concerning supports a prepend: true argument which will prepend the
+# concern instead of using include for it.
+#
+# source://activesupport//lib/active_support/core_ext/module/concerning.rb#112
module Module::Concerning
+ # A low-cruft shortcut to define a concern.
+ #
+ # concern :EventTracking do
+ # ...
+ # end
+ #
+ # is equivalent to
+ #
+ # module EventTracking
+ # extend ActiveSupport::Concern
+ #
+ # ...
+ # end
+ #
+ # source://activesupport//lib/active_support/core_ext/module/concerning.rb#132
def concern(topic, &module_definition); end
+
+ # Define a new concern and mix it in.
+ #
+ # source://activesupport//lib/active_support/core_ext/module/concerning.rb#114
def concerning(topic, prepend: T.unsafe(nil), &block); end
end
+# source://activesupport//lib/active_support/core_ext/module/delegation.rb#13
Module::DELEGATION_RESERVED_KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://activesupport//lib/active_support/core_ext/module/delegation.rb#14
Module::DELEGATION_RESERVED_METHOD_NAMES = T.let(T.unsafe(nil), Set)
+
+# Error generated by +delegate+ when a method is called on +nil+ and +allow_nil+
+# option is not used.
+#
+# source://activesupport//lib/active_support/core_ext/module/delegation.rb#8
class Module::DelegationError < ::NoMethodError; end
+
+# source://activesupport//lib/active_support/core_ext/module/delegation.rb#10
Module::RUBY_RESERVED_KEYWORDS = T.let(T.unsafe(nil), Array)
+# source://activesupport//lib/active_support/core_ext/name_error.rb#3
class NameError < ::StandardError
+ include ::ErrorHighlight::CoreExt
include ::DidYouMean::Correctable
+ # Extract the name of the missing constant from the exception message.
+ #
+ # begin
+ # HelloWorld
+ # rescue NameError => e
+ # e.missing_name
+ # end
+ # # => "HelloWorld"
+ #
+ # source://activesupport//lib/active_support/core_ext/name_error.rb#12
def missing_name; end
+
+ # Was this exception raised because the given name was missing?
+ #
+ # begin
+ # HelloWorld
+ # rescue NameError => e
+ # e.missing_name?("HelloWorld")
+ # end
+ # # => true
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/name_error.rb#44
def missing_name?(name); end
private
+ # source://activesupport//lib/active_support/core_ext/name_error.rb#57
def real_mod_name(mod); end
end
+# source://activesupport//lib/active_support/core_ext/name_error.rb#53
NameError::UNBOUND_METHOD_MODULE_NAME = T.let(T.unsafe(nil), UnboundMethod)
+# source://activesupport//lib/active_support/core_ext/object/blank.rb#50
class NilClass
- include ::JSON::Ext::Generator::GeneratorMethods::NilClass
- include ::MessagePack::CoreExt
-
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#82
def as_json(options = T.unsafe(nil)); end
+
+ # +nil+ is blank:
+ #
+ # nil.blank? # => true
+ #
+ # @return [true]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/blank.rb#56
def blank?; end
+
+ # Returns +self+.
+ #
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#20
def to_param; end
+
+ # Calling +try+ on +nil+ always returns +nil+.
+ # It becomes especially helpful when navigating through associations that may return +nil+.
+ #
+ # nil.try(:name) # => nil
+ #
+ # Without +try+
+ # @person && @person.children.any? && @person.children.first.name
+ #
+ # With +try+
+ # @person.try(:children).try(:first).try(:name)
+ #
+ # source://activesupport//lib/active_support/core_ext/object/try.rb#148
def try(_method_name = T.unsafe(nil), *_arg1); end
+
+ # Calling +try!+ on +nil+ always returns +nil+.
+ #
+ # nil.try!(:name) # => nil
+ #
+ # source://activesupport//lib/active_support/core_ext/object/try.rb#155
def try!(_method_name = T.unsafe(nil), *_arg1); end
end
+# source://activesupport//lib/active_support/core_ext/object/blank.rb#134
class Numeric
include ::Comparable
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#100
def as_json(options = T.unsafe(nil)); end
+
+ # No number is blank:
+ #
+ # 1.blank? # => false
+ # 0.blank? # => false
+ #
+ # @return [false]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/blank.rb#141
def blank?; end
+
+ # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
+ #
+ # 2.bytes # => 2
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#14
def byte; end
+
+ # Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
+ #
+ # 2.bytes # => 2
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#14
def bytes; end
+
+ # Returns a Duration instance matching the number of days provided.
+ #
+ # 2.days # => 2 days
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#37
def day; end
+
+ # Returns a Duration instance matching the number of days provided.
+ #
+ # 2.days # => 2 days
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#37
def days; end
+
+ # Returns the number of bytes equivalent to the exabytes provided.
+ #
+ # 2.exabytes # => 2_305_843_009_213_693_952
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#62
def exabyte; end
+
+ # Returns the number of bytes equivalent to the exabytes provided.
+ #
+ # 2.exabytes # => 2_305_843_009_213_693_952
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#62
def exabytes; end
+
+ # Returns a Duration instance matching the number of fortnights provided.
+ #
+ # 2.fortnights # => 4 weeks
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#53
def fortnight; end
+
+ # Returns a Duration instance matching the number of fortnights provided.
+ #
+ # 2.fortnights # => 4 weeks
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#53
def fortnights; end
+
+ # Returns the number of bytes equivalent to the gigabytes provided.
+ #
+ # 2.gigabytes # => 2_147_483_648
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#38
def gigabyte; end
+
+ # Returns the number of bytes equivalent to the gigabytes provided.
+ #
+ # 2.gigabytes # => 2_147_483_648
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#38
def gigabytes; end
+
+ # Returns a Duration instance matching the number of hours provided.
+ #
+ # 2.hours # => 2 hours
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#29
def hour; end
+
+ # Returns a Duration instance matching the number of hours provided.
+ #
+ # 2.hours # => 2 hours
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#29
def hours; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#156
def html_safe?; end
+
+ # Returns the number of milliseconds equivalent to the seconds provided.
+ # Used with the standard time durations.
+ #
+ # 2.in_milliseconds # => 2000
+ # 1.hour.in_milliseconds # => 3600000
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#63
def in_milliseconds; end
+
+ # Returns the number of bytes equivalent to the kilobytes provided.
+ #
+ # 2.kilobytes # => 2048
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#22
def kilobyte; end
+
+ # Returns the number of bytes equivalent to the kilobytes provided.
+ #
+ # 2.kilobytes # => 2048
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#22
def kilobytes; end
+
+ # Returns the number of bytes equivalent to the megabytes provided.
+ #
+ # 2.megabytes # => 2_097_152
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#30
def megabyte; end
+
+ # Returns the number of bytes equivalent to the megabytes provided.
+ #
+ # 2.megabytes # => 2_097_152
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#30
def megabytes; end
+
+ # Returns a Duration instance matching the number of minutes provided.
+ #
+ # 2.minutes # => 2 minutes
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#21
def minute; end
+
+ # Returns a Duration instance matching the number of minutes provided.
+ #
+ # 2.minutes # => 2 minutes
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#21
def minutes; end
+
+ # Returns the number of bytes equivalent to the petabytes provided.
+ #
+ # 2.petabytes # => 2_251_799_813_685_248
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#54
def petabyte; end
+
+ # Returns the number of bytes equivalent to the petabytes provided.
+ #
+ # 2.petabytes # => 2_251_799_813_685_248
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#54
def petabytes; end
+
+ # Returns a Duration instance matching the number of seconds provided.
+ #
+ # 2.seconds # => 2 seconds
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#13
def second; end
+
+ # Returns a Duration instance matching the number of seconds provided.
+ #
+ # 2.seconds # => 2 seconds
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#13
def seconds; end
+
+ # Returns the number of bytes equivalent to the terabytes provided.
+ #
+ # 2.terabytes # => 2_199_023_255_552
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#46
def terabyte; end
+
+ # Returns the number of bytes equivalent to the terabytes provided.
+ #
+ # 2.terabytes # => 2_199_023_255_552
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#46
def terabytes; end
+
+ # Returns a Duration instance matching the number of weeks provided.
+ #
+ # 2.weeks # => 2 weeks
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#45
def week; end
+
+ # Returns a Duration instance matching the number of weeks provided.
+ #
+ # 2.weeks # => 2 weeks
+ #
+ # source://activesupport//lib/active_support/core_ext/numeric/time.rb#45
def weeks; end
end
+# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#9
Numeric::EXABYTE = T.let(T.unsafe(nil), Integer)
+
+# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#6
Numeric::GIGABYTE = T.let(T.unsafe(nil), Integer)
+
+# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#4
Numeric::KILOBYTE = T.let(T.unsafe(nil), Integer)
+
+# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#5
Numeric::MEGABYTE = T.let(T.unsafe(nil), Integer)
+
+# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#8
Numeric::PETABYTE = T.let(T.unsafe(nil), Integer)
+
+# source://activesupport//lib/active_support/core_ext/numeric/bytes.rb#7
Numeric::TERABYTE = T.let(T.unsafe(nil), Integer)
+# --
+# Most objects are cloneable, but not all. For example you can't dup methods:
+#
+# method(:puts).dup # => TypeError: allocator undefined for Method
+#
+# Classes may signal their instances are not duplicable removing +dup+/+clone+
+# or raising exceptions from them. So, to dup an arbitrary object you normally
+# use an optimistic approach and are ready to catch an exception, say:
+#
+# arbitrary_object.dup rescue object
+#
+# Rails dups objects in a few critical spots where they are not that arbitrary.
+# That rescue is very expensive (like 40 times slower than a predicate), and it
+# is often triggered.
+#
+# That's why we hardcode the following cases and check duplicable? instead of
+# using that rescue idiom.
+# ++
+#
+# source://activesupport//lib/active_support/core_ext/object/blank.rb#5
class Object < ::BasicObject
include ::ActiveSupport::ToJsonWithActiveSupportEncoder
include ::ActiveSupport::ForkTracker::CoreExt
include ::ActiveSupport::ForkTracker::CoreExtPrivate
include ::Kernel
- include ::JSON::Ext::Generator::GeneratorMethods::Object
include ::PP::ObjectMixin
include ::ActiveSupport::Tryable
include ::ActiveSupport::Dependencies::Loadable
+ # A duck-type assistant method. For example, Active Support extends Date
+ # to define an acts_like_date? method, and extends Time to define
+ # acts_like_time?. As a result, we can do x.acts_like?(:time) and
+ # x.acts_like?(:date) to do duck-type-safe comparisons, since classes that
+ # we want to act like Time simply need to define an acts_like_time? method.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/acts_like.rb#9
def acts_like?(duck); end
+
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#54
def as_json(options = T.unsafe(nil)); end
+
+ # An object is blank if it's false, empty, or a whitespace string.
+ # For example, +nil+, '', ' ', [], {}, and +false+ are all blank.
+ #
+ # This simplifies
+ #
+ # !address || address.empty?
+ #
+ # to
+ #
+ # address.blank?
+ #
+ # @return [true, false]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/blank.rb#18
def blank?; end
+
+ # Returns a deep copy of object if it's duplicable. If it's
+ # not duplicable, returns +self+.
+ #
+ # object = Object.new
+ # dup = object.deep_dup
+ # dup.instance_variable_set(:@a, 1)
+ #
+ # object.instance_variable_defined?(:@a) # => false
+ # dup.instance_variable_defined?(:@a) # => true
+ #
+ # source://activesupport//lib/active_support/core_ext/object/deep_dup.rb#15
def deep_dup; end
+
+ # Can you safely dup this object?
+ #
+ # False for method objects;
+ # true otherwise.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/duplicable.rb#26
def duplicable?; end
+
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#150
def html_safe?; end
+
+ # Returns true if this object is included in the argument. Argument must be
+ # any object which responds to +#include?+. Usage:
+ #
+ # characters = ["Konata", "Kagami", "Tsukasa"]
+ # "Konata".in?(characters) # => true
+ #
+ # This will throw an +ArgumentError+ if the argument doesn't respond
+ # to +#include?+.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/inclusion.rb#12
def in?(another_object); end
+
+ # Returns a hash with string keys that maps instance variable names without "@" to their
+ # corresponding values.
+ #
+ # class C
+ # def initialize(x, y)
+ # @x, @y = x, y
+ # end
+ # end
+ #
+ # C.new(0, 1).instance_values # => {"x" => 0, "y" => 1}
+ #
+ # source://activesupport//lib/active_support/core_ext/object/instance_variables.rb#14
def instance_values; end
+
+ # Returns an array of instance variable names as strings including "@".
+ #
+ # class C
+ # def initialize(x, y)
+ # @x, @y = x, y
+ # end
+ # end
+ #
+ # C.new(0, 1).instance_variable_names # => ["@y", "@x"]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/instance_variables.rb#27
def instance_variable_names; end
+
+ # Returns the receiver if it's present otherwise returns +nil+.
+ # object.presence is equivalent to
+ #
+ # object.present? ? object : nil
+ #
+ # For example, something like
+ #
+ # state = params[:state] if params[:state].present?
+ # country = params[:country] if params[:country].present?
+ # region = state || country || 'US'
+ #
+ # becomes
+ #
+ # region = params[:state].presence || params[:country].presence || 'US'
+ #
+ # @return [Object]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/blank.rb#45
def presence; end
+
+ # Returns the receiver if it's included in the argument otherwise returns +nil+.
+ # Argument must be any object which responds to +#include?+. Usage:
+ #
+ # params[:bucket_type].presence_in %w( project calendar )
+ #
+ # This will throw an +ArgumentError+ if the argument doesn't respond to +#include?+.
+ #
+ # @return [Object]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/inclusion.rb#26
def presence_in(another_object); end
+
+ # An object is present if it's not blank.
+ #
+ # @return [true, false]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/blank.rb#25
def present?; end
+
+ # Alias of to_s.
+ #
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#7
def to_param; end
+
+ # Converts an object into a string suitable for use as a URL query string,
+ # using the given key as the param name.
+ #
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#13
def to_query(key); end
+
+ # An elegant way to factor duplication out of options passed to a series of
+ # method calls. Each method called in the block, with the block variable as
+ # the receiver, will have its options merged with the default +options+ hash
+ # provided. Each method called on the block variable must take an options
+ # hash as its final argument.
+ #
+ # Without with_options, this code contains duplication:
+ #
+ # class Account < ActiveRecord::Base
+ # has_many :customers, dependent: :destroy
+ # has_many :products, dependent: :destroy
+ # has_many :invoices, dependent: :destroy
+ # has_many :expenses, dependent: :destroy
+ # end
+ #
+ # Using with_options, we can remove the duplication:
+ #
+ # class Account < ActiveRecord::Base
+ # with_options dependent: :destroy do |assoc|
+ # assoc.has_many :customers
+ # assoc.has_many :products
+ # assoc.has_many :invoices
+ # assoc.has_many :expenses
+ # end
+ # end
+ #
+ # It can also be used with an explicit receiver:
+ #
+ # I18n.with_options locale: user.locale, scope: 'newsletter' do |i18n|
+ # subject i18n.t :subject
+ # body i18n.t :body, user_name: user.name
+ # end
+ #
+ # When you don't pass an explicit receiver, it executes the whole block
+ # in merging options context:
+ #
+ # class Account < ActiveRecord::Base
+ # with_options dependent: :destroy do
+ # has_many :customers
+ # has_many :products
+ # has_many :invoices
+ # has_many :expenses
+ # end
+ # end
+ #
+ # with_options can also be nested since the call is forwarded to its receiver.
+ #
+ # NOTE: Each nesting level will merge inherited defaults in addition to their own.
+ #
+ # class Post < ActiveRecord::Base
+ # with_options if: :persisted?, length: { minimum: 50 } do
+ # validates :content, if: -> { content.present? }
+ # end
+ # end
+ #
+ # The code is equivalent to:
+ #
+ # validates :content, length: { minimum: 50 }, if: -> { content.present? }
+ #
+ # Hence the inherited default for +if+ key is ignored.
+ #
+ # NOTE: You cannot call class methods implicitly inside of with_options.
+ # You can access these methods using the class name instead:
+ #
+ # class Phone < ActiveRecord::Base
+ # enum phone_number_type: { home: 0, office: 1, mobile: 2 }
+ #
+ # with_options presence: true do
+ # validates :phone_number_type, inclusion: { in: Phone.phone_number_types.keys }
+ # end
+ # end
+ #
+ # source://activesupport//lib/active_support/core_ext/object/with_options.rb#78
def with_options(options, &block); end
end
+# source://activesupport//lib/active_support/core_ext/object/json.rb#217
class Pathname
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#218
def as_json(options = T.unsafe(nil)); end
end
+module Process
+ class << self
+ # source://activesupport//lib/active_support/fork_tracker.rb#6
+ def fork(*_arg0, **_arg1); end
+ end
+end
+
+# source://activesupport//lib/active_support/core_ext/object/json.rb#229
class Process::Status
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#230
def as_json(options = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/core_ext/enumerable.rb#214
class Range
include ::ActiveSupport::RangeWithFormat
include ::ActiveSupport::CompareWithRange
@@ -3617,248 +16779,1385 @@ class Range
include ::ActiveSupport::EachTimeWithZone
include ::Enumerable
+ # source://activesupport//lib/active_support/core_ext/range/compare_range.rb#16
+ def ===(value); end
+
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#147
def as_json(options = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/core_ext/range/compare_range.rb#66
+ def cover?(value); end
+
+ # source://activesupport//lib/active_support/core_ext/range/each.rb#7
+ def each(&block); end
+
+ # source://activesupport//lib/active_support/core_ext/range/include_time_with_zone.rb#12
+ def include?(value); end
+
+ # Compare two ranges and see if they overlap each other
+ # (1..5).overlaps?(4..6) # => true
+ # (1..5).overlaps?(7..9) # => false
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/range/overlaps.rb#7
def overlaps?(other); end
+
+ # source://activesupport//lib/active_support/core_ext/range/each.rb#12
+ def step(n = T.unsafe(nil), &block); end
+
+ # Optimize range sum to use arithmetic progression if a block is not given and
+ # we have a range of numeric values.
+ #
+ # source://activesupport//lib/active_support/core_ext/enumerable.rb#217
def sum(identity = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28
+ def to_default_s(format = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28
+ def to_formatted_s(format = T.unsafe(nil)); end
+
+ # source://activesupport//lib/active_support/core_ext/range/conversions.rb#28
+ def to_s(format = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/core_ext/object/json.rb#128
class Regexp
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#129
def as_json(options = T.unsafe(nil)); end
- def multiline?; end
-end
-
-Regexp::TOKEN_KEYS = T.let(T.unsafe(nil), Array)
-
-class Regexp::Token < ::Struct
- def conditional_level; end
- def conditional_level=(_); end
- def length; end
- def level; end
- def level=(_); end
- def next; end
- def next=(_arg0); end
- def offset; end
- def previous; end
- def previous=(_arg0); end
- def set_level; end
- def set_level=(_); end
- def te; end
- def te=(_); end
- def text; end
- def text=(_); end
- def token; end
- def token=(_); end
- def ts; end
- def ts=(_); end
- def type; end
- def type=(_); end
- class << self
- def [](*_arg0); end
- def inspect; end
- def members; end
- def new(*_arg0); end
- 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
- extend ::Random::Formatter
-
class << self
+ # SecureRandom.base36 generates a random base36 string in lowercase.
+ #
+ # The argument _n_ specifies the length of the random string to be generated.
+ #
+ # If _n_ is not specified or is +nil+, 16 is assumed. It may be larger in the future.
+ # This method can be used over +base58+ if a deterministic case key is necessary.
+ #
+ # The result will contain alphanumeric characters in lowercase.
+ #
+ # p SecureRandom.base36 # => "4kugl2pdqmscqtje"
+ # p SecureRandom.base36(24) # => "77tmhrhjfvfdwodq8w7ev2m7"
+ #
+ # source://activesupport//lib/active_support/core_ext/securerandom.rb#38
def base36(n = T.unsafe(nil)); end
+
+ # SecureRandom.base58 generates a random base58 string.
+ #
+ # The argument _n_ specifies the length of the random string to be generated.
+ #
+ # If _n_ is not specified or is +nil+, 16 is assumed. It may be larger in the future.
+ #
+ # The result may contain alphanumeric characters except 0, O, I and l.
+ #
+ # p SecureRandom.base58 # => "4kUgL2pdQMSCQtjE"
+ # p SecureRandom.base58(24) # => "77TMHrHJFvFDwodq8w7Ev2m7"
+ #
+ # source://activesupport//lib/active_support/core_ext/securerandom.rb#19
def base58(n = T.unsafe(nil)); end
end
end
+# source://activesupport//lib/active_support/core_ext/securerandom.rb#7
SecureRandom::BASE36_ALPHABET = T.let(T.unsafe(nil), Array)
+
+# source://activesupport//lib/active_support/core_ext/securerandom.rb#6
SecureRandom::BASE58_ALPHABET = T.let(T.unsafe(nil), Array)
+# String inflections define new methods on the String class to transform names for different purposes.
+# For instance, you can figure out the name of a table from the name of a class.
+#
+# 'ScaleScore'.tableize # => "scale_scores"
+#
+# source://activesupport//lib/active_support/core_ext/string/multibyte.rb#5
class String
include ::Comparable
- include ::JSON::Ext::Generator::GeneratorMethods::String
- include ::MessagePack::CoreExt
- extend ::JSON::Ext::Generator::GeneratorMethods::String::Extend
+ # Enables more predictable duck-typing on String-like classes. See Object#acts_like?.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/string/behavior.rb#5
def acts_like_string?; end
+
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#88
def as_json(options = T.unsafe(nil)); end
+
+ # If you pass a single integer, returns a substring of one character at that
+ # position. The first character of the string is at position 0, the next at
+ # position 1, and so on. If a range is supplied, a substring containing
+ # characters at offsets given by the range is returned. In both cases, if an
+ # offset is negative, it is counted from the end of the string. Returns +nil+
+ # if the initial offset falls outside the string. Returns an empty string if
+ # the beginning of the range is greater than the end of the string.
+ #
+ # str = "hello"
+ # str.at(0) # => "h"
+ # str.at(1..3) # => "ell"
+ # str.at(-2) # => "l"
+ # str.at(-2..-1) # => "lo"
+ # str.at(5) # => nil
+ # str.at(5..-1) # => ""
+ #
+ # If a Regexp is given, the matching portion of the string is returned.
+ # If a String is given, that given string is returned if it occurs in
+ # the string. In both cases, +nil+ is returned if there is no match.
+ #
+ # str = "hello"
+ # str.at(/lo/) # => "lo"
+ # str.at(/ol/) # => nil
+ # str.at("lo") # => "lo"
+ # str.at("ol") # => nil
+ #
+ # source://activesupport//lib/active_support/core_ext/string/access.rb#29
def at(position); end
+
+ # A string is blank if it's empty or contains whitespaces only:
+ #
+ # ''.blank? # => true
+ # ' '.blank? # => true
+ # "\t\n\r".blank? # => true
+ # ' blah '.blank? # => false
+ #
+ # Unicode whitespace is supported:
+ #
+ # "\u00a0".blank? # => true
+ #
+ # @return [true, false]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/blank.rb#121
def blank?; end
+
+ # By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize
+ # is set to :lower then camelize produces lowerCamelCase.
+ #
+ # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
+ #
+ # 'active_record'.camelize # => "ActiveRecord"
+ # 'active_record'.camelize(:lower) # => "activeRecord"
+ # 'active_record/errors'.camelize # => "ActiveRecord::Errors"
+ # 'active_record/errors'.camelize(:lower) # => "activeRecord::Errors"
+ #
+ # +camelize+ is also aliased as +camelcase+.
+ #
+ # See ActiveSupport::Inflector.camelize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#103
def camelcase(first_letter = T.unsafe(nil)); end
+
+ # By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize
+ # is set to :lower then camelize produces lowerCamelCase.
+ #
+ # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
+ #
+ # 'active_record'.camelize # => "ActiveRecord"
+ # 'active_record'.camelize(:lower) # => "activeRecord"
+ # 'active_record/errors'.camelize # => "ActiveRecord::Errors"
+ # 'active_record/errors'.camelize(:lower) # => "activeRecord::Errors"
+ #
+ # +camelize+ is also aliased as +camelcase+.
+ #
+ # See ActiveSupport::Inflector.camelize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#103
def camelize(first_letter = T.unsafe(nil)); end
+
+ # Creates a class name from a plural table name like Rails does for table names to models.
+ # Note that this returns a string and not a class. (To convert to an actual class
+ # follow +classify+ with +constantize+.)
+ #
+ # 'ham_and_eggs'.classify # => "HamAndEgg"
+ # 'posts'.classify # => "Post"
+ #
+ # See ActiveSupport::Inflector.classify.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#243
def classify; end
+
+ # +constantize+ tries to find a declared constant with the name specified
+ # in the string. It raises a NameError when the name is not in CamelCase
+ # or is not initialized.
+ #
+ # 'Module'.constantize # => Module
+ # 'Class'.constantize # => Class
+ # 'blargle'.constantize # => NameError: wrong constant name blargle
+ #
+ # See ActiveSupport::Inflector.constantize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#73
def constantize; end
+
+ # Replaces underscores with dashes in the string.
+ #
+ # 'puni_puni'.dasherize # => "puni-puni"
+ #
+ # See ActiveSupport::Inflector.dasherize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#152
def dasherize; end
+
+ # Removes the rightmost segment from the constant expression in the string.
+ #
+ # 'Net::HTTP'.deconstantize # => "Net"
+ # '::Net::HTTP'.deconstantize # => "::Net"
+ # 'String'.deconstantize # => ""
+ # '::String'.deconstantize # => ""
+ # ''.deconstantize # => ""
+ #
+ # See ActiveSupport::Inflector.deconstantize.
+ #
+ # See also +demodulize+.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#181
def deconstantize; end
+
+ # Removes the module part from the constant expression in the string.
+ #
+ # 'ActiveSupport::Inflector::Inflections'.demodulize # => "Inflections"
+ # 'Inflections'.demodulize # => "Inflections"
+ # '::Inflections'.demodulize # => "Inflections"
+ # ''.demodulize # => ''
+ #
+ # See ActiveSupport::Inflector.demodulize.
+ #
+ # See also +deconstantize+.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#166
def demodulize; end
+
+ # The inverse of String#include?. Returns true if the string
+ # does not include the other string.
+ #
+ # "hello".exclude? "lo" # => false
+ # "hello".exclude? "ol" # => true
+ # "hello".exclude? ?h # => false
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/string/exclude.rb#10
def exclude?(string); end
+
+ # Returns the first character. If a limit is supplied, returns a substring
+ # from the beginning of the string until it reaches the limit value. If the
+ # given limit is greater than or equal to the string length, returns a copy of self.
+ #
+ # str = "hello"
+ # str.first # => "h"
+ # str.first(1) # => "h"
+ # str.first(2) # => "he"
+ # str.first(0) # => ""
+ # str.first(6) # => "hello"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/access.rb#78
def first(limit = T.unsafe(nil)); end
+
+ # Creates a foreign key name from a class name.
+ # +separate_class_name_and_id_with_underscore+ sets whether
+ # the method should put '_' between the name and 'id'.
+ #
+ # 'Message'.foreign_key # => "message_id"
+ # 'Message'.foreign_key(false) # => "messageid"
+ # 'Admin::Post'.foreign_key # => "post_id"
+ #
+ # See ActiveSupport::Inflector.foreign_key.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#290
def foreign_key(separate_class_name_and_id_with_underscore = T.unsafe(nil)); end
+
+ # Returns a substring from the given position to the end of the string.
+ # If the position is negative, it is counted from the end of the string.
+ #
+ # str = "hello"
+ # str.from(0) # => "hello"
+ # str.from(3) # => "lo"
+ # str.from(-2) # => "lo"
+ #
+ # You can mix it with +to+ method and do fun things like:
+ #
+ # str = "hello"
+ # str.from(0).to(-1) # => "hello"
+ # str.from(1).to(-2) # => "ell"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/access.rb#46
def from(position); end
+
+ # Marks a string as trusted safe. It will be inserted into HTML with no
+ # additional escaping performed. It is your responsibility to ensure that the
+ # string contains no malicious content. This method is equivalent to the
+ # +raw+ helper in views. It is recommended that you use +sanitize+ instead of
+ # this method. It should never be called on user input.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/output_safety.rb#344
def html_safe; end
+
+ # Capitalizes the first word, turns underscores into spaces, and (by default)strips a
+ # trailing '_id' if present.
+ # Like +titleize+, this is meant for creating pretty output.
+ #
+ # The capitalization of the first word can be turned off by setting the
+ # optional parameter +capitalize+ to false.
+ # By default, this parameter is true.
+ #
+ # The trailing '_id' can be kept and capitalized by setting the
+ # optional parameter +keep_id_suffix+ to true.
+ # By default, this parameter is false.
+ #
+ # 'employee_salary'.humanize # => "Employee salary"
+ # 'author_id'.humanize # => "Author"
+ # 'author_id'.humanize(capitalize: false) # => "author"
+ # '_id'.humanize # => "Id"
+ # 'author_id'.humanize(keep_id_suffix: true) # => "Author Id"
+ #
+ # See ActiveSupport::Inflector.humanize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#266
def humanize(capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end
+
+ # Converts String to a TimeWithZone in the current zone if Time.zone or Time.zone_default
+ # is set, otherwise converts String to a Time via String#to_time
+ #
+ # source://activesupport//lib/active_support/core_ext/string/zones.rb#9
def in_time_zone(zone = T.unsafe(nil)); end
+
+ # Indents the lines in the receiver:
+ #
+ # <
+ # def some_method
+ # some_code
+ # end
+ #
+ # The second argument, +indent_string+, specifies which indent string to
+ # use. The default is +nil+, which tells the method to make a guess by
+ # peeking at the first indented line, and fallback to a space if there is
+ # none.
+ #
+ # " foo".indent(2) # => " foo"
+ # "foo\n\t\tbar".indent(2) # => "\t\tfoo\n\t\t\t\tbar"
+ # "foo".indent(2, "\t") # => "\t\tfoo"
+ #
+ # While +indent_string+ is typically one space or tab, it may be any string.
+ #
+ # The third argument, +indent_empty_lines+, is a flag that says whether
+ # empty lines should be indented. Default is false.
+ #
+ # "foo\n\nbar".indent(2) # => " foo\n\n bar"
+ # "foo\n\nbar".indent(2, nil, true) # => " foo\n \n bar"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/indent.rb#42
def indent(amount, indent_string = T.unsafe(nil), indent_empty_lines = T.unsafe(nil)); end
+
+ # Same as +indent+, except it indents the receiver in-place.
+ #
+ # Returns the indented string, or +nil+ if there was nothing to indent.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/indent.rb#7
def indent!(amount, indent_string = T.unsafe(nil), indent_empty_lines = T.unsafe(nil)); end
+
+ # Wraps the current string in the ActiveSupport::StringInquirer class,
+ # which gives you a prettier way to test for equality.
+ #
+ # env = 'production'.inquiry
+ # env.production? # => true
+ # env.development? # => false
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inquiry.rb#13
def inquiry; end
+
+ # Returns +true+ if string has utf_8 encoding.
+ #
+ # utf_8_str = "some string".encode "UTF-8"
+ # iso_str = "some string".encode "ISO-8859-1"
+ #
+ # utf_8_str.is_utf8? # => true
+ # iso_str.is_utf8? # => false
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/string/multibyte.rb#48
def is_utf8?; end
+
+ # Returns the last character of the string. If a limit is supplied, returns a substring
+ # from the end of the string until it reaches the limit value (counting backwards). If
+ # the given limit is greater than or equal to the string length, returns a copy of self.
+ #
+ # str = "hello"
+ # str.last # => "o"
+ # str.last(1) # => "o"
+ # str.last(2) # => "lo"
+ # str.last(0) # => ""
+ # str.last(6) # => "hello"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/access.rb#92
def last(limit = T.unsafe(nil)); end
+
+ # == Multibyte proxy
+ #
+ # +mb_chars+ is a multibyte safe proxy for string methods.
+ #
+ # It creates and returns an instance of the ActiveSupport::Multibyte::Chars class which
+ # encapsulates the original string. A Unicode safe version of all the String methods are defined on this proxy
+ # class. If the proxy class doesn't respond to a certain method, it's forwarded to the encapsulated string.
+ #
+ # >> "lj".mb_chars.upcase.to_s
+ # => "LJ"
+ #
+ # NOTE: Ruby 2.4 and later support native Unicode case mappings:
+ #
+ # >> "lj".upcase
+ # => "LJ"
+ #
+ # == Method chaining
+ #
+ # All the methods on the Chars proxy which normally return a string will return a Chars object. This allows
+ # method chaining on the result of any of these methods.
+ #
+ # name.mb_chars.reverse.length # => 12
+ #
+ # == Interoperability and configuration
+ #
+ # The Chars object tries to be as interchangeable with String objects as possible: sorting and comparing between
+ # String and Char work like expected. The bang! methods change the internal string representation in the Chars
+ # object. Interoperability problems can be resolved easily with a +to_s+ call.
+ #
+ # For more information about the methods defined on the Chars proxy see ActiveSupport::Multibyte::Chars. For
+ # information about how to change the default Multibyte behavior see ActiveSupport::Multibyte.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/multibyte.rb#37
def mb_chars; end
+
+ # Replaces special characters in a string so that it may be used as part of a 'pretty' URL.
+ #
+ # If the optional parameter +locale+ is specified,
+ # the word will be parameterized as a word of that language.
+ # By default, this parameter is set to nil and it will use
+ # the configured I18n.locale.
+ #
+ # class Person
+ # def to_param
+ # "#{id}-#{name.parameterize}"
+ # end
+ # end
+ #
+ # @person = Person.find(1)
+ # # => #
+ #
+ # <%= link_to(@person.name, person_path) %>
+ # # => Donald E. Knuth
+ #
+ # To preserve the case of the characters in a string, use the +preserve_case+ argument.
+ #
+ # class Person
+ # def to_param
+ # "#{id}-#{name.parameterize(preserve_case: true)}"
+ # end
+ # end
+ #
+ # @person = Person.find(1)
+ # # => #
+ #
+ # <%= link_to(@person.name, person_path) %>
+ # # => Donald E. Knuth
+ #
+ # See ActiveSupport::Inflector.parameterize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#219
def parameterize(separator: T.unsafe(nil), preserve_case: T.unsafe(nil), locale: T.unsafe(nil)); end
+
+ # Returns the plural form of the word in the string.
+ #
+ # If the optional parameter +count+ is specified,
+ # the singular form will be returned if count == 1.
+ # For any other value of +count+ the plural will be returned.
+ #
+ # If the optional parameter +locale+ is specified,
+ # the word will be pluralized as a word of that language.
+ # By default, this parameter is set to :en.
+ # You must define your own inflection rules for languages other than English.
+ #
+ # 'post'.pluralize # => "posts"
+ # 'octopus'.pluralize # => "octopi"
+ # 'sheep'.pluralize # => "sheep"
+ # 'words'.pluralize # => "words"
+ # 'the blue mailman'.pluralize # => "the blue mailmen"
+ # 'CamelOctopus'.pluralize # => "CamelOctopi"
+ # 'apple'.pluralize(1) # => "apple"
+ # 'apple'.pluralize(2) # => "apples"
+ # 'ley'.pluralize(:es) # => "leyes"
+ # 'ley'.pluralize(1, :es) # => "ley"
+ #
+ # See ActiveSupport::Inflector.pluralize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#35
def pluralize(count = T.unsafe(nil), locale = T.unsafe(nil)); end
+
+ # Returns a new string with all occurrences of the patterns removed.
+ # str = "foo bar test"
+ # str.remove(" test") # => "foo bar"
+ # str.remove(" test", /bar/) # => "foo "
+ # str # => "foo bar test"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/filters.rb#32
def remove(*patterns); end
+
+ # Alters the string by removing all occurrences of the patterns.
+ # str = "foo bar test"
+ # str.remove!(" test", /bar/) # => "foo "
+ # str # => "foo "
+ #
+ # source://activesupport//lib/active_support/core_ext/string/filters.rb#40
def remove!(*patterns); end
+
+ # +safe_constantize+ tries to find a declared constant with the name specified
+ # in the string. It returns +nil+ when the name is not in CamelCase
+ # or is not initialized.
+ #
+ # 'Module'.safe_constantize # => Module
+ # 'Class'.safe_constantize # => Class
+ # 'blargle'.safe_constantize # => nil
+ #
+ # See ActiveSupport::Inflector.safe_constantize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#86
def safe_constantize; end
+
+ # The reverse of +pluralize+, returns the singular form of a word in a string.
+ #
+ # If the optional parameter +locale+ is specified,
+ # the word will be singularized as a word of that language.
+ # By default, this parameter is set to :en.
+ # You must define your own inflection rules for languages other than English.
+ #
+ # 'posts'.singularize # => "post"
+ # 'octopi'.singularize # => "octopus"
+ # 'sheep'.singularize # => "sheep"
+ # 'word'.singularize # => "word"
+ # 'the blue mailmen'.singularize # => "the blue mailman"
+ # 'CamelOctopi'.singularize # => "CamelOctopus"
+ # 'leyes'.singularize(:es) # => "ley"
+ #
+ # See ActiveSupport::Inflector.singularize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#60
def singularize(locale = T.unsafe(nil)); end
+
+ # Returns the string, first removing all whitespace on both ends of
+ # the string, and then changing remaining consecutive whitespace
+ # groups into one space each.
+ #
+ # Note that it handles both ASCII and Unicode whitespace.
+ #
+ # %{ Multi-line
+ # string }.squish # => "Multi-line string"
+ # " foo bar \n \t boo".squish # => "foo bar boo"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/filters.rb#13
def squish; end
+
+ # Performs a destructive squish. See String#squish.
+ # str = " foo bar \n \t boo"
+ # str.squish! # => "foo bar boo"
+ # str # => "foo bar boo"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/filters.rb#21
def squish!; end
+
+ # Strips indentation in heredocs.
+ #
+ # For example in
+ #
+ # if options[:usage]
+ # puts <<-USAGE.strip_heredoc
+ # This command does such and such.
+ #
+ # Supported options are:
+ # -h This message
+ # ...
+ # USAGE
+ # end
+ #
+ # the user would see the usage message aligned against the left margin.
+ #
+ # Technically, it looks for the least indented non-empty line
+ # in the whole string, and removes that amount of leading whitespace.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/strip.rb#22
def strip_heredoc; end
+
+ # Creates the name of a table like Rails does for models to table names. This method
+ # uses the +pluralize+ method on the last word in the string.
+ #
+ # 'RawScaledScorer'.tableize # => "raw_scaled_scorers"
+ # 'ham_and_egg'.tableize # => "ham_and_eggs"
+ # 'fancyCategory'.tableize # => "fancy_categories"
+ #
+ # See ActiveSupport::Inflector.tableize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#231
def tableize; end
+
+ # Capitalizes all the words and replaces some characters in the string to create
+ # a nicer looking title. +titleize+ is meant for creating pretty output. It is not
+ # used in the Rails internals.
+ #
+ # The trailing '_id','Id'.. can be kept and capitalized by setting the
+ # optional parameter +keep_id_suffix+ to true.
+ # By default, this parameter is false.
+ #
+ # 'man from the boondocks'.titleize # => "Man From The Boondocks"
+ # 'x-men: the last stand'.titleize # => "X Men: The Last Stand"
+ # 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id"
+ #
+ # +titleize+ is also aliased as +titlecase+.
+ #
+ # See ActiveSupport::Inflector.titleize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#130
def titlecase(keep_id_suffix: T.unsafe(nil)); end
+
+ # Capitalizes all the words and replaces some characters in the string to create
+ # a nicer looking title. +titleize+ is meant for creating pretty output. It is not
+ # used in the Rails internals.
+ #
+ # The trailing '_id','Id'.. can be kept and capitalized by setting the
+ # optional parameter +keep_id_suffix+ to true.
+ # By default, this parameter is false.
+ #
+ # 'man from the boondocks'.titleize # => "Man From The Boondocks"
+ # 'x-men: the last stand'.titleize # => "X Men: The Last Stand"
+ # 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id"
+ #
+ # +titleize+ is also aliased as +titlecase+.
+ #
+ # See ActiveSupport::Inflector.titleize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#130
def titleize(keep_id_suffix: T.unsafe(nil)); end
+
+ # Returns a substring from the beginning of the string to the given position.
+ # If the position is negative, it is counted from the end of the string.
+ #
+ # str = "hello"
+ # str.to(0) # => "h"
+ # str.to(3) # => "hell"
+ # str.to(-2) # => "hell"
+ #
+ # You can mix it with +from+ method and do fun things like:
+ #
+ # str = "hello"
+ # str.from(0).to(-1) # => "hello"
+ # str.from(1).to(-2) # => "ell"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/access.rb#63
def to(position); end
+
+ # Converts a string to a Date value.
+ #
+ # "1-1-2012".to_date # => Sun, 01 Jan 2012
+ # "01/01/2012".to_date # => Sun, 01 Jan 2012
+ # "2012-12-13".to_date # => Thu, 13 Dec 2012
+ # "12/13/2012".to_date # => ArgumentError: invalid date
+ #
+ # source://activesupport//lib/active_support/core_ext/string/conversions.rb#47
def to_date; end
+
+ # Converts a string to a DateTime value.
+ #
+ # "1-1-2012".to_datetime # => Sun, 01 Jan 2012 00:00:00 +0000
+ # "01/01/2012 23:59:59".to_datetime # => Sun, 01 Jan 2012 23:59:59 +0000
+ # "2012-12-13 12:50".to_datetime # => Thu, 13 Dec 2012 12:50:00 +0000
+ # "12/13/2012".to_datetime # => ArgumentError: invalid date
+ #
+ # source://activesupport//lib/active_support/core_ext/string/conversions.rb#57
def to_datetime; end
+
+ # Converts a string to a Time value.
+ # The +form+ can be either :utc or :local (default :local).
+ #
+ # The time is parsed using Time.parse method.
+ # If +form+ is :local, then the time is in the system timezone.
+ # If the date part is missing then the current date is used and if
+ # the time part is missing then it is assumed to be 00:00:00.
+ #
+ # "13-12-2012".to_time # => 2012-12-13 00:00:00 +0100
+ # "06:12".to_time # => 2012-12-13 06:12:00 +0100
+ # "2012-12-13 06:12".to_time # => 2012-12-13 06:12:00 +0100
+ # "2012-12-13T06:12".to_time # => 2012-12-13 06:12:00 +0100
+ # "2012-12-13T06:12".to_time(:utc) # => 2012-12-13 06:12:00 UTC
+ # "12/13/2012".to_time # => ArgumentError: argument out of range
+ # "1604326192".to_time # => ArgumentError: argument out of range
+ #
+ # source://activesupport//lib/active_support/core_ext/string/conversions.rb#22
def to_time(form = T.unsafe(nil)); end
+
+ # Truncates a given +text+ after a given length if +text+ is longer than length:
+ #
+ # 'Once upon a time in a world far far away'.truncate(27)
+ # # => "Once upon a time in a wo..."
+ #
+ # Pass a string or regexp :separator to truncate +text+ at a natural break:
+ #
+ # 'Once upon a time in a world far far away'.truncate(27, separator: ' ')
+ # # => "Once upon a time in a..."
+ #
+ # 'Once upon a time in a world far far away'.truncate(27, separator: /\s/)
+ # # => "Once upon a time in a..."
+ #
+ # The last characters will be replaced with the :omission string (defaults to "...")
+ # for a total length not exceeding length:
+ #
+ # 'And they found that many people were sleeping better.'.truncate(25, omission: '... (continued)')
+ # # => "And they f... (continued)"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/filters.rb#66
def truncate(truncate_at, options = T.unsafe(nil)); end
+
+ # Truncates +text+ to at most bytesize bytes in length without
+ # breaking string encoding by splitting multibyte characters or breaking
+ # grapheme clusters ("perceptual characters") by truncating at combining
+ # characters.
+ #
+ # >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".size
+ # => 20
+ # >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".bytesize
+ # => 80
+ # >> "🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪🔪".truncate_bytes(20)
+ # => "🔪🔪🔪🔪…"
+ #
+ # The truncated text ends with the :omission string, defaulting
+ # to "…", for a total length not exceeding bytesize.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/filters.rb#95
def truncate_bytes(truncate_at, omission: T.unsafe(nil)); end
+
+ # Truncates a given +text+ after a given number of words (words_count):
+ #
+ # 'Once upon a time in a world far far away'.truncate_words(4)
+ # # => "Once upon a time..."
+ #
+ # Pass a string or regexp :separator to specify a different separator of words:
+ #
+ # 'Once upon a time in a world'.truncate_words(5, separator: ' ')
+ # # => "Once upon a time in..."
+ #
+ # The last characters will be replaced with the :omission string (defaults to "..."):
+ #
+ # 'And they found that many people were sleeping better.'.truncate_words(5, omission: '... (continued)')
+ # # => "And they found that many... (continued)"
+ #
+ # source://activesupport//lib/active_support/core_ext/string/filters.rb#136
def truncate_words(words_count, options = T.unsafe(nil)); end
+
+ # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
+ #
+ # +underscore+ will also change '::' to '/' to convert namespaces to paths.
+ #
+ # 'ActiveModel'.underscore # => "active_model"
+ # 'ActiveModel::Errors'.underscore # => "active_model/errors"
+ #
+ # See ActiveSupport::Inflector.underscore.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#143
def underscore; end
+
+ # Converts just the first character to uppercase.
+ #
+ # 'what a Lovely Day'.upcase_first # => "What a Lovely Day"
+ # 'w'.upcase_first # => "W"
+ # ''.upcase_first # => ""
+ #
+ # See ActiveSupport::Inflector.upcase_first.
+ #
+ # source://activesupport//lib/active_support/core_ext/string/inflections.rb#277
def upcase_first; end
end
+# source://activesupport//lib/active_support/core_ext/object/blank.rb#104
String::BLANK_RE = T.let(T.unsafe(nil), Regexp)
+
+# source://activesupport//lib/active_support/core_ext/object/blank.rb#105
String::ENCODED_BLANKS = T.let(T.unsafe(nil), Concurrent::Map)
+# source://activesupport//lib/active_support/core_ext/object/json.rb#63
class Struct
include ::Enumerable
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#64
def as_json(options = T.unsafe(nil)); end
end
-Struct::Group = Etc::Group
-Struct::Passwd = Etc::Passwd
-Struct::Tms = Process::Tms
-
+# source://activesupport//lib/active_support/core_ext/symbol/starts_ends_with.rb#3
class Symbol
include ::Comparable
- include ::MessagePack::CoreExt
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#94
def as_json(options = T.unsafe(nil)); end
- def end_with?(*suffixes); end
- def ends_with?(*suffixes); end
- def start_with?(*prefixes); end
- def starts_with?(*prefixes); end
end
+# source://activesupport//lib/active_support/core_ext/object/blank.rb#146
class Time
include ::Comparable
include ::DateAndTime::Zones
include ::DateAndTime::Calculations
include ::DateAndTime::Compatibility
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#281
def +(other); end
+
+ # Time#- can also be used to determine the number of seconds between two Time instances.
+ # We're layering on additional behavior so that ActiveSupport::TimeWithZone instances
+ # are coerced into values that Time#- will recognize
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#304
def -(other); end
+
+ # Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances
+ # can be chronologically compared with a Time
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#313
def <=>(other); end
+
+ # Duck-types as a Time-like class. See Object#acts_like?.
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/time/acts_like.rb#7
def acts_like_time?; end
+
+ # Uses Date to provide precise Time calculations for years, months, and days
+ # according to the proleptic Gregorian calendar. The +options+ parameter
+ # takes a hash with any of these keys: :years, :months,
+ # :weeks, :days, :hours, :minutes,
+ # :seconds.
+ #
+ # Time.new(2015, 8, 1, 14, 35, 0).advance(seconds: 1) # => 2015-08-01 14:35:01 -0700
+ # Time.new(2015, 8, 1, 14, 35, 0).advance(minutes: 1) # => 2015-08-01 14:36:00 -0700
+ # Time.new(2015, 8, 1, 14, 35, 0).advance(hours: 1) # => 2015-08-01 15:35:00 -0700
+ # Time.new(2015, 8, 1, 14, 35, 0).advance(days: 1) # => 2015-08-02 14:35:00 -0700
+ # Time.new(2015, 8, 1, 14, 35, 0).advance(weeks: 1) # => 2015-08-08 14:35:00 -0700
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#183
def advance(options); end
+
+ # Returns a new Time representing the time a number of seconds ago, this is basically a wrapper around the Numeric extension
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#209
def ago(seconds); end
+
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#182
def as_json(options = T.unsafe(nil)); end
+
+ # Returns a new Time representing the start of the day (0:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#222
def at_beginning_of_day; end
+
+ # Returns a new Time representing the start of the hour (x:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#251
def at_beginning_of_hour; end
+
+ # Returns a new Time representing the start of the minute (x:xx:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#267
def at_beginning_of_minute; end
+
+ # Returns a new Time representing the end of the day, 23:59:59.999999
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#240
def at_end_of_day; end
+
+ # Returns a new Time representing the end of the hour, x:59:59.999999
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#257
def at_end_of_hour; end
+
+ # Returns a new Time representing the end of the minute, x:xx:59.999999
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#273
def at_end_of_minute; end
+
+ # Returns a new Time representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#230
def at_midday; end
+
+ # Returns a new Time representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#230
def at_middle_of_day; end
+
+ # Returns a new Time representing the start of the day (0:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#222
def at_midnight; end
+
+ # Returns a new Time representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#230
def at_noon; end
+
+ # Returns a new Time representing the start of the day (0:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#222
def beginning_of_day; end
+
+ # Returns a new Time representing the start of the hour (x:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#251
def beginning_of_hour; end
+
+ # Returns a new Time representing the start of the minute (x:xx:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#267
def beginning_of_minute; end
+
+ # No Time is blank:
+ #
+ # Time.now.blank? # => false
+ #
+ # @return [false]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/blank.rb#152
def blank?; end
- def ceil(precision = T.unsafe(nil)); end
+
+ # Returns a new Time where one or more of the elements have been changed according
+ # to the +options+ parameter. The time options (:hour, :min,
+ # :sec, :usec, :nsec) reset cascadingly, so if only
+ # the hour is passed, then minute, sec, usec and nsec is set to 0. If the hour
+ # and minute is passed, then sec, usec and nsec is set to 0. The +options+ parameter
+ # takes a hash with any of these keys: :year, :month, :day,
+ # :hour, :min, :sec, :usec, :nsec,
+ # :offset. Pass either :usec or :nsec, not both.
+ #
+ # Time.new(2012, 8, 29, 22, 35, 0).change(day: 1) # => Time.new(2012, 8, 1, 22, 35, 0)
+ # Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, day: 1) # => Time.new(1981, 8, 1, 22, 35, 0)
+ # Time.new(2012, 8, 29, 22, 35, 0).change(year: 1981, hour: 0) # => Time.new(1981, 8, 29, 0, 0, 0)
+ #
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#139
def change(options); end
+
+ # Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances
+ # can be chronologically compared with a Time
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#313
def compare_with_coercion(other); end
+
+ # Returns a new Time representing the end of the day, 23:59:59.999999
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#240
def end_of_day; end
+
+ # Returns a new Time representing the end of the hour, x:59:59.999999
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#257
def end_of_hour; end
+
+ # Returns a new Time representing the end of the minute, x:xx:59.999999
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#273
def end_of_minute; end
+
+ # Layers additional behavior on Time#eql? so that ActiveSupport::TimeWithZone instances
+ # can be eql? to an equivalent Time
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#328
def eql?(other); end
+
+ # Layers additional behavior on Time#eql? so that ActiveSupport::TimeWithZone instances
+ # can be eql? to an equivalent Time
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#328
def eql_with_coercion(other); end
- def floor(precision = T.unsafe(nil)); end
+
+ # Returns a formatted string of the offset from UTC, or an alternative
+ # string if the time zone is already UTC.
+ #
+ # Time.local(2000).formatted_offset # => "-06:00"
+ # Time.local(2000).formatted_offset(false) # => "-0600"
+ #
+ # source://activesupport//lib/active_support/core_ext/time/conversions.rb#68
def formatted_offset(colon = T.unsafe(nil), alternate_utc_string = T.unsafe(nil)); end
+
+ # Returns a new Time representing the time a number of seconds since the instance time
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#214
def in(seconds); end
+
+ # Returns a new Time representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#230
def midday; end
+
+ # Returns a new Time representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#230
def middle_of_day; end
+
+ # Returns a new Time representing the start of the day (0:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#222
def midnight; end
+
+ # Time#- can also be used to determine the number of seconds between two Time instances.
+ # We're layering on additional behavior so that ActiveSupport::TimeWithZone instances
+ # are coerced into values that Time#- will recognize
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#304
def minus_with_coercion(other); end
+
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#291
def minus_with_duration(other); end
+
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#291
def minus_without_coercion(other); end
+
+ # Returns a new time the specified number of days in the future.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#342
def next_day(days = T.unsafe(nil)); end
+
+ # Returns a new time the specified number of months in the future.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#352
def next_month(months = T.unsafe(nil)); end
+
+ # Returns a new time the specified number of years in the future.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#362
def next_year(years = T.unsafe(nil)); end
+
+ # Returns a new Time representing the middle of the day (12:00)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#230
def noon; end
+
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#281
def plus_with_duration(other); end
+
+ # Returns a new time the specified number of days ago.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#337
def prev_day(days = T.unsafe(nil)); end
+
+ # Returns a new time the specified number of months ago.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#347
def prev_month(months = T.unsafe(nil)); end
+
+ # Returns a new time the specified number of years ago.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#357
def prev_year(years = T.unsafe(nil)); end
+
+ # Returns the fraction of a second as a +Rational+
+ #
+ # Time.new(2012, 8, 29, 0, 0, 0.5).sec_fraction # => (1/2)
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#108
def sec_fraction; end
+
+ # Returns the number of seconds since 00:00:00.
+ #
+ # Time.new(2012, 8, 29, 0, 0, 0).seconds_since_midnight # => 0.0
+ # Time.new(2012, 8, 29, 12, 34, 56).seconds_since_midnight # => 45296.0
+ # Time.new(2012, 8, 29, 23, 59, 59).seconds_since_midnight # => 86399.0
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#92
def seconds_since_midnight; end
+
+ # Returns the number of seconds until 23:59:59.
+ #
+ # Time.new(2012, 8, 29, 0, 0, 0).seconds_until_end_of_day # => 86399
+ # Time.new(2012, 8, 29, 12, 34, 56).seconds_until_end_of_day # => 41103
+ # Time.new(2012, 8, 29, 23, 59, 59).seconds_until_end_of_day # => 0
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#101
def seconds_until_end_of_day; end
+
+ # Returns a new Time representing the time a number of seconds since the instance time
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#214
def since(seconds); end
+
+ # Converts to a formatted string. See DATE_FORMATS for built-in formats.
+ #
+ # This method is aliased to to_s.
+ #
+ # time = Time.now # => 2007-01-18 06:10:17 -06:00
+ #
+ # time.to_formatted_s(:time) # => "06:10"
+ # time.to_s(:time) # => "06:10"
+ #
+ # time.to_formatted_s(:db) # => "2007-01-18 06:10:17"
+ # time.to_formatted_s(:number) # => "20070118061017"
+ # time.to_formatted_s(:short) # => "18 Jan 06:10"
+ # time.to_formatted_s(:long) # => "January 18, 2007 06:10"
+ # time.to_formatted_s(:long_ordinal) # => "January 18th, 2007 06:10"
+ # time.to_formatted_s(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
+ # time.to_formatted_s(:iso8601) # => "2007-01-18T06:10:17-06:00"
+ #
+ # == Adding your own time formats to +to_formatted_s+
+ # You can add your own formats to the Time::DATE_FORMATS hash.
+ # Use the format name as the hash key and either a strftime string
+ # or Proc instance that takes a time argument as the value.
+ #
+ # # config/initializers/time_formats.rb
+ # Time::DATE_FORMATS[:month_and_year] = '%B %Y'
+ # Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") }
+ #
+ # source://activesupport//lib/active_support/core_ext/time/conversions.rb#53
def to_formatted_s(format = T.unsafe(nil)); end
+
+ # Converts to a formatted string. See DATE_FORMATS for built-in formats.
+ #
+ # This method is aliased to to_s.
+ #
+ # time = Time.now # => 2007-01-18 06:10:17 -06:00
+ #
+ # time.to_formatted_s(:time) # => "06:10"
+ # time.to_s(:time) # => "06:10"
+ #
+ # time.to_formatted_s(:db) # => "2007-01-18 06:10:17"
+ # time.to_formatted_s(:number) # => "20070118061017"
+ # time.to_formatted_s(:short) # => "18 Jan 06:10"
+ # time.to_formatted_s(:long) # => "January 18, 2007 06:10"
+ # time.to_formatted_s(:long_ordinal) # => "January 18th, 2007 06:10"
+ # time.to_formatted_s(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
+ # time.to_formatted_s(:iso8601) # => "2007-01-18T06:10:17-06:00"
+ #
+ # == Adding your own time formats to +to_formatted_s+
+ # You can add your own formats to the Time::DATE_FORMATS hash.
+ # Use the format name as the hash key and either a strftime string
+ # or Proc instance that takes a time argument as the value.
+ #
+ # # config/initializers/time_formats.rb
+ # Time::DATE_FORMATS[:month_and_year] = '%B %Y'
+ # Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") }
+ #
+ # source://activesupport//lib/active_support/core_ext/time/conversions.rb#53
def to_s(format = T.unsafe(nil)); end
+
+ # Either return +self+ or the time in the local system timezone depending
+ # on the setting of +ActiveSupport.to_time_preserves_timezone+.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/compatibility.rb#13
def to_time; end
class << self
+ # Overriding case equality method so that it returns true for ActiveSupport::TimeWithZone instances
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#18
def ===(other); end
- def at(*args); end
- def at_with_coercion(*args); end
+
+ # Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime
+ # instances can be used when called with a single argument
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#45
+ def at(*args, **_arg1); end
+
+ # Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime
+ # instances can be used when called with a single argument
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#45
+ def at_with_coercion(*args, **_arg1); end
+
+ # Returns Time.zone.now when Time.zone or config.time_zone are set, otherwise just returns Time.now.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#39
def current; end
+
+ # Returns the number of days in the given month.
+ # If no year is specified, it will use the current year.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#24
def days_in_month(month, year = T.unsafe(nil)); end
+
+ # Returns the number of days in the given year.
+ # If no year is specified, it will use the current year.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#34
def days_in_year(year = T.unsafe(nil)); end
+
+ # Returns a TimeZone instance matching the time zone provided.
+ # Accepts the time zone in any format supported by Time.zone=.
+ # Returns +nil+ for invalid time zones.
+ #
+ # Time.find_zone "America/New_York" # => #
+ # Time.find_zone "NOT-A-TIMEZONE" # => nil
+ #
+ # source://activesupport//lib/active_support/core_ext/time/zones.rb#109
def find_zone(time_zone); end
+
+ # Returns a TimeZone instance matching the time zone provided.
+ # Accepts the time zone in any format supported by Time.zone=.
+ # Raises an +ArgumentError+ for invalid time zones.
+ #
+ # Time.find_zone! "America/New_York" # => #
+ # Time.find_zone! "EST" # => #
+ # Time.find_zone! -5.hours # => #
+ # Time.find_zone! nil # => nil
+ # Time.find_zone! false # => false
+ # Time.find_zone! "NOT-A-TIMEZONE" # => ArgumentError: Invalid Timezone: NOT-A-TIMEZONE
+ #
+ # source://activesupport//lib/active_support/core_ext/time/zones.rb#82
def find_zone!(time_zone); end
+
+ # Creates a +Time+ instance from an RFC 3339 string.
+ #
+ # Time.rfc3339('1999-12-31T14:00:00-10:00') # => 2000-01-01 00:00:00 -1000
+ #
+ # If the time or offset components are missing then an +ArgumentError+ will be raised.
+ #
+ # Time.rfc3339('1999-12-31') # => ArgumentError: invalid date
+ #
+ # @raise [ArgumentError]
+ #
+ # source://activesupport//lib/active_support/core_ext/time/calculations.rb#70
def rfc3339(str); end
+
+ # Allows override of Time.zone locally inside supplied block;
+ # resets Time.zone to existing value when done.
+ #
+ # class ApplicationController < ActionController::Base
+ # around_action :set_time_zone
+ #
+ # private
+ #
+ # def set_time_zone
+ # Time.use_zone(current_user.timezone) { yield }
+ # end
+ # end
+ #
+ # NOTE: This won't affect any ActiveSupport::TimeWithZone
+ # objects that have already been created, e.g. any model timestamp
+ # attributes that have been read before the block will remain in
+ # the application's default timezone.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/zones.rb#62
def use_zone(time_zone); end
+
+ # Returns the TimeZone for the current request, if this has been set (via Time.zone=).
+ # If Time.zone has not been set for the current request, returns the TimeZone specified in config.time_zone.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/zones.rb#14
def zone; end
+
+ # Sets Time.zone to a TimeZone object for the current request/thread.
+ #
+ # This method accepts any of the following:
+ #
+ # * A Rails TimeZone object.
+ # * An identifier for a Rails TimeZone object (e.g., "Eastern Time (US & Canada)", -5.hours).
+ # * A TZInfo::Timezone object.
+ # * An identifier for a TZInfo::Timezone object (e.g., "America/New_York").
+ #
+ # Here's an example of how you might set Time.zone on a per request basis and reset it when the request is done.
+ # current_user.time_zone just needs to return a string identifying the user's preferred time zone:
+ #
+ # class ApplicationController < ActionController::Base
+ # around_action :set_time_zone
+ #
+ # def set_time_zone
+ # if logged_in?
+ # Time.use_zone(current_user.time_zone) { yield }
+ # else
+ # yield
+ # end
+ # end
+ # end
+ #
+ # source://activesupport//lib/active_support/core_ext/time/zones.rb#41
def zone=(time_zone); end
+
+ # Returns the value of attribute zone_default.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/zones.rb#10
def zone_default; end
+
+ # Sets the attribute zone_default
+ #
+ # @param value the value to set the attribute zone_default to.
+ #
+ # source://activesupport//lib/active_support/core_ext/time/zones.rb#10
def zone_default=(_arg0); end
end
end
+# source://activesupport//lib/active_support/core_ext/time/calculations.rb#14
Time::COMMON_YEAR_DAYS_IN_MONTH = T.let(T.unsafe(nil), Array)
+
+# source://activesupport//lib/active_support/core_ext/time/conversions.rb#8
Time::DATE_FORMATS = T.let(T.unsafe(nil), Hash)
+# source://activesupport//lib/active_support/core_ext/object/blank.rb#72
class TrueClass
- include ::JSON::Ext::Generator::GeneratorMethods::TrueClass
- include ::MessagePack::CoreExt
-
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#70
def as_json(options = T.unsafe(nil)); end
+
+ # +true+ is not blank:
+ #
+ # true.blank? # => false
+ #
+ # @return [false]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/blank.rb#78
def blank?; end
+
+ # Returns +self+.
+ #
+ # source://activesupport//lib/active_support/core_ext/object/to_query.rb#27
def to_param; end
end
+# source://activesupport//lib/active_support/core_ext/uri.rb#19
module URI
- include ::URI::RFC2396_REGEXP
- extend ::URI::Escape
-
class << self
+ # source://activesupport//lib/active_support/core_ext/uri.rb#21
def parser; end
end
end
+# source://activesupport//lib/active_support/core_ext/object/json.rb#211
class URI::Generic
include ::URI::RFC2396_REGEXP
- include ::URI
+ # source://activesupport//lib/active_support/core_ext/object/json.rb#212
def as_json(options = T.unsafe(nil)); end
end
+# source://activesupport//lib/active_support/core_ext/object/duplicable.rb#41
class UnboundMethod
- include ::MethodSource::SourceLocation::UnboundMethodExtensions
- include ::MethodSource::MethodExtensions
-
+ # Unbound methods are not duplicable:
+ #
+ # method(:puts).unbind.duplicable? # => false
+ # method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod
+ #
+ # @return [Boolean]
+ #
+ # source://activesupport//lib/active_support/core_ext/object/duplicable.rb#46
def duplicable?; end
end
diff --git a/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.6.rbi b/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.6.rbi
index bf7d23653cbc1..9b249f24f40eb 100644
--- a/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.6.rbi
+++ b/Library/Homebrew/sorbet/rbi/gems/addressable@2.8.6.rbi
@@ -4,289 +4,1990 @@
# This is an autogenerated file for types exported from the `addressable` gem.
# Please instead update this file by running `bin/tapioca gem addressable`.
+# Addressable is a library for processing links and URIs.
+#
+# source://addressable//lib/addressable/version.rb#22
module Addressable; end
+# source://addressable//lib/addressable/idna/pure.rb#21
module Addressable::IDNA
class << self
+ # source://addressable//lib/addressable/idna/pure.rb#117
def _deprecated_unicode_normalize_kc(value); end
+
+ # Converts from a Unicode internationalized domain name to an ASCII
+ # domain name as described in RFC 3490.
+ #
+ # source://addressable//lib/addressable/idna/pure.rb#67
def to_ascii(input); end
+
+ # Converts from an ASCII domain name to a Unicode internationalized
+ # domain name as described in RFC 3490.
+ #
+ # source://addressable//lib/addressable/idna/pure.rb#93
def to_unicode(input); end
+
+ # @deprecated Use {String#unicode_normalize(:nfkc)} instead
def unicode_normalize_kc(*args, **_arg1, &block); end
private
+ # source://addressable//lib/addressable/idna/pure.rb#140
def lookup_unicode_lowercase(codepoint); end
+
+ # Bias adaptation method
+ #
+ # source://addressable//lib/addressable/idna/pure.rb#488
def punycode_adapt(delta, numpoints, firsttime); end
+
+ # @return [Boolean]
+ #
+ # source://addressable//lib/addressable/idna/pure.rb#456
def punycode_basic?(codepoint); end
+
+ # source://addressable//lib/addressable/idna/pure.rb#334
def punycode_decode(punycode); end
+
+ # Returns the numeric value of a basic codepoint
+ # (for use in representing integers) in the range 0 to
+ # base - 1, or PUNYCODE_BASE if codepoint does not represent a value.
+ #
+ # source://addressable//lib/addressable/idna/pure.rb#474
def punycode_decode_digit(codepoint); end
+
+ # @return [Boolean]
+ #
+ # source://addressable//lib/addressable/idna/pure.rb#461
def punycode_delimiter?(codepoint); end
+
+ # source://addressable//lib/addressable/idna/pure.rb#213
def punycode_encode(unicode); end
+
+ # source://addressable//lib/addressable/idna/pure.rb#466
def punycode_encode_digit(d); end
+
+ # Unicode aware downcase method.
+ #
+ # @api private
+ # @param input [String] The input string.
+ # @return [String] The downcased result.
+ #
+ # source://addressable//lib/addressable/idna/pure.rb#132
def unicode_downcase(input); end
end
end
+# source://addressable//lib/addressable/idna/pure.rb#183
Addressable::IDNA::ACE_MAX_LENGTH = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#40
Addressable::IDNA::ACE_PREFIX = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/idna/pure.rb#172
Addressable::IDNA::COMPOSITION_TABLE = T.let(T.unsafe(nil), Hash)
+
+# source://addressable//lib/addressable/idna/pure.rb#185
Addressable::IDNA::PUNYCODE_BASE = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#189
Addressable::IDNA::PUNYCODE_DAMP = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#192
Addressable::IDNA::PUNYCODE_DELIMITER = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#190
Addressable::IDNA::PUNYCODE_INITIAL_BIAS = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#191
Addressable::IDNA::PUNYCODE_INITIAL_N = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#194
Addressable::IDNA::PUNYCODE_MAXINT = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#196
Addressable::IDNA::PUNYCODE_PRINT_ASCII = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/idna/pure.rb#188
Addressable::IDNA::PUNYCODE_SKEW = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#187
Addressable::IDNA::PUNYCODE_TMAX = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#186
Addressable::IDNA::PUNYCODE_TMIN = T.let(T.unsafe(nil), Integer)
+
+# Input is invalid.
+#
+# source://addressable//lib/addressable/idna/pure.rb#207
class Addressable::IDNA::PunycodeBadInput < ::StandardError; end
+
+# Output would exceed the space provided.
+#
+# source://addressable//lib/addressable/idna/pure.rb#209
class Addressable::IDNA::PunycodeBigOutput < ::StandardError; end
+
+# Input needs wider integers to process.
+#
+# source://addressable//lib/addressable/idna/pure.rb#211
class Addressable::IDNA::PunycodeOverflow < ::StandardError; end
+
+# source://addressable//lib/addressable/idna/pure.rb#163
Addressable::IDNA::UNICODE_DATA = T.let(T.unsafe(nil), Hash)
+
+# source://addressable//lib/addressable/idna/pure.rb#150
Addressable::IDNA::UNICODE_DATA_CANONICAL = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#148
Addressable::IDNA::UNICODE_DATA_COMBINING_CLASS = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#151
Addressable::IDNA::UNICODE_DATA_COMPATIBILITY = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#149
Addressable::IDNA::UNICODE_DATA_EXCLUSION = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#153
Addressable::IDNA::UNICODE_DATA_LOWERCASE = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#154
Addressable::IDNA::UNICODE_DATA_TITLECASE = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#152
Addressable::IDNA::UNICODE_DATA_UPPERCASE = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#182
Addressable::IDNA::UNICODE_MAX_LENGTH = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/idna/pure.rb#36
Addressable::IDNA::UNICODE_TABLE = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/idna/pure.rb#42
Addressable::IDNA::UTF8_REGEX = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/idna/pure.rb#53
Addressable::IDNA::UTF8_REGEX_MULTIBYTE = T.let(T.unsafe(nil), Regexp)
+# This is an implementation of a URI template based on
+# RFC 6570 (http://tools.ietf.org/html/rfc6570).
+#
+# source://addressable//lib/addressable/template.rb#27
class Addressable::Template
+ # Creates a new Addressable::Template object.
+ #
+ # @param pattern [#to_str] The URI Template pattern.
+ # @return [Addressable::Template] The initialized Template object.
+ #
+ # source://addressable//lib/addressable/template.rb#234
def initialize(pattern); end
+ # Returns true if the Template objects are equal. This method
+ # does NOT normalize either Template before doing the comparison.
+ #
+ # @param template [Object] The Template to compare.
+ # @return [TrueClass, FalseClass] true if the Templates are equivalent, false
+ # otherwise.
+ #
+ # source://addressable//lib/addressable/template.rb#274
def ==(template); end
+
+ # Returns true if the Template objects are equal. This method
+ # does NOT normalize either Template before doing the comparison.
+ # Addressable::Template makes no distinction between `==` and `eql?`.
+ #
+ # @param template [Object] The Template to compare.
+ # @return [TrueClass, FalseClass] true if the Templates are equivalent, false
+ # otherwise.
+ # @see #==
+ #
+ # source://addressable//lib/addressable/template.rb#274
def eql?(template); end
+
+ # Expands a URI template into a full URI.
+ #
+ # The object should respond to either the validate or
+ # transform messages or both. Both the validate and
+ # transform methods should take two parameters: name and
+ # value. The validate method should return true
+ # or false; true if the value of the variable is valid,
+ # false otherwise. An InvalidTemplateValueError
+ # exception will be raised if the value is invalid. The transform
+ # method should return the transformed variable value as a String.
+ # If a transform method is used, the value will not be percent
+ # encoded automatically. Unicode normalization will be performed both
+ # before and after sending the value to the transform method.
+ #
+ # @example
+ # class ExampleProcessor
+ # def self.validate(name, value)
+ # return !!(value =~ /^[\w ]+$/) if name == "query"
+ # return true
+ # end
+ #
+ # def self.transform(name, value)
+ # return value.gsub(/ /, "+") if name == "query"
+ # return value
+ # end
+ # end
+ #
+ # Addressable::Template.new(
+ # "http://example.com/search/{query}/"
+ # ).expand(
+ # {"query" => "an example search query"},
+ # ExampleProcessor
+ # ).to_str
+ # #=> "http://example.com/search/an+example+search+query/"
+ #
+ # Addressable::Template.new(
+ # "http://example.com/search/{query}/"
+ # ).expand(
+ # {"query" => "an example search query"}
+ # ).to_str
+ # #=> "http://example.com/search/an%20example%20search%20query/"
+ #
+ # Addressable::Template.new(
+ # "http://example.com/search/{query}/"
+ # ).expand(
+ # {"query" => "bogus!"},
+ # ExampleProcessor
+ # ).to_str
+ # #=> Addressable::Template::InvalidTemplateValueError
+ # @param mapping [Hash] The mapping that corresponds to the pattern.
+ # @param processor [#validate, #transform] An optional processor object may be supplied.
+ # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true
+ # @return [Addressable::URI] The expanded URI template.
+ #
+ # source://addressable//lib/addressable/template.rb#591
def expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end
+
+ # Extracts a mapping from the URI using a URI Template pattern.
+ #
+ # @example
+ # class ExampleProcessor
+ # def self.restore(name, value)
+ # return value.gsub(/\+/, " ") if name == "query"
+ # return value
+ # end
+ #
+ # def self.match(name)
+ # return ".*?" if name == "first"
+ # return ".*"
+ # end
+ # end
+ #
+ # uri = Addressable::URI.parse(
+ # "http://example.com/search/an+example+search+query/"
+ # )
+ # Addressable::Template.new(
+ # "http://example.com/search/{query}/"
+ # ).extract(uri, ExampleProcessor)
+ # #=> {"query" => "an example search query"}
+ #
+ # uri = Addressable::URI.parse("http://example.com/a/b/c/")
+ # Addressable::Template.new(
+ # "http://example.com/{first}/{second}/"
+ # ).extract(uri, ExampleProcessor)
+ # #=> {"first" => "a", "second" => "b/c"}
+ #
+ # uri = Addressable::URI.parse("http://example.com/a/b/c/")
+ # Addressable::Template.new(
+ # "http://example.com/{first}/{-list|/|second}/"
+ # ).extract(uri)
+ # #=> {"first" => "a", "second" => ["b", "c"]}
+ # @param uri [Addressable::URI, #to_str] The URI to extract from.
+ # @param processor [#restore, #match] A template processor object may optionally be supplied.
+ #
+ # The object should respond to either the restore or
+ # match messages or both. The restore method should
+ # take two parameters: `[String] name` and `[String] value`.
+ # The restore method should reverse any transformations that
+ # have been performed on the value to ensure a valid URI.
+ # The match method should take a single
+ # parameter: `[String] name`. The match method should return
+ # a String containing a regular expression capture group for
+ # matching on that particular variable. The default value is `".*?"`.
+ # The match method has no effect on multivariate operator
+ # expansions.
+ # @return [Hash, NilClass] The Hash mapping that was extracted from the URI, or
+ # nil if the URI didn't match the template.
+ #
+ # source://addressable//lib/addressable/template.rb#342
def extract(uri, processor = T.unsafe(nil)); end
+
+ # Freeze URI, initializing instance variables.
+ #
+ # @return [Addressable::URI] The frozen URI object.
+ #
+ # source://addressable//lib/addressable/template.rb#245
def freeze; end
+
+ # Returns a String representation of the Template object's state.
+ #
+ # @return [String] The Template object's state, as a String.
+ #
+ # source://addressable//lib/addressable/template.rb#260
def inspect; end
+
+ # Returns an Array of variables used within the template pattern.
+ # The variables are listed in the Array in the order they appear within
+ # the pattern. Multiple occurrences of a variable within a pattern are
+ # not represented in this Array.
+ #
+ # @return [Array] The variables present in the template's pattern.
+ #
+ # source://addressable//lib/addressable/template.rb#607
def keys; end
+
+ # Extracts match data from the URI using a URI Template pattern.
+ #
+ # @example
+ # class ExampleProcessor
+ # def self.restore(name, value)
+ # return value.gsub(/\+/, " ") if name == "query"
+ # return value
+ # end
+ #
+ # def self.match(name)
+ # return ".*?" if name == "first"
+ # return ".*"
+ # end
+ # end
+ #
+ # uri = Addressable::URI.parse(
+ # "http://example.com/search/an+example+search+query/"
+ # )
+ # match = Addressable::Template.new(
+ # "http://example.com/search/{query}/"
+ # ).match(uri, ExampleProcessor)
+ # match.variables
+ # #=> ["query"]
+ # match.captures
+ # #=> ["an example search query"]
+ #
+ # uri = Addressable::URI.parse("http://example.com/a/b/c/")
+ # match = Addressable::Template.new(
+ # "http://example.com/{first}/{+second}/"
+ # ).match(uri, ExampleProcessor)
+ # match.variables
+ # #=> ["first", "second"]
+ # match.captures
+ # #=> ["a", "b/c"]
+ #
+ # uri = Addressable::URI.parse("http://example.com/a/b/c/")
+ # match = Addressable::Template.new(
+ # "http://example.com/{first}{/second*}/"
+ # ).match(uri)
+ # match.variables
+ # #=> ["first", "second"]
+ # match.captures
+ # #=> ["a", ["b", "c"]]
+ # @param uri [Addressable::URI, #to_str] The URI to extract from.
+ # @param processor [#restore, #match] A template processor object may optionally be supplied.
+ #
+ # The object should respond to either the restore or
+ # match messages or both. The restore method should
+ # take two parameters: `[String] name` and `[String] value`.
+ # The restore method should reverse any transformations that
+ # have been performed on the value to ensure a valid URI.
+ # The match method should take a single
+ # parameter: `[String] name`. The match method should return
+ # a String containing a regular expression capture group for
+ # matching on that particular variable. The default value is `".*?"`.
+ # The match method has no effect on multivariate operator
+ # expansions.
+ # @return [Hash, NilClass] The Hash mapping that was extracted from the URI, or
+ # nil if the URI didn't match the template.
+ #
+ # source://addressable//lib/addressable/template.rb#413
def match(uri, processor = T.unsafe(nil)); end
+
+ # Returns the named captures of the coerced `Regexp`.
+ #
+ # @api private
+ # @return [Hash] The named captures of the `Regexp` given by {#to_regexp}.
+ #
+ # source://addressable//lib/addressable/template.rb#651
def named_captures; end
+
+ # Returns an Array of variables used within the template pattern.
+ # The variables are listed in the Array in the order they appear within
+ # the pattern. Multiple occurrences of a variable within a pattern are
+ # not represented in this Array.
+ #
+ # @return [Array] The variables present in the template's pattern.
+ #
+ # source://addressable//lib/addressable/template.rb#607
def names; end
+
+ # Expands a URI template into another URI template.
+ #
+ # The object should respond to either the validate or
+ # transform messages or both. Both the validate and
+ # transform methods should take two parameters: name and
+ # value. The validate method should return true
+ # or false; true if the value of the variable is valid,
+ # false otherwise. An InvalidTemplateValueError
+ # exception will be raised if the value is invalid. The transform
+ # method should return the transformed variable value as a String.
+ # If a transform method is used, the value will not be percent
+ # encoded automatically. Unicode normalization will be performed both
+ # before and after sending the value to the transform method.
+ #
+ # @example
+ # Addressable::Template.new(
+ # "http://example.com/{one}/{two}/"
+ # ).partial_expand({"one" => "1"}).pattern
+ # #=> "http://example.com/1/{two}/"
+ #
+ # Addressable::Template.new(
+ # "http://example.com/{?one,two}/"
+ # ).partial_expand({"one" => "1"}).pattern
+ # #=> "http://example.com/?one=1{&two}/"
+ #
+ # Addressable::Template.new(
+ # "http://example.com/{?one,two,three}/"
+ # ).partial_expand({"one" => "1", "three" => 3}).pattern
+ # #=> "http://example.com/?one=1{&two}&three=3"
+ # @param mapping [Hash] The mapping that corresponds to the pattern.
+ # @param processor [#validate, #transform] An optional processor object may be supplied.
+ # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true
+ # @return [Addressable::Template] The partially expanded URI template.
+ #
+ # source://addressable//lib/addressable/template.rb#524
def partial_expand(mapping, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end
+
+ # @return [String] The Template object's pattern.
+ #
+ # source://addressable//lib/addressable/template.rb#254
def pattern; end
+
+ # Returns the source of the coerced `Regexp`.
+ #
+ # @api private
+ # @return [String] The source of the `Regexp` given by {#to_regexp}.
+ #
+ # source://addressable//lib/addressable/template.rb#641
def source; end
+
+ # Coerces a template into a `Regexp` object. This regular expression will
+ # behave very similarly to the actual template, and should match the same
+ # URI values, but it cannot fully handle, for example, values that would
+ # extract to an `Array`.
+ #
+ # @return [Regexp] A regular expression which should match the template.
+ #
+ # source://addressable//lib/addressable/template.rb#630
def to_regexp; end
+
+ # Returns a mapping of variables to their default values specified
+ # in the template. Variables without defaults are not returned.
+ #
+ # @return [Hash] Mapping of template variables to their defaults
+ #
+ # source://addressable//lib/addressable/template.rb#618
def variable_defaults; end
+
+ # Returns an Array of variables used within the template pattern.
+ # The variables are listed in the Array in the order they appear within
+ # the pattern. Multiple occurrences of a variable within a pattern are
+ # not represented in this Array.
+ #
+ # @return [Array] The variables present in the template's pattern.
+ #
+ # source://addressable//lib/addressable/template.rb#607
def variables; end
private
+ # Takes a set of values, and joins them together based on the
+ # operator.
+ #
+ # @param operator [String, Nil] One of the operators from the set
+ # (?,&,+,#,;,/,.), or nil if there wasn't one.
+ # @param return_value [Array] The set of return values (as [variable_name, value] tuples) that will
+ # be joined together.
+ # @return [String] The transformed mapped value
+ #
+ # source://addressable//lib/addressable/template.rb#861
def join_values(operator, return_value); end
+
+ # Generates a hash with string keys
+ #
+ # @param mapping [Hash] A mapping hash to normalize
+ # @return [Hash] A hash with stringified keys
+ #
+ # source://addressable//lib/addressable/template.rb#924
def normalize_keys(mapping); end
+
+ # Takes a set of values, and joins them together based on the
+ # operator.
+ #
+ # @param value [Hash, Array, String] Normalizes unicode keys and values with String#unicode_normalize (NFC)
+ # @return [Hash, Array, String] The normalized values
+ #
+ # source://addressable//lib/addressable/template.rb#898
def normalize_value(value); end
+
+ # source://addressable//lib/addressable/template.rb#656
def ordered_variable_defaults; end
+
+ # Generates the Regexp that parses a template pattern.
+ #
+ # @param pattern [String] The URI template pattern.
+ # @param processor [#match] The template processor to use.
+ # @return [Array, Regexp] An array of expansion variables nad a regular expression which may be
+ # used to parse a template pattern
+ #
+ # source://addressable//lib/addressable/template.rb#968
def parse_new_template_pattern(pattern, processor = T.unsafe(nil)); end
+
+ # Generates the Regexp that parses a template pattern. Memoizes the
+ # value if template processor not set (processors may not be deterministic)
+ #
+ # @param pattern [String] The URI template pattern.
+ # @param processor [#match] The template processor to use.
+ # @return [Array, Regexp] An array of expansion variables nad a regular expression which may be
+ # used to parse a template pattern
+ #
+ # source://addressable//lib/addressable/template.rb#950
def parse_template_pattern(pattern, processor = T.unsafe(nil)); end
+
+ # Transforms a mapped value so that values can be substituted into the
+ # template.
+ #
+ # The object should respond to either the validate or
+ # transform messages or both. Both the validate and
+ # transform methods should take two parameters: name and
+ # value. The validate method should return true
+ # or false; true if the value of the variable is valid,
+ # false otherwise. An InvalidTemplateValueError exception
+ # will be raised if the value is invalid. The transform method
+ # should return the transformed variable value as a String. If a
+ # transform method is used, the value will not be percent encoded
+ # automatically. Unicode normalization will be performed both before and
+ # after sending the value to the transform method.
+ #
+ # @param mapping [Hash] The mapping to replace captures
+ # @param capture [String] The expression to replace
+ # @param processor [#validate, #transform] An optional processor object may be supplied.
+ # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true
+ # @return [String] The expanded expression
+ #
+ # source://addressable//lib/addressable/template.rb#753
def transform_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end
+
+ # Loops through each capture and expands any values available in mapping
+ #
+ # The object should respond to either the validate or
+ # transform messages or both. Both the validate and
+ # transform methods should take two parameters: name and
+ # value. The validate method should return true
+ # or false; true if the value of the variable is valid,
+ # false otherwise. An InvalidTemplateValueError exception
+ # will be raised if the value is invalid. The transform method
+ # should return the transformed variable value as a String. If a
+ # transform method is used, the value will not be percent encoded
+ # automatically. Unicode normalization will be performed both before and
+ # after sending the value to the transform method.
+ #
+ # @param mapping [Hash] Set of keys to expand
+ # @param capture [String] The expression to expand
+ # @param processor [#validate, #transform] An optional processor object may be supplied.
+ # @param normalize_values [Boolean] Optional flag to enable/disable unicode normalization. Default: true
+ # @return [String] The expanded expression
+ #
+ # source://addressable//lib/addressable/template.rb#694
def transform_partial_capture(mapping, capture, processor = T.unsafe(nil), normalize_values = T.unsafe(nil)); end
end
+# source://addressable//lib/addressable/template.rb#58
Addressable::Template::EXPRESSION = T.let(T.unsafe(nil), Regexp)
+
+# Raised if an invalid template operator is used in a pattern.
+#
+# source://addressable//lib/addressable/template.rb#85
class Addressable::Template::InvalidTemplateOperatorError < ::StandardError; end
+
+# Raised if an invalid template value is supplied.
+#
+# source://addressable//lib/addressable/template.rb#80
class Addressable::Template::InvalidTemplateValueError < ::StandardError; end
+
+# source://addressable//lib/addressable/template.rb#70
Addressable::Template::JOINERS = T.let(T.unsafe(nil), Hash)
+
+# source://addressable//lib/addressable/template.rb#62
Addressable::Template::LEADERS = T.let(T.unsafe(nil), Hash)
+# This class represents the data that is extracted when a Template
+# is matched against a URI.
+#
+# source://addressable//lib/addressable/template.rb#96
class Addressable::Template::MatchData
+ # Creates a new MatchData object.
+ # MatchData objects should never be instantiated directly.
+ #
+ # @param uri [Addressable::URI] The URI that the template was matched against.
+ # @return [MatchData] a new instance of MatchData
+ #
+ # source://addressable//lib/addressable/template.rb#103
def initialize(uri, template, mapping); end
+ # Accesses captured values by name or by index.
+ #
+ # @param key [String, Symbol, Fixnum] Capture index or name. Note that when accessing by with index
+ # of 0, the full URI will be returned. The intention is to mimic
+ # the ::MatchData#[] behavior.
+ # @param len [#to_int, nil] If provided, an array of values will be returend with the given
+ # parameter used as length.
+ # @return [Array, String, nil] The captured value corresponding to the index or name. If the
+ # value was not provided or the key is unknown, nil will be
+ # returned.
+ #
+ # If the second parameter is provided, an array of that length will
+ # be returned instead.
+ #
+ # source://addressable//lib/addressable/template.rb#170
def [](key, len = T.unsafe(nil)); end
+
+ # @return [Array] The list of values that were captured by the Template.
+ # Note that this list will include nils for any variables which
+ # were in the Template, but did not appear in the URI.
+ #
+ # source://addressable//lib/addressable/template.rb#143
def captures; end
+
+ # Returns a String representation of the MatchData's state.
+ #
+ # @return [String] The MatchData's state, as a String.
+ #
+ # source://addressable//lib/addressable/template.rb#213
def inspect; end
+
+ # @return [Array] The list of variables that were present in the Template.
+ # Note that this list will include variables which do not appear
+ # in the mapping because they were not present in URI.
+ #
+ # source://addressable//lib/addressable/template.rb#132
def keys; end
+
+ # @return [Hash] The mapping that resulted from the match.
+ # Note that this mapping does not include keys or values for
+ # variables that appear in the Template, but are not present
+ # in the URI.
+ #
+ # source://addressable//lib/addressable/template.rb#125
def mapping; end
+
+ # @return [Array] The list of variables that were present in the Template.
+ # Note that this list will include variables which do not appear
+ # in the mapping because they were not present in URI.
+ #
+ # source://addressable//lib/addressable/template.rb#132
def names; end
+
+ # Dummy method for code expecting a ::MatchData instance
+ #
+ # @return [String] An empty string.
+ #
+ # source://addressable//lib/addressable/template.rb#222
def post_match; end
+
+ # Dummy method for code expecting a ::MatchData instance
+ #
+ # @return [String] An empty string.
+ #
+ # source://addressable//lib/addressable/template.rb#222
def pre_match; end
+
+ # @return [String] The matched URI as String.
+ #
+ # source://addressable//lib/addressable/template.rb#191
def string; end
+
+ # @return [Addressable::Template] The Template used for the match.
+ #
+ # source://addressable//lib/addressable/template.rb#117
def template; end
+
+ # @return [Array] Array with the matched URI as first element followed by the captured
+ # values.
+ #
+ # source://addressable//lib/addressable/template.rb#184
def to_a; end
+
+ # @return [String] The matched URI as String.
+ #
+ # source://addressable//lib/addressable/template.rb#191
def to_s; end
+
+ # @return [Addressable::URI] The URI that the Template was matched against.
+ #
+ # source://addressable//lib/addressable/template.rb#112
def uri; end
+
+ # @return [Array] The list of values that were captured by the Template.
+ # Note that this list will include nils for any variables which
+ # were in the Template, but did not appear in the URI.
+ #
+ # source://addressable//lib/addressable/template.rb#143
def values; end
+
+ # Returns multiple captured values at once.
+ #
+ # @param *indexes [String, Symbol, Fixnum] Indices of the captures to be returned
+ # @return [Array] Values corresponding to given indices.
+ # @see Addressable::Template::MatchData#[]
+ #
+ # source://addressable//lib/addressable/template.rb#205
def values_at(*indexes); end
+
+ # @return [Array] The list of variables that were present in the Template.
+ # Note that this list will include variables which do not appear
+ # in the mapping because they were not present in URI.
+ #
+ # source://addressable//lib/addressable/template.rb#132
def variables; end
end
+# source://addressable//lib/addressable/template.rb#40
Addressable::Template::RESERVED = T.let(T.unsafe(nil), String)
+
+# Raised if an invalid template operator is used in a pattern.
+#
+# source://addressable//lib/addressable/template.rb#90
class Addressable::Template::TemplateOperatorAbortedError < ::StandardError; end
+
+# source://addressable//lib/addressable/template.rb#42
Addressable::Template::UNRESERVED = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/template.rb#54
Addressable::Template::VARIABLE_LIST = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/template.rb#50
Addressable::Template::VARNAME = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/template.rb#52
Addressable::Template::VARSPEC = T.let(T.unsafe(nil), Regexp)
+# This is an implementation of a URI parser based on
+# RFC 3986,
+# RFC 3987.
+#
+# source://addressable//lib/addressable/uri.rb#31
class Addressable::URI
+ # Creates a new uri object from component parts.
+ #
+ # @option [String,
+ # @option [String,
+ # @option [String,
+ # @option [String,
+ # @option [String,
+ # @option [String,
+ # @option [String,
+ # @option [String,
+ # @option [String,
+ # @option [String,
+ # @param [String, [Hash] a customizable set of options
+ # @return [Addressable::URI] The constructed URI object.
+ #
+ # source://addressable//lib/addressable/uri.rb#830
def initialize(options = T.unsafe(nil)); end
+ # Joins two URIs together.
+ #
+ # @param The [String, Addressable::URI, #to_str] URI to join with.
+ # @return [Addressable::URI] The joined URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#1889
def +(uri); end
+
+ # Returns true if the URI objects are equal. This method
+ # normalizes both URIs before doing the comparison.
+ #
+ # @param uri [Object] The URI to compare.
+ # @return [TrueClass, FalseClass] true if the URIs are equivalent, false
+ # otherwise.
+ #
+ # source://addressable//lib/addressable/uri.rb#2239
def ==(uri); end
+
+ # Returns true if the URI objects are equal. This method
+ # normalizes both URIs before doing the comparison, and allows comparison
+ # against Strings.
+ #
+ # @param uri [Object] The URI to compare.
+ # @return [TrueClass, FalseClass] true if the URIs are equivalent, false
+ # otherwise.
+ #
+ # source://addressable//lib/addressable/uri.rb#2217
def ===(uri); end
+
+ # Determines if the URI is absolute.
+ #
+ # @return [TrueClass, FalseClass] true if the URI is absolute. false
+ # otherwise.
+ #
+ # source://addressable//lib/addressable/uri.rb#1879
def absolute?; end
+
+ # The authority component for this URI.
+ # Combines the user, password, host, and port components.
+ #
+ # @return [String] The authority component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1234
def authority; end
+
+ # Sets the authority component for this URI.
+ #
+ # @param new_authority [String, #to_str] The new authority component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1274
def authority=(new_authority); end
+
+ # The basename, if any, of the file in the path component.
+ #
+ # @return [String] The path's basename.
+ #
+ # source://addressable//lib/addressable/uri.rb#1588
def basename; end
+
+ # The default port for this URI's scheme.
+ # This method will always returns the default port for the URI's scheme
+ # regardless of the presence of an explicit port in the URI.
+ #
+ # @return [Integer] The default port.
+ #
+ # source://addressable//lib/addressable/uri.rb#1454
def default_port; end
+
+ # This method allows you to make several changes to a URI simultaneously,
+ # which separately would cause validation errors, but in conjunction,
+ # are valid. The URI will be revalidated as soon as the entire block has
+ # been executed.
+ #
+ # @param block [Proc] A set of operations to perform on a given URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#2396
def defer_validation; end
+
+ # Creates a URI suitable for display to users. If semantic attacks are
+ # likely, the application should try to detect these and warn the user.
+ # See RFC 3986,
+ # section 7.6 for more information.
+ #
+ # @return [Addressable::URI] A URI suitable for display purposes.
+ #
+ # source://addressable//lib/addressable/uri.rb#2201
def display_uri; end
+
+ # Returns the public suffix domain for this host.
+ #
+ # @example
+ # Addressable::URI.parse("http://www.example.co.uk").domain # => "example.co.uk"
+ #
+ # source://addressable//lib/addressable/uri.rb#1225
def domain; end
+
+ # Clones the URI object.
+ #
+ # @return [Addressable::URI] The cloned URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#2271
def dup; end
+
+ # Determines if the URI is an empty string.
+ #
+ # @return [TrueClass, FalseClass] Returns true if empty, false otherwise.
+ #
+ # source://addressable//lib/addressable/uri.rb#2333
def empty?; end
+
+ # source://addressable//lib/addressable/uri.rb#2406
def encode_with(coder); end
+
+ # Returns true if the URI objects are equal. This method
+ # does NOT normalize either URI before doing the comparison.
+ #
+ # @param uri [Object] The URI to compare.
+ # @return [TrueClass, FalseClass] true if the URIs are equivalent, false
+ # otherwise.
+ #
+ # source://addressable//lib/addressable/uri.rb#2253
def eql?(uri); end
+
+ # The extname, if any, of the file in the path component.
+ # Empty string if there is no extension.
+ #
+ # @return [String] The path's extname.
+ #
+ # source://addressable//lib/addressable/uri.rb#1598
def extname; end
+
+ # The fragment component for this URI.
+ #
+ # @return [String] The fragment component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1810
def fragment; end
+
+ # Sets the fragment component for this URI.
+ #
+ # @param new_fragment [String, #to_str] The new fragment component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1835
def fragment=(new_fragment); end
+
+ # Freeze URI, initializing instance variables.
+ #
+ # @return [Addressable::URI] The frozen URI object.
+ #
+ # source://addressable//lib/addressable/uri.rb#870
def freeze; end
+
+ # A hash value that will make a URI equivalent to its normalized
+ # form.
+ #
+ # @return [Integer] A hash of the URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#2263
def hash; end
+
+ # The host component for this URI.
+ #
+ # @return [String] The host component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1120
def host; end
+
+ # Sets the host component for this URI.
+ #
+ # @param new_host [String, #to_str] The new host component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1156
def host=(new_host); end
+
+ # This method is same as URI::Generic#host except
+ # brackets for IPv6 (and 'IPvFuture') addresses are removed.
+ #
+ # @return [String] The hostname for this URI.
+ # @see Addressable::URI#host
+ #
+ # source://addressable//lib/addressable/uri.rb#1178
def hostname; end
+
+ # This method is same as URI::Generic#host= except
+ # the argument can be a bare IPv6 address (or 'IPvFuture').
+ #
+ # @param new_hostname [String, #to_str] The new hostname for this URI.
+ # @see Addressable::URI#host=
+ #
+ # source://addressable//lib/addressable/uri.rb#1190
def hostname=(new_hostname); end
+
+ # The inferred port component for this URI.
+ # This method will normalize to the default port for the URI's scheme if
+ # the port isn't explicitly specified in the URI.
+ #
+ # @return [Integer] The inferred port component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1440
def inferred_port; end
+
+ # source://addressable//lib/addressable/uri.rb#2417
def init_with(coder); end
+
+ # Returns a String representation of the URI object's state.
+ #
+ # @return [String] The URI object's state, as a String.
+ #
+ # source://addressable//lib/addressable/uri.rb#2384
def inspect; end
+
+ # Determines if the scheme indicates an IP-based protocol.
+ #
+ # @return [TrueClass, FalseClass] true if the scheme indicates an IP-based protocol.
+ # false otherwise.
+ #
+ # source://addressable//lib/addressable/uri.rb#1855
def ip_based?; end
+
+ # Joins two URIs together.
+ #
+ # @param The [String, Addressable::URI, #to_str] URI to join with.
+ # @return [Addressable::URI] The joined URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#1889
def join(uri); end
+
+ # Destructive form of join.
+ #
+ # @param The [String, Addressable::URI, #to_str] URI to join with.
+ # @return [Addressable::URI] The joined URI.
+ # @see Addressable::URI#join
+ #
+ # source://addressable//lib/addressable/uri.rb#1992
def join!(uri); end
+
+ # Merges a URI with a Hash of components.
+ # This method has different behavior from join. Any
+ # components present in the hash parameter will override the
+ # original components. The path component is not treated specially.
+ #
+ # @param The [Hash, Addressable::URI, #to_hash] components to merge with.
+ # @return [Addressable::URI] The merged URI.
+ # @see Hash#merge
+ #
+ # source://addressable//lib/addressable/uri.rb#2007
def merge(hash); end
+
+ # Destructive form of merge.
+ #
+ # @param The [Hash, Addressable::URI, #to_hash] components to merge with.
+ # @return [Addressable::URI] The merged URI.
+ # @see Addressable::URI#merge
+ #
+ # source://addressable//lib/addressable/uri.rb#2072
def merge!(uri); end
+
+ # Returns a normalized URI object.
+ #
+ # NOTE: This method does not attempt to fully conform to specifications.
+ # It exists largely to correct other people's failures to read the
+ # specifications, and also to deal with caching issues since several
+ # different URIs may represent the same resource and should not be
+ # cached multiple times.
+ #
+ # @return [Addressable::URI] The normalized URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#2164
def normalize; end
+
+ # Destructively normalizes this URI object.
+ #
+ # @return [Addressable::URI] The normalized URI.
+ # @see Addressable::URI#normalize
+ #
+ # source://addressable//lib/addressable/uri.rb#2190
def normalize!; end
+
+ # The authority component for this URI, normalized.
+ #
+ # @return [String] The authority component, normalized.
+ #
+ # source://addressable//lib/addressable/uri.rb#1252
def normalized_authority; end
+
+ # The fragment component for this URI, normalized.
+ #
+ # @return [String] The fragment component, normalized.
+ #
+ # source://addressable//lib/addressable/uri.rb#1816
def normalized_fragment; end
+
+ # The host component for this URI, normalized.
+ #
+ # @return [String] The host component, normalized.
+ #
+ # source://addressable//lib/addressable/uri.rb#1126
def normalized_host; end
+
+ # The password component for this URI, normalized.
+ #
+ # @return [String] The password component, normalized.
+ #
+ # source://addressable//lib/addressable/uri.rb#1002
def normalized_password; end
+
+ # The path component for this URI, normalized.
+ #
+ # @return [String] The path component, normalized.
+ #
+ # source://addressable//lib/addressable/uri.rb#1535
def normalized_path; end
+
+ # The port component for this URI, normalized.
+ #
+ # @return [Integer] The port component, normalized.
+ #
+ # source://addressable//lib/addressable/uri.rb#1392
def normalized_port; end
+
+ # The query component for this URI, normalized.
+ #
+ # @return [String] The query component, normalized.
+ #
+ # source://addressable//lib/addressable/uri.rb#1613
def normalized_query(*flags); end
+
+ # The scheme component for this URI, normalized.
+ #
+ # @return [String] The scheme component, normalized.
+ #
+ # source://addressable//lib/addressable/uri.rb#896
def normalized_scheme; end
+
+ # The normalized combination of components that represent a site.
+ # Combines the scheme, user, password, host, and port components.
+ # Primarily useful for HTTP and HTTPS.
+ #
+ # For example, "http://example.com/path?query" would have a
+ # site value of "http://example.com".
+ #
+ # @return [String] The normalized components that identify a site.
+ #
+ # source://addressable//lib/addressable/uri.rb#1485
def normalized_site; end
+
+ # The user component for this URI, normalized.
+ #
+ # @return [String] The user component, normalized.
+ #
+ # source://addressable//lib/addressable/uri.rb#947
def normalized_user; end
+
+ # The userinfo component for this URI, normalized.
+ #
+ # @return [String] The userinfo component, normalized.
+ #
+ # source://addressable//lib/addressable/uri.rb#1068
def normalized_userinfo; end
+
+ # Omits components from a URI.
+ #
+ # @example
+ # uri = Addressable::URI.parse("http://example.com/path?query")
+ # #=> #
+ # uri.omit(:scheme, :authority)
+ # #=> #
+ # @param *components [Symbol] The components to be omitted.
+ # @return [Addressable::URI] The URI with components omitted.
+ #
+ # source://addressable//lib/addressable/uri.rb#2297
def omit(*components); end
+
+ # Destructive form of omit.
+ #
+ # @param *components [Symbol] The components to be omitted.
+ # @return [Addressable::URI] The URI with components omitted.
+ # @see Addressable::URI#omit
+ #
+ # source://addressable//lib/addressable/uri.rb#2324
def omit!(*components); end
+
+ # The origin for this URI, serialized to ASCII, as per
+ # RFC 6454, section 6.2.
+ #
+ # @return [String] The serialized origin.
+ #
+ # source://addressable//lib/addressable/uri.rb#1314
def origin; end
+
+ # Sets the origin for this URI, serialized to ASCII, as per
+ # RFC 6454, section 6.2. This assignment will reset the `userinfo`
+ # component.
+ #
+ # @param new_origin [String, #to_str] The new origin component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1333
def origin=(new_origin); end
+
+ # The password component for this URI.
+ #
+ # @return [String] The password component.
+ #
+ # source://addressable//lib/addressable/uri.rb#996
def password; end
+
+ # Sets the password component for this URI.
+ #
+ # @param new_password [String, #to_str] The new password component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1025
def password=(new_password); end
+
+ # The path component for this URI.
+ #
+ # @return [String] The path component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1528
def path; end
+
+ # Sets the path component for this URI.
+ #
+ # @param new_path [String, #to_str] The new path component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1567
def path=(new_path); end
+
+ # The port component for this URI.
+ # This is the port number actually given in the URI. This does not
+ # infer port numbers from default values.
+ #
+ # @return [Integer] The port component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1386
def port; end
+
+ # Sets the port component for this URI.
+ #
+ # @param new_port [String, Integer, #to_s] The new port component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1408
def port=(new_port); end
+
+ # The query component for this URI.
+ #
+ # @return [String] The query component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1607
def query; end
+
+ # Sets the query component for this URI.
+ #
+ # @param new_query [String, #to_str] The new query component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1641
def query=(new_query); end
+
+ # Converts the query component to a Hash value.
+ #
+ # @example
+ # Addressable::URI.parse("?one=1&two=2&three=3").query_values
+ # #=> {"one" => "1", "two" => "2", "three" => "3"}
+ # Addressable::URI.parse("?one=two&one=three").query_values(Array)
+ # #=> [["one", "two"], ["one", "three"]]
+ # Addressable::URI.parse("?one=two&one=three").query_values(Hash)
+ # #=> {"one" => "three"}
+ # Addressable::URI.parse("?").query_values
+ # #=> {}
+ # Addressable::URI.parse("").query_values
+ # #=> nil
+ # @param return_type [Class] The return type desired. Value must be either
+ # `Hash` or `Array`.
+ # @return [Hash, Array, nil] The query string parsed as a Hash or Array
+ # or nil if the query string is blank.
+ #
+ # source://addressable//lib/addressable/uri.rb#1672
def query_values(return_type = T.unsafe(nil)); end
+
+ # Sets the query component for this URI from a Hash object.
+ # An empty Hash or Array will result in an empty query string.
+ #
+ # @example
+ # uri.query_values = {:a => "a", :b => ["c", "d", "e"]}
+ # uri.query
+ # # => "a=a&b=c&b=d&b=e"
+ # uri.query_values = [['a', 'a'], ['b', 'c'], ['b', 'd'], ['b', 'e']]
+ # uri.query
+ # # => "a=a&b=c&b=d&b=e"
+ # uri.query_values = [['a', 'a'], ['b', ['c', 'd', 'e']]]
+ # uri.query
+ # # => "a=a&b=c&b=d&b=e"
+ # uri.query_values = [['flag'], ['key', 'value']]
+ # uri.query
+ # # => "flag&key=value"
+ # @param new_query_values [Hash, #to_hash, Array] The new query values.
+ #
+ # source://addressable//lib/addressable/uri.rb#1723
def query_values=(new_query_values); end
+
+ # Determines if the URI is relative.
+ #
+ # @return [TrueClass, FalseClass] true if the URI is relative. false
+ # otherwise.
+ #
+ # source://addressable//lib/addressable/uri.rb#1869
def relative?; end
+
+ # The HTTP request URI for this URI. This is the path and the
+ # query string.
+ #
+ # @return [String] The request URI required for an HTTP request.
+ #
+ # source://addressable//lib/addressable/uri.rb#1774
def request_uri; end
+
+ # Sets the HTTP request URI for this URI.
+ #
+ # @param new_request_uri [String, #to_str] The new HTTP request URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#1786
def request_uri=(new_request_uri); end
+
+ # Returns the shortest normalized relative form of this URI that uses the
+ # supplied URI as a base for resolution. Returns an absolute URI if
+ # necessary. This is effectively the opposite of route_to.
+ #
+ # @param uri [String, Addressable::URI, #to_str] The URI to route from.
+ # @return [Addressable::URI] The normalized relative URI that is equivalent to the original URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#2085
def route_from(uri); end
+
+ # Returns the shortest normalized relative form of the supplied URI that
+ # uses this URI as a base for resolution. Returns an absolute URI if
+ # necessary. This is effectively the opposite of route_from.
+ #
+ # @param uri [String, Addressable::URI, #to_str] The URI to route to.
+ # @return [Addressable::URI] The normalized relative URI that is equivalent to the supplied URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#2150
def route_to(uri); end
+
+ # The scheme component for this URI.
+ #
+ # @return [String] The scheme component.
+ #
+ # source://addressable//lib/addressable/uri.rb#890
def scheme; end
+
+ # Sets the scheme component for this URI.
+ #
+ # @param new_scheme [String, #to_str] The new scheme component.
+ #
+ # source://addressable//lib/addressable/uri.rb#917
def scheme=(new_scheme); end
+
+ # The combination of components that represent a site.
+ # Combines the scheme, user, password, host, and port components.
+ # Primarily useful for HTTP and HTTPS.
+ #
+ # For example, "http://example.com/path?query" would have a
+ # site value of "http://example.com".
+ #
+ # @return [String] The components that identify a site.
+ #
+ # source://addressable//lib/addressable/uri.rb#1467
def site; end
+
+ # Sets the site value for this URI.
+ #
+ # @param new_site [String, #to_str] The new site value.
+ #
+ # source://addressable//lib/addressable/uri.rb#1506
def site=(new_site); end
+
+ # Returns the top-level domain for this host.
+ #
+ # @example
+ # Addressable::URI.parse("http://www.example.co.uk").tld # => "co.uk"
+ #
+ # source://addressable//lib/addressable/uri.rb#1207
def tld; end
+
+ # Sets the top-level domain for this URI.
+ #
+ # @param new_tld [String, #to_str] The new top-level domain.
+ #
+ # source://addressable//lib/addressable/uri.rb#1215
def tld=(new_tld); end
+
+ # Returns a Hash of the URI components.
+ #
+ # @return [Hash] The URI as a Hash of components.
+ #
+ # source://addressable//lib/addressable/uri.rb#2367
def to_hash; end
+
+ # Converts the URI to a String.
+ #
+ # @return [String] The URI's String representation.
+ #
+ # source://addressable//lib/addressable/uri.rb#2341
def to_s; end
+
+ # Converts the URI to a String.
+ # URI's are glorified Strings. Allow implicit conversion.
+ #
+ # @return [String] The URI's String representation.
+ #
+ # source://addressable//lib/addressable/uri.rb#2341
def to_str; end
+
+ # The user component for this URI.
+ #
+ # @return [String] The user component.
+ #
+ # source://addressable//lib/addressable/uri.rb#941
def user; end
+
+ # Sets the user component for this URI.
+ #
+ # @param new_user [String, #to_str] The new user component.
+ #
+ # source://addressable//lib/addressable/uri.rb#970
def user=(new_user); end
+
+ # The userinfo component for this URI.
+ # Combines the user and password components.
+ #
+ # @return [String] The userinfo component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1052
def userinfo; end
+
+ # Sets the userinfo component for this URI.
+ #
+ # @param new_userinfo [String, #to_str] The new userinfo component.
+ #
+ # source://addressable//lib/addressable/uri.rb#1091
def userinfo=(new_userinfo); end
protected
+ # Converts the string to be UTF-8 if it is not already UTF-8
+ #
+ # @api private
+ #
+ # source://addressable//lib/addressable/uri.rb#2561
def force_utf8_encoding_if_needed(str); end
+
+ # Resets composite values for the entire URI
+ #
+ # @api private
+ #
+ # source://addressable//lib/addressable/uri.rb#2552
def remove_composite_values; end
+
+ # Replaces the internal state of self with the specified URI's state.
+ # Used in destructive operations to avoid massive code repetition.
+ #
+ # @param uri [Addressable::URI] The URI to replace self with.
+ # @return [Addressable::URI] self.
+ #
+ # source://addressable//lib/addressable/uri.rb#2519
def replace_self(uri); end
+
+ # Splits path string with "/" (slash).
+ # It is considered that there is empty string after last slash when
+ # path ends with slash.
+ #
+ # @param path [String] The path to split.
+ # @return [Array] An array of parts of path.
+ #
+ # source://addressable//lib/addressable/uri.rb#2542
def split_path(path); end
+
+ # Ensures that the URI is valid.
+ #
+ # source://addressable//lib/addressable/uri.rb#2476
def validate; end
private
+ # Resets instance variables
+ #
+ # @api private
+ #
+ # source://addressable//lib/addressable/uri.rb#2573
def reset_ivs; end
class << self
+ # Converts a path to a file scheme URI. If the path supplied is
+ # relative, it will be returned as a relative URI. If the path supplied
+ # is actually a non-file URI, it will parse the URI as if it had been
+ # parsed with Addressable::URI.parse. Handles all of the
+ # various Microsoft-specific formats for specifying paths.
+ #
+ # @example
+ # base = Addressable::URI.convert_path("/absolute/path/")
+ # uri = Addressable::URI.convert_path("relative/path")
+ # (base + uri).to_s
+ # #=> "file:///absolute/path/relative/path"
+ #
+ # Addressable::URI.convert_path(
+ # "c:\\windows\\My Documents 100%20\\foo.txt"
+ # ).to_s
+ # #=> "file:///c:/windows/My%20Documents%20100%20/foo.txt"
+ #
+ # Addressable::URI.convert_path("http://example.com/").to_s
+ # #=> "http://example.com/"
+ # @param path [String, Addressable::URI, #to_str] Typically a String path to a file or directory, but
+ # will return a sensible return value if an absolute URI is supplied
+ # instead.
+ # @return [Addressable::URI] The parsed file scheme URI or the original URI if some other URI
+ # scheme was provided.
+ #
+ # source://addressable//lib/addressable/uri.rb#292
def convert_path(path); end
+
+ # Percent encodes any special characters in the URI.
+ #
+ # @param uri [String, Addressable::URI, #to_str] The URI to encode.
+ # @param return_type [Class] The type of object to return.
+ # This value may only be set to String or
+ # Addressable::URI. All other values are invalid. Defaults
+ # to String.
+ # @return [String, Addressable::URI] The encoded URI.
+ # The return type is determined by the return_type
+ # parameter.
+ #
+ # source://addressable//lib/addressable/uri.rb#616
def encode(uri, return_type = T.unsafe(nil)); end
+
+ # Percent encodes a URI component.
+ #
+ # '9' to be percent encoded. If a Regexp is passed, the
+ # value /[^b-zB-Z0-9]/ would have the same effect. A set of
+ # useful String values may be found in the
+ # Addressable::URI::CharacterClasses module. The default
+ # value is the reserved plus unreserved character classes specified in
+ # RFC 3986.
+ #
+ # @example
+ # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9")
+ # => "simple%2Fex%61mple"
+ # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/)
+ # => "simple%2Fex%61mple"
+ # Addressable::URI.encode_component(
+ # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED
+ # )
+ # => "simple%2Fexample"
+ # @param component [String, #to_str] The URI component to encode.
+ # @param character_class [String, Regexp] The characters which are not percent encoded. If a String
+ # is passed, the String must be formatted as a regular
+ # expression character class. (Do not include the surrounding square
+ # brackets.) For example, "b-zB-Z0-9" would cause
+ # everything but the letters 'b' through 'z' and the numbers '0' through
+ # @param upcase_encoded [Regexp] A string of characters that may already be percent encoded, and whose
+ # encodings should be upcased. This allows normalization of percent
+ # encodings for characters not included in the
+ # character_class.
+ # @return [String] The encoded component.
+ #
+ # source://addressable//lib/addressable/uri.rb#403
def encode_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end
+
+ # Percent encodes any special characters in the URI.
+ #
+ # @param uri [String, Addressable::URI, #to_str] The URI to encode.
+ # @param return_type [Class] The type of object to return.
+ # This value may only be set to String or
+ # Addressable::URI. All other values are invalid. Defaults
+ # to String.
+ # @return [String, Addressable::URI] The encoded URI.
+ # The return type is determined by the return_type
+ # parameter.
+ #
+ # source://addressable//lib/addressable/uri.rb#616
def escape(uri, return_type = T.unsafe(nil)); end
+
+ # Percent encodes a URI component.
+ #
+ # '9' to be percent encoded. If a Regexp is passed, the
+ # value /[^b-zB-Z0-9]/ would have the same effect. A set of
+ # useful String values may be found in the
+ # Addressable::URI::CharacterClasses module. The default
+ # value is the reserved plus unreserved character classes specified in
+ # RFC 3986.
+ #
+ # @example
+ # Addressable::URI.encode_component("simple/example", "b-zB-Z0-9")
+ # => "simple%2Fex%61mple"
+ # Addressable::URI.encode_component("simple/example", /[^b-zB-Z0-9]/)
+ # => "simple%2Fex%61mple"
+ # Addressable::URI.encode_component(
+ # "simple/example", Addressable::URI::CharacterClasses::UNRESERVED
+ # )
+ # => "simple%2Fexample"
+ # @param component [String, #to_str] The URI component to encode.
+ # @param character_class [String, Regexp] The characters which are not percent encoded. If a String
+ # is passed, the String must be formatted as a regular
+ # expression character class. (Do not include the surrounding square
+ # brackets.) For example, "b-zB-Z0-9" would cause
+ # everything but the letters 'b' through 'z' and the numbers '0' through
+ # @param upcase_encoded [Regexp] A string of characters that may already be percent encoded, and whose
+ # encodings should be upcased. This allows normalization of percent
+ # encodings for characters not included in the
+ # character_class.
+ # @return [String] The encoded component.
+ #
+ # source://addressable//lib/addressable/uri.rb#403
def escape_component(component, character_class = T.unsafe(nil), upcase_encoded = T.unsafe(nil)); end
+
+ # Encodes a set of key/value pairs according to the rules for the
+ # application/x-www-form-urlencoded MIME type.
+ #
+ # @param form_values [#to_hash, #to_ary] The form values to encode.
+ # @param sort [TrueClass, FalseClass] Sort the key/value pairs prior to encoding.
+ # Defaults to false.
+ # @return [String] The encoded value.
+ #
+ # source://addressable//lib/addressable/uri.rb#740
def form_encode(form_values, sort = T.unsafe(nil)); end
+
+ # Decodes a String according to the rules for the
+ # application/x-www-form-urlencoded MIME type.
+ #
+ # @param encoded_value [String, #to_str] The form values to decode.
+ # @return [Array] The decoded values.
+ # This is not a Hash because of the possibility for
+ # duplicate keys.
+ #
+ # source://addressable//lib/addressable/uri.rb#793
def form_unencode(encoded_value); end
+
+ # Converts an input to a URI. The input does not have to be a valid
+ # URI — the method will use heuristics to guess what URI was intended.
+ # This is not standards-compliant, merely user-friendly.
+ #
+ # @param uri [String, Addressable::URI, #to_str] The URI string to parse.
+ # No parsing is performed if the object is already an
+ # Addressable::URI.
+ # @param hints [Hash] A Hash of hints to the heuristic parser.
+ # Defaults to {:scheme => "http"}.
+ # @return [Addressable::URI] The parsed URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#191
def heuristic_parse(uri, hints = T.unsafe(nil)); end
+
+ # Returns an array of known ip-based schemes. These schemes typically
+ # use a similar URI form:
+ # //:@:/
+ #
+ # source://addressable//lib/addressable/uri.rb#1369
def ip_based_schemes; end
+
+ # Joins several URIs together.
+ #
+ # @example
+ # base = "http://example.com/"
+ # uri = Addressable::URI.parse("relative/path")
+ # Addressable::URI.join(base, uri)
+ # #=> #
+ # @param *uris [String, Addressable::URI, #to_str] The URIs to join.
+ # @return [Addressable::URI] The joined URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#343
def join(*uris); end
+
+ # Normalizes the encoding of a URI component.
+ #
+ # @example
+ # Addressable::URI.normalize_component("simpl%65/%65xampl%65", "b-zB-Z")
+ # => "simple%2Fex%61mple"
+ # Addressable::URI.normalize_component(
+ # "simpl%65/%65xampl%65", /[^b-zB-Z]/
+ # )
+ # => "simple%2Fex%61mple"
+ # Addressable::URI.normalize_component(
+ # "simpl%65/%65xampl%65",
+ # Addressable::URI::CharacterClasses::UNRESERVED
+ # )
+ # => "simple%2Fexample"
+ # Addressable::URI.normalize_component(
+ # "one%20two%2fthree%26four",
+ # "0-9a-zA-Z &/",
+ # "/"
+ # )
+ # => "one two%2Fthree&four"
+ # @param component [String, #to_str] The URI component to encode.
+ # @param character_class [String, Regexp] The characters which are not percent encoded. If a String
+ # is passed, the String must be formatted as a regular
+ # expression character class. (Do not include the surrounding square
+ # brackets.) For example, "b-zB-Z0-9" would cause
+ # everything but the letters 'b' through 'z' and the numbers '0'
+ # through '9' to be percent encoded. If a Regexp is passed,
+ # the value /[^b-zB-Z0-9]/ would have the same effect. A
+ # set of useful String values may be found in the
+ # Addressable::URI::CharacterClasses module. The default
+ # value is the reserved plus unreserved character classes specified in
+ # RFC 3986.
+ # @param leave_encoded [String] When character_class is a String then
+ # leave_encoded is a string of characters that should remain
+ # percent encoded while normalizing the component; if they appear percent
+ # encoded in the original component, then they will be upcased ("%2f"
+ # normalized to "%2F") but otherwise left alone.
+ # @return [String] The normalized component.
+ #
+ # source://addressable//lib/addressable/uri.rb#552
def normalize_component(component, character_class = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
+
+ # Resolves paths to their simplest form.
+ #
+ # @param path [String] The path to normalize.
+ # @return [String] The normalized path.
+ #
+ # source://addressable//lib/addressable/uri.rb#2440
def normalize_path(path); end
+
+ # Normalizes the encoding of a URI. Characters within a hostname are
+ # not percent encoded to allow for internationalized domain names.
+ #
+ # @param uri [String, Addressable::URI, #to_str] The URI to encode.
+ # @param return_type [Class] The type of object to return.
+ # This value may only be set to String or
+ # Addressable::URI. All other values are invalid. Defaults
+ # to String.
+ # @return [String, Addressable::URI] The encoded URI.
+ # The return type is determined by the return_type
+ # parameter.
+ #
+ # source://addressable//lib/addressable/uri.rb#671
def normalized_encode(uri, return_type = T.unsafe(nil)); end
+
+ # Returns a URI object based on the parsed string.
+ #
+ # @param uri [String, Addressable::URI, #to_str] The URI string to parse.
+ # No parsing is performed if the object is already an
+ # Addressable::URI.
+ # @return [Addressable::URI] The parsed URI.
+ #
+ # source://addressable//lib/addressable/uri.rb#114
def parse(uri); end
+
+ # Returns a hash of common IP-based schemes and their default port
+ # numbers. Adding new schemes to this hash, as necessary, will allow
+ # for better URI normalization.
+ #
+ # source://addressable//lib/addressable/uri.rb#1376
def port_mapping; end
+
+ # Unencodes any percent encoded characters within a URI component.
+ # This method may be used for unencoding either components or full URIs,
+ # however, it is recommended to use the unencode_component
+ # alias when unencoding components.
+ #
+ # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
+ # @param return_type [Class] The type of object to return.
+ # This value may only be set to String or
+ # Addressable::URI. All other values are invalid. Defaults
+ # to String.
+ # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
+ # in this list is encountered then it will remain percent encoded.
+ # @return [String, Addressable::URI] The unencoded component or URI.
+ # The return type is determined by the return_type
+ # parameter.
+ #
+ # source://addressable//lib/addressable/uri.rb#472
def unencode(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
+
+ # Unencodes any percent encoded characters within a URI component.
+ # This method may be used for unencoding either components or full URIs,
+ # however, it is recommended to use the unencode_component
+ # alias when unencoding components.
+ #
+ # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
+ # @param return_type [Class] The type of object to return.
+ # This value may only be set to String or
+ # Addressable::URI. All other values are invalid. Defaults
+ # to String.
+ # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
+ # in this list is encountered then it will remain percent encoded.
+ # @return [String, Addressable::URI] The unencoded component or URI.
+ # The return type is determined by the return_type
+ # parameter.
+ #
+ # source://addressable//lib/addressable/uri.rb#472
def unencode_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
+
+ # Unencodes any percent encoded characters within a URI component.
+ # This method may be used for unencoding either components or full URIs,
+ # however, it is recommended to use the unencode_component
+ # alias when unencoding components.
+ #
+ # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
+ # @param return_type [Class] The type of object to return.
+ # This value may only be set to String or
+ # Addressable::URI. All other values are invalid. Defaults
+ # to String.
+ # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
+ # in this list is encountered then it will remain percent encoded.
+ # @return [String, Addressable::URI] The unencoded component or URI.
+ # The return type is determined by the return_type
+ # parameter.
+ #
+ # source://addressable//lib/addressable/uri.rb#472
def unescape(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
+
+ # Unencodes any percent encoded characters within a URI component.
+ # This method may be used for unencoding either components or full URIs,
+ # however, it is recommended to use the unencode_component
+ # alias when unencoding components.
+ #
+ # @param uri [String, Addressable::URI, #to_str] The URI or component to unencode.
+ # @param return_type [Class] The type of object to return.
+ # This value may only be set to String or
+ # Addressable::URI. All other values are invalid. Defaults
+ # to String.
+ # @param leave_encoded [String] A string of characters to leave encoded. If a percent encoded character
+ # in this list is encountered then it will remain percent encoded.
+ # @return [String, Addressable::URI] The unencoded component or URI.
+ # The return type is determined by the return_type
+ # parameter.
+ #
+ # source://addressable//lib/addressable/uri.rb#472
def unescape_component(uri, return_type = T.unsafe(nil), leave_encoded = T.unsafe(nil)); end
end
end
+# Container for the character classes specified in
+# RFC 3986.
+#
+# Note: Concatenated and interpolated `String`s are not affected by the
+# `frozen_string_literal` directive and must be frozen explicitly.
+#
+# Interpolated `String`s *were* frozen this way before Ruby 3.0:
+# https://bugs.ruby-lang.org/issues/17104
+#
+# source://addressable//lib/addressable/uri.rb#46
module Addressable::URI::CharacterClasses; end
+
+# source://addressable//lib/addressable/uri.rb#47
Addressable::URI::CharacterClasses::ALPHA = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#57
Addressable::URI::CharacterClasses::AUTHORITY = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#48
Addressable::URI::CharacterClasses::DIGIT = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#60
Addressable::URI::CharacterClasses::FRAGMENT = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#49
Addressable::URI::CharacterClasses::GEN_DELIMS = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#56
Addressable::URI::CharacterClasses::HOST = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#58
Addressable::URI::CharacterClasses::PATH = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#54
Addressable::URI::CharacterClasses::PCHAR = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#59
Addressable::URI::CharacterClasses::QUERY = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#51
Addressable::URI::CharacterClasses::RESERVED = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#53
Addressable::URI::CharacterClasses::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#55
Addressable::URI::CharacterClasses::SCHEME = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#50
Addressable::URI::CharacterClasses::SUB_DELIMS = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#52
Addressable::URI::CharacterClasses::UNRESERVED = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#72
module Addressable::URI::CharacterClassesRegexps; end
+
+# source://addressable//lib/addressable/uri.rb#73
Addressable::URI::CharacterClassesRegexps::AUTHORITY = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#74
Addressable::URI::CharacterClassesRegexps::FRAGMENT = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#75
Addressable::URI::CharacterClassesRegexps::HOST = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#76
Addressable::URI::CharacterClassesRegexps::PATH = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#77
Addressable::URI::CharacterClassesRegexps::QUERY = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#78
Addressable::URI::CharacterClassesRegexps::RESERVED = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#79
Addressable::URI::CharacterClassesRegexps::RESERVED_AND_UNRESERVED = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#80
Addressable::URI::CharacterClassesRegexps::SCHEME = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#81
Addressable::URI::CharacterClassesRegexps::UNRESERVED = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#85
Addressable::URI::EMPTY_STR = T.let(T.unsafe(nil), String)
+
+# Raised if something other than a uri is supplied.
+#
+# source://addressable//lib/addressable/uri.rb#34
class Addressable::URI::InvalidURIError < ::StandardError; end
+
+# source://addressable//lib/addressable/uri.rb#2598
module Addressable::URI::NONE; end
+
+# source://addressable//lib/addressable/uri.rb#1530
Addressable::URI::NORMPATH = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#63
module Addressable::URI::NormalizeCharacterClasses; end
+
+# source://addressable//lib/addressable/uri.rb#68
Addressable::URI::NormalizeCharacterClasses::FRAGMENT = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#64
Addressable::URI::NormalizeCharacterClasses::HOST = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#66
Addressable::URI::NormalizeCharacterClasses::PCHAR = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#69
Addressable::URI::NormalizeCharacterClasses::QUERY = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#67
Addressable::URI::NormalizeCharacterClasses::SCHEME = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#65
Addressable::URI::NormalizeCharacterClasses::UNRESERVED = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#2427
Addressable::URI::PARENT = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#89
Addressable::URI::PORT_MAPPING = T.let(T.unsafe(nil), Hash)
+
+# source://addressable//lib/addressable/uri.rb#2429
Addressable::URI::RULE_2A = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#2430
Addressable::URI::RULE_2B_2C = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#2431
Addressable::URI::RULE_2D = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#2432
Addressable::URI::RULE_PREFIXED_PARENT = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/uri.rb#2426
Addressable::URI::SELF_REF = T.let(T.unsafe(nil), String)
+
+# Tables used to optimize encoding operations in `self.encode_component`
+# and `self.normalize_component`
+#
+# source://addressable//lib/addressable/uri.rb#360
Addressable::URI::SEQUENCE_ENCODING_TABLE = T.let(T.unsafe(nil), Array)
+
+# source://addressable//lib/addressable/uri.rb#364
Addressable::URI::SEQUENCE_UPCASED_PERCENT_ENCODING_TABLE = T.let(T.unsafe(nil), Array)
+
+# source://addressable//lib/addressable/uri.rb#84
Addressable::URI::SLASH = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/uri.rb#87
Addressable::URI::URIREGEX = T.let(T.unsafe(nil), Regexp)
+
+# source://addressable//lib/addressable/version.rb#23
module Addressable::VERSION; end
+
+# source://addressable//lib/addressable/version.rb#24
Addressable::VERSION::MAJOR = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/version.rb#25
Addressable::VERSION::MINOR = T.let(T.unsafe(nil), Integer)
+
+# source://addressable//lib/addressable/version.rb#28
Addressable::VERSION::STRING = T.let(T.unsafe(nil), String)
+
+# source://addressable//lib/addressable/version.rb#26
Addressable::VERSION::TINY = T.let(T.unsafe(nil), Integer)
diff --git a/Library/Homebrew/sorbet/rbi/gems/ast@2.4.2.rbi b/Library/Homebrew/sorbet/rbi/gems/ast@2.4.2.rbi
index 687dae5b0e7ce..3fc4495da71a7 100644
--- a/Library/Homebrew/sorbet/rbi/gems/ast@2.4.2.rbi
+++ b/Library/Homebrew/sorbet/rbi/gems/ast@2.4.2.rbi
@@ -4,34 +4,263 @@
# This is an autogenerated file for types exported from the `ast` gem.
# Please instead update this file by running `bin/tapioca gem ast`.
+# {AST} is a library for manipulating abstract syntax trees.
+#
+# It embraces immutability; each AST node is inherently frozen at
+# creation, and updating a child node requires recreating that node
+# and its every parent, recursively.
+# This is a design choice. It does create some pressure on
+# garbage collector, but completely eliminates all concurrency
+# and aliasing problems.
+#
+# See also {AST::Node}, {AST::Processor::Mixin} and {AST::Sexp} for
+# additional recommendations and design patterns.
+#
+# source://ast//lib/ast.rb#13
module AST; end
+# Node is an immutable class, instances of which represent abstract
+# syntax tree nodes. It combines semantic information (i.e. anything
+# that affects the algorithmic properties of a program) with
+# meta-information (line numbers or compiler intermediates).
+#
+# Notes on inheritance
+# ====================
+#
+# The distinction between semantics and metadata is important. Complete
+# semantic information should be contained within just the {#type} and
+# {#children} of a Node instance; in other words, if an AST was to be
+# stripped of all meta-information, it should remain a valid AST which
+# could be successfully processed to yield a result with the same
+# algorithmic properties.
+#
+# Thus, Node should never be inherited in order to define methods which
+# affect or return semantic information, such as getters for `class_name`,
+# `superclass` and `body` in the case of a hypothetical `ClassNode`. The
+# correct solution is to use a generic Node with a {#type} of `:class`
+# and three children. See also {Processor} for tips on working with such
+# ASTs.
+#
+# On the other hand, Node can and should be inherited to define
+# application-specific metadata (see also {#initialize}) or customize the
+# printing format. It is expected that an application would have one or two
+# such classes and use them across the entire codebase.
+#
+# The rationale for this pattern is extensibility and maintainability.
+# Unlike static ones, dynamic languages do not require the presence of a
+# predefined, rigid structure, nor does it improve dispatch efficiency,
+# and while such a structure can certainly be defined, it does not add
+# any value but incurs a maintaining cost.
+# For example, extending the AST even with a transformation-local
+# temporary node type requires making globally visible changes to
+# the codebase.
+#
+# source://ast//lib/ast/node.rb#40
class AST::Node
+ # Constructs a new instance of Node.
+ #
+ # The arguments `type` and `children` are converted with `to_sym` and
+ # `to_a` respectively. Additionally, the result of converting `children`
+ # is frozen. While mutating the arguments is generally considered harmful,
+ # the most common case is to pass an array literal to the constructor. If
+ # your code does not expect the argument to be frozen, use `#dup`.
+ #
+ # The `properties` hash is passed to {#assign_properties}.
+ #
+ # @return [Node] a new instance of Node
+ #
+ # source://ast//lib/ast/node.rb#72
def initialize(type, children = T.unsafe(nil), properties = T.unsafe(nil)); end
+ # Concatenates `array` with `children` and returns the resulting node.
+ #
+ # @return [AST::Node]
+ #
+ # source://ast//lib/ast/node.rb#168
def +(array); end
+
+ # Appends `element` to `children` and returns the resulting node.
+ #
+ # @return [AST::Node]
+ #
+ # source://ast//lib/ast/node.rb#177
def <<(element); end
+
+ # Compares `self` to `other`, possibly converting with `to_ast`. Only
+ # `type` and `children` are compared; metadata is deliberately ignored.
+ #
+ # @return [Boolean]
+ #
+ # source://ast//lib/ast/node.rb#153
def ==(other); end
+
+ # Appends `element` to `children` and returns the resulting node.
+ #
+ # @return [AST::Node]
+ #
+ # source://ast//lib/ast/node.rb#177
def append(element); end
+
+ # Returns the children of this node.
+ # The returned value is frozen.
+ # The to_a alias is useful for decomposing nodes concisely.
+ # For example:
+ #
+ # node = s(:gasgn, :$foo, s(:integer, 1))
+ # var_name, value = *node
+ # p var_name # => :$foo
+ # p value # => (integer 1)
+ #
+ # @return [Array]
+ #
+ # source://ast//lib/ast/node.rb#56
def children; end
+
+ # Nodes are already frozen, so there is no harm in returning the
+ # current node as opposed to initializing from scratch and freezing
+ # another one.
+ #
+ # @return self
+ #
+ # source://ast//lib/ast/node.rb#115
def clone; end
+
+ # Concatenates `array` with `children` and returns the resulting node.
+ #
+ # @return [AST::Node]
+ #
+ # source://ast//lib/ast/node.rb#168
def concat(array); end
+
+ # Enables matching for Node, where type is the first element
+ # and the children are remaining items.
+ #
+ # @return [Array]
+ #
+ # source://ast//lib/ast/node.rb#253
def deconstruct; end
+
+ # Nodes are already frozen, so there is no harm in returning the
+ # current node as opposed to initializing from scratch and freezing
+ # another one.
+ #
+ # @return self
+ #
+ # source://ast//lib/ast/node.rb#115
def dup; end
+
+ # Test if other object is equal to
+ #
+ # @param other [Object]
+ # @return [Boolean]
+ #
+ # source://ast//lib/ast/node.rb#85
def eql?(other); end
+
+ # Returns the precomputed hash value for this node
+ #
+ # @return [Fixnum]
+ #
+ # source://ast//lib/ast/node.rb#61
def hash; end
+
+ # Converts `self` to a s-expression ruby string.
+ # The code return will recreate the node, using the sexp module s()
+ #
+ # @param indent [Integer] Base indentation level.
+ # @return [String]
+ #
+ # source://ast//lib/ast/node.rb#211
def inspect(indent = T.unsafe(nil)); end
+
+ # Returns the children of this node.
+ # The returned value is frozen.
+ # The to_a alias is useful for decomposing nodes concisely.
+ # For example:
+ #
+ # node = s(:gasgn, :$foo, s(:integer, 1))
+ # var_name, value = *node
+ # p var_name # => :$foo
+ # p value # => (integer 1)
+ #
+ # @return [Array]
+ #
+ # source://ast//lib/ast/node.rb#56
def to_a; end
+
+ # @return [AST::Node] self
+ #
+ # source://ast//lib/ast/node.rb#229
def to_ast; end
+
+ # Converts `self` to a pretty-printed s-expression.
+ #
+ # @param indent [Integer] Base indentation level.
+ # @return [String]
+ #
+ # source://ast//lib/ast/node.rb#187
def to_s(indent = T.unsafe(nil)); end
+
+ # Converts `self` to a pretty-printed s-expression.
+ #
+ # @param indent [Integer] Base indentation level.
+ # @return [String]
+ #
+ # source://ast//lib/ast/node.rb#187
def to_sexp(indent = T.unsafe(nil)); end
+
+ # Converts `self` to an Array where the first element is the type as a Symbol,
+ # and subsequent elements are the same representation of its children.
+ #
+ # @return [Array]
+ #
+ # source://ast//lib/ast/node.rb#237
def to_sexp_array; end
+
+ # Returns the type of this node.
+ #
+ # @return [Symbol]
+ #
+ # source://ast//lib/ast/node.rb#43
def type; end
+
+ # Returns a new instance of Node where non-nil arguments replace the
+ # corresponding fields of `self`.
+ #
+ # For example, `Node.new(:foo, [ 1, 2 ]).updated(:bar)` would yield
+ # `(bar 1 2)`, and `Node.new(:foo, [ 1, 2 ]).updated(nil, [])` would
+ # yield `(foo)`.
+ #
+ # If the resulting node would be identical to `self`, does nothing.
+ #
+ # @param type [Symbol, nil]
+ # @param children [Array, nil]
+ # @param properties [Hash, nil]
+ # @return [AST::Node]
+ #
+ # source://ast//lib/ast/node.rb#133
def updated(type = T.unsafe(nil), children = T.unsafe(nil), properties = T.unsafe(nil)); end
protected
+ # By default, each entry in the `properties` hash is assigned to
+ # an instance variable in this instance of Node. A subclass should define
+ # attribute readers for such variables. The values passed in the hash
+ # are not frozen or whitelisted; such behavior can also be implemented
+ # by subclassing Node and overriding this method.
+ #
+ # @return [nil]
+ #
+ # source://ast//lib/ast/node.rb#98
def assign_properties(properties); end
+
+ # Returns `@type` with all underscores replaced by dashes. This allows
+ # to write symbol literals without quotes in Ruby sources and yet have
+ # nicely looking s-expressions.
+ #
+ # @return [String]
+ #
+ # source://ast//lib/ast/node.rb#264
def fancy_type; end
private
@@ -39,16 +268,317 @@ class AST::Node
def original_dup; end
end
+# This class includes {AST::Processor::Mixin}; however, it is
+# deprecated, since the module defines all of the behaviors that
+# the processor includes. Any new libraries should use
+# {AST::Processor::Mixin} instead of subclassing this.
+#
+# @deprecated Use {AST::Processor::Mixin} instead.
+#
+# source://ast//lib/ast/processor.rb#8
class AST::Processor
include ::AST::Processor::Mixin
end
+# The processor module is a module which helps transforming one
+# AST into another. In a nutshell, the {#process} method accepts
+# a {Node} and dispatches it to a handler corresponding to its
+# type, and returns a (possibly) updated variant of the node.
+#
+# The processor module has a set of associated design patterns.
+# They are best explained with a concrete example. Let's define a
+# simple arithmetic language and an AST format for it:
+#
+# Terminals (AST nodes which do not have other AST nodes inside):
+#
+# * `(integer )`,
+#
+# Nonterminals (AST nodes with other nodes as children):
+#
+# * `(add )`,
+# * `(multiply )`,
+# * `(divide )`,
+# * `(negate )`,
+# * `(store )`: stores value of ``
+# into a variable named ``,
+# * `(load )`: loads value of a variable named
+# ``,
+# * `(each ...)`: computes each of the ``s and
+# prints the result.
+#
+# All AST nodes have the same Ruby class, and therefore they don't
+# know how to traverse themselves. (A solution which dynamically
+# checks the type of children is possible, but is slow and
+# error-prone.) So, a class including the module which knows how
+# to traverse the entire tree should be defined. Such classes
+# have a handler for each nonterminal node which recursively
+# processes children nodes:
+#
+# require 'ast'
+#
+# class ArithmeticsProcessor
+# include AST::Processor::Mixin
+# # This method traverses any binary operators such as (add)
+# # or (multiply).
+# def process_binary_op(node)
+# # Children aren't decomposed automatically; it is
+# # suggested to use Ruby multiple assignment expansion,
+# # as it is very convenient here.
+# left_expr, right_expr = *node
+#
+# # AST::Node#updated won't change node type if nil is
+# # passed as a first argument, which allows to reuse the
+# # same handler for multiple node types using `alias'
+# # (below).
+# node.updated(nil, [
+# process(left_expr),
+# process(right_expr)
+# ])
+# end
+# alias_method :on_add, :process_binary_op
+# alias_method :on_multiply, :process_binary_op
+# alias_method :on_divide, :process_binary_op
+#
+# def on_negate(node)
+# # It is also possible to use #process_all for more
+# # compact code if every child is a Node.
+# node.updated(nil, process_all(node))
+# end
+#
+# def on_store(node)
+# expr, variable_name = *node
+#
+# # Note that variable_name is not a Node and thus isn't
+# # passed to #process.
+# node.updated(nil, [
+# process(expr),
+# variable_name
+# ])
+# end
+#
+# # (load) is effectively a terminal node, and so it does
+# # not need an explicit handler, as the following is the
+# # default behavior. Essentially, for any nodes that don't
+# # have a defined handler, the node remains unchanged.
+# def on_load(node)
+# nil
+# end
+#
+# def on_each(node)
+# node.updated(nil, process_all(node))
+# end
+# end
+#
+# Let's test our ArithmeticsProcessor:
+#
+# include AST::Sexp
+# expr = s(:add, s(:integer, 2), s(:integer, 2))
+#
+# p ArithmeticsProcessor.new.process(expr) == expr # => true
+#
+# As expected, it does not change anything at all. This isn't
+# actually very useful, so let's now define a Calculator, which
+# will compute the expression values:
+#
+# # This Processor folds nonterminal nodes and returns an
+# # (integer) terminal node.
+# class ArithmeticsCalculator < ArithmeticsProcessor
+# def compute_op(node)
+# # First, node children are processed and then unpacked
+# # to local variables.
+# nodes = process_all(node)
+#
+# if nodes.all? { |node| node.type == :integer }
+# # If each of those nodes represents a literal, we can
+# # fold this node!
+# values = nodes.map { |node| node.children.first }
+# AST::Node.new(:integer, [
+# yield(values)
+# ])
+# else
+# # Otherwise, we can just leave the current node in the
+# # tree and only update it with processed children
+# # nodes, which can be partially folded.
+# node.updated(nil, nodes)
+# end
+# end
+#
+# def on_add(node)
+# compute_op(node) { |left, right| left + right }
+# end
+#
+# def on_multiply(node)
+# compute_op(node) { |left, right| left * right }
+# end
+# end
+#
+# Let's check:
+#
+# p ArithmeticsCalculator.new.process(expr) # => (integer 4)
+#
+# Excellent, the calculator works! Now, a careful reader could
+# notice that the ArithmeticsCalculator does not know how to
+# divide numbers. What if we pass an expression with division to
+# it?
+#
+# expr_with_division = \
+# s(:add,
+# s(:integer, 1),
+# s(:divide,
+# s(:add, s(:integer, 8), s(:integer, 4)),
+# s(:integer, 3))) # 1 + (8 + 4) / 3
+#
+# folded_expr_with_division = ArithmeticsCalculator.new.process(expr_with_division)
+# p folded_expr_with_division
+# # => (add
+# # (integer 1)
+# # (divide
+# # (integer 12)
+# # (integer 3)))
+#
+# As you can see, the expression was folded _partially_: the inner
+# `(add)` node which could be computed was folded to
+# `(integer 12)`, the `(divide)` node is left as-is because there
+# is no computing handler for it, and the root `(add)` node was
+# also left as it is because some of its children were not
+# literals.
+#
+# Note that this partial folding is only possible because the
+# _data_ format, i.e. the format in which the computed values of
+# the nodes are represented, is the same as the AST itself.
+#
+# Let's extend our ArithmeticsCalculator class further.
+#
+# class ArithmeticsCalculator
+# def on_divide(node)
+# compute_op(node) { |left, right| left / right }
+# end
+#
+# def on_negate(node)
+# # Note how #compute_op works regardless of the operator
+# # arity.
+# compute_op(node) { |value| -value }
+# end
+# end
+#
+# Now, let's apply our renewed ArithmeticsCalculator to a partial
+# result of previous evaluation:
+#
+# p ArithmeticsCalculator.new.process(expr_with_division) # => (integer 5)
+#
+# Five! Excellent. This is also pretty much how CRuby 1.8 executed
+# its programs.
+#
+# Now, let's do some automated bug searching. Division by zero is
+# an error, right? So if we could detect that someone has divided
+# by zero before the program is even run, that could save some
+# debugging time.
+#
+# class DivisionByZeroVerifier < ArithmeticsProcessor
+# class VerificationFailure < Exception; end
+#
+# def on_divide(node)
+# # You need to process the children to handle nested divisions
+# # such as:
+# # (divide
+# # (integer 1)
+# # (divide (integer 1) (integer 0))
+# left, right = process_all(node)
+#
+# if right.type == :integer &&
+# right.children.first == 0
+# raise VerificationFailure, "Ouch! This code divides by zero."
+# end
+# end
+#
+# def divides_by_zero?(ast)
+# process(ast)
+# false
+# rescue VerificationFailure
+# true
+# end
+# end
+#
+# nice_expr = \
+# s(:divide,
+# s(:add, s(:integer, 10), s(:integer, 2)),
+# s(:integer, 4))
+#
+# p DivisionByZeroVerifier.new.divides_by_zero?(nice_expr)
+# # => false. Good.
+#
+# bad_expr = \
+# s(:add, s(:integer, 10),
+# s(:divide, s(:integer, 1), s(:integer, 0)))
+#
+# p DivisionByZeroVerifier.new.divides_by_zero?(bad_expr)
+# # => true. WHOOPS. DO NOT RUN THIS.
+#
+# Of course, this won't detect more complex cases... unless you
+# use some partial evaluation before! The possibilites are
+# endless. Have fun.
+#
+# source://ast//lib/ast/processor/mixin.rb#240
module AST::Processor::Mixin
+ # Default handler. Does nothing.
+ #
+ # @param node [AST::Node]
+ # @return [AST::Node, nil]
+ #
+ # source://ast//lib/ast/processor/mixin.rb#284
def handler_missing(node); end
+
+ # Dispatches `node`. If a node has type `:foo`, then a handler
+ # named `on_foo` is invoked with one argument, the `node`; if
+ # there isn't such a handler, {#handler_missing} is invoked
+ # with the same argument.
+ #
+ # If the handler returns `nil`, `node` is returned; otherwise,
+ # the return value of the handler is passed along.
+ #
+ # @param node [AST::Node, nil]
+ # @return [AST::Node, nil]
+ #
+ # source://ast//lib/ast/processor/mixin.rb#251
def process(node); end
+
+ # {#process}es each node from `nodes` and returns an array of
+ # results.
+ #
+ # @param nodes [Array]
+ # @return [Array]
+ #
+ # source://ast//lib/ast/processor/mixin.rb#274
def process_all(nodes); end
end
+# This simple module is very useful in the cases where one needs
+# to define deeply nested ASTs from Ruby code, for example, in
+# tests. It should be used like this:
+#
+# describe YourLanguage::AST do
+# include Sexp
+#
+# it "should correctly parse expressions" do
+# YourLanguage.parse("1 + 2 * 3").should ==
+# s(:add,
+# s(:integer, 1),
+# s(:multiply,
+# s(:integer, 2),
+# s(:integer, 3)))
+# end
+# end
+#
+# This way the amount of boilerplate code is greatly reduced.
+#
+# source://ast//lib/ast/sexp.rb#20
module AST::Sexp
+ # Creates a {Node} with type `type` and children `children`.
+ # Note that the resulting node is of the type AST::Node and not a
+ # subclass.
+ # This would not pose a problem with comparisons, as {Node#==}
+ # ignores metadata.
+ #
+ # source://ast//lib/ast/sexp.rb#26
def s(type, *children); end
end
diff --git a/Library/Homebrew/sorbet/rbi/gems/bindata@2.4.15.rbi b/Library/Homebrew/sorbet/rbi/gems/bindata@2.4.15.rbi
index 33c16953df10a..84fdca10457e3 100644
--- a/Library/Homebrew/sorbet/rbi/gems/bindata@2.4.15.rbi
+++ b/Library/Homebrew/sorbet/rbi/gems/bindata@2.4.15.rbi
@@ -4,232 +4,811 @@
# This is an autogenerated file for types exported from the `bindata` gem.
# Please instead update this file by running `bin/tapioca gem bindata`.
+# source://bindata//lib/bindata/version.rb#1
module BinData
extend ::BinData::BitFieldFactory
extend ::BinData::IntFactory
private
+ # @yield [@tracer]
+ #
+ # source://bindata//lib/bindata/trace.rb#40
def trace_message; end
+
+ # Turn on trace information when reading a BinData object.
+ # If +block+ is given then the tracing only occurs for that block.
+ # This is useful for debugging a BinData declaration.
+ #
+ # source://bindata//lib/bindata/trace.rb#26
def trace_reading(io = T.unsafe(nil)); end
class << self
+ # @yield [@tracer]
+ #
+ # source://bindata//lib/bindata/trace.rb#40
def trace_message; end
+
+ # Turn on trace information when reading a BinData object.
+ # If +block+ is given then the tracing only occurs for that block.
+ # This is useful for debugging a BinData declaration.
+ #
+ # source://bindata//lib/bindata/trace.rb#26
def trace_reading(io = T.unsafe(nil)); end
end
end
+# source://bindata//lib/bindata/params.rb#4
module BinData::AcceptedParametersPlugin
+ # source://bindata//lib/bindata/params.rb#30
def accepted_parameters; end
+
+ # Default parameters can be overridden when instantiating a data object.
+ #
+ # source://bindata//lib/bindata/params.rb#16
def default_parameter(*args); end
+
+ # Default parameters can be overridden when instantiating a data object.
+ #
+ # source://bindata//lib/bindata/params.rb#16
def default_parameters(*args); end
+
+ # Mandatory parameters must be present when instantiating a data object.
+ #
+ # source://bindata//lib/bindata/params.rb#6
def mandatory_parameter(*args); end
+
+ # Mandatory parameters must be present when instantiating a data object.
+ #
+ # source://bindata//lib/bindata/params.rb#6
def mandatory_parameters(*args); end
+
+ # Mutually exclusive parameters may not all be present when
+ # instantiating a data object.
+ #
+ # source://bindata//lib/bindata/params.rb#22
def mutually_exclusive_parameters(*args); end
+
+ # Optional parameters may be present when instantiating a data object.
+ #
+ # source://bindata//lib/bindata/params.rb#11
def optional_parameter(*args); end
+
+ # Optional parameters may be present when instantiating a data object.
+ #
+ # source://bindata//lib/bindata/params.rb#11
def optional_parameters(*args); end
end
+# BinData objects accept parameters when initializing. AcceptedParameters
+# allow a BinData class to declaratively identify accepted parameters as
+# mandatory, optional, default or mutually exclusive.
+#
+# source://bindata//lib/bindata/params.rb#41
class BinData::AcceptedParametersPlugin::AcceptedParameters
+ # @return [AcceptedParameters] a new instance of AcceptedParameters
+ #
+ # source://bindata//lib/bindata/params.rb#42
def initialize(ancestor_parameters = T.unsafe(nil)); end
+ # source://bindata//lib/bindata/params.rb#94
def all; end
+
+ # source://bindata//lib/bindata/params.rb#72
def default(args = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/params.rb#56
def mandatory(*args); end
+
+ # source://bindata//lib/bindata/params.rb#82
def mutually_exclusive(*args); end
+
+ # source://bindata//lib/bindata/params.rb#64
def optional(*args); end
private
+ # source://bindata//lib/bindata/params.rb#107
def ensure_valid_names(names); end
+
+ # source://bindata//lib/bindata/params.rb#101
def to_syms(args); end
class << self
+ # source://bindata//lib/bindata/params.rb#117
def invalid_parameter_names; end
end
end
+# An Array is a list of data objects of the same type.
+#
+# require 'bindata'
+#
+# data = "\x03\x04\x05\x06\x07\x08\x09"
+#
+# obj = BinData::Array.new(type: :int8, initial_length: 6)
+# obj.read(data) #=> [3, 4, 5, 6, 7, 8]
+#
+# obj = BinData::Array.new(type: :int8,
+# read_until: -> { index == 1 })
+# obj.read(data) #=> [3, 4]
+#
+# obj = BinData::Array.new(type: :int8,
+# read_until: -> { element >= 6 })
+# obj.read(data) #=> [3, 4, 5, 6]
+#
+# obj = BinData::Array.new(type: :int8,
+# read_until: -> { array[index] + array[index - 1] == 13 })
+# obj.read(data) #=> [3, 4, 5, 6, 7]
+#
+# obj = BinData::Array.new(type: :int8, read_until: :eof)
+# obj.read(data) #=> [3, 4, 5, 6, 7, 8, 9]
+#
+# == Parameters
+#
+# Parameters may be provided at initialisation to control the behaviour of
+# an object. These params are:
+#
+# :type:: The symbol representing the data type of the
+# array elements. If the type is to have params
+# passed to it, then it should be provided as
+# [type_symbol, hash_params].
+# :initial_length:: The initial length of the array.
+# :read_until:: While reading, elements are read until this
+# condition is true. This is typically used to
+# read an array until a sentinel value is found.
+# The variables +index+, +element+ and +array+
+# are made available to any lambda assigned to
+# this parameter. If the value of this parameter
+# is the symbol :eof, then the array will read
+# as much data from the stream as possible.
+#
+# Each data object in an array has the variable +index+ made available
+# to any lambda evaluated as a parameter of that data object.
+#
+# source://bindata//lib/bindata/array.rb#50
class BinData::Array < ::BinData::Base
include ::Enumerable
extend ::BinData::DSLMixin
+ # source://bindata//lib/bindata/array.rb#106
def <<(*args); end
+
+ # Returns the element at +index+.
+ #
+ # source://bindata//lib/bindata/array.rb#139
def [](arg1, arg2 = T.unsafe(nil)); end
+
+ # Sets the element at +index+.
+ #
+ # source://bindata//lib/bindata/array.rb#174
def []=(index, value); end
+
+ # @raise [ArgumentError]
+ #
+ # source://bindata//lib/bindata/array.rb#82
def assign(array); end
+
+ # Returns the element at +index+. Unlike +slice+, if +index+ is out
+ # of range the array will not be automatically extended.
+ #
+ # source://bindata//lib/bindata/array.rb#169
def at(index); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/array.rb#78
def clear?; end
+
+ # source://bindata//lib/bindata/array.rb#117
def concat(array); end
+
+ # source://bindata//lib/bindata/array.rb#223
def debug_name_of(child); end
+
+ # source://bindata//lib/bindata/array.rb#239
def do_num_bytes; end
+
+ # source://bindata//lib/bindata/array.rb#235
def do_write(io); end
+
+ # source://bindata//lib/bindata/array.rb#219
def each; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/array.rb#210
def empty?; end
+
+ # source://bindata//lib/bindata/array.rb#94
def find_index(obj); end
+
+ # Returns the first index of +obj+ in self.
+ #
+ # Uses equal? for the comparator.
+ #
+ # source://bindata//lib/bindata/array.rb#102
def find_index_of(obj); end
+
+ # Returns the first element, or the first +n+ elements, of the array.
+ # If the array is empty, the first form returns nil, and the second
+ # form returns an empty array.
+ #
+ # source://bindata//lib/bindata/array.rb#182
def first(n = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/array.rb#94
def index(obj); end
+
+ # source://bindata//lib/bindata/array.rb#74
def initialize_instance; end
+
+ # source://bindata//lib/bindata/array.rb#61
def initialize_shared_instance; end
+
+ # source://bindata//lib/bindata/array.rb#122
def insert(index, *objs); end
+
+ # Returns the last element, or the last +n+ elements, of the array.
+ # If the array is empty, the first form returns nil, and the second
+ # form returns an empty array.
+ #
+ # source://bindata//lib/bindata/array.rb#196
def last(n = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/array.rb#205
def length; end
+
+ # source://bindata//lib/bindata/array.rb#228
def offset_of(child); end
+
+ # source://bindata//lib/bindata/array.rb#106
def push(*args); end
+
+ # source://bindata//lib/bindata/array.rb#205
def size; end
+
+ # Returns the element at +index+.
+ #
+ # source://bindata//lib/bindata/array.rb#139
def slice(arg1, arg2 = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/array.rb#90
def snapshot; end
+
+ # Allow this object to be used in array context.
+ #
+ # source://bindata//lib/bindata/array.rb#215
def to_ary; end
+
+ # source://bindata//lib/bindata/array.rb#112
def unshift(*args); end
private
+ # source://bindata//lib/bindata/array.rb#257
def append_new_element; end
+
+ # source://bindata//lib/bindata/array.rb#253
def elements; end
+
+ # source://bindata//lib/bindata/array.rb#246
def extend_array(max_index); end
+
+ # source://bindata//lib/bindata/array.rb#263
def new_element; end
+
+ # source://bindata//lib/bindata/array.rb#153
def slice_index(index); end
+
+ # source://bindata//lib/bindata/array.rb#162
def slice_range(range); end
+
+ # source://bindata//lib/bindata/array.rb#158
def slice_start_length(start, length); end
+
+ # source://bindata//lib/bindata/array.rb#271
def sum_num_bytes_below_index(index); end
+
+ # source://bindata//lib/bindata/array.rb#267
def sum_num_bytes_for_all_elements; end
end
+# source://bindata//lib/bindata/array.rb#284
class BinData::ArrayArgProcessor < ::BinData::BaseArgProcessor
+ # source://bindata//lib/bindata/array.rb#285
def sanitize_parameters!(obj_class, params); end
end
+# Add these offset options to Base
+#
+# source://bindata//lib/bindata/base.rb#11
class BinData::Base
include ::BinData::Framework
include ::BinData::RegisterNamePlugin
extend ::BinData::AcceptedParametersPlugin
+ # source://bindata//lib/bindata/warnings.rb#12
def initialize(*args); end
+ # source://bindata//lib/bindata/base.rb#231
def ==(other); end
+
+ # Override and delegate =~ as it is defined in Object.
+ #
+ # source://bindata//lib/bindata/base.rb#199
def =~(other); end
+
+ # Returns the offset (in bytes) of this object with respect to its most
+ # distant ancestor.
+ #
+ # source://bindata//lib/bindata/base.rb#214
def abs_offset; end
+
def base_respond_to?(*_arg0); end
+
+ # Resets the internal state to that of a newly created object.
+ #
+ # source://bindata//lib/bindata/base.rb#137
def clear; end
+
+ # Returns a user friendly name of this object for debugging purposes.
+ #
+ # source://bindata//lib/bindata/base.rb#204
def debug_name; end
+
+ # Returns the result of evaluating the parameter identified by +key+.
+ #
+ # +overrides+ is an optional +parameters+ like hash that allow the
+ # parameters given at object construction to be overridden.
+ #
+ # Returns nil if +key+ does not refer to any parameter.
+ #
+ # source://bindata//lib/bindata/base.rb#110
def eval_parameter(key, overrides = T.unsafe(nil)); end
+
+ # Returns the parameter referenced by +key+.
+ # Use this method if you are sure the parameter is not to be evaluated.
+ # You most likely want #eval_parameter.
+ #
+ # source://bindata//lib/bindata/base.rb#127
def get_parameter(key); end
+
+ # Returns whether +key+ exists in the +parameters+ hash.
+ #
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/base.rb#132
def has_parameter?(key); end
+
+ # source://bindata//lib/bindata/warnings.rb#25
def initialize_instance(*args); end
+
+ # source://bindata//lib/bindata/warnings.rb#12
def initialize_with_warning(*args); end
+
+ # Return a human readable representation of this data object.
+ #
+ # source://bindata//lib/bindata/base.rb#184
def inspect; end
+
+ # Returns a lazy evaluator for this object.
+ #
+ # source://bindata//lib/bindata/base.rb#120
def lazy_evaluator; end
+
+ # Creates a new data object based on this instance.
+ #
+ # All parameters will be be duplicated. Use this method
+ # when creating multiple objects with the same parameters.
+ #
+ # source://bindata//lib/bindata/base.rb#95
def new(value = T.unsafe(nil), parent = T.unsafe(nil)); end
+
+ # Returns the number of bytes it will take to write this data object.
+ #
+ # source://bindata//lib/bindata/base.rb#167
def num_bytes; end
+
+ # Returns the value of attribute parent.
+ #
+ # source://bindata//lib/bindata/base.rb#88
def parent; end
+
+ # Work with Ruby's pretty-printer library.
+ #
+ # source://bindata//lib/bindata/base.rb#194
def pretty_print(pp); end
+
+ # Reads data into this data object.
+ #
+ # source://bindata//lib/bindata/base.rb#142
def read(io, &block); end
+
+ # Returns the offset (in bytes) of this object with respect to its parent.
+ #
+ # source://bindata//lib/bindata/base.rb#223
def rel_offset; end
+
+ # A version of +respond_to?+ used by the lazy evaluator. It doesn't
+ # reinvoke the evaluator so as to avoid infinite evaluation loops.
+ #
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/base.rb#238
def safe_respond_to?(symbol, include_private = T.unsafe(nil)); end
+
+ # Returns the string representation of this data object.
+ #
+ # source://bindata//lib/bindata/base.rb#172
def to_binary_s(&block); end
+
+ # Returns the hexadecimal string representation of this data object.
+ #
+ # source://bindata//lib/bindata/base.rb#179
def to_hex(&block); end
+
+ # Return a string representing this data object.
+ #
+ # source://bindata//lib/bindata/base.rb#189
def to_s; end
+
+ # Writes the value for this data object to +io+.
+ #
+ # source://bindata//lib/bindata/base.rb#155
def write(io, &block); end
protected
+ # Sets the attribute parent
+ #
+ # @param value the value to set the attribute parent to.
+ #
+ # source://bindata//lib/bindata/base.rb#88
def parent=(_arg0); end
private
+ # source://bindata//lib/bindata/base.rb#284
def binary_string(str); end
+
+ # source://bindata//lib/bindata/base.rb#247
def extract_args(args); end
+
+ # Creates a new data object.
+ #
+ # Args are optional, but if present, must be in the following order.
+ #
+ # +value+ is a value that is +assign+ed immediately after initialization.
+ #
+ # +parameters+ is a hash containing symbol keys. Some parameters may
+ # reference callable objects (methods or procs).
+ #
+ # +parent+ is the parent data object (e.g. struct, array, choice) this
+ # object resides under.
+ # Don't override initialize. If you are defining a new kind of datatype
+ # (list, array, choice etc) then put your initialization code in
+ # #initialize_instance. BinData objects might be initialized as prototypes
+ # and your initialization code may not be called.
+ #
+ # If you're subclassing BinData::Record, you are definitely doing the wrong
+ # thing. Read the documentation on how to use BinData.
+ # http://github.com/dmendel/bindata/wiki/Records
+ #
+ # @return [Base] a new instance of Base
+ #
+ # source://bindata//lib/bindata/base.rb#80
def initialize_without_warning(*args); end
+
+ # Is this object tree currently being read? Used by BasePrimitive.
+ #
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/base.rb#259
def reading?; end
+
+ # source://bindata//lib/bindata/base.rb#251
def start_read; end
+
+ # source://bindata//lib/bindata/base.rb#273
def top_level; end
+
+ # source://bindata//lib/bindata/base.rb#267
def top_level_get(sym); end
+
+ # source://bindata//lib/bindata/base.rb#263
def top_level_set(sym, value); end
class << self
+ # The arg processor for this class.
+ #
+ # source://bindata//lib/bindata/base.rb#26
def arg_processor(name = T.unsafe(nil)); end
+
+ # The +auto_call_delayed_io+ keyword sets a data object tree to perform
+ # multi pass I/O automatically.
+ #
+ # source://bindata//lib/bindata/delayed_io.rb#161
def auto_call_delayed_io; end
+
+ # The name of this class as used by Records, Arrays etc.
+ #
+ # source://bindata//lib/bindata/base.rb#41
def bindata_name; end
+
+ # source://bindata//lib/bindata/base.rb#53
def inherited(subclass); end
+
+ # Instantiates this class and reads from +io+, returning the newly
+ # created data object. +args+ will be used when instantiating.
+ #
+ # source://bindata//lib/bindata/base.rb#19
def read(io, *args, &block); end
private
+ # Registers all subclasses of this class for use
+ #
+ # source://bindata//lib/bindata/base.rb#51
def register_subclasses; end
+
+ # Call this method if this class is abstract and not to be used.
+ #
+ # source://bindata//lib/bindata/base.rb#46
def unregister_self; end
end
end
+# source://bindata//lib/bindata/delayed_io.rb#179
module BinData::Base::AutoCallDelayedIO
+ # source://bindata//lib/bindata/delayed_io.rb#180
def initialize_shared_instance; end
+
+ # source://bindata//lib/bindata/delayed_io.rb#193
def num_bytes; end
+
+ # source://bindata//lib/bindata/delayed_io.rb#185
def read(io); end
+
+ # source://bindata//lib/bindata/delayed_io.rb#189
def write(io, *_); end
end
+# ArgProcessors process the arguments passed to BinData::Base.new into
+# the form required to initialise the BinData object.
+#
+# Any passed parameters are sanitized so the BinData object doesn't
+# need to perform error checking on the parameters.
+#
+# source://bindata//lib/bindata/base.rb#294
class BinData::BaseArgProcessor
+ # Takes the arguments passed to BinData::Base.new and
+ # extracts [value, sanitized_parameters, parent].
+ #
+ # source://bindata//lib/bindata/base.rb#299
def extract_args(obj_class, obj_args); end
+
+ # Performs sanity checks on the given parameters.
+ # This method converts the parameters to the form expected
+ # by the data object.
+ #
+ # source://bindata//lib/bindata/base.rb#332
def sanitize_parameters!(obj_class, obj_params); end
+
+ # Separates the arguments passed to BinData::Base.new into
+ # [value, parameters, parent]. Called by #extract_args.
+ #
+ # source://bindata//lib/bindata/base.rb#308
def separate_args(_obj_class, obj_args); end
end
+# A BinData::BasePrimitive object is a container for a value that has a
+# particular binary representation. A value corresponds to a primitive type
+# such as as integer, float or string. Only one value can be contained by
+# this object. This value can be read from or written to an IO stream.
+#
+# require 'bindata'
+#
+# obj = BinData::Uint8.new(initial_value: 42)
+# obj #=> 42
+# obj.assign(5)
+# obj #=> 5
+# obj.clear
+# obj #=> 42
+#
+# obj = BinData::Uint8.new(value: 42)
+# obj #=> 42
+# obj.assign(5)
+# obj #=> 42
+#
+# obj = BinData::Uint8.new(assert: 3)
+# obj.read("\005") #=> BinData::ValidityError: value is '5' but expected '3'
+#
+# obj = BinData::Uint8.new(assert: -> { value < 5 })
+# obj.read("\007") #=> BinData::ValidityError: value not as expected
+#
+# == Parameters
+#
+# Parameters may be provided at initialisation to control the behaviour of
+# an object. These params include those for BinData::Base as well as:
+#
+# [:initial_value] This is the initial value to use before one is
+# either #read or explicitly set with #value=.
+# [:value] The object will always have this value.
+# Calls to #value= are ignored when
+# using this param. While reading, #value
+# will return the value of the data read from the
+# IO, not the result of the :value param.
+# [:assert] Raise an error unless the value read or assigned
+# meets this criteria. The variable +value+ is
+# made available to any lambda assigned to this
+# parameter. A boolean return indicates success
+# or failure. Any other return is compared to
+# the value just read in.
+# [:asserted_value] Equivalent to :assert and :value.
+#
+# source://bindata//lib/bindata/base_primitive.rb#49
class BinData::BasePrimitive < ::BinData::Base
+ # source://bindata//lib/bindata/base_primitive.rb#115
def <=>(other); end
+
+ # @raise [ArgumentError]
+ #
+ # source://bindata//lib/bindata/base_primitive.rb#72
def assign(val); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/base_primitive.rb#68
def clear?; end
+
+ # source://bindata//lib/bindata/base_primitive.rb#136
def do_num_bytes; end
+
+ # source://bindata//lib/bindata/base_primitive.rb#128
def do_read(io); end
+
+ # source://bindata//lib/bindata/trace.rb#58
def do_read_with_hook(io); end
+
+ # source://bindata//lib/bindata/base_primitive.rb#132
def do_write(io); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/base_primitive.rb#119
def eql?(other); end
+
+ # source://bindata//lib/bindata/base_primitive.rb#124
def hash; end
+
+ # source://bindata//lib/bindata/base_primitive.rb#64
def initialize_instance; end
+
+ # source://bindata//lib/bindata/base_primitive.rb#56
def initialize_shared_instance; end
+
+ # source://bindata//lib/bindata/base_primitive.rb#102
def method_missing(symbol, *args, &block); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/base_primitive.rb#97
def respond_to?(symbol, include_private = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/base_primitive.rb#85
def snapshot; end
+
+ # source://bindata//lib/bindata/trace.rb#63
def trace_value; end
+
+ # source://bindata//lib/bindata/base_primitive.rb#89
def value; end
+
+ # source://bindata//lib/bindata/base_primitive.rb#93
def value=(val); end
private
+ # The unmodified value of this data object. Note that #snapshot calls this
+ # method. This indirection is so that #snapshot can be overridden in
+ # subclasses to modify the presentation value.
+ #
+ # source://bindata//lib/bindata/base_primitive.rb#146
def _value; end
+
+ # Read a number of bytes from +io+ and return the value they represent.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://bindata//lib/bindata/base_primitive.rb#236
def read_and_return_value(io); end
+
+ # Return a sensible default for this data.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://bindata//lib/bindata/base_primitive.rb#241
def sensible_default; end
+
+ # Return the string representation that +val+ will take when written.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://bindata//lib/bindata/base_primitive.rb#231
def value_to_binary_string(val); end
class << self
+ # source://bindata//lib/bindata/alignment.rb#72
def bit_aligned; end
+
+ # source://bindata//lib/bindata/base.rb#53
def inherited(subclass); end
+
+ # source://bindata//lib/bindata/trace.rb#53
def turn_off_tracing; end
+
+ # source://bindata//lib/bindata/trace.rb#48
def turn_on_tracing; end
end
end
+# Logic for the :assert parameter
+#
+# source://bindata//lib/bindata/base_primitive.rb#169
module BinData::BasePrimitive::AssertPlugin
+ # @raise [ValidityError]
+ #
+ # source://bindata//lib/bindata/base_primitive.rb#180
def assert!; end
+
+ # source://bindata//lib/bindata/base_primitive.rb#170
def assign(val); end
+
+ # source://bindata//lib/bindata/base_primitive.rb#175
def do_read(io); end
end
+# Logic for the :asserted_value parameter
+#
+# source://bindata//lib/bindata/base_primitive.rb#198
module BinData::BasePrimitive::AssertedValuePlugin
+ # source://bindata//lib/bindata/base_primitive.rb#204
def _value; end
+
+ # source://bindata//lib/bindata/base_primitive.rb#213
def assert!; end
+
+ # source://bindata//lib/bindata/base_primitive.rb#217
def assert_value(current_value); end
+
+ # source://bindata//lib/bindata/base_primitive.rb#199
def assign(val); end
+
+ # source://bindata//lib/bindata/base_primitive.rb#208
def do_read(io); end
end
+# Logic for the :initial_value parameter
+#
+# source://bindata//lib/bindata/base_primitive.rb#162
module BinData::BasePrimitive::InitialValuePlugin
+ # source://bindata//lib/bindata/base_primitive.rb#163
def _value; end
end
+# Logic for the :value parameter
+#
+# source://bindata//lib/bindata/base_primitive.rb#151
module BinData::BasePrimitive::ValuePlugin
+ # source://bindata//lib/bindata/base_primitive.rb#156
def _value; end
+
+ # source://bindata//lib/bindata/base_primitive.rb#152
def assign(val); end
end
+# source://bindata//lib/bindata/bits.rb#15
class BinData::Bit < ::BinData::BasePrimitive
def assign(val); end
def bit_aligned?; end
@@ -242,38 +821,94 @@ class BinData::Bit < ::BinData::BasePrimitive
def sensible_default; end
end
+# A monkey patch to force byte-aligned primitives to
+# become bit-aligned. This allows them to be used at
+# non byte based boundaries.
+#
+# class BitString < BinData::String
+# bit_aligned
+# end
+#
+# class MyRecord < BinData::Record
+# bit4 :preamble
+# bit_string :str, length: 2
+# end
+#
+# source://bindata//lib/bindata/alignment.rb#43
module BinData::BitAligned
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/alignment.rb#55
def bit_aligned?; end
+
+ # source://bindata//lib/bindata/alignment.rb#63
def do_num_bytes; end
+
+ # source://bindata//lib/bindata/alignment.rb#67
def do_write(io); end
+
+ # source://bindata//lib/bindata/alignment.rb#59
def read_and_return_value(io); end
end
+# source://bindata//lib/bindata/alignment.rb#44
class BinData::BitAligned::BitAlignedIO
+ # @return [BitAlignedIO] a new instance of BitAlignedIO
+ #
+ # source://bindata//lib/bindata/alignment.rb#45
def initialize(io); end
+ # source://bindata//lib/bindata/alignment.rb#48
def readbytes(n); end
end
+# Defines a number of classes that contain a bit based integer.
+# The integer is defined by endian and number of bits.
+#
+# source://bindata//lib/bindata/bits.rb#8
module BinData::BitField
class << self
+ # source://bindata//lib/bindata/bits.rb#92
def create_clamp_code(nbits, signed); end
+
+ # source://bindata//lib/bindata/bits.rb#84
def create_do_num_bytes_code(nbits); end
+
+ # source://bindata//lib/bindata/bits.rb#100
def create_dynamic_clamp_code(signed); end
+
+ # source://bindata//lib/bindata/bits.rb#112
def create_fixed_clamp_code(nbits, signed); end
+
+ # source://bindata//lib/bindata/bits.rb#135
def create_int2uint_code(nbits, signed); end
+
+ # source://bindata//lib/bindata/bits.rb#76
def create_nbits_code(nbits); end
+
+ # source://bindata//lib/bindata/bits.rb#68
def create_params_code(nbits); end
+
+ # source://bindata//lib/bindata/bits.rb#145
def create_uint2int_code(nbits, signed); end
+
+ # source://bindata//lib/bindata/bits.rb#12
def define_class(name, nbits, endian, signed = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/bits.rb#26
def define_methods(bit_class, nbits, endian, signed); end
end
end
+# Create classes on demand
+#
+# source://bindata//lib/bindata/bits.rb#166
module BinData::BitFieldFactory
+ # source://bindata//lib/bindata/bits.rb#167
def const_missing(name); end
end
+# source://bindata//lib/bindata/bits.rb#15
class BinData::BitLe < ::BinData::BasePrimitive
def assign(val); end
def bit_aligned?; end
@@ -286,35 +921,184 @@ class BinData::BitLe < ::BinData::BasePrimitive
def sensible_default; end
end
+# A Buffer is conceptually a substream within a data stream. It has a
+# defined size and it will always read or write the exact number of bytes to
+# fill the buffer. Short reads will skip over unused bytes and short writes
+# will pad the substream with "\0" bytes.
+#
+# require 'bindata'
+#
+# obj = BinData::Buffer.new(length: 5, type: [:string, {value: "abc"}])
+# obj.to_binary_s #=> "abc\000\000"
+#
+#
+# class MyBuffer < BinData::Buffer
+# default_parameter length: 8
+#
+# endian :little
+#
+# uint16 :num1
+# uint16 :num2
+# # padding occurs here
+# end
+#
+# obj = MyBuffer.read("\001\000\002\000\000\000\000\000")
+# obj.num1 #=> 1
+# obj.num1 #=> 2
+# obj.raw_num_bytes #=> 4
+# obj.num_bytes #=> 8
+#
+#
+# class StringTable < BinData::Record
+# endian :little
+#
+# uint16 :table_size_in_bytes
+# buffer :strings, length: :table_size_in_bytes do
+# array read_until: :eof do
+# uint8 :len
+# string :str, length: :len
+# end
+# end
+# end
+#
+#
+# == Parameters
+#
+# Parameters may be provided at initialisation to control the behaviour of
+# an object. These params are:
+#
+# :length:: The number of bytes in the buffer.
+# :type:: The single type inside the buffer. Use a struct if
+# multiple fields are required.
+#
+# source://bindata//lib/bindata/buffer.rb#54
class BinData::Buffer < ::BinData::Base
extend ::BinData::DSLMixin
+ # source://bindata//lib/bindata/buffer.rb#75
def assign(val); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/buffer.rb#71
def clear?; end
+
+ # source://bindata//lib/bindata/buffer.rb#103
def do_num_bytes; end
+
+ # source://bindata//lib/bindata/buffer.rb#91
def do_read(io); end
+
+ # source://bindata//lib/bindata/buffer.rb#97
def do_write(io); end
+
+ # source://bindata//lib/bindata/buffer.rb#62
def initialize_instance; end
+
+ # source://bindata//lib/bindata/buffer.rb#87
def method_missing(symbol, *args, &block); end
+
+ # The number of bytes used, ignoring the padding imposed by the buffer.
+ #
+ # source://bindata//lib/bindata/buffer.rb#67
def raw_num_bytes; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/buffer.rb#83
def respond_to?(symbol, include_private = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/buffer.rb#79
def snapshot; end
end
+# source://bindata//lib/bindata/buffer.rb#108
class BinData::BufferArgProcessor < ::BinData::BaseArgProcessor
include ::BinData::MultiFieldArgSeparator
+ # source://bindata//lib/bindata/buffer.rb#111
def sanitize_parameters!(obj_class, params); end
end
+# Align fields to a multiple of :byte_align
+#
+# source://bindata//lib/bindata/struct.rb#294
module BinData::ByteAlignPlugin
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/struct.rb#343
def align_obj?(obj); end
+
+ # source://bindata//lib/bindata/struct.rb#338
def bytes_to_align(obj, rel_offset); end
+
+ # source://bindata//lib/bindata/struct.rb#295
def do_read(io); end
+
+ # source://bindata//lib/bindata/struct.rb#308
def do_write(io); end
+
+ # source://bindata//lib/bindata/struct.rb#321
def sum_num_bytes_below_index(index); end
end
+# A Choice is a collection of data objects of which only one is active
+# at any particular time. Method calls will be delegated to the active
+# choice.
+#
+# require 'bindata'
+#
+# type1 = [:string, {value: "Type1"}]
+# type2 = [:string, {value: "Type2"}]
+#
+# choices = {5 => type1, 17 => type2}
+# a = BinData::Choice.new(choices: choices, selection: 5)
+# a # => "Type1"
+#
+# choices = [ type1, type2 ]
+# a = BinData::Choice.new(choices: choices, selection: 1)
+# a # => "Type2"
+#
+# choices = [ nil, nil, nil, type1, nil, type2 ]
+# a = BinData::Choice.new(choices: choices, selection: 3)
+# a # => "Type1"
+#
+#
+# Chooser = Struct.new(:choice)
+# mychoice = Chooser.new
+# mychoice.choice = 'big'
+#
+# choices = {'big' => :uint16be, 'little' => :uint16le}
+# a = BinData::Choice.new(choices: choices, copy_on_change: true,
+# selection: -> { mychoice.choice })
+# a.assign(256)
+# a.to_binary_s #=> "\001\000"
+#
+# mychoice.choice = 'little'
+# a.to_binary_s #=> "\000\001"
+#
+# == Parameters
+#
+# Parameters may be provided at initialisation to control the behaviour of
+# an object. These params are:
+#
+# :choices:: Either an array or a hash specifying the possible
+# data objects. The format of the
+# array/hash.values is a list of symbols
+# representing the data object type. If a choice
+# is to have params passed to it, then it should
+# be provided as [type_symbol, hash_params]. An
+# implementation constraint is that the hash may
+# not contain symbols as keys, with the exception
+# of :default. :default is to be used when then
+# :selection does not exist in the :choices hash.
+# :selection:: An index/key into the :choices array/hash which
+# specifies the currently active choice.
+# :copy_on_change:: If set to true, copy the value of the previous
+# selection to the current selection whenever the
+# selection changes. Default is false.
+#
+# source://bindata//lib/bindata/choice.rb#60
class BinData::Choice < ::BinData::Base
extend ::BinData::DSLMixin
@@ -322,157 +1106,491 @@ class BinData::Choice < ::BinData::Base
def clear?(*args); end
def do_num_bytes(*args); end
def do_read(*args); end
+
+ # source://bindata//lib/bindata/trace.rb#83
def do_read_with_hook(io); end
+
def do_write(*args); end
+
+ # source://bindata//lib/bindata/choice.rb#74
def initialize_instance; end
+
+ # source://bindata//lib/bindata/choice.rb#69
def initialize_shared_instance; end
+
+ # source://bindata//lib/bindata/choice.rb#92
def method_missing(symbol, *args, &block); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/choice.rb#88
def respond_to?(symbol, include_private = T.unsafe(nil)); end
+
+ # Returns the current selection.
+ #
+ # source://bindata//lib/bindata/choice.rb#80
def selection; end
+
def snapshot(*args); end
+
+ # source://bindata//lib/bindata/trace.rb#88
def trace_selection; end
private
+ # source://bindata//lib/bindata/choice.rb#107
def current_choice; end
+
+ # source://bindata//lib/bindata/choice.rb#112
def instantiate_choice(selection); end
class << self
+ # source://bindata//lib/bindata/trace.rb#78
def turn_off_tracing; end
+
+ # source://bindata//lib/bindata/trace.rb#73
def turn_on_tracing; end
end
end
+# source://bindata//lib/bindata/choice.rb#121
class BinData::ChoiceArgProcessor < ::BinData::BaseArgProcessor
+ # source://bindata//lib/bindata/choice.rb#122
def sanitize_parameters!(obj_class, params); end
private
+ # source://bindata//lib/bindata/choice.rb#135
def choices_as_hash(choices); end
+
+ # source://bindata//lib/bindata/choice.rb#151
def ensure_valid_keys(choices); end
+
+ # source://bindata//lib/bindata/choice.rb#143
def key_array_by_index(array); end
end
+# Logic for the :copy_on_change parameter
+#
+# source://bindata//lib/bindata/choice.rb#162
module BinData::CopyOnChangePlugin
+ # source://bindata//lib/bindata/choice.rb#169
def copy_previous_value(obj); end
+
+ # source://bindata//lib/bindata/choice.rb#163
def current_choice; end
+
+ # source://bindata//lib/bindata/choice.rb#176
def get_previous_choice(selection); end
+
+ # source://bindata//lib/bindata/choice.rb#182
def remember_current_selection(selection); end
end
+# Counts the number of bytes remaining in the input stream from the current
+# position to the end of the stream. This only makes sense for seekable
+# streams.
+#
+# require 'bindata'
+#
+# class A < BinData::Record
+# count_bytes_remaining :bytes_remaining
+# string :all_data, read_length: :bytes_remaining
+# end
+#
+# obj = A.read("abcdefghij")
+# obj.all_data #=> "abcdefghij"
+#
+# source://bindata//lib/bindata/count_bytes_remaining.rb#19
class BinData::CountBytesRemaining < ::BinData::BasePrimitive
private
+ # source://bindata//lib/bindata/count_bytes_remaining.rb#26
def read_and_return_value(io); end
+
+ # source://bindata//lib/bindata/count_bytes_remaining.rb#30
def sensible_default; end
+
+ # source://bindata//lib/bindata/count_bytes_remaining.rb#22
def value_to_binary_string(val); end
end
+# BinData classes that are part of the DSL must be extended by this.
+#
+# source://bindata//lib/bindata/dsl.rb#37
module BinData::DSLMixin
+ # source://bindata//lib/bindata/dsl.rb#38
def dsl_parser(parser_type = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/dsl.rb#45
def method_missing(symbol, *args, &block); end
+
+ # Assert object is not an array or string.
+ #
+ # source://bindata//lib/bindata/dsl.rb#50
def to_ary; end
+
+ # source://bindata//lib/bindata/dsl.rb#51
def to_str; end
end
+# Handles the :big_and_little endian option.
+# This option creates two subclasses, each handling
+# :big or :little endian.
+#
+# source://bindata//lib/bindata/dsl.rb#255
class BinData::DSLMixin::DSLBigAndLittleEndianHandler
class << self
+ # source://bindata//lib/bindata/dsl.rb#323
def class_with_endian(class_name, endian); end
+
+ # source://bindata//lib/bindata/dsl.rb#269
def create_subclasses_with_endian(bnl_class); end
+
+ # source://bindata//lib/bindata/dsl.rb#290
def delegate_field_creation(bnl_class); end
+
+ # source://bindata//lib/bindata/dsl.rb#303
def fixup_subclass_hierarchy(bnl_class); end
+
+ # source://bindata//lib/bindata/dsl.rb#257
def handle(bnl_class); end
+
+ # source://bindata//lib/bindata/dsl.rb#265
def make_class_abstract(bnl_class); end
+
+ # source://bindata//lib/bindata/dsl.rb#331
def obj_attribute(obj, attr); end
+
+ # source://bindata//lib/bindata/dsl.rb#274
def override_new_in_class(bnl_class); end
end
end
+# Extracts the details from a field declaration.
+#
+# source://bindata//lib/bindata/dsl.rb#338
class BinData::DSLMixin::DSLFieldParser
+ # @return [DSLFieldParser] a new instance of DSLFieldParser
+ #
+ # source://bindata//lib/bindata/dsl.rb#339
def initialize(hints, symbol, *args, &block); end
+ # Returns the value of attribute name.
+ #
+ # source://bindata//lib/bindata/dsl.rb#346
def name; end
+
+ # source://bindata//lib/bindata/dsl.rb#348
def name_from_field_declaration(args); end
+
+ # Returns the value of attribute params.
+ #
+ # source://bindata//lib/bindata/dsl.rb#346
def params; end
+
+ # source://bindata//lib/bindata/dsl.rb#367
def params_from_args(args); end
+
+ # source://bindata//lib/bindata/dsl.rb#374
def params_from_block(&block); end
+
+ # source://bindata//lib/bindata/dsl.rb#357
def params_from_field_declaration(args, &block); end
+
+ # Returns the value of attribute type.
+ #
+ # source://bindata//lib/bindata/dsl.rb#346
def type; end
end
+# Validates a field defined in a DSLMixin.
+#
+# source://bindata//lib/bindata/dsl.rb#398
class BinData::DSLMixin::DSLFieldValidator
+ # @return [DSLFieldValidator] a new instance of DSLFieldValidator
+ #
+ # source://bindata//lib/bindata/dsl.rb#399
def initialize(the_class, parser); end
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#448
def all_or_none_names_failed?(name); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#463
def duplicate_name?(name); end
+
+ # source://bindata//lib/bindata/dsl.rb#420
def ensure_valid_name(name); end
+
+ # source://bindata//lib/bindata/dsl.rb#475
def fields; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#459
def malformed_name?(name); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#444
def must_have_a_name_failed?(name); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#440
def must_not_have_a_name_failed?(name); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#471
def name_is_reserved?(name); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#467
def name_shadows_method?(name); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#479
def option?(opt); end
+
+ # source://bindata//lib/bindata/dsl.rb#404
def validate_field(name); end
end
+# A DSLParser parses and accumulates field definitions of the form
+#
+# type name, params
+#
+# where:
+# * +type+ is the under_scored name of a registered type
+# * +name+ is the (possible optional) name of the field
+# * +params+ is a hash containing any parameters
+#
+# source://bindata//lib/bindata/dsl.rb#62
class BinData::DSLMixin::DSLParser
+ # @return [DSLParser] a new instance of DSLParser
+ #
+ # source://bindata//lib/bindata/dsl.rb#63
def initialize(the_class, parser_type); end
+ # source://bindata//lib/bindata/dsl.rb#113
def dsl_params; end
+
+ # source://bindata//lib/bindata/dsl.rb#74
def endian(endian = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/dsl.rb#109
def fields; end
+
+ # source://bindata//lib/bindata/dsl.rb#98
def hide(*args); end
+
+ # source://bindata//lib/bindata/dsl.rb#118
def method_missing(*args, &block); end
+
+ # Returns the value of attribute parser_type.
+ #
+ # source://bindata//lib/bindata/dsl.rb#72
def parser_type; end
+
+ # source://bindata//lib/bindata/dsl.rb#83
def search_prefix(*args); end
private
+ # source://bindata//lib/bindata/dsl.rb#190
def append_field(type, name, params); end
+
+ # @raise [exception]
+ #
+ # source://bindata//lib/bindata/dsl.rb#206
def dsl_raise(exception, msg); end
+
+ # source://bindata//lib/bindata/dsl.rb#142
def ensure_hints; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#176
def fields?; end
+
+ # source://bindata//lib/bindata/dsl.rb#147
def hints; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#138
def option?(opt); end
+
+ # source://bindata//lib/bindata/dsl.rb#196
def parent_attribute(attr, default = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/dsl.rb#172
def parent_fields; end
+
+ # source://bindata//lib/bindata/dsl.rb#180
def parse_and_append_field(*args, &block); end
+
+ # source://bindata//lib/bindata/dsl.rb#126
def parser_abilities; end
+
+ # source://bindata//lib/bindata/dsl.rb#151
def set_endian(endian); end
+
+ # source://bindata//lib/bindata/dsl.rb#224
def to_choice_params(key); end
+
+ # source://bindata//lib/bindata/dsl.rb#213
def to_object_params(key); end
+
+ # source://bindata//lib/bindata/dsl.rb#236
def to_struct_params(*unused); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#168
def valid_endian?(endian); end
end
+# BinData declarations are evaluated in a single pass.
+# However, some binary formats require multi pass processing. A common
+# reason is seeking backwards in the input stream.
+#
+# DelayedIO supports multi pass processing. It works by ignoring the normal
+# #read or #write calls. The user must explicitly call the #read_now! or
+# #write_now! methods to process an additional pass. This additional pass
+# must specify the abs_offset of the I/O operation.
+#
+# require 'bindata'
+#
+# obj = BinData::DelayedIO.new(read_abs_offset: 3, type: :uint16be)
+# obj.read("\x00\x00\x00\x11\x12")
+# obj #=> 0
+#
+# obj.read_now!
+# obj #=> 0x1112
+#
+# - OR -
+#
+# obj.read("\x00\x00\x00\x11\x12") { obj.read_now! } #=> 0x1122
+#
+# obj.to_binary_s { obj.write_now! } #=> "\x00\x00\x00\x11\x12"
+#
+# You can use the +auto_call_delayed_io+ keyword to cause #read and #write to
+# automatically perform the extra passes.
+#
+# class ReversePascalString < BinData::Record
+# auto_call_delayed_io
+#
+# delayed_io :str, read_abs_offset: 0 do
+# string read_length: :len
+# end
+# count_bytes_remaining :total_size
+# skip to_abs_offset: -> { total_size - 1 }
+# uint8 :len, value: -> { str.length }
+# end
+#
+# s = ReversePascalString.read("hello\x05")
+# s.to_binary_s #=> "hello\x05"
+#
+#
+# == Parameters
+#
+# Parameters may be provided at initialisation to control the behaviour of
+# an object. These params are:
+#
+# :read_abs_offset:: The abs_offset to start reading at.
+# :type:: The single type inside the delayed io. Use
+# a struct if multiple fields are required.
+#
+# source://bindata//lib/bindata/delayed_io.rb#55
class BinData::DelayedIO < ::BinData::Base
extend ::BinData::DSLMixin
+ # source://bindata//lib/bindata/delayed_io.rb#94
def abs_offset; end
+
+ # Sets the +abs_offset+ to use when writing this object.
+ #
+ # source://bindata//lib/bindata/delayed_io.rb#99
def abs_offset=(offset); end
+
+ # source://bindata//lib/bindata/delayed_io.rb#74
def assign(val); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/delayed_io.rb#70
def clear?; end
+
+ # source://bindata//lib/bindata/delayed_io.rb#115
def do_num_bytes; end
+
+ # source://bindata//lib/bindata/delayed_io.rb#107
def do_read(io); end
+
+ # source://bindata//lib/bindata/delayed_io.rb#111
def do_write(io); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/delayed_io.rb#119
def include_obj?; end
+
+ # source://bindata//lib/bindata/delayed_io.rb#63
def initialize_instance; end
+
+ # source://bindata//lib/bindata/delayed_io.rb#90
def method_missing(symbol, *args, &block); end
+
+ # source://bindata//lib/bindata/delayed_io.rb#82
def num_bytes; end
+
+ # DelayedIO objects aren't read when #read is called.
+ # The reading is delayed until this method is called.
+ #
+ # @raise [IOError]
+ #
+ # source://bindata//lib/bindata/delayed_io.rb#125
def read_now!; end
+
+ # source://bindata//lib/bindata/delayed_io.rb#103
def rel_offset; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/delayed_io.rb#86
def respond_to?(symbol, include_private = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/delayed_io.rb#78
def snapshot; end
+
+ # DelayedIO objects aren't written when #write is called.
+ # The writing is delayed until this method is called.
+ #
+ # @raise [IOError]
+ #
+ # source://bindata//lib/bindata/delayed_io.rb#137
def write_now!; end
end
+# source://bindata//lib/bindata/delayed_io.rb#146
class BinData::DelayedIoArgProcessor < ::BinData::BaseArgProcessor
include ::BinData::MultiFieldArgSeparator
+ # source://bindata//lib/bindata/delayed_io.rb#149
def sanitize_parameters!(obj_class, params); end
end
+# Double precision floating point number in big endian format
+#
+# source://bindata//lib/bindata/float.rb#80
class BinData::DoubleBe < ::BinData::BasePrimitive
def do_num_bytes; end
@@ -483,6 +1601,9 @@ class BinData::DoubleBe < ::BinData::BasePrimitive
def value_to_binary_string(val); end
end
+# Double precision floating point number in little endian format
+#
+# source://bindata//lib/bindata/float.rb#75
class BinData::DoubleLe < ::BinData::BasePrimitive
def do_num_bytes; end
@@ -493,6 +1614,9 @@ class BinData::DoubleLe < ::BinData::BasePrimitive
def value_to_binary_string(val); end
end
+# Single precision floating point number in big endian format
+#
+# source://bindata//lib/bindata/float.rb#70
class BinData::FloatBe < ::BinData::BasePrimitive
def do_num_bytes; end
@@ -503,6 +1627,9 @@ class BinData::FloatBe < ::BinData::BasePrimitive
def value_to_binary_string(val); end
end
+# Single precision floating point number in little endian format
+#
+# source://bindata//lib/bindata/float.rb#65
class BinData::FloatLe < ::BinData::BasePrimitive
def do_num_bytes; end
@@ -513,191 +1640,453 @@ class BinData::FloatLe < ::BinData::BasePrimitive
def value_to_binary_string(val); end
end
+# Defines a number of classes that contain a floating point number.
+# The float is defined by precision and endian.
+#
+# source://bindata//lib/bindata/float.rb#7
module BinData::FloatingPoint
class << self
+ # source://bindata//lib/bindata/float.rb#44
def create_num_bytes_code(precision); end
+
+ # source://bindata//lib/bindata/float.rb#48
def create_read_code(precision, endian); end
+
+ # source://bindata//lib/bindata/float.rb#55
def create_to_binary_s_code(precision, endian); end
+
+ # source://bindata//lib/bindata/float.rb#21
def define_methods(float_class, precision, endian); end
end
end
+# All methods provided by the framework are to be implemented or overridden
+# by subclasses of BinData::Base.
+#
+# source://bindata//lib/bindata/framework.rb#7
module BinData::Framework
+ # Assigns the value of +val+ to this data object. Note that +val+ must
+ # always be deep copied to ensure no aliasing problems can occur.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://bindata//lib/bindata/framework.rb#29
def assign(val); end
+
+ # Is this object aligned on non-byte boundaries?
+ #
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/framework.rb#51
def bit_aligned?; end
+
+ # Returns true if the object has not been changed since creation.
+ #
+ # @raise [NotImplementedError]
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/framework.rb#23
def clear?; end
+
+ # Returns the debug name of +child+. This only needs to be implemented
+ # by objects that contain child objects.
+ #
+ # source://bindata//lib/bindata/framework.rb#40
def debug_name_of(child); end
+
+ # Returns the offset of +child+. This only needs to be implemented
+ # by objects that contain child objects.
+ #
+ # source://bindata//lib/bindata/framework.rb#46
def offset_of(child); end
+
+ # Returns a snapshot of this data object.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://bindata//lib/bindata/framework.rb#34
def snapshot; end
protected
+ # Returns the number of bytes it will take to write this data.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://bindata//lib/bindata/framework.rb#66
def do_num_bytes; end
+
+ # Reads the data for this data object from +io+.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://bindata//lib/bindata/framework.rb#56
def do_read(io); end
+
+ # Writes the value for this data to +io+.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://bindata//lib/bindata/framework.rb#61
def do_write(io); end
+
+ # Initializes the state of the object. All instance variables that
+ # are used by the object must be initialized here.
+ #
+ # source://bindata//lib/bindata/framework.rb#10
def initialize_instance; end
+
+ # Initialises state that is shared by objects with the same parameters.
+ #
+ # This should only be used when optimising for performance. Instance
+ # variables set here, and changes to the singleton class will be shared
+ # between all objects that are initialized with the same parameters.
+ # This method is called only once for a particular set of parameters.
+ #
+ # source://bindata//lib/bindata/framework.rb#19
def initialize_shared_instance; end
end
+# A wrapper around an IO object. The wrapper provides a consistent
+# interface for BinData objects to use when accessing the IO.
+#
+# source://bindata//lib/bindata/io.rb#6
module BinData::IO
class << self
+ # Creates a StringIO around +str+.
+ #
+ # source://bindata//lib/bindata/io.rb#215
def create_string_io(str = T.unsafe(nil)); end
end
end
+# Common operations for both Read and Write.
+#
+# source://bindata//lib/bindata/io.rb#9
module BinData::IO::Common
+ # source://bindata//lib/bindata/io.rb#10
def initialize(io); end
private
+ # source://bindata//lib/bindata/io.rb#40
def buffer_limited_n(n); end
+
+ # source://bindata//lib/bindata/io.rb#36
def seek(n); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/io.rb#30
def seekable?; end
+
+ # source://bindata//lib/bindata/io.rb#54
def with_buffer_common(n); end
end
+# Use #seek and #pos on seekable streams
+#
+# source://bindata//lib/bindata/io.rb#69
module BinData::IO::Common::SeekableStream
+ # The number of bytes remaining in the input stream.
+ #
+ # source://bindata//lib/bindata/io.rb#71
def num_bytes_remaining; end
+
+ # All io calls in +block+ are rolled back after this
+ # method completes.
+ #
+ # source://bindata//lib/bindata/io.rb#90
def with_readahead; end
private
+ # source://bindata//lib/bindata/io.rb#106
def offset_raw; end
+
+ # source://bindata//lib/bindata/io.rb#114
def read_raw(n); end
+
+ # source://bindata//lib/bindata/io.rb#110
def seek_raw(n); end
+
+ # source://bindata//lib/bindata/io.rb#102
def stream_init; end
+
+ # source://bindata//lib/bindata/io.rb#118
def write_raw(data); end
end
+# Manually keep track of offset for unseekable streams.
+#
+# source://bindata//lib/bindata/io.rb#124
module BinData::IO::Common::UnSeekableStream
+ # The number of bytes remaining in the input stream.
+ #
+ # @raise [IOError]
+ #
+ # source://bindata//lib/bindata/io.rb#130
def num_bytes_remaining; end
+
+ # source://bindata//lib/bindata/io.rb#125
def offset_raw; end
+
+ # All io calls in +block+ are rolled back after this
+ # method completes.
+ #
+ # source://bindata//lib/bindata/io.rb#136
def with_readahead; end
private
+ # source://bindata//lib/bindata/io.rb#161
def read_raw(n); end
+
+ # source://bindata//lib/bindata/io.rb#167
def read_raw_with_readahead(n); end
+
+ # @raise [IOError]
+ #
+ # source://bindata//lib/bindata/io.rb#199
def seek_raw(n); end
+
+ # source://bindata//lib/bindata/io.rb#157
def stream_init; end
+
+ # source://bindata//lib/bindata/io.rb#194
def write_raw(data); end
end
+# Create a new IO Read wrapper around +io+. +io+ must provide #read,
+# #pos if reading the current stream position and #seek if setting the
+# current stream position. If +io+ is a string it will be automatically
+# wrapped in an StringIO object.
+#
+# The IO can handle bitstreams in either big or little endian format.
+#
+# M byte1 L M byte2 L
+# S 76543210 S S fedcba98 S
+# B B B B
+#
+# In big endian format:
+# readbits(6), readbits(5) #=> [765432, 10fed]
+#
+# In little endian format:
+# readbits(6), readbits(5) #=> [543210, a9876]
+#
+# source://bindata//lib/bindata/io.rb#238
class BinData::IO::Read
include ::BinData::IO::Common
+ # @return [Read] a new instance of Read
+ #
+ # source://bindata//lib/bindata/io.rb#241
def initialize(io); end
+ # Returns the current offset of the io stream. Offset will be rounded
+ # up when reading bitfields.
+ #
+ # source://bindata//lib/bindata/io.rb#261
def offset; end
+
+ # Reads all remaining bytes from the stream.
+ #
+ # source://bindata//lib/bindata/io.rb#282
def read_all_bytes; end
+
+ # Reads exactly +nbits+ bits from the stream. +endian+ specifies whether
+ # the bits are stored in +:big+ or +:little+ endian format.
+ #
+ # source://bindata//lib/bindata/io.rb#289
def readbits(nbits, endian); end
+
+ # Reads exactly +n+ bytes from +io+.
+ #
+ # If the data read is nil an EOFError is raised.
+ #
+ # If the data read is too short an IOError is raised.
+ #
+ # source://bindata//lib/bindata/io.rb#276
def readbytes(n); end
+
+ # Discards any read bits so the stream becomes aligned at the
+ # next byte boundary.
+ #
+ # source://bindata//lib/bindata/io.rb#305
def reset_read_bits; end
+
+ # Seek +n+ bytes from the current position in the io stream.
+ #
+ # source://bindata//lib/bindata/io.rb#266
def seekbytes(n); end
+
+ # Sets a buffer of +n+ bytes on the io stream. Any reading or seeking
+ # calls inside the +block+ will be contained within this buffer.
+ #
+ # source://bindata//lib/bindata/io.rb#252
def with_buffer(n); end
private
+ # source://bindata//lib/bindata/io.rb#334
def accumulate_big_endian_bits; end
+
+ # source://bindata//lib/bindata/io.rb#352
def accumulate_little_endian_bits; end
+
+ # source://bindata//lib/bindata/io.rb#358
def mask(nbits); end
+
+ # source://bindata//lib/bindata/io.rb#313
def read(n = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/io.rb#322
def read_big_endian_bits(nbits); end
+
+ # source://bindata//lib/bindata/io.rb#340
def read_little_endian_bits(nbits); end
end
+# Create a new IO Write wrapper around +io+. +io+ must provide #write.
+# If +io+ is a string it will be automatically wrapped in an StringIO
+# object.
+#
+# The IO can handle bitstreams in either big or little endian format.
+#
+# See IO::Read for more information.
+#
+# source://bindata//lib/bindata/io.rb#370
class BinData::IO::Write
include ::BinData::IO::Common
+ # @return [Write] a new instance of Write
+ #
+ # source://bindata//lib/bindata/io.rb#372
def initialize(io); end
+ # To be called after all +writebits+ have been applied.
+ #
+ # source://bindata//lib/bindata/io.rb#428
def flush; end
+
+ # To be called after all +writebits+ have been applied.
+ #
+ # source://bindata//lib/bindata/io.rb#428
def flushbits; end
+
+ # Returns the current offset of the io stream. Offset will be rounded
+ # up when writing bitfields.
+ #
+ # source://bindata//lib/bindata/io.rb#393
def offset; end
+
+ # Seek +n+ bytes from the current position in the io stream.
+ #
+ # source://bindata//lib/bindata/io.rb#398
def seekbytes(n); end
+
+ # Sets a buffer of +n+ bytes on the io stream. Any writes inside the
+ # +block+ will be contained within this buffer. If less than +n+ bytes
+ # are written inside the block, the remainder will be padded with '\0'
+ # bytes.
+ #
+ # source://bindata//lib/bindata/io.rb#384
def with_buffer(n); end
+
+ # Writes +nbits+ bits from +val+ to the stream. +endian+ specifies whether
+ # the bits are to be stored in +:big+ or +:little+ endian format.
+ #
+ # source://bindata//lib/bindata/io.rb#411
def writebits(val, nbits, endian); end
+
+ # Writes the given string of bytes to the io stream.
+ #
+ # source://bindata//lib/bindata/io.rb#404
def writebytes(str); end
private
+ # source://bindata//lib/bindata/io.rb#491
def mask(nbits); end
+
+ # source://bindata//lib/bindata/io.rb#440
def write(data); end
+
+ # source://bindata//lib/bindata/io.rb#449
def write_big_endian_bits(val, nbits); end
+
+ # source://bindata//lib/bindata/io.rb#470
def write_little_endian_bits(val, nbits); end
end
+# Logic for the :initial_length parameter
+#
+# source://bindata//lib/bindata/array.rb#328
module BinData::InitialLengthPlugin
+ # source://bindata//lib/bindata/array.rb#329
def do_read(io); end
+
+ # source://bindata//lib/bindata/array.rb#333
def elements; end
end
+# Defines a number of classes that contain an integer. The integer
+# is defined by endian, signedness and number of bytes.
+#
+# source://bindata//lib/bindata/int.rb#8
module BinData::Int
class << self
+ # source://bindata//lib/bindata/int.rb#12
def define_class(name, nbits, endian, signed); end
+
+ # source://bindata//lib/bindata/int.rb#26
def define_methods(int_class, nbits, endian, signed); end
private
+ # source://bindata//lib/bindata/int.rb#150
def bits_per_word(nbits); end
+
+ # source://bindata//lib/bindata/int.rb#60
def create_clamp_code(nbits, signed); end
+
+ # source://bindata//lib/bindata/int.rb#142
def create_int2uint_code(nbits); end
+
+ # source://bindata//lib/bindata/int.rb#82
def create_raw_read_code(nbits, endian, signed); end
+
+ # source://bindata//lib/bindata/int.rb#101
def create_read_assemble_code(nbits, endian, signed); end
+
+ # source://bindata//lib/bindata/int.rb#72
def create_read_code(nbits, endian, signed); end
+
+ # source://bindata//lib/bindata/int.rb#94
def create_read_unpack_code(nbits, endian, signed); end
+
+ # source://bindata//lib/bindata/int.rb#115
def create_to_binary_s_code(nbits, endian, signed); end
+
+ # source://bindata//lib/bindata/int.rb#146
def create_uint2int_code(nbits); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/int.rb#172
def need_signed_conversion_code?(nbits, signed); end
+
+ # source://bindata//lib/bindata/int.rb#157
def pack_directive(nbits, endian, signed); end
+
+ # source://bindata//lib/bindata/int.rb#130
def val_as_packed_words(nbits, endian, signed); end
end
end
-class BinData::Int32be < ::BinData::BasePrimitive
- def assign(val); end
- def do_num_bytes; end
-
- private
-
- def read_and_return_value(io); end
- def sensible_default; end
- def value_to_binary_string(val); end
-end
-
-class BinData::Int32le < ::BinData::BasePrimitive
- def assign(val); end
- def do_num_bytes; end
-
- private
-
- def read_and_return_value(io); end
- def sensible_default; end
- def value_to_binary_string(val); end
-end
-
-class BinData::Int64be < ::BinData::BasePrimitive
- def assign(val); end
- def do_num_bytes; end
-
- private
-
- def read_and_return_value(io); end
- def sensible_default; end
- def value_to_binary_string(val); end
-end
-
-class BinData::Int64le < ::BinData::BasePrimitive
- def assign(val); end
- def do_num_bytes; end
-
- private
-
- def read_and_return_value(io); end
- def sensible_default; end
- def value_to_binary_string(val); end
-end
-
+# Signed 1 byte integer.
+#
+# source://bindata//lib/bindata/int.rb#185
class BinData::Int8 < ::BinData::BasePrimitive
def assign(val); end
def do_num_bytes; end
@@ -709,214 +2098,655 @@ class BinData::Int8 < ::BinData::BasePrimitive
def value_to_binary_string(val); end
end
+# Create classes on demand
+#
+# source://bindata//lib/bindata/int.rb#190
module BinData::IntFactory
+ # source://bindata//lib/bindata/int.rb#191
def const_missing(name); end
end
+# A LazyEvaluator is bound to a data object. The evaluator will evaluate
+# lambdas in the context of this data object. These lambdas
+# are those that are passed to data objects as parameters, e.g.:
+#
+# BinData::String.new(value: -> { %w(a test message).join(" ") })
+#
+# As a shortcut, :foo is the equivalent of lambda { foo }.
+#
+# When evaluating lambdas, unknown methods are resolved in the context of the
+# parent of the bound data object. Resolution is attempted firstly as keys
+# in #parameters, and secondly as methods in this parent. This
+# resolution propagates up the chain of parent data objects.
+#
+# An evaluation will recurse until it returns a result that is not
+# a lambda or a symbol.
+#
+# This resolution process makes the lambda easier to read as we just write
+# field instead of obj.field.
+#
+# source://bindata//lib/bindata/lazy.rb#20
class BinData::LazyEvaluator
+ # Creates a new evaluator. All lazy evaluation is performed in the
+ # context of +obj+.
+ #
+ # @return [LazyEvaluator] a new instance of LazyEvaluator
+ #
+ # source://bindata//lib/bindata/lazy.rb#24
def initialize(obj); end
+ # Returns the index of this data object inside it's nearest container
+ # array.
+ #
+ # @raise [NoMethodError]
+ #
+ # source://bindata//lib/bindata/lazy.rb#50
def index; end
+
+ # source://bindata//lib/bindata/lazy.rb#28
def lazy_eval(val, overrides = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/lazy.rb#65
def method_missing(symbol, *args); end
+
+ # Returns a LazyEvaluator for the parent of this data object.
+ #
+ # source://bindata//lib/bindata/lazy.rb#40
def parent; end
private
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/lazy.rb#105
def callable?(obj); end
+
+ # source://bindata//lib/bindata/lazy.rb#78
def eval_symbol_in_parent_context(symbol, args); end
+
+ # source://bindata//lib/bindata/lazy.rb#95
def recursively_eval(val, args); end
+
+ # source://bindata//lib/bindata/lazy.rb#83
def resolve_symbol_in_parent_context(symbol, args); end
end
+# Extracts args for Records and Buffers.
+#
+# Foo.new(bar: "baz) is ambiguous as to whether :bar is a value or parameter.
+#
+# BaseArgExtractor always assumes :bar is parameter. This extractor correctly
+# identifies it as value or parameter.
+#
+# source://bindata//lib/bindata/dsl.rb#8
module BinData::MultiFieldArgSeparator
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#28
def field_names_in_parameters?(obj_class, parameters); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/dsl.rb#20
def parameters_is_value?(obj_class, value, parameters); end
+
+ # source://bindata//lib/bindata/dsl.rb#9
def separate_args(obj_class, obj_args); end
end
+# A Primitive is a declarative way to define a new BinData data type.
+# The data type must contain a primitive value only, i.e numbers or strings.
+# For new data types that contain multiple values see BinData::Record.
+#
+# To define a new data type, set fields as if for Record and add a
+# #get and #set method to extract / convert the data between the fields
+# and the #value of the object.
+#
+# require 'bindata'
+#
+# class PascalString < BinData::Primitive
+# uint8 :len, value: -> { data.length }
+# string :data, read_length: :len
+#
+# def get
+# self.data
+# end
+#
+# def set(v)
+# self.data = v
+# end
+# end
+#
+# ps = PascalString.new(initial_value: "hello")
+# ps.to_binary_s #=> "\005hello"
+# ps.read("\003abcde")
+# ps #=> "abc"
+#
+# # Unsigned 24 bit big endian integer
+# class Uint24be < BinData::Primitive
+# uint8 :byte1
+# uint8 :byte2
+# uint8 :byte3
+#
+# def get
+# (self.byte1 << 16) | (self.byte2 << 8) | self.byte3
+# end
+#
+# def set(v)
+# v = 0 if v < 0
+# v = 0xffffff if v > 0xffffff
+#
+# self.byte1 = (v >> 16) & 0xff
+# self.byte2 = (v >> 8) & 0xff
+# self.byte3 = v & 0xff
+# end
+# end
+#
+# u24 = Uint24be.new
+# u24.read("\x12\x34\x56")
+# "0x%x" % u24 #=> 0x123456
+#
+# == Parameters
+#
+# Primitive objects accept all the parameters that BinData::BasePrimitive do.
+#
+# source://bindata//lib/bindata/primitive.rb#62
class BinData::Primitive < ::BinData::BasePrimitive
extend ::BinData::DSLMixin
+ # source://bindata//lib/bindata/primitive.rb#88
def assign(val); end
+
+ # source://bindata//lib/bindata/primitive.rb#94
def debug_name_of(child); end
+
+ # source://bindata//lib/bindata/primitive.rb#103
def do_num_bytes; end
+
+ # source://bindata//lib/bindata/primitive.rb#98
def do_write(io); end
+
+ # source://bindata//lib/bindata/primitive.rb#71
def initialize_instance; end
+
+ # source://bindata//lib/bindata/primitive.rb#80
def method_missing(symbol, *args, &block); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/primitive.rb#76
def respond_to?(symbol, include_private = T.unsafe(nil)); end
private
+ # Extracts the value for this data object from the fields of the
+ # internal struct.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://bindata//lib/bindata/primitive.rb#125
def get; end
+
+ # source://bindata//lib/bindata/primitive.rb#115
def read_and_return_value(io); end
+
+ # source://bindata//lib/bindata/primitive.rb#111
def sensible_default; end
+
+ # Sets the fields of the internal struct to represent +v+.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://bindata//lib/bindata/primitive.rb#130
def set(v); end
class << self
+ # source://bindata//lib/bindata/alignment.rb#76
def bit_aligned; end
end
end
+# source://bindata//lib/bindata/primitive.rb#138
class BinData::PrimitiveArgProcessor < ::BinData::BaseArgProcessor
+ # source://bindata//lib/bindata/primitive.rb#139
def sanitize_parameters!(obj_class, params); end
end
+# Logic for the read_until: :eof parameter
+#
+# source://bindata//lib/bindata/array.rb#313
module BinData::ReadUntilEOFPlugin
+ # source://bindata//lib/bindata/array.rb#314
def do_read(io); end
end
+# Logic for the :read_until parameter
+#
+# source://bindata//lib/bindata/array.rb#301
module BinData::ReadUntilPlugin
+ # source://bindata//lib/bindata/array.rb#302
def do_read(io); end
end
+# A Record is a declarative wrapper around Struct.
+#
+# See +Struct+ for more info.
+#
+# source://bindata//lib/bindata/record.rb#8
class BinData::Record < ::BinData::Struct
extend ::BinData::DSLMixin
class << self
+ # source://bindata//lib/bindata/base.rb#53
def inherited(subclass); end
end
end
+# source://bindata//lib/bindata/record.rb#16
class BinData::RecordArgProcessor < ::BinData::StructArgProcessor
include ::BinData::MultiFieldArgSeparator
+ # source://bindata//lib/bindata/record.rb#19
def sanitize_parameters!(obj_class, params); end
end
+# == Parameters
+#
+# Parameters may be provided at initialisation to control the behaviour of
+# an object. These parameters are:
+#
+# :name:: The name that this object can be referred to may be
+# set explicitly. This is only useful when dynamically
+# generating types.
+#
+#
+# source://bindata//lib/bindata/name.rb#14
module BinData::RegisterNamePlugin
+ # source://bindata//lib/bindata/name.rb#21
def initialize_shared_instance; end
class << self
+ # source://bindata//lib/bindata/name.rb#16
def included(base); end
end
end
+# A singleton registry of all registered classes.
+#
+# source://bindata//lib/bindata/registry.rb#133
BinData::RegisteredClasses = T.let(T.unsafe(nil), BinData::Registry)
+# This registry contains a register of name -> class mappings.
+#
+# Numerics (integers and floating point numbers) have an endian property as
+# part of their name (e.g. int32be, float_le).
+#
+# Classes can be looked up based on their full name or an abbreviated +name+
+# with +hints+.
+#
+# There are two hints supported, :endian and :search_prefix.
+#
+# #lookup("int32", { endian: :big }) will return Int32Be.
+#
+# #lookup("my_type", { search_prefix: :ns }) will return NsMyType.
+#
+# Names are stored in under_score_style, not camelCase.
+#
+# source://bindata//lib/bindata/registry.rb#20
class BinData::Registry
+ # @return [Registry] a new instance of Registry
+ #
+ # source://bindata//lib/bindata/registry.rb#22
def initialize; end
+ # source://bindata//lib/bindata/registry.rb#39
def lookup(name, hints = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/registry.rb#26
def register(name, class_to_register); end
+
+ # Convert CamelCase +name+ to underscore style.
+ #
+ # source://bindata//lib/bindata/registry.rb#51
def underscore_name(name); end
+
+ # source://bindata//lib/bindata/registry.rb#35
def unregister(name); end
private
+ # source://bindata//lib/bindata/registry.rb#96
def name_with_endian(name, endian); end
+
+ # source://bindata//lib/bindata/registry.rb#87
def name_with_prefix(name, prefix); end
+
+ # source://bindata//lib/bindata/registry.rb#64
def normalize_name(name, hints); end
+
+ # source://bindata//lib/bindata/registry.rb#113
def register_dynamic_class(name); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/registry.rb#107
def registered?(name); end
+
+ # source://bindata//lib/bindata/registry.rb#123
def warn_if_name_is_already_registered(name, class_to_register); end
end
+# Rest will consume the input stream from the current position to the end of
+# the stream. This will mainly be useful for debugging and developing.
+#
+# require 'bindata'
+#
+# class A < BinData::Record
+# string :a, read_length: 5
+# rest :rest
+# end
+#
+# obj = A.read("abcdefghij")
+# obj.a #=> "abcde"
+# obj.rest #=" "fghij"
+#
+# source://bindata//lib/bindata/rest.rb#19
class BinData::Rest < ::BinData::BasePrimitive
private
+ # source://bindata//lib/bindata/rest.rb#26
def read_and_return_value(io); end
+
+ # source://bindata//lib/bindata/rest.rb#30
def sensible_default; end
+
+ # source://bindata//lib/bindata/rest.rb#22
def value_to_binary_string(val); end
end
+# Resets the stream alignment to the next byte. This is
+# only useful when using bit-based primitives.
+#
+# class MyRec < BinData::Record
+# bit4 :a
+# resume_byte_alignment
+# bit4 :b
+# end
+#
+# MyRec.read("\x12\x34") #=> {"a" => 1, "b" => 3}
+#
+# source://bindata//lib/bindata/alignment.rb#15
class BinData::ResumeByteAlignment < ::BinData::Base
+ # source://bindata//lib/bindata/alignment.rb#17
def assign(val); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/alignment.rb#16
def clear?; end
+
+ # source://bindata//lib/bindata/alignment.rb#19
def do_num_bytes; end
+
+ # source://bindata//lib/bindata/alignment.rb#21
def do_read(io); end
+
+ # source://bindata//lib/bindata/alignment.rb#25
def do_write(io); end
+
+ # source://bindata//lib/bindata/alignment.rb#18
def snapshot; end
end
+# ----------------------------------------------------------------------------
+#
+# source://bindata//lib/bindata/sanitize.rb#157
class BinData::SanitizedBigEndian < ::BinData::SanitizedParameter
+ # source://bindata//lib/bindata/sanitize.rb#158
def endian; end
end
+# ----------------------------------------------------------------------------
+#
+# source://bindata//lib/bindata/sanitize.rb#132
class BinData::SanitizedChoices < ::BinData::SanitizedParameter
+ # @return [SanitizedChoices] a new instance of SanitizedChoices
+ #
+ # source://bindata//lib/bindata/sanitize.rb#133
def initialize(choices, hints); end
+ # source://bindata//lib/bindata/sanitize.rb#151
def [](key); end
end
+# ----------------------------------------------------------------------------
+#
+# source://bindata//lib/bindata/sanitize.rb#46
class BinData::SanitizedField < ::BinData::SanitizedParameter
+ # @return [SanitizedField] a new instance of SanitizedField
+ #
+ # source://bindata//lib/bindata/sanitize.rb#47
def initialize(name, field_type, field_params, hints); end
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/sanitize.rb#62
def has_parameter?(param); end
+
+ # source://bindata//lib/bindata/sanitize.rb#66
def instantiate(value = T.unsafe(nil), parent = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/sanitize.rb#58
def name; end
+
+ # source://bindata//lib/bindata/sanitize.rb#54
def name_as_sym; end
+
+ # Returns the value of attribute prototype.
+ #
+ # source://bindata//lib/bindata/sanitize.rb#52
def prototype; end
end
+# ----------------------------------------------------------------------------
+#
+# source://bindata//lib/bindata/sanitize.rb#72
class BinData::SanitizedFields < ::BinData::SanitizedParameter
include ::Enumerable
+ # @return [SanitizedFields] a new instance of SanitizedFields
+ #
+ # source://bindata//lib/bindata/sanitize.rb#75
def initialize(hints, base_fields = T.unsafe(nil)); end
+ # source://bindata//lib/bindata/sanitize.rb#94
def [](idx); end
+
+ # source://bindata//lib/bindata/sanitize.rb#84
def add_field(type, name, params); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/sanitize.rb#118
def all_field_names_blank?; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/sanitize.rb#126
def any_field_has_parameter?(parameter); end
+
+ # source://bindata//lib/bindata/sanitize.rb#106
def each(&block); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/sanitize.rb#98
def empty?; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/sanitize.rb#114
def field_name?(name); end
+
+ # source://bindata//lib/bindata/sanitize.rb#110
def field_names; end
+
+ # source://bindata//lib/bindata/sanitize.rb#102
def length; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/sanitize.rb#122
def no_field_names_blank?; end
+
+ # source://bindata//lib/bindata/sanitize.rb#90
def raw_fields; end
end
+# source://bindata//lib/bindata/sanitize.rb#163
class BinData::SanitizedLittleEndian < ::BinData::SanitizedParameter
+ # source://bindata//lib/bindata/sanitize.rb#164
def endian; end
end
+# Subclasses of this are sanitized
+#
+# source://bindata//lib/bindata/sanitize.rb#6
class BinData::SanitizedParameter; end
+# BinData objects are instantiated with parameters to determine their
+# behaviour. These parameters must be sanitized to ensure their values
+# are valid. When instantiating many objects with identical parameters,
+# such as an array of records, there is much duplicated sanitizing.
+#
+# The purpose of the sanitizing code is to eliminate the duplicated
+# validation.
+#
+# SanitizedParameters is a hash-like collection of parameters. Its purpose
+# is to recursively sanitize the parameters of an entire BinData object chain
+# at a single time.
+#
+# source://bindata//lib/bindata/sanitize.rb#181
class BinData::SanitizedParameters < ::Hash
+ # @return [SanitizedParameters] a new instance of SanitizedParameters
+ #
+ # source://bindata//lib/bindata/sanitize.rb#197
def initialize(parameters, the_class, hints); end
+ # source://bindata//lib/bindata/sanitize.rb#287
def create_sanitized_params(params, the_class); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/sanitize.rb#215
def has_at_least_one_of?(*keys); end
+
def has_parameter?(_arg0); end
+
+ # source://bindata//lib/bindata/sanitize.rb#291
def hints; end
+
+ # def warn_renamed_parameter(old_key, new_key)
+ # val = delete(old_key)
+ # if val
+ # self[new_key] = val
+ # Kernel.warn ":#{old_key} has been renamed to :#{new_key} in #{@the_class}. " \
+ # "Using :#{old_key} is now deprecated and will be removed in the future"
+ # end
+ # end
+ #
+ # source://bindata//lib/bindata/sanitize.rb#239
def must_be_integer(*keys); end
+
+ # source://bindata//lib/bindata/sanitize.rb#253
def rename_parameter(old_key, new_key); end
+
+ # source://bindata//lib/bindata/sanitize.rb#281
def sanitize(key, &block); end
+
+ # source://bindata//lib/bindata/sanitize.rb#271
def sanitize_choices(key, &block); end
+
+ # source://bindata//lib/bindata/sanitize.rb#277
def sanitize_endian(key); end
+
+ # source://bindata//lib/bindata/sanitize.rb#263
def sanitize_fields(key, &block); end
+
+ # source://bindata//lib/bindata/sanitize.rb#259
def sanitize_object_prototype(key); end
+
+ # source://bindata//lib/bindata/sanitize.rb#223
def warn_replacement_parameter(bad_key, suggested_key); end
private
+ # source://bindata//lib/bindata/sanitize.rb#359
def create_sanitized_choices(choices); end
+
+ # source://bindata//lib/bindata/sanitize.rb#347
def create_sanitized_endian(endian); end
+
+ # source://bindata//lib/bindata/sanitize.rb#363
def create_sanitized_fields; end
+
+ # source://bindata//lib/bindata/sanitize.rb#367
def create_sanitized_object_prototype(obj_type, obj_params); end
+
+ # source://bindata//lib/bindata/sanitize.rb#327
def ensure_mandatory_parameters_exist; end
+
+ # source://bindata//lib/bindata/sanitize.rb#336
def ensure_mutual_exclusion_of_parameters; end
+
+ # source://bindata//lib/bindata/sanitize.rb#312
def ensure_no_nil_values; end
+
+ # source://bindata//lib/bindata/sanitize.rb#321
def merge_default_parameters!; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/sanitize.rb#308
def needs_sanitizing?(key); end
+
+ # source://bindata//lib/bindata/sanitize.rb#298
def sanitize!; end
class << self
+ # source://bindata//lib/bindata/sanitize.rb#188
def sanitize(parameters, the_class); end
end
end
+# Memoized constants
+#
+# source://bindata//lib/bindata/sanitize.rb#184
BinData::SanitizedParameters::BIG_ENDIAN = T.let(T.unsafe(nil), BinData::SanitizedBigEndian)
+
+# source://bindata//lib/bindata/sanitize.rb#185
BinData::SanitizedParameters::LITTLE_ENDIAN = T.let(T.unsafe(nil), BinData::SanitizedLittleEndian)
+# source://bindata//lib/bindata/sanitize.rb#8
class BinData::SanitizedPrototype < ::BinData::SanitizedParameter
+ # @return [SanitizedPrototype] a new instance of SanitizedPrototype
+ #
+ # source://bindata//lib/bindata/sanitize.rb#9
def initialize(obj_type, obj_params, hints); end
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/sanitize.rb#30
def has_parameter?(param); end
+
+ # source://bindata//lib/bindata/sanitize.rb#38
def instantiate(value = T.unsafe(nil), parent = T.unsafe(nil)); end
end
+# source://bindata//lib/bindata/bits.rb#15
class BinData::Sbit < ::BinData::BasePrimitive
def assign(val); end
def bit_aligned?; end
@@ -929,6 +2759,7 @@ class BinData::Sbit < ::BinData::BasePrimitive
def sensible_default; end
end
+# source://bindata//lib/bindata/bits.rb#15
class BinData::SbitLe < ::BinData::BasePrimitive
def assign(val); end
def bit_aligned?; end
@@ -941,205 +2772,475 @@ class BinData::SbitLe < ::BinData::BasePrimitive
def sensible_default; end
end
+# Skip will skip over bytes from the input stream. If the stream is not
+# seekable, then the bytes are consumed and discarded.
+#
+# When writing, skip will write the appropriate number of zero bytes.
+#
+# require 'bindata'
+#
+# class A < BinData::Record
+# skip length: 5
+# string :a, read_length: 5
+# end
+#
+# obj = A.read("abcdefghij")
+# obj.a #=> "fghij"
+#
+#
+# class B < BinData::Record
+# skip until_valid: [:string, {read_length: 2, assert: "ef"} ]
+# string :b, read_length: 5
+# end
+#
+# obj = B.read("abcdefghij")
+# obj.b #=> "efghi"
+#
+#
+# == Parameters
+#
+# Skip objects accept all the params that BinData::BasePrimitive
+# does, as well as the following:
+#
+# :length:: The number of bytes to skip.
+# :to_abs_offset:: Skips to the given absolute offset.
+# :until_valid:: Skips untils a given byte pattern is matched.
+# This parameter contains a type that will raise
+# a BinData::ValidityError unless an acceptable byte
+# sequence is found. The type is represented by a
+# Symbol, or if the type is to have params #
+# passed to it, then it should be provided as #
+# [type_symbol, hash_params].
+#
+# source://bindata//lib/bindata/skip.rb#44
class BinData::Skip < ::BinData::BasePrimitive
+ # source://bindata//lib/bindata/skip.rb#50
def initialize_shared_instance; end
private
+ # source://bindata//lib/bindata/skip.rb#69
def read_and_return_value(io); end
+
+ # source://bindata//lib/bindata/skip.rb#79
def sensible_default; end
+
+ # source://bindata//lib/bindata/skip.rb#60
def value_to_binary_string(val); end
end
+# source://bindata//lib/bindata/skip.rb#84
class BinData::SkipArgProcessor < ::BinData::BaseArgProcessor
+ # source://bindata//lib/bindata/skip.rb#85
def sanitize_parameters!(obj_class, params); end
end
+# Logic for the :length parameter
+#
+# source://bindata//lib/bindata/skip.rb#96
module BinData::SkipLengthPlugin
+ # source://bindata//lib/bindata/skip.rb#97
def skip_length; end
end
+# Logic for the :to_abs_offset parameter
+#
+# source://bindata//lib/bindata/skip.rb#103
module BinData::SkipToAbsOffsetPlugin
+ # source://bindata//lib/bindata/skip.rb#104
def skip_length; end
end
+# Logic for the :until_valid parameter
+#
+# source://bindata//lib/bindata/skip.rb#110
module BinData::SkipUntilValidPlugin
+ # source://bindata//lib/bindata/skip.rb#116
def read_and_return_value(io); end
+
+ # source://bindata//lib/bindata/skip.rb#111
def skip_length; end
end
+# A String is a sequence of bytes. This is the same as strings in Ruby 1.8.
+# The issue of character encoding is ignored by this class.
+#
+# require 'bindata'
+#
+# data = "abcdefghij"
+#
+# obj = BinData::String.new(read_length: 5)
+# obj.read(data)
+# obj #=> "abcde"
+#
+# obj = BinData::String.new(length: 6)
+# obj.read(data)
+# obj #=> "abcdef"
+# obj.assign("abcdefghij")
+# obj #=> "abcdef"
+# obj.assign("abcd")
+# obj #=> "abcd\000\000"
+#
+# obj = BinData::String.new(length: 6, trim_padding: true)
+# obj.assign("abcd")
+# obj #=> "abcd"
+# obj.to_binary_s #=> "abcd\000\000"
+#
+# obj = BinData::String.new(length: 6, pad_byte: 'A')
+# obj.assign("abcd")
+# obj #=> "abcdAA"
+# obj.to_binary_s #=> "abcdAA"
+#
+# == Parameters
+#
+# String objects accept all the params that BinData::BasePrimitive
+# does, as well as the following:
+#
+# :read_length:: The length in bytes to use when reading a value.
+# :length:: The fixed length of the string. If a shorter
+# string is set, it will be padded to this length.
+# :pad_byte:: The byte to use when padding a string to a
+# set length. Valid values are Integers and
+# Strings of length 1. "\0" is the default.
+# :pad_front:: Signifies that the padding occurs at the front
+# of the string rather than the end. Default
+# is false.
+# :trim_padding:: Boolean, default false. If set, #value will
+# return the value with all pad_bytes trimmed
+# from the end of the string. The value will
+# not be trimmed when writing.
+#
+# source://bindata//lib/bindata/string.rb#51
class BinData::String < ::BinData::BasePrimitive
+ # source://bindata//lib/bindata/string.rb#67
def assign(val); end
+
+ # source://bindata//lib/bindata/string.rb#59
def initialize_shared_instance; end
+
+ # source://bindata//lib/bindata/string.rb#71
def snapshot; end
private
+ # source://bindata//lib/bindata/string.rb#86
def clamp_to_length(str); end
+
+ # source://bindata//lib/bindata/string.rb#116
def read_and_return_value(io); end
+
+ # source://bindata//lib/bindata/string.rb#121
def sensible_default; end
+
+ # source://bindata//lib/bindata/string.rb#104
def trim_padding(str); end
+
+ # source://bindata//lib/bindata/string.rb#112
def value_to_binary_string(val); end
end
+# source://bindata//lib/bindata/string.rb#126
class BinData::StringArgProcessor < ::BinData::BaseArgProcessor
+ # source://bindata//lib/bindata/string.rb#127
def sanitize_parameters!(obj_class, params); end
private
+ # source://bindata//lib/bindata/string.rb#137
def sanitized_pad_byte(byte); end
end
+# A BinData::Stringz object is a container for a zero ("\0") terminated
+# string.
+#
+# For convenience, the zero terminator is not necessary when setting the
+# value. Likewise, the returned value will not be zero terminated.
+#
+# require 'bindata'
+#
+# data = "abcd\x00efgh"
+#
+# obj = BinData::Stringz.new
+# obj.read(data)
+# obj.snapshot #=> "abcd"
+# obj.num_bytes #=> 5
+# obj.to_binary_s #=> "abcd\000"
+#
+# == Parameters
+#
+# Stringz objects accept all the params that BinData::BasePrimitive
+# does, as well as the following:
+#
+# :max_length:: The maximum length of the string including the zero
+# byte.
+#
+# source://bindata//lib/bindata/stringz.rb#27
class BinData::Stringz < ::BinData::BasePrimitive
+ # source://bindata//lib/bindata/stringz.rb#31
def assign(val); end
+
+ # source://bindata//lib/bindata/stringz.rb#35
def snapshot; end
private
+ # source://bindata//lib/bindata/stringz.rb#90
def append_zero_byte_if_needed!(str); end
+
+ # source://bindata//lib/bindata/stringz.rb#48
def read_and_return_value(io); end
+
+ # source://bindata//lib/bindata/stringz.rb#64
def sensible_default; end
+
+ # source://bindata//lib/bindata/stringz.rb#68
def trim_and_zero_terminate(str); end
+
+ # source://bindata//lib/bindata/stringz.rb#80
def trim_to!(str, max_length = T.unsafe(nil)); end
+
+ # source://bindata//lib/bindata/stringz.rb#76
def truncate_after_first_zero_byte!(str); end
+
+ # source://bindata//lib/bindata/stringz.rb#44
def value_to_binary_string(val); end
end
+# A Struct is an ordered collection of named data objects.
+#
+# require 'bindata'
+#
+# class Tuple < BinData::Record
+# int8 :x
+# int8 :y
+# int8 :z
+# end
+#
+# obj = BinData::Struct.new(hide: :a,
+# fields: [ [:int32le, :a],
+# [:int16le, :b],
+# [:tuple, :s] ])
+# obj.field_names =># [:b, :s]
+#
+#
+# == Parameters
+#
+# Parameters may be provided at initialisation to control the behaviour of
+# an object. These params are:
+#
+# :fields:: An array specifying the fields for this struct.
+# Each element of the array is of the form [type, name,
+# params]. Type is a symbol representing a registered
+# type. Name is the name of this field. Params is an
+# optional hash of parameters to pass to this field
+# when instantiating it. If name is "" or nil, then
+# that field is anonymous and behaves as a hidden field.
+# :hide:: A list of the names of fields that are to be hidden
+# from the outside world. Hidden fields don't appear
+# in #snapshot or #field_names but are still accessible
+# by name.
+# :endian:: Either :little or :big. This specifies the default
+# endian of any numerics in this struct, or in any
+# nested data objects.
+# :search_prefix:: Allows abbreviated type names. If a type is
+# unrecognised, then each prefix is applied until
+# a match is found.
+#
+# == Field Parameters
+#
+# Fields may have have extra parameters as listed below:
+#
+# [:onlyif] Used to indicate a data object is optional.
+# if +false+, this object will not be included in any
+# calls to #read, #write, #num_bytes or #snapshot.
+# [:byte_align] This field's rel_offset must be a multiple of
+# :byte_align.
+#
+# source://bindata//lib/bindata/struct.rb#59
class BinData::Struct < ::BinData::Base
+ # source://bindata//lib/bindata/struct.rb#153
def [](key); end
+
+ # source://bindata//lib/bindata/struct.rb#157
def []=(key, value); end
+
+ # source://bindata//lib/bindata/struct.rb#101
def assign(val); end
+
+ # source://bindata//lib/bindata/struct.rb#93
def clear; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/struct.rb#97
def clear?; end
+
+ # source://bindata//lib/bindata/struct.rb#127
def debug_name_of(child); end
+
+ # source://bindata//lib/bindata/struct.rb#148
def do_num_bytes; end
+
+ # source://bindata//lib/bindata/struct.rb#138
def do_read(io); end
+
+ # :nodoc
+ #
+ # source://bindata//lib/bindata/struct.rb#143
def do_write(io); end
+
+ # source://bindata//lib/bindata/struct.rb#168
def each_pair; end
+
+ # Returns a list of the names of all fields accessible through this
+ # object. +include_hidden+ specifies whether to include hidden names
+ # in the listing.
+ #
+ # source://bindata//lib/bindata/struct.rb#118
def field_names(include_hidden = T.unsafe(nil)); end
+
+ # has_key? is deprecated
+ #
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/struct.rb#164
def has_key?(key); end
+
+ # source://bindata//lib/bindata/struct.rb#89
def initialize_instance; end
+
+ # source://bindata//lib/bindata/struct.rb#81
def initialize_shared_instance; end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/struct.rb#164
def key?(key); end
+
+ # source://bindata//lib/bindata/struct.rb#132
def offset_of(child); end
+
+ # source://bindata//lib/bindata/struct.rb#106
def snapshot; end
private
+ # source://bindata//lib/bindata/struct.rb#239
def as_stringified_hash(val); end
+
+ # source://bindata//lib/bindata/struct.rb#228
def assign_fields(val); end
+
+ # source://bindata//lib/bindata/struct.rb#213
def base_field_name(name); end
+
+ # source://bindata//lib/bindata/struct.rb#177
def define_field_accessors; end
+
+ # source://bindata//lib/bindata/struct.rb#184
def define_field_accessors_for(name, index); end
+
+ # source://bindata//lib/bindata/struct.rb#199
def find_index_of(obj); end
+
+ # source://bindata//lib/bindata/struct.rb#203
def find_obj_for_name(name); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/struct.rb#273
def include_obj?(obj); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/struct.rb#267
def include_obj_for_io?(obj); end
+
+ # source://bindata//lib/bindata/struct.rb#217
def instantiate_all_objs; end
+
+ # source://bindata//lib/bindata/struct.rb#221
def instantiate_obj_at(index); end
+
+ # source://bindata//lib/bindata/struct.rb#255
def sum_num_bytes_below_index(index); end
+
+ # source://bindata//lib/bindata/struct.rb#251
def sum_num_bytes_for_all_fields; end
class << self
+ # source://bindata//lib/bindata/base.rb#53
def inherited(subclass); end
end
end
+# These reserved words may not be used as field names
+#
+# source://bindata//lib/bindata/struct.rb#66
BinData::Struct::RESERVED = T.let(T.unsafe(nil), Hash)
+# A hash that can be accessed via attributes.
+#
+# source://bindata//lib/bindata/struct.rb#278
class BinData::Struct::Snapshot < ::Hash
+ # source://bindata//lib/bindata/struct.rb#279
def []=(key, value); end
+
+ # source://bindata//lib/bindata/struct.rb#287
def method_missing(symbol, *args); end
+
+ # @return [Boolean]
+ #
+ # source://bindata//lib/bindata/struct.rb#283
def respond_to?(symbol, include_private = T.unsafe(nil)); end
end
+# source://bindata//lib/bindata/struct.rb#348
class BinData::StructArgProcessor < ::BinData::BaseArgProcessor
+ # source://bindata//lib/bindata/struct.rb#349
def sanitize_parameters!(obj_class, params); end
private
+ # source://bindata//lib/bindata/struct.rb#403
def ensure_field_names_are_valid(obj_class, field_names); end
+
+ # source://bindata//lib/bindata/struct.rb#399
def hidden_field_names(hidden); end
+
+ # source://bindata//lib/bindata/struct.rb#359
def sanitize_endian(params); end
+
+ # source://bindata//lib/bindata/struct.rb#375
def sanitize_fields(obj_class, params); end
+
+ # source://bindata//lib/bindata/struct.rb#386
def sanitize_hide(params); end
+
+ # source://bindata//lib/bindata/struct.rb#363
def sanitize_search_prefix(params); end
+
+ # source://bindata//lib/bindata/struct.rb#395
def sanitized_field_names(sanitized_fields); end
end
+# source://bindata//lib/bindata/trace.rb#5
class BinData::Tracer
+ # @return [Tracer] a new instance of Tracer
+ #
+ # source://bindata//lib/bindata/trace.rb#6
def initialize(io); end
+ # source://bindata//lib/bindata/trace.rb#10
def trace(msg); end
- def trace_obj(obj_name, val); end
-end
-
-class BinData::Uint16be < ::BinData::BasePrimitive
- def assign(val); end
- def do_num_bytes; end
- private
-
- def read_and_return_value(io); end
- def sensible_default; end
- def value_to_binary_string(val); end
-end
-
-class BinData::Uint16le < ::BinData::BasePrimitive
- def assign(val); end
- def do_num_bytes; end
-
- private
-
- def read_and_return_value(io); end
- def sensible_default; end
- def value_to_binary_string(val); end
-end
-
-class BinData::Uint32be < ::BinData::BasePrimitive
- def assign(val); end
- def do_num_bytes; end
-
- private
-
- def read_and_return_value(io); end
- def sensible_default; end
- def value_to_binary_string(val); end
-end
-
-class BinData::Uint32le < ::BinData::BasePrimitive
- def assign(val); end
- def do_num_bytes; end
-
- private
-
- def read_and_return_value(io); end
- def sensible_default; end
- def value_to_binary_string(val); end
-end
-
-class BinData::Uint64be < ::BinData::BasePrimitive
- def assign(val); end
- def do_num_bytes; end
-
- private
-
- def read_and_return_value(io); end
- def sensible_default; end
- def value_to_binary_string(val); end
-end
-
-class BinData::Uint64le < ::BinData::BasePrimitive
- def assign(val); end
- def do_num_bytes; end
-
- private
-
- def read_and_return_value(io); end
- def sensible_default; end
- def value_to_binary_string(val); end
+ # source://bindata//lib/bindata/trace.rb#14
+ def trace_obj(obj_name, val); end
end
+# Unsigned 1 byte integer.
+#
+# source://bindata//lib/bindata/int.rb#180
class BinData::Uint8 < ::BinData::BasePrimitive
def assign(val); end
def do_num_bytes; end
@@ -1151,29 +3252,104 @@ class BinData::Uint8 < ::BinData::BasePrimitive
def value_to_binary_string(val); end
end
+# Uint8Array is a specialised type of array that only contains
+# bytes (Uint8). It is a faster and more memory efficient version
+# of `BinData::Array.new(:type => :uint8)`.
+#
+# require 'bindata'
+#
+# obj = BinData::Uint8Array.new(initial_length: 5)
+# obj.read("abcdefg") #=> [97, 98, 99, 100, 101]
+# obj[2] #=> 99
+# obj.collect { |x| x.chr }.join #=> "abcde"
+#
+# == Parameters
+#
+# Parameters may be provided at initialisation to control the behaviour of
+# an object. These params are:
+#
+# :initial_length:: The initial length of the array.
+# :read_until:: May only have a value of `:eof`. This parameter
+# instructs the array to read as much data from
+# the stream as possible.
+#
+# source://bindata//lib/bindata/uint8_array.rb#24
class BinData::Uint8Array < ::BinData::BasePrimitive
private
+ # source://bindata//lib/bindata/uint8_array.rb#36
def read_and_return_value(io); end
+
+ # source://bindata//lib/bindata/uint8_array.rb#46
def sensible_default; end
+
+ # source://bindata//lib/bindata/uint8_array.rb#32
def value_to_binary_string(val); end
end
+# source://bindata//lib/bindata/uint8_array.rb#51
class BinData::Uint8ArrayArgProcessor < ::BinData::BaseArgProcessor
+ # source://bindata//lib/bindata/uint8_array.rb#52
def sanitize_parameters!(obj_class, params); end
end
+# source://bindata//lib/bindata/registry.rb#3
class BinData::UnRegisteredTypeError < ::StandardError; end
+
+# source://bindata//lib/bindata/version.rb#2
BinData::VERSION = T.let(T.unsafe(nil), String)
+
+# Error raised when unexpected results occur when reading data from IO.
+#
+# source://bindata//lib/bindata/framework.rb#3
class BinData::ValidityError < ::StandardError; end
+# A virtual field is one that is neither read, written nor occupies space in
+# the data stream. It is used to make assertions or as a convenient label
+# for determining offsets or storing values.
+#
+# require 'bindata'
+#
+# class A < BinData::Record
+# string :a, read_length: 5
+# string :b, read_length: 5
+# virtual :c, assert: -> { a == b }
+# end
+#
+# obj = A.read("abcdeabcde")
+# obj.a #=> "abcde"
+# obj.c.offset #=> 10
+#
+# obj = A.read("abcdeABCDE") #=> BinData::ValidityError: assertion failed for obj.c
+#
+# == Parameters
+#
+# Parameters may be provided at initialisation to control the behaviour of
+# an object. These params include those for BinData::Base as well as:
+#
+# [:assert] Raise an error when reading or assigning if the value
+# of this evaluated parameter is false.
+# [:value] The virtual object will always have this value.
+#
+# source://bindata//lib/bindata/virtual.rb#31
class BinData::Virtual < ::BinData::BasePrimitive
+ # source://bindata//lib/bindata/virtual.rb#39
def do_num_bytes; end
+
+ # source://bindata//lib/bindata/virtual.rb#33
def do_read(io); end
+
+ # source://bindata//lib/bindata/virtual.rb#36
def do_write(io); end
+
+ # source://bindata//lib/bindata/virtual.rb#43
def sensible_default; end
end
+# Warns when reading if :value && no :read_length
+#
+# source://bindata//lib/bindata/string.rb#147
module BinData::WarnNoReadLengthPlugin
+ # source://bindata//lib/bindata/string.rb#148
def read_and_return_value(io); end
end
diff --git a/Library/Homebrew/sorbet/rbi/gems/bootsnap@1.17.0.rbi b/Library/Homebrew/sorbet/rbi/gems/bootsnap@1.17.0.rbi
index ac7585225e0de..0bdf707de6265 100644
--- a/Library/Homebrew/sorbet/rbi/gems/bootsnap@1.17.0.rbi
+++ b/Library/Homebrew/sorbet/rbi/gems/bootsnap@1.17.0.rbi
@@ -4,214 +4,646 @@
# This is an autogenerated file for types exported from the `bootsnap` gem.
# Please instead update this file by running `bin/tapioca gem bootsnap`.
+# source://bootsnap//lib/bootsnap/version.rb#3
module Bootsnap
extend ::Bootsnap
+ # @return [Boolean]
+ #
+ # source://bootsnap//lib/bootsnap/bundler.rb#6
def bundler?; end
class << self
+ # source://bootsnap//lib/bootsnap.rb#34
def _instrument(event, path); end
+
+ # source://bootsnap//lib/bootsnap.rb#122
def absolute_path?(path); end
+
+ # source://bootsnap//lib/bootsnap.rb#70
def default_setup; end
+
+ # source://bootsnap//lib/bootsnap.rb#27
def instrumentation=(callback); end
+
+ # source://bootsnap//lib/bootsnap.rb#14
def log!; end
+
+ # Returns the value of attribute logger.
+ #
+ # source://bootsnap//lib/bootsnap.rb#12
def logger; end
+
+ # source://bootsnap//lib/bootsnap.rb#18
def logger=(logger); end
+
+ # Allow the C extension to redefine `rb_get_path` without warning.
+ # Allow the C extension to redefine `rb_get_path` without warning.
+ #
+ # source://bootsnap//lib/bootsnap.rb#130
def rb_get_path(fname); end
+
+ # source://bootsnap//lib/bootsnap.rb#38
def setup(cache_dir:, development_mode: T.unsafe(nil), load_path_cache: T.unsafe(nil), ignore_directories: T.unsafe(nil), readonly: T.unsafe(nil), compile_cache_iseq: T.unsafe(nil), compile_cache_yaml: T.unsafe(nil), compile_cache_json: T.unsafe(nil)); end
+
+ # source://bootsnap//lib/bootsnap.rb#66
def unload_cache!; end
end
end
+# source://bootsnap//lib/bootsnap/compile_cache.rb#4
module Bootsnap::CompileCache
class << self
+ # source://bootsnap//lib/bootsnap/compile_cache.rb#12
def setup(cache_dir:, iseq:, yaml:, json:, readonly: T.unsafe(nil)); end
+
+ # @return [Boolean]
+ #
+ # source://bootsnap//lib/bootsnap/compile_cache.rb#45
def supported?; end
end
end
+# source://bootsnap//lib/bootsnap/compile_cache.rb#10
class Bootsnap::CompileCache::Error < ::StandardError; end
+
+# source://bootsnap//lib/bootsnap/compile_cache.rb#5
Bootsnap::CompileCache::UNCOMPILABLE = T.let(T.unsafe(nil), BasicObject)
+# source://bootsnap//lib/bootsnap/explicit_require.rb#4
module Bootsnap::ExplicitRequire
class << self
+ # source://bootsnap//lib/bootsnap/explicit_require.rb#17
def from_archdir(feature); end
+
+ # source://bootsnap//lib/bootsnap/explicit_require.rb#13
def from_rubylibdir(feature); end
+
+ # source://bootsnap//lib/bootsnap/explicit_require.rb#9
def from_self(feature); end
+
+ # Given a set of gems, run a block with the LOAD_PATH narrowed to include
+ # only core ruby source paths and these gems -- that is, roughly,
+ # temporarily remove all gems not listed in this call from the LOAD_PATH.
+ #
+ # This is useful before bootsnap is fully-initialized to load gems that it
+ # depends on, without forcing full LOAD_PATH traversals.
+ #
+ # source://bootsnap//lib/bootsnap/explicit_require.rb#27
def with_gems(*gems); end
end
end
+# source://bootsnap//lib/bootsnap/explicit_require.rb#5
Bootsnap::ExplicitRequire::ARCHDIR = T.let(T.unsafe(nil), String)
+
+# source://bootsnap//lib/bootsnap/explicit_require.rb#7
Bootsnap::ExplicitRequire::DLEXT = T.let(T.unsafe(nil), String)
+
+# source://bootsnap//lib/bootsnap/explicit_require.rb#6
Bootsnap::ExplicitRequire::RUBYLIBDIR = T.let(T.unsafe(nil), String)
+
+# source://bootsnap//lib/bootsnap.rb#9
class Bootsnap::InvalidConfiguration < ::StandardError; end
+# source://bootsnap//lib/bootsnap/load_path_cache.rb#4
module Bootsnap::LoadPathCache
class << self
+ # Returns the value of attribute enabled.
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache.rb#27
def enabled?; end
+
+ # Returns the value of attribute load_path_cache.
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache.rb#27
def load_path_cache; end
+
+ # Returns the value of attribute loaded_features_index.
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache.rb#27
def loaded_features_index; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache.rb#31
def setup(cache_path:, development_mode:, ignore_directories:, readonly: T.unsafe(nil)); end
+
+ # @return [Boolean]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache.rb#56
def supported?; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache.rb#48
def unload!; end
end
end
+# source://bootsnap//lib/bootsnap/load_path_cache.rb#22
Bootsnap::LoadPathCache::CACHED_EXTENSIONS = T.let(T.unsafe(nil), Array)
+# source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#7
class Bootsnap::LoadPathCache::Cache
+ # @return [Cache] a new instance of Cache
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#10
def initialize(store, path_obj, development_mode: T.unsafe(nil)); end
+ # Try to resolve this feature to an absolute path without traversing the
+ # loadpath.
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#56
def find(feature); end
+
+ # What is the path item that contains the dir as child?
+ # e.g. given "/a/b/c/d" exists, and the path is ["/a/b"], load_dir("c/d")
+ # is "/a/b".
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#22
def load_dir(dir); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#116
def push_paths(sender, *paths); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#122
def reinitialize(path_obj = T.unsafe(nil)); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#110
def unshift_paths(sender, *paths); end
private
+ # @return [Boolean]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#135
def dir_changed?; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#180
def expand_path(feature); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#211
def maybe_append_extension(feature); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#188
def now; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#145
def push_paths_locked(*paths); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#207
def search_index(feature); end
+
+ # @return [Boolean]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#184
def stale?; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#239
def try_ext(feature); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#219
def try_index(feature); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#163
def unshift_paths_locked(*paths); end
end
+# seconds
+#
+# source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#8
Bootsnap::LoadPathCache::Cache::AGE_THRESHOLD = T.let(T.unsafe(nil), Integer)
+
+# { 'enumerator' => nil, 'enumerator.so' => nil, ... }
+#
+# source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#32
Bootsnap::LoadPathCache::Cache::BUILTIN_FEATURES = T.let(T.unsafe(nil), Hash)
+# source://bootsnap//lib/bootsnap/load_path_cache/cache.rb#27
+Bootsnap::LoadPathCache::Cache::TRUFFLERUBY_LIB_DIR_PREFIX = T.let(T.unsafe(nil), T.untyped)
+
+# source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#5
module Bootsnap::LoadPathCache::ChangeObserver
class << self
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#65
def register(arr, observer); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#74
def unregister(arr); end
end
end
+# source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#6
module Bootsnap::LoadPathCache::ChangeObserver::ArrayMixin
+ # For each method that adds items to one end or another of the array
+ # (<<, push, unshift, concat), override that method to also notify the
+ # observer of the change.
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#10
def <<(entry); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def []=(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#15
def append(*entries); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def clear(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#58
def clone; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def collect!(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def compact!(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#27
def concat(entries); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def delete(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def delete_at(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def delete_if(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#58
def dup; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def fill(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def flatten!(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def insert(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def keep_if(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def map!(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def pop(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#21
def prepend(*entries); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#15
def push(*entries); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def reject!(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def replace(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def reverse!(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def rotate!(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def select!(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def shift(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def shuffle!(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def slice!(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def sort!(*args, &block); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#51
def sort_by!(*args, &block); end
+
+ # uniq! keeps the first occurrence of each path, otherwise preserving
+ # order, preserving the effective load path
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#34
def uniq!(*args); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb#21
def unshift(*entries); end
end
+# source://bootsnap//lib/bootsnap/load_path_cache.rb#16
Bootsnap::LoadPathCache::DLEXT = T.let(T.unsafe(nil), String)
+
+# This is nil on linux and darwin, but I think it's '.o' on some other
+# platform. I'm not really sure which, but it seems better to replicate
+# ruby's semantics as faithfully as possible.
+#
+# source://bootsnap//lib/bootsnap/load_path_cache.rb#20
+Bootsnap::LoadPathCache::DLEXT2 = T.let(T.unsafe(nil), T.untyped)
+
+# source://bootsnap//lib/bootsnap/load_path_cache.rb#11
Bootsnap::LoadPathCache::DL_EXTENSIONS = T.let(T.unsafe(nil), Array)
+
+# source://bootsnap//lib/bootsnap/load_path_cache.rb#7
Bootsnap::LoadPathCache::DOT_RB = T.let(T.unsafe(nil), String)
+
+# source://bootsnap//lib/bootsnap/load_path_cache.rb#8
Bootsnap::LoadPathCache::DOT_SO = T.let(T.unsafe(nil), String)
+
+# source://bootsnap//lib/bootsnap/load_path_cache.rb#5
Bootsnap::LoadPathCache::FALLBACK_SCAN = T.let(T.unsafe(nil), BasicObject)
+# LoadedFeaturesIndex partially mirrors an internal structure in ruby that
+# we can't easily obtain an interface to.
+#
+# This works around an issue where, without bootsnap, *ruby* knows that it
+# has already required a file by its short name (e.g. require 'bundler') if
+# a new instance of bundler is added to the $LOAD_PATH which resolves to a
+# different absolute path. This class makes bootsnap smart enough to
+# realize that it has already loaded 'bundler', and not just
+# '/path/to/bundler'.
+#
+# If you disable LoadedFeaturesIndex, you can see the problem this solves by:
+#
+# 1. `require 'a'`
+# 2. Prepend a new $LOAD_PATH element containing an `a.rb`
+# 3. `require 'a'`
+#
+# Ruby returns false from step 3.
+# With bootsnap but with no LoadedFeaturesIndex, this loads two different
+# `a.rb`s.
+# With bootsnap and with LoadedFeaturesIndex, this skips the second load,
+# returning false like ruby.
+#
+# source://bootsnap//lib/bootsnap/load_path_cache/loaded_features_index.rb#26
class Bootsnap::LoadPathCache::LoadedFeaturesIndex
+ # @return [LoadedFeaturesIndex] a new instance of LoadedFeaturesIndex
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/loaded_features_index.rb#27
def initialize; end
+ # source://bootsnap//lib/bootsnap/load_path_cache/loaded_features_index.rb#72
def cursor(short); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/loaded_features_index.rb#78
def identify(short, cursor); end
+
+ # @return [Boolean]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/loaded_features_index.rb#68
def key?(feature); end
+
+ # We've optimized for initialize and register to be fast, and purge to be tolerable.
+ # If access patterns make this not-okay, we can lazy-invert the LFI on
+ # first purge and work from there.
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/loaded_features_index.rb#54
def purge(feature); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/loaded_features_index.rb#61
def purge_multi(features); end
+
+ # There is a relatively uncommon case where we could miss adding an
+ # entry:
+ #
+ # If the user asked for e.g. `require 'bundler'`, and we went through the
+ # `FALLBACK_SCAN` pathway in `kernel_require.rb` and therefore did not
+ # pass `long` (the full expanded absolute path), then we did are not able
+ # to confidently add the `bundler.rb` form to @lfi.
+ #
+ # We could either:
+ #
+ # 1. Just add `bundler.rb`, `bundler.so`, and so on, which is close but
+ # not quite right; or
+ # 2. Inspect $LOADED_FEATURES upon return from yield to find the matching
+ # entry.
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/loaded_features_index.rb#105
def register(short, long); end
private
+ # Might Ruby automatically search for this extension if
+ # someone tries to 'require' the file without it? E.g. Ruby
+ # will implicitly try 'x.rb' if you ask for 'x'.
+ #
+ # This is complex and platform-dependent, and the Ruby docs are a little
+ # handwavy about what will be tried when and in what order.
+ # So optimistically pretend that all known elidable extensions
+ # will be tried on all platforms, and that people are unlikely
+ # to name files in a way that assumes otherwise.
+ # (E.g. It's unlikely that someone will know that their code
+ # will _never_ run on MacOS, and therefore think they can get away
+ # with calling a Ruby file 'x.dylib.rb' and then requiring it as 'x.dylib'.)
+ #
+ # See .
+ #
+ # @return [Boolean]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/loaded_features_index.rb#146
def extension_elidable?(feature); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/loaded_features_index.rb#150
def strip_extension_if_elidable(feature); end
end
+# source://bootsnap//lib/bootsnap/load_path_cache/loaded_features_index.rb#129
Bootsnap::LoadPathCache::LoadedFeaturesIndex::STRIP_EXTENSION = T.let(T.unsafe(nil), Regexp)
+# source://bootsnap//lib/bootsnap/load_path_cache/path.rb#7
class Bootsnap::LoadPathCache::Path
+ # @return [Path] a new instance of Path
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#24
def initialize(path, real: T.unsafe(nil)); end
+ # Return a list of all the requirable files and all of the subdirectories
+ # of this +Path+.
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#59
def entries_and_dirs(store); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#82
def expanded_path; end
+
+ # True if the path exists, but represents a non-directory object
+ #
+ # @return [Boolean]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#47
def non_directory?; end
+
+ # Returns the value of attribute path.
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#22
def path; end
+
+ # @return [Boolean]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#53
def relative?; end
+
+ # A path is considered 'stable' if it is part of a Gem.path or the ruby
+ # distribution. When adding or removing files in these paths, the cache
+ # must be cleared before the change will be noticed.
+ #
+ # @return [Boolean]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#11
def stable?; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#29
def to_realpath; end
+
+ # A path is considered volatile if it doesn't live under a Gem.path or
+ # the ruby distribution root. These paths are scanned for new additions
+ # more frequently.
+ #
+ # @return [Boolean]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#18
def volatile?; end
private
+ # last time a directory was modified in this subtree. +dirs+ should be a
+ # list of relative paths to directories under +path+. e.g. for /a/b and
+ # /a/b/c, pass ('/a/b', ['c'])
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#99
def latest_mtime(path, dirs); end
+
+ # (expensive) returns [entries, dirs]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#92
def scan!; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/path.rb#123
def stability; end
end
+# Built-in ruby lib stuff doesn't change, but things can occasionally be
+# installed into sitedir, which generally lives under rubylibdir.
+#
+# source://bootsnap//lib/bootsnap/load_path_cache/path.rb#120
Bootsnap::LoadPathCache::Path::RUBY_LIBDIR = T.let(T.unsafe(nil), String)
+
+# source://bootsnap//lib/bootsnap/load_path_cache/path.rb#121
Bootsnap::LoadPathCache::Path::RUBY_SITEDIR = T.let(T.unsafe(nil), String)
+
+# a Path can be either stable of volatile, depending on how frequently we
+# expect its contents may change. Stable paths aren't rescanned nearly as
+# often.
+#
+# source://bootsnap//lib/bootsnap/load_path_cache/path.rb#115
Bootsnap::LoadPathCache::Path::STABLE = T.let(T.unsafe(nil), Symbol)
+
+# source://bootsnap//lib/bootsnap/load_path_cache/path.rb#116
Bootsnap::LoadPathCache::Path::VOLATILE = T.let(T.unsafe(nil), Symbol)
+# source://bootsnap//lib/bootsnap/load_path_cache/path_scanner.rb#7
module Bootsnap::LoadPathCache::PathScanner
class << self
+ # source://bootsnap//lib/bootsnap/load_path_cache/path_scanner.rb#23
def call(path); end
+
+ # Returns the value of attribute ignored_directories.
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/path_scanner.rb#21
def ignored_directories; end
+
+ # Sets the attribute ignored_directories
+ #
+ # @param value the value to set the attribute ignored_directories to.
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/path_scanner.rb#21
def ignored_directories=(_arg0); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/path_scanner.rb#69
def os_path(path); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/path_scanner.rb#49
def walk(absolute_dir_path, relative_dir_path, &block); end
end
end
+# source://bootsnap//lib/bootsnap/load_path_cache/path_scanner.rb#10
Bootsnap::LoadPathCache::PathScanner::ALTERNATIVE_NATIVE_EXTENSIONS_PATTERN = T.let(T.unsafe(nil), Regexp)
+
+# source://bootsnap//lib/bootsnap/load_path_cache/path_scanner.rb#12
Bootsnap::LoadPathCache::PathScanner::BUNDLE_PATH = T.let(T.unsafe(nil), String)
+
+# source://bootsnap//lib/bootsnap/load_path_cache/path_scanner.rb#9
Bootsnap::LoadPathCache::PathScanner::NORMALIZE_NATIVE_EXTENSIONS = T.let(T.unsafe(nil), TrueClass)
+
+# source://bootsnap//lib/bootsnap/load_path_cache/path_scanner.rb#8
Bootsnap::LoadPathCache::PathScanner::REQUIRABLE_EXTENSIONS = T.let(T.unsafe(nil), Array)
+
+# source://bootsnap//lib/bootsnap/load_path_cache.rb#9
Bootsnap::LoadPathCache::SLASH = T.let(T.unsafe(nil), String)
+# source://bootsnap//lib/bootsnap/load_path_cache/store.rb#9
class Bootsnap::LoadPathCache::Store
+ # @return [Store] a new instance of Store
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/store.rb#16
def initialize(store_path, readonly: T.unsafe(nil)); end
+ # @raise [SetOutsideTransactionNotAllowed]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/store.rb#28
def fetch(key); end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/store.rb#24
def get(key); end
+
+ # @raise [SetOutsideTransactionNotAllowed]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/store.rb#40
def set(key, value); end
+
+ # @raise [NestedTransactionError]
+ #
+ # source://bootsnap//lib/bootsnap/load_path_cache/store.rb#49
def transaction; end
private
+ # source://bootsnap//lib/bootsnap/load_path_cache/store.rb#66
def commit_transaction; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/store.rb#112
def default_data; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/store.rb#95
def dump_data; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/store.rb#73
def load_data; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/store.rb#61
def mark_for_mutation!; end
+
+ # source://bootsnap//lib/bootsnap/load_path_cache/store.rb#116
def mkdir_p(path); end
end
+# source://bootsnap//lib/bootsnap/load_path_cache/store.rb#11
Bootsnap::LoadPathCache::Store::CURRENT_VERSION = T.let(T.unsafe(nil), String)
+
+# source://bootsnap//lib/bootsnap/load_path_cache/store.rb#13
class Bootsnap::LoadPathCache::Store::NestedTransactionError < ::StandardError; end
+
+# source://bootsnap//lib/bootsnap/load_path_cache/store.rb#14
class Bootsnap::LoadPathCache::Store::SetOutsideTransactionNotAllowed < ::StandardError; end
+
+# source://bootsnap//lib/bootsnap/load_path_cache/store.rb#10
Bootsnap::LoadPathCache::Store::VERSION_KEY = T.let(T.unsafe(nil), String)
+
+# source://bootsnap//lib/bootsnap/version.rb#4
Bootsnap::VERSION = T.let(T.unsafe(nil), String)
diff --git a/Library/Homebrew/sorbet/rbi/gems/byebug@11.1.3.rbi b/Library/Homebrew/sorbet/rbi/gems/byebug@11.1.3.rbi
index da405adea8fed..bbd147bdc1d3f 100644
--- a/Library/Homebrew/sorbet/rbi/gems/byebug@11.1.3.rbi
+++ b/Library/Homebrew/sorbet/rbi/gems/byebug@11.1.3.rbi
@@ -4,17 +4,35 @@
# This is an autogenerated file for types exported from the `byebug` gem.
# Please instead update this file by running `bin/tapioca gem byebug`.
+# Reopen main module to define the library version
+#
+# source://byebug//lib/byebug/attacher.rb#6
module Byebug
class << self
+ # Starts byebug, and stops at the first line of user's code.
+ #
+ # source://byebug//lib/byebug/attacher.rb#10
def attach; end
+
+ # source://byebug//lib/byebug/attacher.rb#21
def spawn(host = T.unsafe(nil), port = T.unsafe(nil)); end
end
end
+# Adds a `byebug` method to the Kernel module.
+#
+# Dropping a `byebug` call anywhere in your code, you get a debug prompt.
+#
+# source://byebug//lib/byebug/attacher.rb#34
module Kernel
- extend ::Forwardable
+ include ::ActiveSupport::ForkTracker::CoreExt
+ # source://byebug//lib/byebug/attacher.rb#35
def byebug; end
+
+ # source://byebug//lib/byebug/attacher.rb#35
def debugger; end
+
+ # source://byebug//lib/byebug/attacher.rb#41
def remote_byebug(host = T.unsafe(nil), port = T.unsafe(nil)); end
end
diff --git a/Library/Homebrew/sorbet/rbi/gems/coderay@1.1.3.rbi b/Library/Homebrew/sorbet/rbi/gems/coderay@1.1.3.rbi
index 1cf355998aeda..0ada31cfb6087 100644
--- a/Library/Homebrew/sorbet/rbi/gems/coderay@1.1.3.rbi
+++ b/Library/Homebrew/sorbet/rbi/gems/coderay@1.1.3.rbi
@@ -4,1002 +4,3423 @@
# This is an autogenerated file for types exported from the `coderay` gem.
# Please instead update this file by running `bin/tapioca gem coderay`.
+# = CodeRay Library
+#
+# CodeRay is a Ruby library for syntax highlighting.
+#
+# I try to make CodeRay easy to use and intuitive, but at the same time fully
+# featured, complete, fast and efficient.
+#
+# See README.
+#
+# It consists mainly of
+# * the main engine: CodeRay (Scanners::Scanner, Tokens, Encoders::Encoder)
+# * the plugin system: PluginHost, Plugin
+# * the scanners in CodeRay::Scanners
+# * the encoders in CodeRay::Encoders
+# * the styles in CodeRay::Styles
+#
+# Here's a fancy graphic to light up this gray docu:
+#
+# http://cycnus.de/raindark/coderay/scheme.png
+#
+# == Documentation
+#
+# See CodeRay, Encoders, Scanners, Tokens.
+#
+# == Usage
+#
+# Remember you need RubyGems to use CodeRay, unless you have it in your load
+# path. Run Ruby with -rubygems option if required.
+#
+# === Highlight Ruby code in a string as html
+#
+# require 'coderay'
+# print CodeRay.scan('puts "Hello, world!"', :ruby).html
+#
+# # prints something like this:
+# puts "Hello, world!"
+#
+#
+# === Highlight C code from a file in a html div
+#
+# require 'coderay'
+# print CodeRay.scan(File.read('ruby.h'), :c).div
+# print CodeRay.scan_file('ruby.h').html.div
+#
+# You can include this div in your page. The used CSS styles can be printed with
+#
+# % coderay_stylesheet
+#
+# === Highlight without typing too much
+#
+# If you are one of the hasty (or lazy, or extremely curious) people, just run this file:
+#
+# % ruby -rubygems /path/to/coderay/coderay.rb > example.html
+#
+# and look at the file it created in your browser.
+#
+# = CodeRay Module
+#
+# The CodeRay module provides convenience methods for the engine.
+#
+# * The +lang+ and +format+ arguments select Scanner and Encoder to use. These are
+# simply lower-case symbols, like :python or :html.
+# * All methods take an optional hash as last parameter, +options+, that is send to
+# the Encoder / Scanner.
+# * Input and language are always sorted in this order: +code+, +lang+.
+# (This is in alphabetical order, if you need a mnemonic ;)
+#
+# You should be able to highlight everything you want just using these methods;
+# so there is no need to dive into CodeRay's deep class hierarchy.
+#
+# The examples in the demo directory demonstrate common cases using this interface.
+#
+# = Basic Access Ways
+#
+# Read this to get a general view what CodeRay provides.
+#
+# == Scanning
+#
+# Scanning means analysing an input string, splitting it up into Tokens.
+# Each Token knows about what type it is: string, comment, class name, etc.
+#
+# Each +lang+ (language) has its own Scanner; for example, :ruby code is
+# handled by CodeRay::Scanners::Ruby.
+#
+# CodeRay.scan:: Scan a string in a given language into Tokens.
+# This is the most common method to use.
+# CodeRay.scan_file:: Scan a file and guess the language using FileType.
+#
+# The Tokens object you get from these methods can encode itself; see Tokens.
+#
+# == Encoding
+#
+# Encoding means compiling Tokens into an output. This can be colored HTML or
+# LaTeX, a textual statistic or just the number of non-whitespace tokens.
+#
+# Each Encoder provides output in a specific +format+, so you select Encoders via
+# formats like :html or :statistic.
+#
+# CodeRay.encode:: Scan and encode a string in a given language.
+# CodeRay.encode_tokens:: Encode the given tokens.
+# CodeRay.encode_file:: Scan a file, guess the language using FileType and encode it.
+#
+# == All-in-One Encoding
+#
+# CodeRay.encode:: Highlight a string with a given input and output format.
+#
+# == Instanciating
+#
+# You can use an Encoder instance to highlight multiple inputs. This way, the setup
+# for this Encoder must only be done once.
+#
+# CodeRay.encoder:: Create an Encoder instance with format and options.
+# CodeRay.scanner:: Create an Scanner instance for lang, with '' as default code.
+#
+# To make use of CodeRay.scanner, use CodeRay::Scanner::code=.
+#
+# The scanning methods provide more flexibility; we recommend to use these.
+#
+# == Reusing Scanners and Encoders
+#
+# If you want to re-use scanners and encoders (because that is faster), see
+# CodeRay::Duo for the most convenient (and recommended) interface.
+#
+# source://coderay//lib/coderay.rb#126
module CodeRay
class << self
+ # Assuming the path is a subpath of lib/coderay/
+ #
+ # source://coderay//lib/coderay.rb#133
def coderay_path(*path); end
+
+ # Encode a string.
+ #
+ # This scans +code+ with the the Scanner for +lang+ and then
+ # encodes it with the Encoder for +format+.
+ # +options+ will be passed to the Encoder.
+ #
+ # See CodeRay::Encoder.encode.
+ #
+ # source://coderay//lib/coderay.rb#196
def encode(code, lang, format, options = T.unsafe(nil)); end
+
+ # Encodes +filename+ (a path to a code file) with the Scanner for +lang+.
+ #
+ # See CodeRay.scan_file.
+ # Notice that the second argument is the output +format+, not the input language.
+ #
+ # Example:
+ # require 'coderay'
+ # page = CodeRay.encode_file 'some_c_code.c', :html
+ #
+ # source://coderay//lib/coderay.rb#221
def encode_file(filename, format, options = T.unsafe(nil)); end
+
+ # Encode pre-scanned Tokens.
+ # Use this together with CodeRay.scan:
+ #
+ # require 'coderay'
+ #
+ # # Highlight a short Ruby code example in a HTML span
+ # tokens = CodeRay.scan '1 + 2', :ruby
+ # puts CodeRay.encode_tokens(tokens, :span)
+ #
+ # source://coderay//lib/coderay.rb#209
def encode_tokens(tokens, format, options = T.unsafe(nil)); end
+
+ # Finds the Encoder class for +format+ and creates an instance, passing
+ # +options+ to it.
+ #
+ # Example:
+ # require 'coderay'
+ #
+ # stats = CodeRay.encoder(:statistic)
+ # stats.encode("puts 17 + 4\n", :ruby)
+ #
+ # puts '%d out of %d tokens have the kind :integer.' % [
+ # stats.type_stats[:integer].count,
+ # stats.real_token_count
+ # ]
+ # #-> 2 out of 4 tokens have the kind :integer.
+ #
+ # source://coderay//lib/coderay.rb#260
def encoder(format, options = T.unsafe(nil)); end
+
+ # Extract the options for the scanner from the +options+ hash.
+ #
+ # Returns an empty Hash if :scanner_options is not set.
+ #
+ # This is used if a method like CodeRay.encode has to provide options
+ # for Encoder _and_ scanner.
+ #
+ # source://coderay//lib/coderay.rb#278
def get_scanner_options(options); end
+
+ # Highlight a string into a HTML
.
+ #
+ # CSS styles use classes, so you have to include a stylesheet
+ # in your output.
+ #
+ # See encode.
+ #
+ # source://coderay//lib/coderay.rb#232
def highlight(code, lang, options = T.unsafe(nil), format = T.unsafe(nil)); end
+
+ # Highlight a file into a HTML
.
+ #
+ # CSS styles use classes, so you have to include a stylesheet
+ # in your output.
+ #
+ # See encode.
+ #
+ # source://coderay//lib/coderay.rb#242
def highlight_file(filename, options = T.unsafe(nil), format = T.unsafe(nil)); end
+
+ # Scans the given +code+ (a String) with the Scanner for +lang+.
+ #
+ # This is a simple way to use CodeRay. Example:
+ # require 'coderay'
+ # page = CodeRay.scan("puts 'Hello, world!'", :ruby).html
+ #
+ # See also demo/demo_simple.
+ #
+ # source://coderay//lib/coderay.rb#168
def scan(code, lang, options = T.unsafe(nil), &block); end
+
+ # Scans +filename+ (a path to a code file) with the Scanner for +lang+.
+ #
+ # If +lang+ is :auto or omitted, the CodeRay::FileType module is used to
+ # determine it. If it cannot find out what type it is, it uses
+ # CodeRay::Scanners::Text.
+ #
+ # Calls CodeRay.scan.
+ #
+ # Example:
+ # require 'coderay'
+ # page = CodeRay.scan_file('some_c_code.c').html
+ #
+ # source://coderay//lib/coderay.rb#183
def scan_file(filename, lang = T.unsafe(nil), options = T.unsafe(nil), &block); end
+
+ # Finds the Scanner class for +lang+ and creates an instance, passing
+ # +options+ to it.
+ #
+ # See Scanner.new.
+ #
+ # source://coderay//lib/coderay.rb#268
def scanner(lang, options = T.unsafe(nil), &block); end
end
end
+# source://coderay//lib/coderay.rb#130
CodeRay::CODERAY_PATH = T.let(T.unsafe(nil), String)
+# = Duo
+#
+# A Duo is a convenient way to use CodeRay. You just create a Duo,
+# giving it a lang (language of the input code) and a format (desired
+# output format), and call Duo#highlight with the code.
+#
+# Duo makes it easy to re-use both scanner and encoder for a repetitive
+# task. It also provides a very easy interface syntax:
+#
+# require 'coderay'
+# CodeRay::Duo[:python, :div].highlight 'import this'
+#
+# Until you want to do uncommon things with CodeRay, I recommend to use
+# this method, since it takes care of everything.
+#
+# source://coderay//lib/coderay/duo.rb#17
class CodeRay::Duo
+ # Create a new Duo, holding a lang and a format to highlight code.
+ #
+ # simple:
+ # CodeRay::Duo[:ruby, :html].highlight 'bla 42'
+ #
+ # with options:
+ # CodeRay::Duo[:ruby, :html, :hint => :debug].highlight '????::??'
+ #
+ # alternative syntax without options:
+ # CodeRay::Duo[:ruby => :statistic].encode 'class << self; end'
+ #
+ # alternative syntax with options:
+ # CodeRay::Duo[{ :ruby => :statistic }, :do => :something].encode 'abc'
+ #
+ # The options are forwarded to scanner and encoder
+ # (see CodeRay.get_scanner_options).
+ #
+ # @return [Duo] a new instance of Duo
+ #
+ # source://coderay//lib/coderay/duo.rb#37
def initialize(lang = T.unsafe(nil), format = T.unsafe(nil), options = T.unsafe(nil)); end
+ # Tokenize and highlight the code using +scanner+ and +encoder+.
+ # Allows to use Duo like a proc object:
+ #
+ # CodeRay::Duo[:python => :yaml].call(code)
+ #
+ # or, in Ruby 1.9 and later:
+ #
+ # CodeRay::Duo[:python => :yaml].(code)
+ #
+ # source://coderay//lib/coderay/duo.rb#64
def call(code, options = T.unsafe(nil)); end
+
+ # Tokenize and highlight the code using +scanner+ and +encoder+.
+ #
+ # source://coderay//lib/coderay/duo.rb#64
def encode(code, options = T.unsafe(nil)); end
+
+ # The encoder of the duo. Only created once.
+ #
+ # source://coderay//lib/coderay/duo.rb#59
def encoder; end
+
+ # Returns the value of attribute format.
+ #
+ # source://coderay//lib/coderay/duo.rb#19
def format; end
+
+ # Sets the attribute format
+ #
+ # @param value the value to set the attribute format to.
+ #
+ # source://coderay//lib/coderay/duo.rb#19
def format=(_arg0); end
+
+ # Tokenize and highlight the code using +scanner+ and +encoder+.
+ #
+ # source://coderay//lib/coderay/duo.rb#64
def highlight(code, options = T.unsafe(nil)); end
+
+ # Returns the value of attribute lang.
+ #
+ # source://coderay//lib/coderay/duo.rb#19
def lang; end
+
+ # Sets the attribute lang
+ #
+ # @param value the value to set the attribute lang to.
+ #
+ # source://coderay//lib/coderay/duo.rb#19
def lang=(_arg0); end
+
+ # Returns the value of attribute options.
+ #
+ # source://coderay//lib/coderay/duo.rb#19
def options; end
+
+ # Sets the attribute options
+ #
+ # @param value the value to set the attribute options to.
+ #
+ # source://coderay//lib/coderay/duo.rb#19
def options=(_arg0); end
+
+ # The scanner of the duo. Only created once.
+ #
+ # source://coderay//lib/coderay/duo.rb#54
def scanner; end
class << self
+ # To allow calls like Duo[:ruby, :html].highlight.
def [](*_arg0); end
end
end
+# This module holds the Encoder class and its subclasses.
+# For example, the HTML encoder is named CodeRay::Encoders::HTML
+# can be found in coderay/encoders/html.
+#
+# Encoders also provides methods and constants for the register
+# mechanism and the [] method that returns the Encoder class
+# belonging to the given format.
+#
+# source://coderay//lib/coderay/encoders.rb#10
module CodeRay::Encoders
extend ::CodeRay::PluginHost
end
+# A simple Filter that removes all tokens of the :comment kind.
+#
+# Alias: +remove_comments+
+#
+# Usage:
+# CodeRay.scan('print # foo', :ruby).comment_filter.text
+# #-> "print "
+#
+# See also: TokenKindFilter, LinesOfCode
+#
+# source://coderay//lib/coderay/encoders/comment_filter.rb#15
class CodeRay::Encoders::CommentFilter < ::CodeRay::Encoders::TokenKindFilter; end
+
+# source://coderay//lib/coderay/encoders/comment_filter.rb#19
CodeRay::Encoders::CommentFilter::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+# Returns the number of tokens.
+#
+# Text and block tokens are counted.
+#
+# source://coderay//lib/coderay/encoders/count.rb#7
class CodeRay::Encoders::Count < ::CodeRay::Encoders::Encoder
+ # source://coderay//lib/coderay/encoders/count.rb#29
def begin_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/count.rb#29
def begin_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/count.rb#29
def end_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/count.rb#29
def end_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/count.rb#25
def text_token(text, kind); end
protected
+ # source://coderay//lib/coderay/encoders/count.rb#19
def finish(options); end
+
+ # source://coderay//lib/coderay/encoders/count.rb#13
def setup(options); end
end
+# = Debug Encoder
+#
+# Fast encoder producing simple debug output.
+#
+# It is readable and diff-able and is used for testing.
+#
+# You cannot fully restore the tokens information from the
+# output, because consecutive :space tokens are merged.
+#
+# See also: Scanners::Debug
+#
+# source://coderay//lib/coderay/encoders/debug.rb#14
class CodeRay::Encoders::Debug < ::CodeRay::Encoders::Encoder
+ # source://coderay//lib/coderay/encoders/debug.rb#30
def begin_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/debug.rb#38
def begin_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/debug.rb#34
def end_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/debug.rb#42
def end_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/debug.rb#20
def text_token(text, kind); end
end
+# source://coderay//lib/coderay/encoders/debug.rb#18
CodeRay::Encoders::Debug::FILE_EXTENSION = T.let(T.unsafe(nil), String)
+# = Debug Lint Encoder
+#
+# Debug encoder with additional checks for:
+#
+# - empty tokens
+# - incorrect nesting
+#
+# It will raise an InvalidTokenStream exception when any of the above occurs.
+#
+# See also: Encoders::Debug
+#
+# source://coderay//lib/coderay/encoders/debug_lint.rb#16
class CodeRay::Encoders::DebugLint < ::CodeRay::Encoders::Debug
+ # source://coderay//lib/coderay/encoders/debug_lint.rb#26
def begin_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/debug_lint.rb#37
def begin_line(kind); end
+
+ # @raise [Lint::IncorrectTokenGroupNesting]
+ #
+ # source://coderay//lib/coderay/encoders/debug_lint.rb#31
def end_group(kind); end
+
+ # @raise [Lint::IncorrectTokenGroupNesting]
+ #
+ # source://coderay//lib/coderay/encoders/debug_lint.rb#42
def end_line(kind); end
+
+ # @raise [Lint::EmptyToken]
+ #
+ # source://coderay//lib/coderay/encoders/debug_lint.rb#20
def text_token(text, kind); end
protected
+ # source://coderay//lib/coderay/encoders/debug_lint.rb#55
def finish(options); end
+
+ # source://coderay//lib/coderay/encoders/debug_lint.rb#50
def setup(options); end
end
+# Wraps HTML output into a DIV element, using inline styles by default.
+#
+# See Encoders::HTML for available options.
+#
+# source://coderay//lib/coderay/encoders/div.rb#9
class CodeRay::Encoders::Div < ::CodeRay::Encoders::HTML; end
+
+# source://coderay//lib/coderay/encoders/div.rb#15
CodeRay::Encoders::Div::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/encoders/div.rb#11
CodeRay::Encoders::Div::FILE_EXTENSION = T.let(T.unsafe(nil), String)
+# = Encoder
+#
+# The Encoder base class. Together with Scanner and
+# Tokens, it forms the highlighting triad.
+#
+# Encoder instances take a Tokens object and do something with it.
+#
+# The most common Encoder is surely the HTML encoder
+# (CodeRay::Encoders::HTML). It highlights the code in a colorful
+# html page.
+# If you want the highlighted code in a div or a span instead,
+# use its subclasses Div and Span.
+#
+# source://coderay//lib/coderay/encoders/encoder.rb#16
class CodeRay::Encoders::Encoder
extend ::CodeRay::Plugin
+ # Creates a new Encoder.
+ # +options+ is saved and used for all encode operations, as long
+ # as you don't overwrite it there by passing additional options.
+ #
+ # Encoder objects provide three encode methods:
+ # - encode simply takes a +code+ string and a +lang+
+ # - encode_tokens expects a +tokens+ object instead
+ #
+ # Each method has an optional +options+ parameter. These are
+ # added to the options you passed at creation.
+ #
+ # @return [Encoder] a new instance of Encoder
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#55
def initialize(options = T.unsafe(nil)); end
+ # source://coderay//lib/coderay/encoders/encoder.rb#87
def <<(token); end
+
+ # Starts a token group with the given +kind+.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#123
def begin_group(kind); end
+
+ # Starts a new line token group with the given +kind+.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#131
def begin_line(kind); end
+
+ # Encode the given +code+ using the Scanner for +lang+.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#70
def encode(code, lang, options = T.unsafe(nil)); end
+
+ # Encode a Tokens object.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#61
def encode_tokens(tokens, options = T.unsafe(nil)); end
+
+ # Ends a token group with the given +kind+.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#127
def end_group(kind); end
+
+ # Ends a new line token group with the given +kind+.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#135
def end_line(kind); end
+
+ # The default file extension for this encoder.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#83
def file_extension; end
+
+ # Encode the given +code+ using the Scanner for +lang+.
+ # You can use highlight instead of encode, if that seems
+ # more clear to you.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#70
def highlight(code, lang, options = T.unsafe(nil)); end
+
+ # The options you gave the Encoder at creating.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#43
def options; end
+
+ # The options you gave the Encoder at creating.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#43
def options=(_arg0); end
+
+ # The options you gave the Encoder at creating.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#43
def scanner; end
+
+ # The options you gave the Encoder at creating.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#43
def scanner=(_arg0); end
+
+ # Called for each text token ([text, kind]), where text is a String.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#118
def text_token(text, kind); end
+
+ # Called with +content+ and +kind+ of the currently scanned token.
+ # For simple scanners, it's enougth to implement this method.
+ #
+ # By default, it calls text_token, begin_group, end_group, begin_line,
+ # or end_line, depending on the +content+.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#100
def token(content, kind); end
+
+ # Do the encoding.
+ #
+ # The already created +tokens+ object must be used; it must be a
+ # Tokens object.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#168
def tokens(tokens, options = T.unsafe(nil)); end
protected
+ # Do the encoding.
+ #
+ # The already created +tokens+ object must be used; it must be a
+ # Tokens object.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#168
def compile(tokens, options = T.unsafe(nil)); end
+
+ # Called with merged options after encoding starts.
+ # The return value is the result of encoding, typically @out.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#160
def finish(options); end
+
+ # source://coderay//lib/coderay/encoders/encoder.rb#148
def get_output(options); end
+
+ # Append data.to_s to the output. Returns the argument.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#153
def output(data); end
+
+ # Called with merged options before encoding starts.
+ # Sets @out to an empty string.
+ #
+ # See the HTML Encoder for an example of option caching.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#144
def setup(options); end
class << self
+ # If FILE_EXTENSION isn't defined, this method returns the
+ # downcase class name instead.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#24
def const_missing(sym); end
+
+ # The default file extension for output file of this encoder class.
+ #
+ # source://coderay//lib/coderay/encoders/encoder.rb#33
def file_extension; end
end
end
+# Subclasses are to store their default options in this constant.
+#
+# source://coderay//lib/coderay/encoders/encoder.rb#40
CodeRay::Encoders::Encoder::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/helpers/plugin.rb#41
CodeRay::Encoders::Encoder::PLUGIN_HOST = CodeRay::Encoders
+# A Filter encoder has another Tokens instance as output.
+# It can be subclass to select, remove, or modify tokens in the stream.
+#
+# Subclasses of Filter are called "Filters" and can be chained.
+#
+# == Options
+#
+# === :tokens
+#
+# The Tokens object which will receive the output.
+#
+# Default: Tokens.new
+#
+# See also: TokenKindFilter
+#
+# source://coderay//lib/coderay/encoders/filter.rb#18
class CodeRay::Encoders::Filter < ::CodeRay::Encoders::Encoder
+ # source://coderay//lib/coderay/encoders/filter.rb#39
def begin_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/filter.rb#43
def begin_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/filter.rb#47
def end_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/filter.rb#51
def end_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/filter.rb#35
def text_token(text, kind); end
protected
+ # source://coderay//lib/coderay/encoders/filter.rb#29
def finish(options); end
+
+ # source://coderay//lib/coderay/encoders/filter.rb#23
def setup(options); end
end
+# = HTML Encoder
+#
+# This is CodeRay's most important highlighter:
+# It provides save, fast XHTML generation and CSS support.
+#
+# == Usage
+#
+# require 'coderay'
+# puts CodeRay.scan('Some /code/', :ruby).html #-> a HTML page
+# puts CodeRay.scan('Some /code/', :ruby).html(:wrap => :span)
+# #-> Some /code/
+# puts CodeRay.scan('Some /code/', :ruby).span #-> the same
+#
+# puts CodeRay.scan('Some code', :ruby).html(
+# :wrap => nil,
+# :line_numbers => :inline,
+# :css => :style
+# )
+#
+# == Options
+#
+# === :tab_width
+# Convert \t characters to +n+ spaces (a number or false.)
+# false will keep tab characters untouched.
+#
+# Default: 8
+#
+# === :css
+# How to include the styles; can be :class or :style.
+#
+# Default: :class
+#
+# === :wrap
+# Wrap in :page, :div, :span or nil.
+#
+# You can also use Encoders::Div and Encoders::Span.
+#
+# Default: nil
+#
+# === :title
+#
+# The title of the HTML page (works only when :wrap is set to :page.)
+#
+# Default: 'CodeRay output'
+#
+# === :break_lines
+#
+# Split multiline blocks at line breaks.
+# Forced to true if :line_numbers option is set to :inline.
+#
+# Default: false
+#
+# === :line_numbers
+# Include line numbers in :table, :inline, or nil (no line numbers)
+#
+# Default: nil
+#
+# === :line_number_anchors
+# Adds anchors and links to the line numbers. Can be false (off), true (on),
+# or a prefix string that will be prepended to the anchor name.
+#
+# The prefix must consist only of letters, digits, and underscores.
+#
+# Default: true, default prefix name: "line"
+#
+# === :line_number_start
+# Where to start with line number counting.
+#
+# Default: 1
+#
+# === :bold_every
+# Make every +n+-th number appear bold.
+#
+# Default: 10
+#
+# === :highlight_lines
+#
+# Highlights certain line numbers.
+# Can be any Enumerable, typically just an Array or Range, of numbers.
+#
+# Bolding is deactivated when :highlight_lines is set. It only makes sense
+# in combination with :line_numbers.
+#
+# Default: nil
+#
+# === :hint
+# Include some information into the output using the title attribute.
+# Can be :info (show token kind on mouse-over), :info_long (with full path)
+# or :debug (via inspect).
+#
+# Default: false
+#
+# source://coderay//lib/coderay/encoders/html.rb#97
class CodeRay::Encoders::HTML < ::CodeRay::Encoders::Encoder
+ # token groups, eg. strings
+ #
+ # source://coderay//lib/coderay/encoders/html.rb#235
def begin_group(kind); end
+
+ # whole lines to be highlighted, eg. a deleted line in a diff
+ #
+ # source://coderay//lib/coderay/encoders/html.rb#247
def begin_line(kind); end
+
+ # Returns the value of attribute css.
+ #
+ # source://coderay//lib/coderay/encoders/html.rb#126
def css; end
+
+ # source://coderay//lib/coderay/encoders/html.rb#241
def end_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/html.rb#261
def end_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/html.rb#221
def text_token(text, kind); end
protected
+ # source://coderay//lib/coderay/encoders/html.rb#316
def break_lines(text, style); end
+
+ # source://coderay//lib/coderay/encoders/html.rb#310
def check_group_nesting(name, kind); end
+
+ # source://coderay//lib/coderay/encoders/html.rb#268
def check_options!(options); end
+
+ # source://coderay//lib/coderay/encoders/html.rb#324
def close_span; end
+
+ # source://coderay//lib/coderay/encoders/html.rb#280
def css_class_for_kinds(kinds); end
+
+ # source://coderay//lib/coderay/encoders/html.rb#195
def finish(options); end
+
+ # source://coderay//lib/coderay/encoders/html.rb#289
def make_span_for_kinds(method, hint); end
+
+ # source://coderay//lib/coderay/encoders/html.rb#172
def setup(options); end
+
+ # source://coderay//lib/coderay/encoders/html.rb#284
def style_for_kinds(kinds); end
class << self
+ # source://coderay//lib/coderay/encoders/html.rb#130
def make_html_escape_hash; end
+
+ # Generate a hint about the given +kinds+ in a +hint+ style.
+ #
+ # +hint+ may be :info, :info_long or :debug.
+ #
+ # source://coderay//lib/coderay/encoders/html.rb#157
def token_path_to_hint(hint, kinds); end
end
end
+# source://coderay//lib/coderay/encoders/html/css.rb#5
class CodeRay::Encoders::HTML::CSS
+ # @return [CSS] a new instance of CSS
+ #
+ # source://coderay//lib/coderay/encoders/html/css.rb#13
def initialize(style = T.unsafe(nil)); end
+ # source://coderay//lib/coderay/encoders/html/css.rb#23
def get_style_for_css_classes(css_classes); end
+
+ # Returns the value of attribute stylesheet.
+ #
+ # source://coderay//lib/coderay/encoders/html/css.rb#7
def stylesheet; end
private
+ # source://coderay//lib/coderay/encoders/html/css.rb#49
def parse(stylesheet); end
class << self
+ # source://coderay//lib/coderay/encoders/html/css.rb#9
def load_stylesheet(style = T.unsafe(nil)); end
end
end
+# source://coderay//lib/coderay/encoders/html/css.rb#36
CodeRay::Encoders::HTML::CSS::CSS_CLASS_PATTERN = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/encoders/html.rb#103
CodeRay::Encoders::HTML::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/encoders/html.rb#101
CodeRay::Encoders::HTML::FILE_EXTENSION = T.let(T.unsafe(nil), String)
+
+# source://coderay//lib/coderay/encoders/html.rb#143
CodeRay::Encoders::HTML::HTML_ESCAPE = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/encoders/html.rb#144
CodeRay::Encoders::HTML::HTML_ESCAPE_PATTERN = T.let(T.unsafe(nil), Regexp)
+# source://coderay//lib/coderay/encoders/html/numbering.rb#6
module CodeRay::Encoders::HTML::Numbering
class << self
+ # source://coderay//lib/coderay/encoders/html/numbering.rb#8
def number!(output, mode = T.unsafe(nil), options = T.unsafe(nil)); end
end
end
+# This module is included in the output String of the HTML Encoder.
+#
+# It provides methods like wrap, div, page etc.
+#
+# Remember to use #clone instead of #dup to keep the modules the object was
+# extended with.
+#
+# TODO: Rewrite this without monkey patching.
+#
+# source://coderay//lib/coderay/encoders/html/output.rb#14
module CodeRay::Encoders::HTML::Output
+ # source://coderay//lib/coderay/encoders/html/output.rb#57
def apply_title!(title); end
+
+ # Returns the value of attribute css.
+ #
+ # source://coderay//lib/coderay/encoders/html/output.rb#16
def css; end
+
+ # Sets the attribute css
+ #
+ # @param value the value to set the attribute css to.
+ #
+ # source://coderay//lib/coderay/encoders/html/output.rb#16
def css=(_arg0); end
+
+ # source://coderay//lib/coderay/encoders/html/output.rb#86
def stylesheet(in_tag = T.unsafe(nil)); end
+
+ # source://coderay//lib/coderay/encoders/html/output.rb#62
def wrap!(element, *args); end
+
+ # source://coderay//lib/coderay/encoders/html/output.rb#52
def wrap_in!(template); end
+
+ # source://coderay//lib/coderay/encoders/html/output.rb#47
def wrapped_in; end
+
+ # Sets the attribute wrapped_in
+ #
+ # @param value the value to set the attribute wrapped_in to.
+ #
+ # source://coderay//lib/coderay/encoders/html/output.rb#50
def wrapped_in=(_arg0); end
+
+ # @return [Boolean]
+ #
+ # source://coderay//lib/coderay/encoders/html/output.rb#43
def wrapped_in?(element); end
class << self
+ # Raises an exception if an object that doesn't respond to to_str is extended by Output,
+ # to prevent users from misuse. Use Module#remove_method to disable.
+ #
+ # source://coderay//lib/coderay/encoders/html/output.rb#22
def extended(o); end
+
+ # source://coderay//lib/coderay/encoders/html/output.rb#26
def make_stylesheet(css, in_tag = T.unsafe(nil)); end
+
+ # source://coderay//lib/coderay/encoders/html/output.rb#36
def page_template_for_css(css); end
end
end
+# source://coderay//lib/coderay/encoders/html/output.rb#117
CodeRay::Encoders::HTML::Output::DIV = T.let(T.unsafe(nil), CodeRay::Encoders::HTML::Output::Template)
+
+# source://coderay//lib/coderay/encoders/html/output.rb#130
CodeRay::Encoders::HTML::Output::PAGE = T.let(T.unsafe(nil), CodeRay::Encoders::HTML::Output::Template)
+
+# source://coderay//lib/coderay/encoders/html/output.rb#115
CodeRay::Encoders::HTML::Output::SPAN = T.let(T.unsafe(nil), CodeRay::Encoders::HTML::Output::Template)
+
+# source://coderay//lib/coderay/encoders/html/output.rb#123
CodeRay::Encoders::HTML::Output::TABLE = T.let(T.unsafe(nil), CodeRay::Encoders::HTML::Output::Template)
+# -- don't include the templates in docu
+#
+# source://coderay//lib/coderay/encoders/html/output.rb#92
class CodeRay::Encoders::HTML::Output::Template < ::String
+ # source://coderay//lib/coderay/encoders/html/output.rb#104
def apply(target, replacement); end
class << self
+ # source://coderay//lib/coderay/encoders/html/output.rb#94
def wrap!(str, template, target); end
end
end
+# source://coderay//lib/coderay/encoders/html.rb#146
CodeRay::Encoders::HTML::TOKEN_KIND_TO_INFO = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/encoders/html.rb#150
CodeRay::Encoders::HTML::TRANSPARENT_TOKEN_KINDS = T.let(T.unsafe(nil), Set)
+# A simple JSON Encoder.
+#
+# Example:
+# CodeRay.scan('puts "Hello world!"', :ruby).json
+# yields
+# [
+# {"type"=>"text", "text"=>"puts", "kind"=>"ident"},
+# {"type"=>"text", "text"=>" ", "kind"=>"space"},
+# {"type"=>"block", "action"=>"open", "kind"=>"string"},
+# {"type"=>"text", "text"=>"\"", "kind"=>"delimiter"},
+# {"type"=>"text", "text"=>"Hello world!", "kind"=>"content"},
+# {"type"=>"text", "text"=>"\"", "kind"=>"delimiter"},
+# {"type"=>"block", "action"=>"close", "kind"=>"string"},
+# ]
+#
+# source://coderay//lib/coderay/encoders/json.rb#18
class CodeRay::Encoders::JSON < ::CodeRay::Encoders::Encoder
+ # source://coderay//lib/coderay/encoders/json.rb#64
def begin_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/json.rb#72
def begin_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/json.rb#68
def end_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/json.rb#76
def end_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/json.rb#60
def text_token(text, kind); end
protected
+ # source://coderay//lib/coderay/encoders/json.rb#49
def append(data); end
+
+ # source://coderay//lib/coderay/encoders/json.rb#45
def finish(options); end
+
+ # source://coderay//lib/coderay/encoders/json.rb#38
def setup(options); end
end
+# source://coderay//lib/coderay/encoders/json.rb#35
CodeRay::Encoders::JSON::FILE_EXTENSION = T.let(T.unsafe(nil), String)
+# Counts the LoC (Lines of Code). Returns an Integer >= 0.
+#
+# Alias: +loc+
+#
+# Everything that is not comment, markup, doctype/shebang, or an empty line,
+# is considered to be code.
+#
+# For example,
+# * HTML files not containing JavaScript have 0 LoC
+# * in a Java class without comments, LoC is the number of non-empty lines
+#
+# A Scanner class should define the token kinds that are not code in the
+# KINDS_NOT_LOC constant, which defaults to [:comment, :doctype].
+#
+# source://coderay//lib/coderay/encoders/lines_of_code.rb#17
class CodeRay::Encoders::LinesOfCode < ::CodeRay::Encoders::TokenKindFilter
protected
+ # source://coderay//lib/coderay/encoders/lines_of_code.rb#38
def finish(options); end
+
+ # source://coderay//lib/coderay/encoders/lines_of_code.rb#25
def setup(options); end
end
+# source://coderay//lib/coderay/encoders/lines_of_code.rb#21
CodeRay::Encoders::LinesOfCode::NON_EMPTY_LINE = T.let(T.unsafe(nil), Regexp)
+# = Lint Encoder
+#
+# Checks for:
+#
+# - empty tokens
+# - incorrect nesting
+#
+# It will raise an InvalidTokenStream exception when any of the above occurs.
+#
+# See also: Encoders::DebugLint
+#
+# source://coderay//lib/coderay/encoders/lint.rb#14
class CodeRay::Encoders::Lint < ::CodeRay::Encoders::Debug
+ # source://coderay//lib/coderay/encoders/lint.rb#28
def begin_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/lint.rb#37
def begin_line(kind); end
+
+ # @raise [IncorrectTokenGroupNesting]
+ #
+ # source://coderay//lib/coderay/encoders/lint.rb#32
def end_group(kind); end
+
+ # @raise [IncorrectTokenGroupNesting]
+ #
+ # source://coderay//lib/coderay/encoders/lint.rb#41
def end_line(kind); end
+
+ # @raise [EmptyToken]
+ #
+ # source://coderay//lib/coderay/encoders/lint.rb#23
def text_token(text, kind); end
protected
+ # source://coderay//lib/coderay/encoders/lint.rb#52
def finish(options); end
+
+ # source://coderay//lib/coderay/encoders/lint.rb#48
def setup(options); end
end
+# source://coderay//lib/coderay/encoders/lint.rb#19
class CodeRay::Encoders::Lint::EmptyToken < ::CodeRay::Encoders::Lint::InvalidTokenStream; end
+
+# source://coderay//lib/coderay/encoders/lint.rb#21
class CodeRay::Encoders::Lint::IncorrectTokenGroupNesting < ::CodeRay::Encoders::Lint::InvalidTokenStream; end
+
+# source://coderay//lib/coderay/encoders/lint.rb#18
class CodeRay::Encoders::Lint::InvalidTokenStream < ::StandardError; end
+
+# source://coderay//lib/coderay/encoders/lint.rb#20
class CodeRay::Encoders::Lint::UnknownTokenKind < ::CodeRay::Encoders::Lint::InvalidTokenStream; end
+# = Null Encoder
+#
+# Does nothing and returns an empty string.
+#
+# source://coderay//lib/coderay/encoders/null.rb#7
class CodeRay::Encoders::Null < ::CodeRay::Encoders::Encoder
+ # source://coderay//lib/coderay/encoders/null.rb#11
def text_token(text, kind); end
end
+# Wraps the output into a HTML page, using CSS classes and
+# line numbers in the table format by default.
+#
+# See Encoders::HTML for available options.
+#
+# source://coderay//lib/coderay/encoders/page.rb#10
class CodeRay::Encoders::Page < ::CodeRay::Encoders::HTML; end
+
+# source://coderay//lib/coderay/encoders/page.rb#16
CodeRay::Encoders::Page::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/encoders/page.rb#12
CodeRay::Encoders::Page::FILE_EXTENSION = T.let(T.unsafe(nil), String)
+
+# Wraps HTML output into a SPAN element, using inline styles by default.
+#
+# See Encoders::HTML for available options.
+#
+# source://coderay//lib/coderay/encoders/span.rb#9
class CodeRay::Encoders::Span < ::CodeRay::Encoders::HTML; end
+
+# source://coderay//lib/coderay/encoders/span.rb#15
CodeRay::Encoders::Span::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/encoders/span.rb#11
CodeRay::Encoders::Span::FILE_EXTENSION = T.let(T.unsafe(nil), String)
+# Makes a statistic for the given tokens.
+#
+# Alias: +stats+
+#
+# source://coderay//lib/coderay/encoders/statistic.rb#7
class CodeRay::Encoders::Statistic < ::CodeRay::Encoders::Encoder
+ # source://coderay//lib/coderay/encoders/statistic.rb#70
def begin_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/statistic.rb#78
def begin_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/statistic.rb#86
def block_token(action, kind); end
+
+ # source://coderay//lib/coderay/encoders/statistic.rb#74
def end_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/statistic.rb#82
def end_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/statistic.rb#11
def real_token_count; end
+
+ # source://coderay//lib/coderay/encoders/statistic.rb#62
def text_token(text, kind); end
+
+ # source://coderay//lib/coderay/encoders/statistic.rb#11
def type_stats; end
protected
+ # source://coderay//lib/coderay/encoders/statistic.rb#42
def finish(options); end
+
+ # source://coderay//lib/coderay/encoders/statistic.rb#17
def setup(options); end
end
+# source://coderay//lib/coderay/encoders/statistic.rb#24
CodeRay::Encoders::Statistic::STATS = T.let(T.unsafe(nil), String)
+
+# source://coderay//lib/coderay/encoders/statistic.rb#38
CodeRay::Encoders::Statistic::TOKEN_TYPES_ROW = T.let(T.unsafe(nil), String)
+# source://coderay//lib/coderay/encoders/statistic.rb#13
class CodeRay::Encoders::Statistic::TypeStats < ::Struct
+ # Returns the value of attribute count
+ #
+ # @return [Object] the current value of count
def count; end
+
+ # Sets the attribute count
+ #
+ # @param value [Object] the value to set the attribute count to.
+ # @return [Object] the newly set value
def count=(_); end
+
+ # Returns the value of attribute size
+ #
+ # @return [Object] the current value of size
def size; end
+
+ # Sets the attribute size
+ #
+ # @param value [Object] the value to set the attribute size to.
+ # @return [Object] the newly set value
def size=(_); end
class << self
def [](*_arg0); end
def inspect; end
+ def keyword_init?; end
def members; end
def new(*_arg0); end
end
end
+# source://coderay//lib/coderay/encoders/terminal.rb#17
class CodeRay::Encoders::Terminal < ::CodeRay::Encoders::Encoder
+ # source://coderay//lib/coderay/encoders/terminal.rb#156
def begin_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/terminal.rb#156
def begin_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/terminal.rb#162
def end_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/terminal.rb#172
def end_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/terminal.rb#141
def text_token(text, kind); end
protected
+ # source://coderay//lib/coderay/encoders/terminal.rb#133
def setup(options); end
private
+ # source://coderay//lib/coderay/encoders/terminal.rb#179
def open_token(kind); end
end
+# source://coderay//lib/coderay/encoders/terminal.rb#21
CodeRay::Encoders::Terminal::TOKEN_COLORS = T.let(T.unsafe(nil), Hash)
+# Concats the tokens into a single string, resulting in the original
+# code string if no tokens were removed.
+#
+# Alias: +plain+, +plaintext+
+#
+# == Options
+#
+# === :separator
+# A separator string to join the tokens.
+#
+# Default: empty String
+#
+# source://coderay//lib/coderay/encoders/text.rb#15
class CodeRay::Encoders::Text < ::CodeRay::Encoders::Encoder
+ # source://coderay//lib/coderay/encoders/text.rb#25
def text_token(text, kind); end
protected
+ # source://coderay//lib/coderay/encoders/text.rb#36
def setup(options); end
end
+# source://coderay//lib/coderay/encoders/text.rb#21
CodeRay::Encoders::Text::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/encoders/text.rb#19
CodeRay::Encoders::Text::FILE_EXTENSION = T.let(T.unsafe(nil), String)
+# A Filter that selects tokens based on their token kind.
+#
+# == Options
+#
+# === :exclude
+#
+# One or many symbols (in an Array) which shall be excluded.
+#
+# Default: []
+#
+# === :include
+#
+# One or many symbols (in an array) which shall be included.
+#
+# Default: :all, which means all tokens are included.
+#
+# Exclusion wins over inclusion.
+#
+# See also: CommentFilter
+#
+# source://coderay//lib/coderay/encoders/token_kind_filter.rb#25
class CodeRay::Encoders::TokenKindFilter < ::CodeRay::Encoders::Filter
+ # Add the token group to the output stream if +kind+ matches the
+ # conditions.
+ #
+ # If it does not, all tokens inside the group are excluded from the
+ # stream, even if their kinds match.
+ #
+ # source://coderay//lib/coderay/encoders/token_kind_filter.rb#66
def begin_group(kind); end
+
+ # See +begin_group+.
+ #
+ # source://coderay//lib/coderay/encoders/token_kind_filter.rb#77
def begin_line(kind); end
+
+ # Take care of re-enabling the delegation of tokens to the output stream
+ # if an exluded group has ended.
+ #
+ # source://coderay//lib/coderay/encoders/token_kind_filter.rb#89
def end_group(kind); end
+
+ # See +end_group+.
+ #
+ # source://coderay//lib/coderay/encoders/token_kind_filter.rb#99
def end_line(kind); end
+
+ # Add the token to the output stream if +kind+ matches the conditions.
+ #
+ # source://coderay//lib/coderay/encoders/token_kind_filter.rb#57
def text_token(text, kind); end
protected
+ # @return [Boolean]
+ #
+ # source://coderay//lib/coderay/encoders/token_kind_filter.rb#49
def include_group?(kind); end
+
+ # @return [Boolean]
+ #
+ # source://coderay//lib/coderay/encoders/token_kind_filter.rb#45
def include_text_token?(text, kind); end
+
+ # source://coderay//lib/coderay/encoders/token_kind_filter.rb#35
def setup(options); end
end
+# source://coderay//lib/coderay/encoders/token_kind_filter.rb#29
CodeRay::Encoders::TokenKindFilter::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+# = XML Encoder
+#
+# Uses REXML. Very slow.
+#
+# source://coderay//lib/coderay/encoders/xml.rb#7
class CodeRay::Encoders::XML < ::CodeRay::Encoders::Encoder
+ # source://coderay//lib/coderay/encoders/xml.rb#58
def begin_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/xml.rb#62
def end_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/xml.rb#38
def text_token(text, kind); end
protected
+ # source://coderay//lib/coderay/encoders/xml.rb#31
def finish(options); end
+
+ # source://coderay//lib/coderay/encoders/xml.rb#22
def setup(options); end
end
+# source://coderay//lib/coderay/encoders/xml.rb#15
CodeRay::Encoders::XML::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/encoders/xml.rb#11
CodeRay::Encoders::XML::FILE_EXTENSION = T.let(T.unsafe(nil), String)
+# = YAML Encoder
+#
+# Slow.
+#
+# source://coderay//lib/coderay/encoders/yaml.rb#9
class CodeRay::Encoders::YAML < ::CodeRay::Encoders::Encoder
+ # source://coderay//lib/coderay/encoders/yaml.rb#31
def begin_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/yaml.rb#39
def begin_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/yaml.rb#35
def end_group(kind); end
+
+ # source://coderay//lib/coderay/encoders/yaml.rb#43
def end_line(kind); end
+
+ # source://coderay//lib/coderay/encoders/yaml.rb#27
def text_token(text, kind); end
protected
+ # source://coderay//lib/coderay/encoders/yaml.rb#22
def finish(options); end
+
+ # source://coderay//lib/coderay/encoders/yaml.rb#16
def setup(options); end
end
+# source://coderay//lib/coderay/encoders/yaml.rb#13
CodeRay::Encoders::YAML::FILE_EXTENSION = T.let(T.unsafe(nil), String)
+# = FileType
+#
+# A simple filetype recognizer.
+#
+# == Usage
+#
+# # determine the type of the given
+# lang = FileType[file_name]
+#
+# # return :text if the file type is unknown
+# lang = FileType.fetch file_name, :text
+#
+# # try the shebang line, too
+# lang = FileType.fetch file_name, :text, true
+#
+# source://coderay//lib/coderay/helpers/file_type.rb#17
module CodeRay::FileType
class << self
+ # Try to determine the file type of the file.
+ #
+ # +filename+ is a relative or absolute path to a file.
+ #
+ # The file itself is only accessed when +read_shebang+ is set to true.
+ # That means you can get filetypes from files that don't exist.
+ #
+ # source://coderay//lib/coderay/helpers/file_type.rb#29
def [](filename, read_shebang = T.unsafe(nil)); end
+
+ # This works like Hash#fetch.
+ #
+ # If the filetype cannot be found, the +default+ value
+ # is returned.
+ #
+ # source://coderay//lib/coderay/helpers/file_type.rb#50
def fetch(filename, default = T.unsafe(nil), read_shebang = T.unsafe(nil)); end
protected
+ # source://coderay//lib/coderay/helpers/file_type.rb#66
def type_from_shebang(filename); end
end
end
+# source://coderay//lib/coderay/helpers/file_type.rb#79
CodeRay::FileType::TypeFromExt = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/helpers/file_type.rb#139
CodeRay::FileType::TypeFromName = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/helpers/file_type.rb#137
CodeRay::FileType::TypeFromShebang = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/helpers/file_type.rb#19
class CodeRay::FileType::UnknownFileType < ::Exception; end
+# = Plugin
+#
+# Plugins have to include this module.
+#
+# IMPORTANT: Use extend for this module.
+#
+# See CodeRay::PluginHost for examples.
+#
+# source://coderay//lib/coderay/helpers/plugin.rb#10
module CodeRay::Plugin
+ # source://coderay//lib/coderay/helpers/plugin.rb#46
def aliases; end
+
+ # The PluginHost for this Plugin class.
+ #
+ # source://coderay//lib/coderay/helpers/plugin.rb#39
def plugin_host(host = T.unsafe(nil)); end
+
+ # Returns the value of attribute plugin_id.
+ #
+ # source://coderay//lib/coderay/helpers/plugin.rb#12
def plugin_id; end
+
+ # Register this class for the given +id+.
+ #
+ # Example:
+ # class MyPlugin < PluginHost::BaseClass
+ # register_for :my_id
+ # ...
+ # end
+ #
+ # See PluginHost.register.
+ #
+ # source://coderay//lib/coderay/helpers/plugin.rb#23
def register_for(id); end
+
+ # Returns the title of the plugin, or sets it to the
+ # optional argument +title+.
+ #
+ # source://coderay//lib/coderay/helpers/plugin.rb#30
def title(title = T.unsafe(nil)); end
end
+# = PluginHost
+#
+# A simple subclass/subfolder plugin system.
+#
+# Example:
+# class Generators
+# extend PluginHost
+# plugin_path 'app/generators'
+# end
+#
+# class Generator
+# extend Plugin
+# PLUGIN_HOST = Generators
+# end
+#
+# class FancyGenerator < Generator
+# register_for :fancy
+# end
+#
+# Generators[:fancy] #-> FancyGenerator
+# # or
+# CodeRay.require_plugin 'Generators/fancy'
+# # or
+# Generators::Fancy
+#
+# source://coderay//lib/coderay/helpers/plugin_host.rb#27
module CodeRay::PluginHost
+ # Returns the Plugin for +id+.
+ #
+ # Example:
+ # yaml_plugin = MyPluginHost[:yaml]
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#49
def [](id, *args, &blk); end
+
+ # Returns an array of all Plugins.
+ #
+ # Note: This loads all plugins using load_all.
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#151
def all_plugins; end
+
+ # Tries to +load+ the missing plugin by translating +const+ to the
+ # underscore form (eg. LinesOfCode becomes lines_of_code).
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#61
def const_missing(const); end
+
+ # Define the default plugin to use when no plugin is found
+ # for a given id, or return the default plugin.
+ #
+ # See also map.
+ #
+ # class MyColorHost < PluginHost
+ # map :navy => :dark_blue
+ # default :gray
+ # end
+ #
+ # MyColorHost.default # loads and returns the Gray plugin
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#114
def default(id = T.unsafe(nil)); end
+
+ # Returns an array of all .rb files in the plugin path.
+ #
+ # The extension .rb is not included.
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#140
def list; end
+
+ # Returns the Plugin for +id+.
+ #
+ # Example:
+ # yaml_plugin = MyPluginHost[:yaml]
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#49
def load(id, *args, &blk); end
+
+ # Loads all plugins using list and load.
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#39
def load_all; end
+
+ # Loads the map file (see map).
+ #
+ # This is done automatically when plugin_path is called.
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#159
def load_plugin_map; end
+
+ # Map a plugin_id to another.
+ #
+ # Usage: Put this in a file plugin_path/_map.rb.
+ #
+ # class MyColorHost < PluginHost
+ # map :navy => :dark_blue,
+ # :maroon => :brown,
+ # :luna => :moon
+ # end
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#95
def map(hash); end
+
+ # A Hash of plugion_id => Plugin pairs.
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#133
def plugin_hash; end
+
+ # The path where the plugins can be found.
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#79
def plugin_path(*args); end
+
+ # Every plugin must register itself for +id+ by calling register_for,
+ # which calls this method.
+ #
+ # See Plugin#register_for.
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#128
def register(plugin, id); end
protected
+ # Return a plugin hash that automatically loads plugins.
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#172
def make_plugin_hash; end
+
+ # Returns the expected path to the plugin file for the given id.
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#196
def path_to(plugin_id); end
+
+ # Converts +id+ to a valid plugin ID String, or returns +nil+.
+ #
+ # Raises +ArgumentError+ for all other objects, or if the
+ # given String includes non-alphanumeric characters (\W).
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#204
def validate_id(id); end
class << self
+ # Adds the module/class to the PLUGIN_HOSTS list.
+ #
+ # source://coderay//lib/coderay/helpers/plugin_host.rb#72
def extended(mod); end
end
end
+# source://coderay//lib/coderay/helpers/plugin_host.rb#33
class CodeRay::PluginHost::HostNotFound < ::LoadError; end
+
+# source://coderay//lib/coderay/helpers/plugin_host.rb#35
CodeRay::PluginHost::PLUGIN_HOSTS = T.let(T.unsafe(nil), Array)
+
+# dummy hash
+#
+# source://coderay//lib/coderay/helpers/plugin_host.rb#36
CodeRay::PluginHost::PLUGIN_HOSTS_BY_ID = T.let(T.unsafe(nil), Hash)
+
+# Raised if Encoders::[] fails because:
+# * a file could not be found
+# * the requested Plugin is not registered
+#
+# source://coderay//lib/coderay/helpers/plugin_host.rb#32
class CodeRay::PluginHost::PluginNotFound < ::LoadError; end
+# = Scanners
+#
+# This module holds the Scanner class and its subclasses.
+# For example, the Ruby scanner is named CodeRay::Scanners::Ruby
+# can be found in coderay/scanners/ruby.
+#
+# Scanner also provides methods and constants for the register
+# mechanism and the [] method that returns the Scanner class
+# belonging to the given lang.
+#
+# See PluginHost.
+#
+# source://coderay//lib/coderay/scanners.rb#18
module CodeRay::Scanners
extend ::CodeRay::PluginHost
end
+# Scanner for C.
+#
+# source://coderay//lib/coderay/scanners/c.rb#5
class CodeRay::Scanners::C < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/c.rb#44
def scan_tokens(encoder, options); end
end
+# source://coderay//lib/coderay/scanners/c.rb#27
CodeRay::Scanners::C::DIRECTIVES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/c.rb#39
CodeRay::Scanners::C::ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/c.rb#33
CodeRay::Scanners::C::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# source://coderay//lib/coderay/scanners/c.rb#10
CodeRay::Scanners::C::KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/c.rb#23
CodeRay::Scanners::C::PREDEFINED_CONSTANTS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/c.rb#17
CodeRay::Scanners::C::PREDEFINED_TYPES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/c.rb#40
CodeRay::Scanners::C::UNICODE_ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# Scanner for C++.
+#
+# Aliases: +cplusplus+, c++
CodeRay::Scanners::CPlusPlus = CodeRay::Scanners::Text
+# source://coderay//lib/coderay/scanners/css.rb#4
class CodeRay::Scanners::CSS < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/css.rb#55
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/css.rb#50
def setup; end
end
+# source://coderay//lib/coderay/scanners/css.rb#8
CodeRay::Scanners::CSS::KINDS_NOT_LOC = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/css.rb#16
module CodeRay::Scanners::CSS::RE; end
+
+# source://coderay//lib/coderay/scanners/css.rb#31
CodeRay::Scanners::CSS::RE::AtKeyword = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#45
CodeRay::Scanners::CSS::RE::AttributeSelector = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#43
CodeRay::Scanners::CSS::RE::Class = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#38
CodeRay::Scanners::CSS::RE::Dimension = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#19
CodeRay::Scanners::CSS::RE::Escape = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#40
CodeRay::Scanners::CSS::RE::Function = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#17
CodeRay::Scanners::CSS::RE::Hex = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#26
CodeRay::Scanners::CSS::RE::HexColor = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#42
CodeRay::Scanners::CSS::RE::Id = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#30
CodeRay::Scanners::CSS::RE::Ident = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#20
CodeRay::Scanners::CSS::RE::NMChar = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#21
CodeRay::Scanners::CSS::RE::NMStart = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#29
CodeRay::Scanners::CSS::RE::Name = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#28
CodeRay::Scanners::CSS::RE::Num = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#32
CodeRay::Scanners::CSS::RE::Percentage = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#44
CodeRay::Scanners::CSS::RE::PseudoClass = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#24
CodeRay::Scanners::CSS::RE::String = T.let(T.unsafe(nil), Regexp)
+
+# TODO: buggy regexp
+#
+# source://coderay//lib/coderay/scanners/css.rb#22
CodeRay::Scanners::CSS::RE::String1 = T.let(T.unsafe(nil), Regexp)
+
+# TODO: buggy regexp
+#
+# source://coderay//lib/coderay/scanners/css.rb#23
CodeRay::Scanners::CSS::RE::String2 = T.let(T.unsafe(nil), Regexp)
+
+# differs from standard because it allows uppercase hex too
+#
+# source://coderay//lib/coderay/scanners/css.rb#18
CodeRay::Scanners::CSS::RE::Unicode = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/css.rb#36
CodeRay::Scanners::CSS::RE::Unit = T.let(T.unsafe(nil), Regexp)
+# source://coderay//lib/coderay/scanners/clojure.rb#6
class CodeRay::Scanners::Clojure < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/clojure.rb#145
def scan_tokens(encoder, options); end
end
+# source://coderay//lib/coderay/scanners/clojure.rb#95
CodeRay::Scanners::Clojure::BASIC_IDENTIFIER = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#133
CodeRay::Scanners::Clojure::COMPLEX10 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#134
CodeRay::Scanners::Clojure::COMPLEX16 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#136
CodeRay::Scanners::Clojure::COMPLEX2 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#135
CodeRay::Scanners::Clojure::COMPLEX8 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#16
CodeRay::Scanners::Clojure::CORE_FORMS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#120
CodeRay::Scanners::Clojure::DECIMAL = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#98
CodeRay::Scanners::Clojure::DIGIT = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#99
CodeRay::Scanners::Clojure::DIGIT10 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#100
CodeRay::Scanners::Clojure::DIGIT16 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#102
CodeRay::Scanners::Clojure::DIGIT2 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#101
CodeRay::Scanners::Clojure::DIGIT8 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#107
CodeRay::Scanners::Clojure::EXACTNESS = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#110
CodeRay::Scanners::Clojure::EXP = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#109
CodeRay::Scanners::Clojure::EXP_MARK = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#96
CodeRay::Scanners::Clojure::IDENTIFIER = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#85
CodeRay::Scanners::Clojure::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#129
CodeRay::Scanners::Clojure::IMAG10 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#130
CodeRay::Scanners::Clojure::IMAG16 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#132
CodeRay::Scanners::Clojure::IMAG2 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#131
CodeRay::Scanners::Clojure::IMAG8 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#90
CodeRay::Scanners::Clojure::KEYWORD_NEXT_TOKEN_KIND = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#141
CodeRay::Scanners::Clojure::NUM = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#137
CodeRay::Scanners::Clojure::NUM10 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#138
CodeRay::Scanners::Clojure::NUM16 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#140
CodeRay::Scanners::Clojure::NUM2 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#139
CodeRay::Scanners::Clojure::NUM8 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#78
CodeRay::Scanners::Clojure::PREDEFINED_CONSTANTS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#112
CodeRay::Scanners::Clojure::PREFIX10 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#113
CodeRay::Scanners::Clojure::PREFIX16 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#115
CodeRay::Scanners::Clojure::PREFIX2 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#114
CodeRay::Scanners::Clojure::PREFIX8 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#106
CodeRay::Scanners::Clojure::RADIX10 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#103
CodeRay::Scanners::Clojure::RADIX16 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#105
CodeRay::Scanners::Clojure::RADIX2 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#104
CodeRay::Scanners::Clojure::RADIX8 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#125
CodeRay::Scanners::Clojure::REAL10 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#126
CodeRay::Scanners::Clojure::REAL16 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#128
CodeRay::Scanners::Clojure::REAL2 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#127
CodeRay::Scanners::Clojure::REAL8 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#108
CodeRay::Scanners::Clojure::SIGN = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#11
CodeRay::Scanners::Clojure::SPECIAL_FORMS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#111
CodeRay::Scanners::Clojure::SUFFIX = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#97
CodeRay::Scanners::Clojure::SYMBOL = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#116
CodeRay::Scanners::Clojure::UINT10 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#117
CodeRay::Scanners::Clojure::UINT16 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#119
CodeRay::Scanners::Clojure::UINT2 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#118
CodeRay::Scanners::Clojure::UINT8 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#121
CodeRay::Scanners::Clojure::UREAL10 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#122
CodeRay::Scanners::Clojure::UREAL16 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#124
CodeRay::Scanners::Clojure::UREAL2 = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/clojure.rb#123
CodeRay::Scanners::Clojure::UREAL8 = T.let(T.unsafe(nil), Regexp)
+# = Debug Scanner
+#
+# Interprets the output of the Encoders::Debug encoder (basically the inverse function).
+#
+# source://coderay//lib/coderay/scanners/debug.rb#9
class CodeRay::Scanners::Debug < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/debug.rb#21
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/debug.rb#16
def setup; end
end
+# Scanner for the Delphi language (Object Pascal).
+#
+# Alias: +pascal+
+#
+# source://coderay//lib/coderay/scanners/delphi.rb#7
class CodeRay::Scanners::Delphi < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/delphi.rb#45
def scan_tokens(encoder, options); end
end
+# source://coderay//lib/coderay/scanners/delphi.rb#25
CodeRay::Scanners::Delphi::DIRECTIVES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/delphi.rb#36
CodeRay::Scanners::Delphi::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList::CaseIgnoring)
+
+# source://coderay//lib/coderay/scanners/delphi.rb#12
CodeRay::Scanners::Delphi::KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/delphi.rb#40
CodeRay::Scanners::Delphi::NAME_FOLLOWS = T.let(T.unsafe(nil), CodeRay::WordList::CaseIgnoring)
+# Scanner for output of the diff command.
+#
+# Alias: +patch+
+#
+# source://coderay//lib/coderay/scanners/diff.rb#7
class CodeRay::Scanners::Diff < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/diff.rb#19
def scan_tokens(encoder, options); end
private
+ # source://coderay//lib/coderay/scanners/diff.rb#204
def diff(a, b); end
end
+# source://coderay//lib/coderay/scanners/diff.rb#12
CodeRay::Scanners::Diff::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+# Scanner for HTML ERB templates.
+#
+# source://coderay//lib/coderay/scanners/erb.rb#8
class CodeRay::Scanners::ERB < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/erb.rb#38
def reset_instance; end
+
+ # source://coderay//lib/coderay/scanners/erb.rb#43
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/erb.rb#33
def setup; end
end
+# source://coderay//lib/coderay/scanners/erb.rb#15
CodeRay::Scanners::ERB::ERB_RUBY_BLOCK = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/erb.rb#13
CodeRay::Scanners::ERB::KINDS_NOT_LOC = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/erb.rb#27
CodeRay::Scanners::ERB::START_OF_ERB = T.let(T.unsafe(nil), Regexp)
+# source://coderay//lib/coderay/scanners/go.rb#4
class CodeRay::Scanners::Go < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/go.rb#50
def scan_tokens(encoder, options); end
end
+# source://coderay//lib/coderay/scanners/go.rb#45
CodeRay::Scanners::Go::ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/go.rb#39
CodeRay::Scanners::Go::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# http://golang.org/ref/spec#Keywords
+#
+# source://coderay//lib/coderay/scanners/go.rb#10
CodeRay::Scanners::Go::KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/go.rb#29
CodeRay::Scanners::Go::PREDEFINED_CONSTANTS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/go.rb#34
CodeRay::Scanners::Go::PREDEFINED_FUNCTIONS = T.let(T.unsafe(nil), Array)
+
+# http://golang.org/ref/spec#Types
+#
+# source://coderay//lib/coderay/scanners/go.rb#19
CodeRay::Scanners::Go::PREDEFINED_TYPES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/go.rb#46
CodeRay::Scanners::Go::UNICODE_ESCAPE = T.let(T.unsafe(nil), Regexp)
+# Scanner for Groovy.
+#
+# source://coderay//lib/coderay/scanners/groovy.rb#7
class CodeRay::Scanners::Groovy < ::CodeRay::Scanners::Java
protected
+ # source://coderay//lib/coderay/scanners/groovy.rb#43
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/groovy.rb#39
def setup; end
end
+# source://coderay//lib/coderay/scanners/groovy.rb#24
CodeRay::Scanners::Groovy::ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# TODO: check list of keywords
+#
+# source://coderay//lib/coderay/scanners/groovy.rb#12
CodeRay::Scanners::Groovy::GROOVY_KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/groovy.rb#18
CodeRay::Scanners::Groovy::GROOVY_MAGIC_VARIABLES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/groovy.rb#20
CodeRay::Scanners::Groovy::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# source://coderay//lib/coderay/scanners/groovy.rb#15
CodeRay::Scanners::Groovy::KEYWORDS_EXPECTING_VALUE = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# source://coderay//lib/coderay/scanners/groovy.rb#26
CodeRay::Scanners::Groovy::REGEXP_ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# TODO: interpretation inside ', ", /
+#
+# source://coderay//lib/coderay/scanners/groovy.rb#29
CodeRay::Scanners::Groovy::STRING_CONTENT_PATTERN = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/groovy.rb#25
CodeRay::Scanners::Groovy::UNICODE_ESCAPE = T.let(T.unsafe(nil), Regexp)
+# source://coderay//lib/coderay/scanners/haml.rb#8
class CodeRay::Scanners::HAML < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/haml.rb#24
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/haml.rb#17
def setup; end
end
+# source://coderay//lib/coderay/scanners/haml.rb#13
CodeRay::Scanners::HAML::KINDS_NOT_LOC = T.let(T.unsafe(nil), Array)
+# HTML Scanner
+#
+# Alias: +xhtml+
+#
+# See also: Scanners::XML
+#
+# source://coderay//lib/coderay/scanners/html.rb#9
class CodeRay::Scanners::HTML < ::CodeRay::Scanners::Scanner
+ # source://coderay//lib/coderay/scanners/html.rb#62
def reset; end
protected
+ # source://coderay//lib/coderay/scanners/html.rb#83
def scan_css(encoder, code, state = T.unsafe(nil)); end
+
+ # source://coderay//lib/coderay/scanners/html.rb#76
def scan_java_script(encoder, code); end
+
+ # source://coderay//lib/coderay/scanners/html.rb#90
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/html.rb#70
def setup; end
end
+# source://coderay//lib/coderay/scanners/html.rb#39
CodeRay::Scanners::HTML::ATTR_NAME = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/html.rb#42
CodeRay::Scanners::HTML::ENTITY = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/html.rb#20
CodeRay::Scanners::HTML::EVENT_ATTRIBUTES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/html.rb#41
CodeRay::Scanners::HTML::HEX = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/html.rb#35
CodeRay::Scanners::HTML::IN_ATTRIBUTE = T.let(T.unsafe(nil), CodeRay::WordList::CaseIgnoring)
+
+# source://coderay//lib/coderay/scanners/html.rb#13
CodeRay::Scanners::HTML::KINDS_NOT_LOC = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/html.rb#57
CodeRay::Scanners::HTML::PLAIN_STRING_CONTENT = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/html.rb#40
CodeRay::Scanners::HTML::TAG_END = T.let(T.unsafe(nil), Regexp)
+# Scanner for JSON (JavaScript Object Notation).
+#
+# source://coderay//lib/coderay/scanners/json.rb#5
class CodeRay::Scanners::JSON < ::CodeRay::Scanners::Scanner
protected
+ # See http://json.org/ for a definition of the JSON lexic/grammar.
+ #
+ # source://coderay//lib/coderay/scanners/json.rb#26
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/json.rb#21
def setup; end
end
+# source://coderay//lib/coderay/scanners/json.rb#15
CodeRay::Scanners::JSON::ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/json.rb#17
CodeRay::Scanners::JSON::KEY = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/json.rb#10
CodeRay::Scanners::JSON::KINDS_NOT_LOC = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/json.rb#16
CodeRay::Scanners::JSON::UNICODE_ESCAPE = T.let(T.unsafe(nil), Regexp)
+# Scanner for Java.
+#
+# source://coderay//lib/coderay/scanners/java.rb#5
class CodeRay::Scanners::Java < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/java.rb#51
def scan_tokens(encoder, options); end
end
+# source://coderay//lib/coderay/scanners/java/builtin_types.rb#4
module CodeRay::Scanners::Java::BuiltinTypes; end
+
+# source://coderay//lib/coderay/scanners/java/builtin_types.rb#7
CodeRay::Scanners::Java::BuiltinTypes::List = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/java.rb#19
CodeRay::Scanners::Java::CONSTANTS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/java.rb#25
CodeRay::Scanners::Java::DIRECTIVES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/java.rb#40
CodeRay::Scanners::Java::ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/java.rb#47
CodeRay::Scanners::Java::IDENT = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/java.rb#30
CodeRay::Scanners::Java::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html
+#
+# source://coderay//lib/coderay/scanners/java.rb#12
CodeRay::Scanners::Java::KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/java.rb#20
CodeRay::Scanners::Java::MAGIC_VARIABLES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/java.rb#18
CodeRay::Scanners::Java::RESERVED = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/java.rb#42
CodeRay::Scanners::Java::STRING_CONTENT_PATTERN = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/java.rb#21
CodeRay::Scanners::Java::TYPES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/java.rb#41
CodeRay::Scanners::Java::UNICODE_ESCAPE = T.let(T.unsafe(nil), Regexp)
+# Scanner for JavaScript.
+#
+# Aliases: +ecmascript+, +ecma_script+, +javascript+
+#
+# source://coderay//lib/coderay/scanners/java_script.rb#7
class CodeRay::Scanners::JavaScript < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/java_script.rb#224
def reset_instance; end
+
+ # source://coderay//lib/coderay/scanners/java_script.rb#61
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/java_script.rb#57
def setup; end
+
+ # source://coderay//lib/coderay/scanners/java_script.rb#229
def xml_scanner; end
end
+# source://coderay//lib/coderay/scanners/java_script.rb#42
CodeRay::Scanners::JavaScript::ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/java_script.rb#36
CodeRay::Scanners::JavaScript::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# The actual JavaScript keywords.
+#
+# source://coderay//lib/coderay/scanners/java_script.rb#13
CodeRay::Scanners::JavaScript::KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/java_script.rb#24
CodeRay::Scanners::JavaScript::KEYWORDS_EXPECTING_VALUE = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# source://coderay//lib/coderay/scanners/java_script.rb#50
CodeRay::Scanners::JavaScript::KEY_CHECK_PATTERN = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/java_script.rb#22
CodeRay::Scanners::JavaScript::MAGIC_VARIABLES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/java_script.rb#18
CodeRay::Scanners::JavaScript::PREDEFINED_CONSTANTS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/java_script.rb#44
CodeRay::Scanners::JavaScript::REGEXP_ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# Reserved for future use.
+#
+# source://coderay//lib/coderay/scanners/java_script.rb#29
CodeRay::Scanners::JavaScript::RESERVED_WORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/java_script.rb#45
CodeRay::Scanners::JavaScript::STRING_CONTENT_PATTERN = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/java_script.rb#43
CodeRay::Scanners::JavaScript::UNICODE_ESCAPE = T.let(T.unsafe(nil), Regexp)
+# Scanner for the Lua[http://lua.org] programming lanuage.
+#
+# The language’s complete syntax is defined in
+# {the Lua manual}[http://www.lua.org/manual/5.2/manual.html],
+# which is what this scanner tries to conform to.
+#
+# source://coderay//lib/coderay/scanners/lua.rb#11
class CodeRay::Scanners::Lua < ::CodeRay::Scanners::Scanner
protected
+ # CodeRay entry hook. Starts parsing.
+ #
+ # source://coderay//lib/coderay/scanners/lua.rb#60
def scan_tokens(encoder, options); end
+
+ # Scanner initialization.
+ #
+ # source://coderay//lib/coderay/scanners/lua.rb#54
def setup; end
end
+# Automatic token kind selection for normal words.
+#
+# source://coderay//lib/coderay/scanners/lua.rb#46
CodeRay::Scanners::Lua::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# Keywords used in Lua.
+#
+# source://coderay//lib/coderay/scanners/lua.rb#18
CodeRay::Scanners::Lua::KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# Constants set by the Lua core.
+#
+# source://coderay//lib/coderay/scanners/lua.rb#25
CodeRay::Scanners::Lua::PREDEFINED_CONSTANTS = T.let(T.unsafe(nil), Array)
+
+# The expressions contained in this array are parts of Lua’s `basic'
+# library. Although it’s not entirely necessary to load that library,
+# it is highly recommended and one would have to provide own implementations
+# of some of these expressions if one does not do so. They however aren’t
+# keywords, neither are they constants, but nearly predefined, so they
+# get tagged as `predefined' rather than anything else.
+#
+# This list excludes values of form `_UPPERCASE' because the Lua manual
+# requires such identifiers to be reserved by Lua anyway and they are
+# highlighted directly accordingly, without the need for specific
+# identifiers to be listed here.
+#
+# source://coderay//lib/coderay/scanners/lua.rb#38
CodeRay::Scanners::Lua::PREDEFINED_EXPRESSIONS = T.let(T.unsafe(nil), Array)
+# Scanner for PHP.
+#
+# Original by Stefan Walk.
+#
+# source://coderay//lib/coderay/scanners/php.rb#10
class CodeRay::Scanners::PHP < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/php.rb#23
def reset_instance; end
+
+ # source://coderay//lib/coderay/scanners/php.rb#234
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/php.rb#19
def setup; end
end
+# source://coderay//lib/coderay/scanners/php.rb#15
CodeRay::Scanners::PHP::KINDS_NOT_LOC = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/php.rb#197
module CodeRay::Scanners::PHP::RE; end
+
+# source://coderay//lib/coderay/scanners/php.rb#211
CodeRay::Scanners::PHP::RE::HTML_INDICATOR = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/php.rb#213
CodeRay::Scanners::PHP::RE::IDENTIFIER = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/php.rb#216
CodeRay::Scanners::PHP::RE::OPERATOR = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/php.rb#206
CodeRay::Scanners::PHP::RE::PHP_END = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/php.rb#199
CodeRay::Scanners::PHP::RE::PHP_START = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/php.rb#214
CodeRay::Scanners::PHP::RE::VARIABLE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/php.rb#28
module CodeRay::Scanners::PHP::Words; end
+
+# according to http://php.net/quickref.php on 2009-04-21;
+# all functions with _ excluded (module functions) and selected additional functions
+#
+# source://coderay//lib/coderay/scanners/php.rb#50
CodeRay::Scanners::PHP::Words::BUILTIN_FUNCTIONS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/php.rb#46
CodeRay::Scanners::PHP::Words::CLASSES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/php.rb#145
CodeRay::Scanners::PHP::Words::CONSTANTS = T.let(T.unsafe(nil), Array)
+
+# TODO: more built-in PHP functions?
+#
+# source://coderay//lib/coderay/scanners/php.rb#140
CodeRay::Scanners::PHP::Words::EXCEPTIONS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/php.rb#184
CodeRay::Scanners::PHP::Words::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList::CaseIgnoring)
+
+# according to http://www.php.net/manual/en/reserved.keywords.php
+#
+# source://coderay//lib/coderay/scanners/php.rb#31
CodeRay::Scanners::PHP::Words::KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/php.rb#41
CodeRay::Scanners::PHP::Words::LANGUAGE_CONSTRUCTS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/php.rb#178
CodeRay::Scanners::PHP::Words::PREDEFINED = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/php.rb#39
CodeRay::Scanners::PHP::Words::TYPES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/php.rb#193
CodeRay::Scanners::PHP::Words::VARIABLE_KIND = T.let(T.unsafe(nil), CodeRay::WordList)
+# Scanner for Python. Supports Python 3.
+#
+# Based on pygments' PythonLexer, see
+# http://dev.pocoo.org/projects/pygments/browser/pygments/lexers/agile.py.
+#
+# source://coderay//lib/coderay/scanners/python.rb#8
class CodeRay::Scanners::Python < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/python.rb#103
def scan_tokens(encoder, options); end
end
+# source://coderay//lib/coderay/scanners/python.rb#86
CodeRay::Scanners::Python::DEF_NEW_STATE = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# source://coderay//lib/coderay/scanners/python.rb#91
CodeRay::Scanners::Python::DESCRIPTOR = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/python.rb#97
CodeRay::Scanners::Python::DOCSTRING_COMING = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/python.rb#65
CodeRay::Scanners::Python::ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/python.rb#57
CodeRay::Scanners::Python::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# source://coderay//lib/coderay/scanners/python.rb#13
CodeRay::Scanners::Python::KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/python.rb#64
CodeRay::Scanners::Python::NAME = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/python.rb#21
CodeRay::Scanners::Python::OLD_KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/python.rb#68
CodeRay::Scanners::Python::OPERATOR = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/python.rb#37
CodeRay::Scanners::Python::PREDEFINED_EXCEPTIONS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/python.rb#25
CodeRay::Scanners::Python::PREDEFINED_METHODS_AND_TYPES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/python.rb#52
CodeRay::Scanners::Python::PREDEFINED_VARIABLES_AND_CONSTANTS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/python.rb#82
CodeRay::Scanners::Python::STRING_CONTENT_REGEXP = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/python.rb#78
CodeRay::Scanners::Python::STRING_DELIMITER_REGEXP = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/python.rb#66
CodeRay::Scanners::Python::UNICODE_ESCAPE = T.let(T.unsafe(nil), Regexp)
+# = Raydebug Scanner
+#
+# Highlights the output of the Encoders::Debug encoder.
+#
+# source://coderay//lib/coderay/scanners/raydebug.rb#9
class CodeRay::Scanners::Raydebug < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/raydebug.rb#22
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/raydebug.rb#17
def setup; end
end
+# This scanner is really complex, since Ruby _is_ a complex language!
+#
+# It tries to highlight 100% of all common code,
+# and 90% of strange codes.
+#
+# It is optimized for HTML highlighting, and is not very useful for
+# parsing or pretty printing.
+#
+# source://coderay//lib/coderay/scanners/ruby.rb#11
class CodeRay::Scanners::Ruby < ::CodeRay::Scanners::Scanner
+ # source://coderay//lib/coderay/scanners/ruby.rb#19
def interpreted_string_state; end
protected
+ # source://coderay//lib/coderay/scanners/ruby.rb#29
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/ruby.rb#25
def setup; end
end
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#5
module CodeRay::Scanners::Ruby::Patterns; end
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#72
CodeRay::Scanners::Ruby::Patterns::BINARY = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#106
CodeRay::Scanners::Ruby::Patterns::CHARACTER = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#55
CodeRay::Scanners::Ruby::Patterns::CLASS_VARIABLE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#96
CodeRay::Scanners::Ruby::Patterns::CONTROL_META_ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#132
CodeRay::Scanners::Ruby::Patterns::DATA = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#69
CodeRay::Scanners::Ruby::Patterns::DECIMAL = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#102
CodeRay::Scanners::Ruby::Patterns::ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#74
CodeRay::Scanners::Ruby::Patterns::EXPONENT = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#168
CodeRay::Scanners::Ruby::Patterns::FANCY_STRING_INTERPRETED = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#161
CodeRay::Scanners::Ruby::Patterns::FANCY_STRING_KIND = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#160
CodeRay::Scanners::Ruby::Patterns::FANCY_STRING_START = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#76
CodeRay::Scanners::Ruby::Patterns::FLOAT_OR_INT = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#75
CodeRay::Scanners::Ruby::Patterns::FLOAT_SUFFIX = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#57
CodeRay::Scanners::Ruby::Patterns::GLOBAL_VARIABLE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#116
CodeRay::Scanners::Ruby::Patterns::HEREDOC_OPEN = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#71
CodeRay::Scanners::Ruby::Patterns::HEXADECIMAL = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#38
CodeRay::Scanners::Ruby::Patterns::IDENT = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#28
CodeRay::Scanners::Ruby::Patterns::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#54
CodeRay::Scanners::Ruby::Patterns::INSTANCE_VARIABLE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#7
CodeRay::Scanners::Ruby::Patterns::KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#151
CodeRay::Scanners::Ruby::Patterns::KEYWORDS_EXPECTING_VALUE = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#32
CodeRay::Scanners::Ruby::Patterns::KEYWORD_NEW_STATE = T.let(T.unsafe(nil), CodeRay::WordList)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#53
CodeRay::Scanners::Ruby::Patterns::METHOD_AFTER_DOT = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#40
CodeRay::Scanners::Ruby::Patterns::METHOD_NAME = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#52
CodeRay::Scanners::Ruby::Patterns::METHOD_NAME_EX = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#41
CodeRay::Scanners::Ruby::Patterns::METHOD_NAME_OPERATOR = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#87
CodeRay::Scanners::Ruby::Patterns::METHOD_NAME_OR_SYMBOL = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#51
CodeRay::Scanners::Ruby::Patterns::METHOD_SUFFIX = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#77
CodeRay::Scanners::Ruby::Patterns::NUMERIC = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#56
CodeRay::Scanners::Ruby::Patterns::OBJECT_VARIABLE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#70
CodeRay::Scanners::Ruby::Patterns::OCTAL = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#17
CodeRay::Scanners::Ruby::Patterns::PREDEFINED_CONSTANTS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#58
CodeRay::Scanners::Ruby::Patterns::PREFIX_VARIABLE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#61
CodeRay::Scanners::Ruby::Patterns::QUOTE_TO_TYPE = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#67
CodeRay::Scanners::Ruby::Patterns::REGEXP_MODIFIERS = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#126
CodeRay::Scanners::Ruby::Patterns::RUBYDOC = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#138
CodeRay::Scanners::Ruby::Patterns::RUBYDOC_OR_DATA = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#89
CodeRay::Scanners::Ruby::Patterns::SIMPLE_ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#79
CodeRay::Scanners::Ruby::Patterns::SYMBOL = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#142
CodeRay::Scanners::Ruby::Patterns::VALUE_FOLLOWS = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/ruby/patterns.rb#59
CodeRay::Scanners::Ruby::Patterns::VARIABLE = T.let(T.unsafe(nil), Regexp)
+# source://coderay//lib/coderay/scanners/ruby/string_state.rb#8
class CodeRay::Scanners::Ruby::StringState < ::Struct
+ # @return [StringState] a new instance of StringState
+ #
+ # source://coderay//lib/coderay/scanners/ruby/string_state.rb#48
def initialize(kind, interpreted, delim, heredoc = T.unsafe(nil)); end
+ # source://coderay//lib/coderay/scanners/ruby/string_state.rb#63
def heredoc_pattern(delim, interpreted, indented); end
class << self
+ # source://coderay//lib/coderay/scanners/ruby/string_state.rb#40
def simple_key_pattern(delim); end
end
end
+# source://coderay//lib/coderay/scanners/ruby/string_state.rb#10
CodeRay::Scanners::Ruby::StringState::CLOSING_PAREN = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/ruby/string_state.rb#17
CodeRay::Scanners::Ruby::StringState::STRING_PATTERN = T.let(T.unsafe(nil), Hash)
+# by Josh Goebel
+#
+# source://coderay//lib/coderay/scanners/sql.rb#5
class CodeRay::Scanners::SQL < ::CodeRay::Scanners::Scanner
+ # source://coderay//lib/coderay/scanners/sql.rb#66
def scan_tokens(encoder, options); end
end
+# source://coderay//lib/coderay/scanners/sql.rb#23
CodeRay::Scanners::SQL::COMMANDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/sql.rb#38
CodeRay::Scanners::SQL::DIRECTIVES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/sql.rb#55
CodeRay::Scanners::SQL::ESCAPE = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/sql.rb#46
CodeRay::Scanners::SQL::IDENT_KIND = T.let(T.unsafe(nil), CodeRay::WordList::CaseIgnoring)
+
+# source://coderay//lib/coderay/scanners/sql.rb#9
CodeRay::Scanners::SQL::KEYWORDS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/sql.rb#18
CodeRay::Scanners::SQL::OBJECTS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/sql.rb#44
CodeRay::Scanners::SQL::PREDEFINED_CONSTANTS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/sql.rb#36
CodeRay::Scanners::SQL::PREDEFINED_FUNCTIONS = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/sql.rb#28
CodeRay::Scanners::SQL::PREDEFINED_TYPES = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/scanners/sql.rb#60
CodeRay::Scanners::SQL::STRING_CONTENT_PATTERN = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/sql.rb#58
CodeRay::Scanners::SQL::STRING_PREFIXES = T.let(T.unsafe(nil), Regexp)
+
+# source://coderay//lib/coderay/scanners/sql.rb#56
CodeRay::Scanners::SQL::UNICODE_ESCAPE = T.let(T.unsafe(nil), Regexp)
+# A scanner for Sass.
+#
+# source://coderay//lib/coderay/scanners/sass.rb#5
class CodeRay::Scanners::Sass < ::CodeRay::Scanners::CSS
protected
+ # source://coderay//lib/coderay/scanners/sass.rb#16
def scan_tokens(encoder, options); end
+
+ # source://coderay//lib/coderay/scanners/sass.rb#12
def setup; end
end
+# = Scanner
+#
+# The base class for all Scanners.
+#
+# It is a subclass of Ruby's great +StringScanner+, which
+# makes it easy to access the scanning methods inside.
+#
+# It is also +Enumerable+, so you can use it like an Array of
+# Tokens:
+#
+# require 'coderay'
+#
+# c_scanner = CodeRay::Scanners[:c].new "if (*p == '{') nest++;"
+#
+# for text, kind in c_scanner
+# puts text if kind == :operator
+# end
+#
+# # prints: (*==)++;
+#
+# OK, this is a very simple example :)
+# You can also use +map+, +any?+, +find+ and even +sort_by+,
+# if you want.
+#
+# source://coderay//lib/coderay/scanners/scanner.rb#29
class CodeRay::Scanners::Scanner < ::StringScanner
include ::Enumerable
extend ::CodeRay::Plugin
+ # Create a new Scanner.
+ #
+ # * +code+ is the input String and is handled by the superclass
+ # StringScanner.
+ # * +options+ is a Hash with Symbols as keys.
+ # It is merged with the default options of the class (you can
+ # overwrite default options here.)
+ #
+ # Else, a Tokens object is used.
+ #
+ # @return [Scanner] a new instance of Scanner
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#125
def initialize(code = T.unsafe(nil), options = T.unsafe(nil)); end
+ # The string in binary encoding.
+ #
+ # To be used with #pos, which is the index of the byte the scanner
+ # will scan next.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#218
def binary_string; end
+
+ # The current column position of the scanner, starting with 1.
+ # See also: #line.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#209
def column(pos = T.unsafe(nil)); end
+
+ # Traverse the tokens.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#192
def each(&block); end
+
+ # the default file extension for this scanner
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#160
def file_extension; end
+
+ # the Plugin ID for this scanner
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#155
def lang; end
+
+ # The current line position of the scanner, starting with 1.
+ # See also: #column.
+ #
+ # Beware, this is implemented inefficiently. It should be used
+ # for debugging only.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#202
def line(pos = T.unsafe(nil)); end
+
+ # Sets back the scanner. Subclasses should redefine the reset_instance
+ # method instead of this one.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#142
def reset; end
+
+ # Returns the value of attribute state.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#44
def state; end
+
+ # Sets the attribute state
+ #
+ # @param value the value to set the attribute state to.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#44
def state=(_arg0); end
+
+ # Set a new string to be scanned.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#148
def string=(code); end
+
+ # Scan the code and returns all tokens in a Tokens object.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#165
def tokenize(source = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # Cache the result of tokenize.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#187
def tokens; end
protected
+ # Scanner error with additional status information
+ #
+ # @raise [ScanError]
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#314
def raise_inspect(message, tokens, state = T.unsafe(nil), ambit = T.unsafe(nil), backtrace = T.unsafe(nil)); end
+
+ # source://coderay//lib/coderay/scanners/scanner.rb#289
def raise_inspect_arguments(message, tokens, state, ambit); end
+
+ # Resets the scanner.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#265
def reset_instance; end
+
+ # Shorthand for scan_until(/\z/).
+ # This method also avoids a JRuby 1.9 mode bug.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#328
def scan_rest; end
+
+ # This is the central method, and commonly the only one a
+ # subclass implements.
+ #
+ # Subclasses must implement this method; it must return +tokens+
+ # and must only use Tokens#<< for storing scanned tokens!
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#260
def scan_tokens(tokens, options); end
+
+ # source://coderay//lib/coderay/scanners/scanner.rb#305
def scanner_state_info(state); end
+
+ # source://coderay//lib/coderay/scanners/scanner.rb#239
def set_string_from_source(source); end
+
+ # source://coderay//lib/coderay/scanners/scanner.rb#250
def set_tokens_from_options(options); end
+
+ # Can be implemented by subclasses to do some initialization
+ # that has to be done once per instance.
+ #
+ # Use reset for initialization that has to be done once per
+ # scan.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#236
def setup; end
+
+ # source://coderay//lib/coderay/scanners/scanner.rb#322
def tokens_last(tokens, n); end
+
+ # source://coderay//lib/coderay/scanners/scanner.rb#318
def tokens_size(tokens); end
class << self
+ # The encoding used internally by this scanner.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#71
def encoding(name = T.unsafe(nil)); end
+
+ # The typical filename suffix for this scanner's language.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#66
def file_extension(extension = T.unsafe(nil)); end
+
+ # The lang of this Scanner class, which is equal to its Plugin ID.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#76
def lang; end
+
+ # Normalizes the given code into a string with UNIX newlines, in the
+ # scanner's internal encoding, with invalid and undefined charachters
+ # replaced by placeholders. Always returns a new object.
+ #
+ # source://coderay//lib/coderay/scanners/scanner.rb#51
def normalize(code); end
protected
+ # source://coderay//lib/coderay/scanners/scanner.rb#82
def encode_with_encoding(code, target_encoding); end
+
+ # source://coderay//lib/coderay/scanners/scanner.rb#100
def guess_encoding(s); end
+
+ # source://coderay//lib/coderay/scanners/scanner.rb#96
def to_unix(code); end
end
end
+# The default options for all scanner classes.
+#
+# Define @default_options for subclasses.
+#
+# source://coderay//lib/coderay/scanners/scanner.rb#40
CodeRay::Scanners::Scanner::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/scanners/scanner.rb#42
CodeRay::Scanners::Scanner::KINDS_NOT_LOC = T.let(T.unsafe(nil), Array)
+
+# source://coderay//lib/coderay/helpers/plugin.rb#41
CodeRay::Scanners::Scanner::PLUGIN_HOST = CodeRay::Scanners
+
+# source://coderay//lib/coderay/scanners/scanner.rb#299
CodeRay::Scanners::Scanner::SCANNER_STATE_INFO = T.let(T.unsafe(nil), String)
+
+# source://coderay//lib/coderay/scanners/scanner.rb#271
CodeRay::Scanners::Scanner::SCAN_ERROR_MESSAGE = T.let(T.unsafe(nil), String)
+
+# Raised if a Scanner fails while scanning
+#
+# source://coderay//lib/coderay/scanners/scanner.rb#35
class CodeRay::Scanners::Scanner::ScanError < ::StandardError; end
+# source://coderay//lib/coderay/scanners/taskpaper.rb#4
class CodeRay::Scanners::Taskpaper < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/taskpaper.rb#11
def scan_tokens(encoder, options); end
end
+# Scanner for plain text.
+#
+# Yields just one token of the kind :plain.
+#
+# Alias: +plaintext+, +plain+
+#
+# source://coderay//lib/coderay/scanners/text.rb#9
class CodeRay::Scanners::Text < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/text.rb#18
def scan_tokens(encoder, options); end
end
+# source://coderay//lib/coderay/scanners/text.rb#14
CodeRay::Scanners::Text::KINDS_NOT_LOC = T.let(T.unsafe(nil), Array)
+
+# Scanner for XML.
+#
+# Currently this is the same scanner as Scanners::HTML.
+#
+# source://coderay//lib/coderay/scanners/xml.rb#9
class CodeRay::Scanners::XML < ::CodeRay::Scanners::HTML; end
+# Scanner for YAML.
+#
+# Based on the YAML scanner from Syntax by Jamis Buck.
+#
+# source://coderay//lib/coderay/scanners/yaml.rb#7
class CodeRay::Scanners::YAML < ::CodeRay::Scanners::Scanner
protected
+ # source://coderay//lib/coderay/scanners/yaml.rb#16
def scan_tokens(encoder, options); end
end
+# source://coderay//lib/coderay/scanners/yaml.rb#12
CodeRay::Scanners::YAML::KINDS_NOT_LOC = T.let(T.unsafe(nil), Symbol)
+# This module holds the Style class and its subclasses.
+#
+# See Plugin.
+#
+# source://coderay//lib/coderay/styles.rb#6
module CodeRay::Styles
extend ::CodeRay::PluginHost
end
+# A colorful theme using CSS 3 colors (with alpha channel).
+#
+# source://coderay//lib/coderay/styles/alpha.rb#5
class CodeRay::Styles::Alpha < ::CodeRay::Styles::Style; end
+
+# source://coderay//lib/coderay/styles/alpha.rb#14
CodeRay::Styles::Alpha::CSS_MAIN_STYLES = T.let(T.unsafe(nil), String)
+
+# source://coderay//lib/coderay/styles/alpha.rb#53
CodeRay::Styles::Alpha::TOKEN_COLORS = T.let(T.unsafe(nil), String)
+# Base class for styles.
+#
+# Styles are used by Encoders::HTML to colorize tokens.
+#
+# source://coderay//lib/coderay/styles/style.rb#8
class CodeRay::Styles::Style
extend ::CodeRay::Plugin
end
+# source://coderay//lib/coderay/styles/style.rb#12
CodeRay::Styles::Style::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
+
+# source://coderay//lib/coderay/helpers/plugin.rb#41
CodeRay::Styles::Style::PLUGIN_HOST = CodeRay::Styles
+
+# A Hash of all known token kinds and their associated CSS classes.
+#
+# source://coderay//lib/coderay/token_kinds.rb#4
CodeRay::TokenKinds = T.let(T.unsafe(nil), Hash)
+# The Tokens class represents a list of tokens returned from
+# a Scanner. It's actually just an Array with a few helper methods.
+#
+# A token itself is not a special object, just two elements in an Array:
+# * the _token_ _text_ (the original source of the token in a String) or
+# a _token_ _action_ (begin_group, end_group, begin_line, end_line)
+# * the _token_ _kind_ (a Symbol representing the type of the token)
+#
+# It looks like this:
+#
+# ..., '# It looks like this', :comment, ...
+# ..., '3.1415926', :float, ...
+# ..., '$^', :error, ...
+#
+# Some scanners also yield sub-tokens, represented by special
+# token actions, for example :begin_group and :end_group.
+#
+# The Ruby scanner, for example, splits "a string" into:
+#
+# [
+# :begin_group, :string,
+# '"', :delimiter,
+# 'a string', :content,
+# '"', :delimiter,
+# :end_group, :string
+# ]
+#
+# Tokens can be used to save the output of a Scanners in a simple
+# Ruby object that can be send to an Encoder later:
+#
+# tokens = CodeRay.scan('price = 2.59', :ruby).tokens
+# tokens.encode(:html)
+# tokens.html
+# CodeRay.encoder(:html).encode_tokens(tokens)
+#
+# Tokens gives you the power to handle pre-scanned code very easily:
+# You can serialize it to a JSON string and store it in a database, pass it
+# around to encode it more than once, send it to other algorithms...
+#
+# source://coderay//lib/coderay/tokens.rb#43
class CodeRay::Tokens < ::Array
+ # source://coderay//lib/coderay/tokens.rb#156
def begin_group(kind); end
+
+ # source://coderay//lib/coderay/tokens.rb#158
def begin_line(kind); end
+
+ # Return the actual number of tokens.
+ #
+ # source://coderay//lib/coderay/tokens.rb#151
def count; end
+
+ # Encode the tokens using encoder.
+ #
+ # encoder can be
+ # * a plugin name like :html oder 'statistic'
+ # * an Encoder object
+ #
+ # options are passed to the encoder.
+ #
+ # source://coderay//lib/coderay/tokens.rb#56
def encode(encoder, options = T.unsafe(nil)); end
+
+ # source://coderay//lib/coderay/tokens.rb#157
def end_group(kind); end
+
+ # source://coderay//lib/coderay/tokens.rb#159
def end_line(kind); end
+
+ # Redirects unknown methods to encoder calls.
+ #
+ # For example, if you call +tokens.html+, the HTML encoder
+ # is used to highlight the tokens.
+ #
+ # source://coderay//lib/coderay/tokens.rb#70
def method_missing(meth, options = T.unsafe(nil)); end
+
+ # The Scanner instance that created the tokens.
+ #
+ # source://coderay//lib/coderay/tokens.rb#47
def scanner; end
+
+ # The Scanner instance that created the tokens.
+ #
+ # source://coderay//lib/coderay/tokens.rb#47
def scanner=(_arg0); end
+
+ # Split the tokens into parts of the given +sizes+.
+ #
+ # The result will be an Array of Tokens objects. The parts have
+ # the text size specified by the parameter. In addition, each
+ # part closes all opened tokens. This is useful to insert tokens
+ # betweem them.
+ #
+ # This method is used by @Scanner#tokenize@ when called with an Array
+ # of source strings. The Diff encoder uses it for inline highlighting.
+ #
+ # source://coderay//lib/coderay/tokens.rb#85
def split_into_parts(*sizes); end
+
def text_token(*_arg0); end
+
+ # Turn tokens into a string by concatenating them.
+ #
+ # source://coderay//lib/coderay/tokens.rb#62
def to_s; end
+
def tokens(*_arg0); end
end
+# The result of a scan operation is a TokensProxy, but should act like Tokens.
+#
+# This proxy makes it possible to use the classic CodeRay.scan.encode API
+# while still providing the benefits of direct streaming.
+#
+# source://coderay//lib/coderay/tokens_proxy.rb#7
class CodeRay::TokensProxy
+ # Create a new TokensProxy with the arguments of CodeRay.scan.
+ #
+ # @return [TokensProxy] a new instance of TokensProxy
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#12
def initialize(input, lang, options = T.unsafe(nil), block = T.unsafe(nil)); end
+ # Returns the value of attribute block.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#9
def block; end
+
+ # Sets the attribute block
+ #
+ # @param value the value to set the attribute block to.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#9
def block=(_arg0); end
+
+ # Overwrite Struct#each.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#48
def each(*args, &blk); end
+
+ # Call CodeRay.encode if +encoder+ is a Symbol;
+ # otherwise, convert the receiver to tokens and call encoder.encode_tokens.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#21
def encode(encoder, options = T.unsafe(nil)); end
+
+ # Returns the value of attribute input.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#9
def input; end
+
+ # Sets the attribute input
+ #
+ # @param value the value to set the attribute input to.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#9
def input=(_arg0); end
+
+ # Returns the value of attribute lang.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#9
def lang; end
+
+ # Sets the attribute lang
+ #
+ # @param value the value to set the attribute lang to.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#9
def lang=(_arg0); end
+
+ # Tries to call encode;
+ # delegates to tokens otherwise.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#31
def method_missing(method, *args, &blk); end
+
+ # Returns the value of attribute options.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#9
def options; end
+
+ # Sets the attribute options
+ #
+ # @param value the value to set the attribute options to.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#9
def options=(_arg0); end
+
+ # A (cached) scanner instance to use for the scan task.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#43
def scanner; end
+
+ # The (cached) result of the tokenized input; a Tokens instance.
+ #
+ # source://coderay//lib/coderay/tokens_proxy.rb#38
def tokens; end
end
+# source://coderay//lib/coderay/version.rb#2
CodeRay::VERSION = T.let(T.unsafe(nil), String)
+# = WordList
+#
+# A Hash subclass designed for mapping word lists to token types.
+#
+# A WordList is a Hash with some additional features.
+# It is intended to be used for keyword recognition.
+#
+# WordList is optimized to be used in Scanners,
+# typically to decide whether a given ident is a special token.
+#
+# For case insensitive words use WordList::CaseIgnoring.
+#
+# Example:
+#
+# # define word arrays
+# RESERVED_WORDS = %w[
+# asm break case continue default do else
+# ]
+#
+# PREDEFINED_TYPES = %w[
+# int long short char void
+# ]
+#
+# # make a WordList
+# IDENT_KIND = WordList.new(:ident).
+# add(RESERVED_WORDS, :reserved).
+# add(PREDEFINED_TYPES, :predefined_type)
+#
+# ...
+#
+# def scan_tokens tokens, options
+# ...
+#
+# elsif scan(/[A-Za-z_][A-Za-z_0-9]*/)
+# # use it
+# kind = IDENT_KIND[match]
+# ...
+#
+# source://coderay//lib/coderay/helpers/word_list.rb#40
class CodeRay::WordList < ::Hash
+ # Create a new WordList with +default+ as default value.
+ #
+ # @return [WordList] a new instance of WordList
+ #
+ # source://coderay//lib/coderay/helpers/word_list.rb#43
def initialize(default = T.unsafe(nil)); end
+ # Add words to the list and associate them with +value+.
+ #
+ # Returns +self+, so you can concat add calls.
+ #
+ # source://coderay//lib/coderay/helpers/word_list.rb#50
def add(words, value = T.unsafe(nil)); end
end
+# A CaseIgnoring WordList is like a WordList, only that
+# keys are compared case-insensitively (normalizing keys using +downcase+).
+#
+# source://coderay//lib/coderay/helpers/word_list.rb#60
class CodeRay::WordList::CaseIgnoring < ::CodeRay::WordList
+ # source://coderay//lib/coderay/helpers/word_list.rb#62
def [](key); end
+
+ # source://coderay//lib/coderay/helpers/word_list.rb#66
def []=(key, value); end
end
diff --git a/Library/Homebrew/sorbet/rbi/gems/commander@4.6.0.rbi b/Library/Homebrew/sorbet/rbi/gems/commander@4.6.0.rbi
index a0da6d393ca4a..79579a361a3b4 100644
--- a/Library/Homebrew/sorbet/rbi/gems/commander@4.6.0.rbi
+++ b/Library/Homebrew/sorbet/rbi/gems/commander@4.6.0.rbi
@@ -4,265 +4,1241 @@
# This is an autogenerated file for types exported from the `commander` gem.
# Please instead update this file by running `bin/tapioca gem commander`.
-::RUBY19 = T.let(T.unsafe(nil), TrueClass)
+# source://commander//lib/commander/core_ext/array.rb#3
+class Array
+ include ::Enumerable
+ class << self
+ # Split _string_ into an array. Used in
+ # conjunction with HighLine's #ask, or #ask_for_array
+ # methods, which must respond to #parse.
+ #
+ # This method allows escaping of whitespace. For example
+ # the arguments foo bar\ baz will become ['foo', 'bar baz']
+ #
+ # === Example
+ #
+ # # ask invokes Array#parse
+ # list = ask 'Favorite cookies:', Array
+ #
+ # # or use ask_for_CLASS
+ # list = ask_for_array 'Favorite cookies: '
+ #
+ # source://commander//lib/commander/core_ext/array.rb#21
+ def parse(string); end
+ end
+end
+
+# source://commander//lib/commander/blank.rb#3
module Blank
class << self
+ # @private
+ #
+ # source://commander//lib/commander/blank.rb#4
def included(base); end
end
end
+# source://commander//lib/commander/version.rb#3
module Commander
private
+ # source://commander//lib/commander/configure.rb#4
def configure(*configuration_opts, &configuration_block); end
class << self
+ # source://commander//lib/commander/configure.rb#4
def configure(*configuration_opts, &configuration_block); end
end
end
+# source://commander//lib/commander/command.rb#6
class Commander::Command
+ # Initialize new command with specified _name_.
+ #
+ # @return [Command] a new instance of Command
+ #
+ # source://commander//lib/commander/command.rb#40
def initialize(name); end
+ # Handle execution of command. The handler may be a class,
+ # object, or block (see examples below).
+ #
+ # === Examples
+ #
+ # # Simple block handling
+ # c.when_called do |args, options|
+ # # do something
+ # end
+ #
+ # # Create inst of Something and pass args / options
+ # c.when_called MyLib::Command::Something
+ #
+ # # Create inst of Something and use arbitrary method
+ # c.when_called MyLib::Command::Something, :some_method
+ #
+ # # Pass an object to handle callback (requires method symbol)
+ # c.when_called SomeObject, :some_method
+ #
+ # source://commander//lib/commander/command.rb#142
def action(*args, &block); end
+
+ # Call the commands when_called block with _args_.
+ #
+ # source://commander//lib/commander/command.rb#181
def call(args = T.unsafe(nil)); end
+
+ # Returns the value of attribute description.
+ #
+ # source://commander//lib/commander/command.rb#7
def description; end
+
+ # Sets the attribute description
+ #
+ # @param value the value to set the attribute description to.
+ #
+ # source://commander//lib/commander/command.rb#7
def description=(_arg0); end
+
+ # Add a usage example for this command.
+ #
+ # Usage examples are later displayed in help documentation
+ # created by the help formatters.
+ #
+ # === Examples
+ #
+ # command :something do |c|
+ # c.example "Should do something", "my_command something"
+ # end
+ #
+ # source://commander//lib/commander/command.rb#59
def example(description, command); end
+
+ # Returns the value of attribute examples.
+ #
+ # source://commander//lib/commander/command.rb#7
def examples; end
+
+ # Sets the attribute examples
+ #
+ # @param value the value to set the attribute examples to.
+ #
+ # source://commander//lib/commander/command.rb#7
def examples=(_arg0); end
+
+ # Returns the value of attribute global_options.
+ #
+ # source://commander//lib/commander/command.rb#8
def global_options; end
+
+ # source://commander//lib/commander/command.rb#215
def inspect; end
+
+ # Returns the value of attribute name.
+ #
+ # source://commander//lib/commander/command.rb#7
def name; end
+
+ # Sets the attribute name
+ #
+ # @param value the value to set the attribute name to.
+ #
+ # source://commander//lib/commander/command.rb#7
def name=(_arg0); end
+
+ # Add an option.
+ #
+ # Options are parsed via OptionParser so view it
+ # for additional usage documentation. A block may optionally be
+ # passed to handle the option, otherwise the _options_ struct seen below
+ # contains the results of this option. This handles common formats such as:
+ #
+ # -h, --help options.help # => bool
+ # --[no-]feature options.feature # => bool
+ # --large-switch options.large_switch # => bool
+ # --file FILE options.file # => file passed
+ # --list WORDS options.list # => array
+ # --date [DATE] options.date # => date or nil when optional argument not set
+ #
+ # === Examples
+ #
+ # command :something do |c|
+ # c.option '--recursive', 'Do something recursively'
+ # c.option '--file FILE', 'Specify a file'
+ # c.option('--info', 'Display info') { puts "handle with block" }
+ # c.option '--[no-]feature', 'With or without feature'
+ # c.option '--list FILES', Array, 'List the files specified'
+ #
+ # c.when_called do |args, options|
+ # do_something_recursively if options.recursive
+ # do_something_with_file options.file if options.file
+ # end
+ # end
+ #
+ # === Help Formatters
+ #
+ # This method also parses the arguments passed in order to determine
+ # which were switches, and which were descriptions for the
+ # option which can later be used within help formatters
+ # using option[:switches] and option[:description].
+ #
+ # === Input Parsing
+ #
+ # Since Commander utilizes OptionParser you can pre-parse and evaluate
+ # option arguments. Simply require 'optparse/time', or 'optparse/date', as these
+ # objects must respond to #parse.
+ #
+ # c.option '--time TIME', Time
+ # c.option '--date [DATE]', Date
+ #
+ # source://commander//lib/commander/command.rb#110
def option(*args, &block); end
+
+ # Option proxy proc used when a block is not explicitly passed
+ # via the #option method. This allows commander to auto-populate
+ # and work with option values.
+ #
+ # source://commander//lib/commander/command.rb#211
def option_proc(switches); end
+
+ # Returns the value of attribute options.
+ #
+ # source://commander//lib/commander/command.rb#7
def options; end
+
+ # Sets the attribute options
+ #
+ # @param value the value to set the attribute options to.
+ #
+ # source://commander//lib/commander/command.rb#7
def options=(_arg0); end
+
+ # Parses options and calls associated procs,
+ # returning the arguments remaining.
+ #
+ # source://commander//lib/commander/command.rb#166
def parse_options_and_call_procs(*args); end
+
+ # Creates an Options instance populated with the option values
+ # collected by the #option_proc.
+ #
+ # source://commander//lib/commander/command.rb#197
def proxy_option_struct; end
+
+ # Returns the value of attribute proxy_options.
+ #
+ # source://commander//lib/commander/command.rb#7
def proxy_options; end
+
+ # Sets the attribute proxy_options
+ #
+ # @param value the value to set the attribute proxy_options to.
+ #
+ # source://commander//lib/commander/command.rb#7
def proxy_options=(_arg0); end
+
+ # Run the command with _args_.
+ #
+ # * parses options, call option blocks
+ # * invokes when_called proc
+ #
+ # source://commander//lib/commander/command.rb#156
def run(*args); end
+
+ # Returns the value of attribute summary.
+ #
+ # source://commander//lib/commander/command.rb#7
def summary; end
+
+ # Sets the attribute summary
+ #
+ # @param value the value to set the attribute summary to.
+ #
+ # source://commander//lib/commander/command.rb#7
def summary=(_arg0); end
+
+ # Returns the value of attribute syntax.
+ #
+ # source://commander//lib/commander/command.rb#7
def syntax; end
+
+ # Sets the attribute syntax
+ #
+ # @param value the value to set the attribute syntax to.
+ #
+ # source://commander//lib/commander/command.rb#7
def syntax=(_arg0); end
+
+ # Handle execution of command. The handler may be a class,
+ # object, or block (see examples below).
+ #
+ # === Examples
+ #
+ # # Simple block handling
+ # c.when_called do |args, options|
+ # # do something
+ # end
+ #
+ # # Create inst of Something and pass args / options
+ # c.when_called MyLib::Command::Something
+ #
+ # # Create inst of Something and use arbitrary method
+ # c.when_called MyLib::Command::Something, :some_method
+ #
+ # # Pass an object to handle callback (requires method symbol)
+ # c.when_called SomeObject, :some_method
+ #
+ # source://commander//lib/commander/command.rb#142
def when_called(*args, &block); end
end
+# Options struct.
+#
+# source://commander//lib/commander/command.rb#13
class Commander::Command::Options
include ::Blank
+ # @return [Options] a new instance of Options
+ #
+ # source://commander//lib/commander/command.rb#16
def initialize; end
+ # source://commander//lib/commander/command.rb#20
def __hash__; end
+
+ # source://commander//lib/commander/command.rb#28
def default(defaults = T.unsafe(nil)); end
+
+ # source://commander//lib/commander/command.rb#32
def inspect; end
+
+ # source://commander//lib/commander/command.rb#24
def method_missing(meth, *args); end
end
+# source://commander//lib/commander/delegates.rb#4
module Commander::Delegates
+ # source://commander//lib/commander/delegates.rb#17
def add_command(*args, &block); end
+
+ # source://commander//lib/commander/delegates.rb#17
def alias_command(*args, &block); end
+
+ # source://commander//lib/commander/delegates.rb#17
def always_trace!(*args, &block); end
+
+ # source://commander//lib/commander/delegates.rb#17
def command(*args, &block); end
+
+ # source://commander//lib/commander/delegates.rb#17
def default_command(*args, &block); end
+
+ # source://commander//lib/commander/delegates.rb#23
def defined_commands(*args, &block); end
+
+ # source://commander//lib/commander/delegates.rb#17
def global_option(*args, &block); end
+
+ # source://commander//lib/commander/delegates.rb#17
def never_trace!(*args, &block); end
+
+ # source://commander//lib/commander/delegates.rb#17
def program(*args, &block); end
+
+ # source://commander//lib/commander/delegates.rb#17
def run!(*args, &block); end
end
+# = Help Formatter
+#
+# Commander's help formatters control the output when
+# either the help command, or --help switch are called.
+# The default formatter is Commander::HelpFormatter::Terminal.
+#
+# source://commander//lib/commander/help_formatters.rb#4
module Commander::HelpFormatter
private
+ # source://commander//lib/commander/help_formatters.rb#47
def indent(amount, text); end
class << self
+ # source://commander//lib/commander/help_formatters.rb#47
def indent(amount, text); end
end
end
+# source://commander//lib/commander/help_formatters/base.rb#12
class Commander::HelpFormatter::Base
+ # @return [Base] a new instance of Base
+ #
+ # source://commander//lib/commander/help_formatters/base.rb#13
def initialize(runner); end
+ # source://commander//lib/commander/help_formatters/base.rb#17
def render; end
+
+ # source://commander//lib/commander/help_formatters/base.rb#21
def render_command(command); end
end
+# source://commander//lib/commander/help_formatters.rb#9
class Commander::HelpFormatter::Context
+ # @return [Context] a new instance of Context
+ #
+ # source://commander//lib/commander/help_formatters.rb#10
def initialize(target); end
+ # No-op, override in subclasses.
+ #
+ # source://commander//lib/commander/help_formatters.rb#21
def decorate_binding(_bind); end
+
+ # source://commander//lib/commander/help_formatters.rb#14
def get_binding; end
end
+# source://commander//lib/commander/help_formatters.rb#25
class Commander::HelpFormatter::ProgramContext < ::Commander::HelpFormatter::Context
+ # source://commander//lib/commander/help_formatters.rb#26
def decorate_binding(bind); end
+
+ # source://commander//lib/commander/help_formatters.rb#35
def max_aliases_length(bind); end
+
+ # source://commander//lib/commander/help_formatters.rb#31
def max_command_length(bind); end
+
+ # source://commander//lib/commander/help_formatters.rb#39
def max_key_length(hash, default = T.unsafe(nil)); end
end
+# source://commander//lib/commander/help_formatters/terminal.rb#7
class Commander::HelpFormatter::Terminal < ::Commander::HelpFormatter::Base
+ # source://commander//lib/commander/help_formatters/terminal.rb#8
def render; end
+
+ # source://commander//lib/commander/help_formatters/terminal.rb#12
def render_command(command); end
+
+ # source://commander//lib/commander/help_formatters/terminal.rb#16
def template(name); end
end
+# source://commander//lib/commander/help_formatters/terminal_compact.rb#7
class Commander::HelpFormatter::TerminalCompact < ::Commander::HelpFormatter::Terminal
+ # source://commander//lib/commander/help_formatters/terminal_compact.rb#8
def template(name); end
end
+# source://commander//lib/commander/methods.rb#4
module Commander::Methods
include ::Commander::UI
include ::Commander::UI::AskForClass
include ::Commander::Delegates
end
+# source://commander//lib/commander/platform.rb#4
module Commander::Platform
class << self
+ # @return [Boolean]
+ #
+ # source://commander//lib/commander/platform.rb#5
def jruby?; end
end
end
+# source://commander//lib/commander/runner.rb#6
class Commander::Runner
+ # Initialize a new command runner. Optionally
+ # supplying _args_ for mocking, or arbitrary usage.
+ #
+ # @return [Runner] a new instance of Runner
+ #
+ # source://commander//lib/commander/runner.rb#21
def initialize(args = T.unsafe(nil)); end
+ # Get active command within arguments passed to this runner.
+ #
+ # source://commander//lib/commander/runner.rb#223
def active_command; end
+
+ # Add a command object to this runner.
+ #
+ # source://commander//lib/commander/runner.rb#200
def add_command(command); end
+
+ # Check if command _name_ is an alias.
+ #
+ # @return [Boolean]
+ #
+ # source://commander//lib/commander/runner.rb#207
def alias?(name); end
+
+ # Alias command _name_ with _alias_name_. Optionally _args_ may be passed
+ # as if they were being passed straight to the original command via the command-line.
+ #
+ # source://commander//lib/commander/runner.rb#184
def alias_command(alias_name, name, *args); end
+
+ # Enable tracing on all executions (bypasses --trace)
+ #
+ # source://commander//lib/commander/runner.rb#89
def always_trace!; end
+
+ # Return arguments without the command name.
+ #
+ # source://commander//lib/commander/runner.rb#255
def args_without_command_name; end
+
+ # Creates and yields a command instance when a block is passed.
+ # Otherwise attempts to return the command, raising InvalidCommandError when
+ # it does not exist.
+ #
+ # === Examples
+ #
+ # command :my_command do |c|
+ # c.when_called do |args|
+ # # Code
+ # end
+ # end
+ #
+ # @yield [add_command(Commander::Command.new(name))]
+ #
+ # source://commander//lib/commander/runner.rb#161
def command(name, &block); end
+
+ # Check if a command _name_ exists.
+ #
+ # @return [Boolean]
+ #
+ # source://commander//lib/commander/runner.rb#214
def command_exists?(name); end
+
+ # Attempts to locate a command name from within the arguments.
+ # Supports multi-word commands, using the largest possible match.
+ # Returns the default command, if no valid commands found in the args.
+ #
+ # source://commander//lib/commander/runner.rb#232
def command_name_from_args; end
+
+ # Returns the value of attribute commands.
+ #
+ # source://commander//lib/commander/runner.rb#15
def commands; end
+
+ # Creates default commands such as 'help' which is
+ # essentially the same as using the --help switch.
+ #
+ # source://commander//lib/commander/runner.rb#287
def create_default_commands; end
+
+ # Default command _name_ to be used when no other
+ # command is found in the arguments.
+ #
+ # source://commander//lib/commander/runner.rb#193
def default_command(name); end
+
+ # expand switches of the style '--[no-]blah' into both their
+ # '--blah' and '--no-blah' variants, so that they can be
+ # properly detected and removed
+ #
+ # source://commander//lib/commander/runner.rb#358
def expand_optionally_negative_switches(switches); end
+
+ # Add a global option; follows the same syntax as Command#option
+ # This would be used for switches such as --version, --trace, etc.
+ #
+ # source://commander//lib/commander/runner.rb#170
def global_option(*args, &block); end
+
+ # Returns a proc allowing for commands to inherit global options.
+ # This functionality works whether a block is present for the global
+ # option or not, so simple switches such as --verbose can be used
+ # without a block, and used throughout all commands.
+ #
+ # source://commander//lib/commander/runner.rb#393
def global_option_proc(switches, &block); end
+
+ # Help formatter instance.
+ #
+ # source://commander//lib/commander/runner.rb#248
def help_formatter; end
+
+ # Returns hash of help formatter alias defaults.
+ #
+ # source://commander//lib/commander/runner.rb#266
def help_formatter_alias_defaults; end
+
+ # Returns the value of attribute help_formatter_aliases.
+ #
+ # source://commander//lib/commander/runner.rb#15
def help_formatter_aliases; end
+
+ # Hide the trace option from the help menus and don't add it as a global option
+ #
+ # source://commander//lib/commander/runner.rb#97
def never_trace!; end
+
+ # Returns the value of attribute options.
+ #
+ # source://commander//lib/commander/runner.rb#15
def options; end
+
+ # Parse global command options.
+ #
+ # source://commander//lib/commander/runner.rb#372
def parse_global_options; end
+
+ # source://commander//lib/commander/runner.rb#131
def program(key, *args, &block); end
+
+ # Returns hash of program defaults.
+ #
+ # source://commander//lib/commander/runner.rb#275
def program_defaults; end
+
+ # Removes global _options_ from _args_. This prevents an invalid
+ # option error from occurring when options are parsed
+ # again for the command.
+ #
+ # source://commander//lib/commander/runner.rb#322
def remove_global_options(options, args); end
+
+ # Raises a CommandError when the program any of the _keys_ are not present, or empty.
+ #
+ # source://commander//lib/commander/runner.rb#405
def require_program(*keys); end
+
+ # Raises InvalidCommandError when a _command_ is not found.
+ #
+ # source://commander//lib/commander/runner.rb#313
def require_valid_command(command = T.unsafe(nil)); end
+
+ # Run command parsing and execution process.
+ #
+ # source://commander//lib/commander/runner.rb#40
def run!; end
+
+ # Run the active command.
+ #
+ # source://commander//lib/commander/runner.rb#439
def run_active_command; end
+
+ # source://commander//lib/commander/runner.rb#448
def say(*args); end
+
+ # Returns array of valid command names found within _args_.
+ #
+ # source://commander//lib/commander/runner.rb#239
def valid_command_names_from(*args); end
+
+ # Return program version.
+ #
+ # source://commander//lib/commander/runner.rb#82
def version; end
private
+ # Attempts to locate a command name from within the provided arguments.
+ # Supports multi-word commands, using the largest possible match.
+ #
+ # source://commander//lib/commander/runner.rb#458
def longest_valid_command_name_from(args); end
class << self
+ # Return singleton Runner instance.
+ #
+ # source://commander//lib/commander/runner.rb#33
def instance; end
+
+ # Return switches and description separated from the _args_ passed.
+ #
+ # source://commander//lib/commander/runner.rb#414
def separate_switches_from_description(*args); end
+
+ # Attempts to generate a method name symbol from +switch+.
+ # For example:
+ #
+ # -h # => :h
+ # --trace # => :trace
+ # --some-switch # => :some_switch
+ # --[no-]feature # => :feature
+ # --file FILE # => :file
+ # --list of,things # => :list
+ #
+ # source://commander//lib/commander/runner.rb#432
def switch_to_sym(switch); end
end
end
+# --
+# Exceptions
+# ++
+#
+# source://commander//lib/commander/runner.rb#11
class Commander::Runner::CommandError < ::StandardError; end
+
+# source://commander//lib/commander/runner.rb#13
class Commander::Runner::InvalidCommandError < ::Commander::Runner::CommandError; end
+# = User Interaction
+#
+# Commander's user interaction module mixes in common
+# methods which extend HighLine's functionality such
+# as a #password method rather than calling #ask directly.
+#
+# source://commander//lib/commander/user_interaction.rb#14
module Commander::UI
private
+ # Execute apple _script_.
+ #
+ # source://commander//lib/commander/user_interaction.rb#193
def applescript(script); end
+
+ # Prompt an editor for input. Optionally supply initial
+ # _input_ which is written to the editor.
+ #
+ # _preferred_editor_ can be hinted.
+ #
+ # === Examples
+ #
+ # ask_editor # => prompts EDITOR with no input
+ # ask_editor('foo') # => prompts EDITOR with default text of 'foo'
+ # ask_editor('foo', 'mate -w') # => prompts TextMate with default text of 'foo'
+ #
+ # source://commander//lib/commander/user_interaction.rb#256
def ask_editor(input = T.unsafe(nil), preferred_editor = T.unsafe(nil)); end
+
+ # Find an editor available in path. Optionally supply the _preferred_
+ # editor. Returns the name as a string, nil if none is available.
+ #
+ # source://commander//lib/commander/user_interaction.rb#237
def available_editor(preferred = T.unsafe(nil)); end
+
+ # Choose from a set array of _choices_.
+ #
+ # source://commander//lib/commander/user_interaction.rb#43
def choose(message = T.unsafe(nil), *choices, &block); end
+
+ # 'Say' something using the specified color
+ #
+ # === Examples
+ # color 'I am blue', :blue
+ # color 'I am bold', :bold
+ # color 'White on Red', :white, :on_red
+ #
+ # === Notes
+ # You may use:
+ # * color: black blue cyan green magenta red white yellow
+ # * style: blink bold clear underline
+ # * highligh: on_
+ #
+ # source://commander//lib/commander/user_interaction.rb#117
def color(*args); end
+
+ # Converse with speech recognition.
+ #
+ # Currently a "poorman's" DSL to utilize applescript and
+ # the MacOS speech recognition server.
+ #
+ # === Examples
+ #
+ # case converse 'What is the best food?', :cookies => 'Cookies', :unknown => 'Nothing'
+ # when :cookies
+ # speak 'o.m.g. you are awesome!'
+ # else
+ # case converse 'That is lame, shall I convince you cookies are the best?', :yes => 'Ok', :no => 'No', :maybe => 'Maybe another time'
+ # when :yes
+ # speak 'Well you see, cookies are just fantastic.'
+ # else
+ # speak 'Ok then, bye.'
+ # end
+ # end
+ #
+ # === Notes
+ #
+ # * MacOS only
+ #
+ # source://commander//lib/commander/user_interaction.rb#168
def converse(prompt, responses = T.unsafe(nil)); end
+
+ # Enable paging of output after called.
+ #
+ # source://commander//lib/commander/user_interaction.rb#272
def enable_paging; end
+
+ # Normalize IO streams, allowing for redirection of
+ # +input+ and/or +output+, for example:
+ #
+ # $ foo # => read from terminal I/O
+ # $ foo in # => read from 'in' file, output to terminal output stream
+ # $ foo in out # => read from 'in' file, output to 'out' file
+ # $ foo < in > out # => equivalent to above (essentially)
+ #
+ # Optionally a +block+ may be supplied, in which case
+ # IO will be reset once the block has executed.
+ #
+ # === Examples
+ #
+ # command :foo do |c|
+ # c.syntax = 'foo [input] [output]'
+ # c.when_called do |args, options|
+ # # or io(args.shift, args.shift)
+ # io *args
+ # str = $stdin.gets
+ # puts 'input was: ' + str.inspect
+ # end
+ # end
+ #
+ # source://commander//lib/commander/user_interaction.rb#222
def io(input = T.unsafe(nil), output = T.unsafe(nil), &block); end
+
+ # 'Log' an _action_ to the terminal. This is typically used
+ # for verbose output regarding actions performed. For example:
+ #
+ # create path/to/file.rb
+ # remove path/to/old_file.rb
+ # remove path/to/old_file2.rb
+ #
+ # source://commander//lib/commander/user_interaction.rb#57
def log(action, *args); end
+
+ # Ask the user for a password. Specify a custom
+ # _message_ other than 'Password: ' or override the
+ # default _mask_ of '*'.
+ #
+ # source://commander//lib/commander/user_interaction.rb#34
def password(message = T.unsafe(nil), mask = T.unsafe(nil)); end
+
+ # Output progress while iterating _arr_.
+ #
+ # === Examples
+ #
+ # uris = %w( http://vision-media.ca http://google.com )
+ # progress uris, :format => "Remaining: :time_remaining" do |uri|
+ # res = open uri
+ # end
+ #
+ # source://commander//lib/commander/user_interaction.rb#316
def progress(arr, options = T.unsafe(nil)); end
+
+ # Substitute _hash_'s keys with their associated values in _str_.
+ #
+ # source://commander//lib/commander/user_interaction.rb#376
def replace_tokens(str, hash); end
+
+ # 'Say' something using the ERROR color (red).
+ #
+ # === Examples
+ # say_error 'Everything is not fine'
+ # say_error 'It is not ok', 'This is not ok too'
+ #
+ # source://commander//lib/commander/user_interaction.rb#97
def say_error(*args); end
+
+ # 'Say' something using the OK color (green).
+ #
+ # === Examples
+ # say_ok 'Everything is fine'
+ # say_ok 'It is ok', 'This is ok too'
+ #
+ # source://commander//lib/commander/user_interaction.rb#69
def say_ok(*args); end
+
+ # 'Say' something using the WARNING color (yellow).
+ #
+ # === Examples
+ # say_warning 'This is a warning'
+ # say_warning 'Be careful', 'Think about it'
+ #
+ # source://commander//lib/commander/user_interaction.rb#83
def say_warning(*args); end
+
+ # Speak _message_ using _voice_ at a speaking rate of _rate_
+ #
+ # Voice defaults to 'Alex', which is one of the better voices.
+ # Speaking rate defaults to 175 words per minute
+ #
+ # === Examples
+ #
+ # speak 'What is your favorite food? '
+ # food = ask 'favorite food?: '
+ # speak "Wow, I like #{food} too. We have so much in common."
+ # speak "I like #{food} as well!", "Victoria", 190
+ #
+ # === Notes
+ #
+ # * MacOS only
+ #
+ # source://commander//lib/commander/user_interaction.rb#139
def speak(message, voice = T.unsafe(nil), rate = T.unsafe(nil)); end
class << self
+ # Execute apple _script_.
+ #
+ # source://commander//lib/commander/user_interaction.rb#193
def applescript(script); end
+
+ # Prompt an editor for input. Optionally supply initial
+ # _input_ which is written to the editor.
+ #
+ # _preferred_editor_ can be hinted.
+ #
+ # === Examples
+ #
+ # ask_editor # => prompts EDITOR with no input
+ # ask_editor('foo') # => prompts EDITOR with default text of 'foo'
+ # ask_editor('foo', 'mate -w') # => prompts TextMate with default text of 'foo'
+ #
+ # source://commander//lib/commander/user_interaction.rb#256
def ask_editor(input = T.unsafe(nil), preferred_editor = T.unsafe(nil)); end
+
+ # Find an editor available in path. Optionally supply the _preferred_
+ # editor. Returns the name as a string, nil if none is available.
+ #
+ # source://commander//lib/commander/user_interaction.rb#237
def available_editor(preferred = T.unsafe(nil)); end
+
+ # Choose from a set array of _choices_.
+ #
+ # source://commander//lib/commander/user_interaction.rb#43
def choose(message = T.unsafe(nil), *choices, &block); end
+
+ # 'Say' something using the specified color
+ #
+ # === Examples
+ # color 'I am blue', :blue
+ # color 'I am bold', :bold
+ # color 'White on Red', :white, :on_red
+ #
+ # === Notes
+ # You may use:
+ # * color: black blue cyan green magenta red white yellow
+ # * style: blink bold clear underline
+ # * highligh: on_
+ #
+ # source://commander//lib/commander/user_interaction.rb#117
def color(*args); end
+
+ # Converse with speech recognition.
+ #
+ # Currently a "poorman's" DSL to utilize applescript and
+ # the MacOS speech recognition server.
+ #
+ # === Examples
+ #
+ # case converse 'What is the best food?', :cookies => 'Cookies', :unknown => 'Nothing'
+ # when :cookies
+ # speak 'o.m.g. you are awesome!'
+ # else
+ # case converse 'That is lame, shall I convince you cookies are the best?', :yes => 'Ok', :no => 'No', :maybe => 'Maybe another time'
+ # when :yes
+ # speak 'Well you see, cookies are just fantastic.'
+ # else
+ # speak 'Ok then, bye.'
+ # end
+ # end
+ #
+ # === Notes
+ #
+ # * MacOS only
+ #
+ # source://commander//lib/commander/user_interaction.rb#168
def converse(prompt, responses = T.unsafe(nil)); end
+
+ # Enable paging of output after called.
+ #
+ # source://commander//lib/commander/user_interaction.rb#272
def enable_paging; end
+
+ # Normalize IO streams, allowing for redirection of
+ # +input+ and/or +output+, for example:
+ #
+ # $ foo # => read from terminal I/O
+ # $ foo in # => read from 'in' file, output to terminal output stream
+ # $ foo in out # => read from 'in' file, output to 'out' file
+ # $ foo < in > out # => equivalent to above (essentially)
+ #
+ # Optionally a +block+ may be supplied, in which case
+ # IO will be reset once the block has executed.
+ #
+ # === Examples
+ #
+ # command :foo do |c|
+ # c.syntax = 'foo [input] [output]'
+ # c.when_called do |args, options|
+ # # or io(args.shift, args.shift)
+ # io *args
+ # str = $stdin.gets
+ # puts 'input was: ' + str.inspect
+ # end
+ # end
+ #
+ # source://commander//lib/commander/user_interaction.rb#222
def io(input = T.unsafe(nil), output = T.unsafe(nil), &block); end
+
+ # 'Log' an _action_ to the terminal. This is typically used
+ # for verbose output regarding actions performed. For example:
+ #
+ # create path/to/file.rb
+ # remove path/to/old_file.rb
+ # remove path/to/old_file2.rb
+ #
+ # source://commander//lib/commander/user_interaction.rb#57
def log(action, *args); end
+
+ # Ask the user for a password. Specify a custom
+ # _message_ other than 'Password: ' or override the
+ # default _mask_ of '*'.
+ #
+ # source://commander//lib/commander/user_interaction.rb#34
def password(message = T.unsafe(nil), mask = T.unsafe(nil)); end
+
+ # Output progress while iterating _arr_.
+ #
+ # === Examples
+ #
+ # uris = %w( http://vision-media.ca http://google.com )
+ # progress uris, :format => "Remaining: :time_remaining" do |uri|
+ # res = open uri
+ # end
+ #
+ # source://commander//lib/commander/user_interaction.rb#316
def progress(arr, options = T.unsafe(nil)); end
+
+ # Substitute _hash_'s keys with their associated values in _str_.
+ #
+ # source://commander//lib/commander/user_interaction.rb#376
def replace_tokens(str, hash); end
+
+ # 'Say' something using the ERROR color (red).
+ #
+ # === Examples
+ # say_error 'Everything is not fine'
+ # say_error 'It is not ok', 'This is not ok too'
+ #
+ # source://commander//lib/commander/user_interaction.rb#97
def say_error(*args); end
+
+ # 'Say' something using the OK color (green).
+ #
+ # === Examples
+ # say_ok 'Everything is fine'
+ # say_ok 'It is ok', 'This is ok too'
+ #
+ # source://commander//lib/commander/user_interaction.rb#69
def say_ok(*args); end
+
+ # 'Say' something using the WARNING color (yellow).
+ #
+ # === Examples
+ # say_warning 'This is a warning'
+ # say_warning 'Be careful', 'Think about it'
+ #
+ # source://commander//lib/commander/user_interaction.rb#83
def say_warning(*args); end
+
+ # Speak _message_ using _voice_ at a speaking rate of _rate_
+ #
+ # Voice defaults to 'Alex', which is one of the better voices.
+ # Speaking rate defaults to 175 words per minute
+ #
+ # === Examples
+ #
+ # speak 'What is your favorite food? '
+ # food = ask 'favorite food?: '
+ # speak "Wow, I like #{food} too. We have so much in common."
+ # speak "I like #{food} as well!", "Victoria", 190
+ #
+ # === Notes
+ #
+ # * MacOS only
+ #
+ # source://commander//lib/commander/user_interaction.rb#139
def speak(message, voice = T.unsafe(nil), rate = T.unsafe(nil)); end
end
end
+# Implements ask_for_CLASS methods.
+#
+# source://commander//lib/commander/user_interaction.rb#325
module Commander::UI::AskForClass
+ # source://commander//lib/commander/user_interaction.rb#330
def ask_for_array(prompt); end
+
+ # source://commander//lib/commander/user_interaction.rb#330
def ask_for_file(prompt); end
+
+ # source://commander//lib/commander/user_interaction.rb#330
def ask_for_float(prompt); end
+
+ # source://commander//lib/commander/user_interaction.rb#330
def ask_for_integer(prompt); end
+
+ # source://commander//lib/commander/user_interaction.rb#330
def ask_for_pathname(prompt); end
+
+ # source://commander//lib/commander/user_interaction.rb#330
def ask_for_regexp(prompt); end
+
+ # source://commander//lib/commander/user_interaction.rb#330
def ask_for_string(prompt); end
+
+ # source://commander//lib/commander/user_interaction.rb#330
def ask_for_symbol(prompt); end
+
+ # source://commander//lib/commander/user_interaction.rb#335
def method_missing(method_name, *arguments, &block); end
private
+ # @return [Boolean]
+ #
+ # source://commander//lib/commander/user_interaction.rb#368
def respond_to_missing?(method_name, include_private = T.unsafe(nil)); end
end
+# source://commander//lib/commander/user_interaction.rb#326
Commander::UI::AskForClass::DEPRECATED_CONSTANTS = T.let(T.unsafe(nil), Array)
+# = Progress Bar
+#
+# Terminal progress bar utility. In its most basic form
+# requires that the developer specifies when the bar should
+# be incremented. Note that a hash of tokens may be passed to
+# #increment, (or returned when using Object#progress).
+#
+# uris = %w(
+# http://vision-media.ca
+# http://yahoo.com
+# http://google.com
+# )
+#
+# bar = Commander::UI::ProgressBar.new uris.length, options
+# threads = []
+# uris.each do |uri|
+# threads << Thread.new do
+# begin
+# res = open uri
+# bar.increment :uri => uri
+# rescue Exception => e
+# bar.increment :uri => "#{uri} failed"
+# end
+# end
+# end
+# threads.each { |t| t.join }
+#
+# The Object method #progress is also available:
+#
+# progress uris, :width => 10 do |uri|
+# res = open uri
+# { :uri => uri } # Can now use :uri within :format option
+# end
+#
+# source://commander//lib/commander/user_interaction.rb#418
class Commander::UI::ProgressBar
+ # Creates a new progress bar.
+ #
+ # === Options
+ #
+ # :title Title, defaults to "Progress"
+ # :width Width of :progress_bar
+ # :progress_str Progress string, defaults to "="
+ # :incomplete_str Incomplete bar string, defaults to '.'
+ # :format Defaults to ":title |:progress_bar| :percent_complete% complete "
+ # :tokens Additional tokens replaced within the format string
+ # :complete_message Defaults to "Process complete"
+ #
+ # === Tokens
+ #
+ # :title
+ # :percent_complete
+ # :progress_bar
+ # :step
+ # :steps_remaining
+ # :total_steps
+ # :time_elapsed
+ # :time_remaining
+ #
+ # @return [ProgressBar] a new instance of ProgressBar
+ #
+ # source://commander//lib/commander/user_interaction.rb#444
def initialize(total, options = T.unsafe(nil)); end
+ # Whether or not the operation has completed.
+ #
+ # @return [Boolean]
+ #
+ # source://commander//lib/commander/user_interaction.rb#534
def completed?; end
+
+ # Erase previous terminal line.
+ #
+ # source://commander//lib/commander/user_interaction.rb#551
def erase_line; end
+
+ # Whether or not the operation is complete, and we have finished.
+ #
+ # @return [Boolean]
+ #
+ # source://commander//lib/commander/user_interaction.rb#527
def finished?; end
+
+ # Generates tokens for this step.
+ #
+ # source://commander//lib/commander/user_interaction.rb#497
def generate_tokens; end
+
+ # Increment progress. Optionally pass _tokens_ which
+ # can be displayed in the output format.
+ #
+ # source://commander//lib/commander/user_interaction.rb#542
def increment(tokens = T.unsafe(nil)); end
+
+ # Completion percentage.
+ #
+ # source://commander//lib/commander/user_interaction.rb#458
def percent_complete; end
+
+ # Formatted progress bar.
+ #
+ # source://commander//lib/commander/user_interaction.rb#490
def progress_bar; end
+
+ # Output the progress bar.
+ #
+ # source://commander//lib/commander/user_interaction.rb#513
def show; end
+
+ # Number of steps left.
+ #
+ # source://commander//lib/commander/user_interaction.rb#483
def steps_remaining; end
+
+ # Time that has elapsed since the operation started.
+ #
+ # source://commander//lib/commander/user_interaction.rb#469
def time_elapsed; end
+
+ # Estimated time remaining.
+ #
+ # source://commander//lib/commander/user_interaction.rb#476
def time_remaining; end
end
+# source://commander//lib/commander/version.rb#4
Commander::VERSION = T.let(T.unsafe(nil), String)
+# source://commander//lib/commander/core_ext/object.rb#3
class Object < ::BasicObject
- include ::ActiveSupport::ToJsonWithActiveSupportEncoder
include ::ActiveSupport::ForkTracker::CoreExt
- include ::ActiveSupport::ForkTracker::CoreExtPrivate
include ::Kernel
- include ::JSON::Ext::Generator::GeneratorMethods::Object
include ::PP::ObjectMixin
- include ::ActiveSupport::Dependencies::Loadable
- include ::ActiveSupport::Tryable
+ # Return the current binding.
+ #
+ # source://commander//lib/commander/core_ext/object.rb#7
def get_binding; end
end
diff --git a/Library/Homebrew/sorbet/rbi/gems/concurrent-ruby@1.2.2.rbi b/Library/Homebrew/sorbet/rbi/gems/concurrent-ruby@1.2.2.rbi
index 12a0de6c9c46d..95c9a8e091884 100644
--- a/Library/Homebrew/sorbet/rbi/gems/concurrent-ruby@1.2.2.rbi
+++ b/Library/Homebrew/sorbet/rbi/gems/concurrent-ruby@1.2.2.rbi
@@ -4,6 +4,9 @@
# 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
@@ -13,525 +16,3115 @@ module Concurrent
private
+ # Abort a currently running transaction - see `Concurrent::atomically`.
+ #
+ # @raise [Transaction::AbortError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#139
def abort_transaction; end
+
+ # Run a block that reads and writes `TVar`s as a single atomic transaction.
+ # With respect to the value of `TVar` objects, the transaction is atomic, in
+ # that it either happens or it does not, consistent, in that the `TVar`
+ # objects involved will never enter an illegal state, and isolated, in that
+ # transactions never interfere with each other. You may recognise these
+ # properties from database transactions.
+ #
+ # There are some very important and unusual semantics that you must be aware of:
+ #
+ # * Most importantly, the block that you pass to atomically may be executed
+ # more than once. In most cases your code should be free of
+ # side-effects, except for via TVar.
+ #
+ # * If an exception escapes an atomically block it will abort the transaction.
+ #
+ # * It is undefined behaviour to use callcc or Fiber with atomically.
+ #
+ # * If you create a new thread within an atomically, it will not be part of
+ # the transaction. Creating a thread counts as a side-effect.
+ #
+ # Transactions within transactions are flattened to a single transaction.
+ #
+ # @example
+ # a = new TVar(100_000)
+ # b = new TVar(100)
+ #
+ # Concurrent::atomically do
+ # a.value -= 10
+ # b.value += 10
+ # end
+ # @raise [ArgumentError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#82
def atomically; end
+
+ # @raise [ArgumentError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#56
def call_dataflow(method, executor, *inputs, &block); end
+
+ # Dataflow allows you to create a task that will be scheduled when all of its data dependencies are available.
+ # {include:file:docs-source/dataflow.md}
+ #
+ # @param inputs [Future] zero or more `Future` operations that this dataflow depends upon
+ # @raise [ArgumentError] if no block is given
+ # @raise [ArgumentError] if any of the inputs are not `IVar`s
+ # @return [Object] the result of all the operations
+ # @yield The operation to perform once all the dependencies are met
+ # @yieldparam inputs [Future] each of the `Future` inputs to the dataflow
+ # @yieldreturn [Object] the result of the block operation
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#34
def dataflow(*inputs, &block); end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#44
def dataflow!(*inputs, &block); end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#39
def dataflow_with(executor, *inputs, &block); end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#49
def dataflow_with!(executor, *inputs, &block); end
+
+ # Leave a transaction without committing or aborting - see `Concurrent::atomically`.
+ #
+ # @raise [Transaction::LeaveError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#144
def leave_transaction; end
+
+ # Returns the current time as tracked by the application monotonic clock.
+ #
+ # @param unit [Symbol] the time unit to be returned, can be either
+ # :float_second, :float_millisecond, :float_microsecond, :second,
+ # :millisecond, :microsecond, or :nanosecond default to :float_second.
+ # @return [Float] The current monotonic time since some unspecified
+ # starting point
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/monotonic_time.rb#15
def monotonic_time(unit = T.unsafe(nil)); end
class << self
+ # Abort a currently running transaction - see `Concurrent::atomically`.
+ #
+ # @raise [Transaction::AbortError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#139
def abort_transaction; end
+
+ # Run a block that reads and writes `TVar`s as a single atomic transaction.
+ # With respect to the value of `TVar` objects, the transaction is atomic, in
+ # that it either happens or it does not, consistent, in that the `TVar`
+ # objects involved will never enter an illegal state, and isolated, in that
+ # transactions never interfere with each other. You may recognise these
+ # properties from database transactions.
+ #
+ # There are some very important and unusual semantics that you must be aware of:
+ #
+ # * Most importantly, the block that you pass to atomically may be executed
+ # more than once. In most cases your code should be free of
+ # side-effects, except for via TVar.
+ #
+ # * If an exception escapes an atomically block it will abort the transaction.
+ #
+ # * It is undefined behaviour to use callcc or Fiber with atomically.
+ #
+ # * If you create a new thread within an atomically, it will not be part of
+ # the transaction. Creating a thread counts as a side-effect.
+ #
+ # Transactions within transactions are flattened to a single transaction.
+ #
+ # @example
+ # a = new TVar(100_000)
+ # b = new TVar(100)
+ #
+ # Concurrent::atomically do
+ # a.value -= 10
+ # b.value += 10
+ # end
+ # @raise [ArgumentError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#82
def atomically; end
+
+ # @raise [ArgumentError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#56
def call_dataflow(method, executor, *inputs, &block); end
+
+ # @return [Logger] Logger with provided level and output.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#37
def create_simple_logger(level = T.unsafe(nil), output = T.unsafe(nil)); end
+
+ # @deprecated
+ # @return [Logger] Logger with provided level and output.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#69
def create_stdlib_logger(level = T.unsafe(nil), output = T.unsafe(nil)); end
+
+ # Dataflow allows you to create a task that will be scheduled when all of its data dependencies are available.
+ # {include:file:docs-source/dataflow.md}
+ #
+ # @param inputs [Future] zero or more `Future` operations that this dataflow depends upon
+ # @raise [ArgumentError] if no block is given
+ # @raise [ArgumentError] if any of the inputs are not `IVar`s
+ # @return [Object] the result of all the operations
+ # @yield The operation to perform once all the dependencies are met
+ # @yieldparam inputs [Future] each of the `Future` inputs to the dataflow
+ # @yieldreturn [Object] the result of the block operation
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#34
def dataflow(*inputs, &block); end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#44
def dataflow!(*inputs, &block); end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#39
def dataflow_with(executor, *inputs, &block); end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/dataflow.rb#49
def dataflow_with!(executor, *inputs, &block); end
+
+ # Disables AtExit handlers including pool auto-termination handlers.
+ # When disabled it will be the application programmer's responsibility
+ # to ensure that the handlers are shutdown properly prior to application
+ # exit by calling `AtExit.run` method.
+ #
+ # @deprecated Has no effect since it is no longer needed, see https://github.com/ruby-concurrency/concurrent-ruby/pull/841.
+ # @note this option should be needed only because of `at_exit` ordering
+ # issues which may arise when running some of the testing frameworks.
+ # E.g. Minitest's test-suite runs itself in `at_exit` callback which
+ # executes after the pools are already terminated. Then auto termination
+ # needs to be disabled and called manually after test-suite ends.
+ # @note This method should *never* be called
+ # from within a gem. It should *only* be used from within the main
+ # application and even then it should be used only when necessary.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#48
def disable_at_exit_handlers!; end
+
+ # General access point to global executors.
+ #
+ # @param executor_identifier [Symbol, Executor] symbols:
+ # - :fast - {Concurrent.global_fast_executor}
+ # - :io - {Concurrent.global_io_executor}
+ # - :immediate - {Concurrent.global_immediate_executor}
+ # @return [Executor]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#83
def executor(executor_identifier); end
+
+ # Global thread pool optimized for short, fast *operations*.
+ #
+ # @return [ThreadPoolExecutor] the thread pool
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#55
def global_fast_executor; end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#66
def global_immediate_executor; end
+
+ # Global thread pool optimized for long, blocking (IO) *tasks*.
+ #
+ # @return [ThreadPoolExecutor] the thread pool
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#62
def global_io_executor; end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#109
def global_logger; end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#113
def global_logger=(value); end
+
+ # Global thread pool user for global *timers*.
+ #
+ # @return [Concurrent::TimerSet] the thread pool
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#73
def global_timer_set; end
+
+ # Leave a transaction without committing or aborting - see `Concurrent::atomically`.
+ #
+ # @raise [Transaction::LeaveError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/tvar.rb#144
def leave_transaction; end
+
+ # Returns the current time as tracked by the application monotonic clock.
+ #
+ # @param unit [Symbol] the time unit to be returned, can be either
+ # :float_second, :float_millisecond, :float_microsecond, :second,
+ # :millisecond, :microsecond, or :nanosecond default to :float_second.
+ # @return [Float] The current monotonic time since some unspecified
+ # starting point
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/monotonic_time.rb#15
def monotonic_time(unit = T.unsafe(nil)); end
+
+ # @return [Boolean]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/lock_local_var.rb#7
def mutex_owned_per_thread?; end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#87
def new_fast_executor(opts = T.unsafe(nil)); end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/configuration.rb#98
def new_io_executor(opts = T.unsafe(nil)); end
+
+ # Number of physical processor cores on the current system. For performance
+ # reasons the calculated value will be memoized on the first call.
+ #
+ # On Windows the Win32 API will be queried for the `NumberOfCores from
+ # Win32_Processor`. This will return the total number "of cores for the
+ # current instance of the processor." On Unix-like operating systems either
+ # the `hwprefs` or `sysctl` utility will be called in a subshell and the
+ # returned value will be used. In the rare case where none of these methods
+ # work or an exception is raised the function will simply return 1.
+ #
+ # @return [Integer] number physical processor cores on the current system
+ # @see https://github.com/grosser/parallel/blob/4fc8b89d08c7091fe0419ca8fba1ec3ce5a8d185/lib/parallel.rb
+ # @see http://msdn.microsoft.com/en-us/library/aa394373(v=vs.85).aspx
+ # @see http://www.unix.com/man-page/osx/1/HWPREFS/
+ # @see http://linux.die.net/man/8/sysctl
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#107
def physical_processor_count; end
+
+ # Number of processors seen by the OS and used for process scheduling. For
+ # performance reasons the calculated value will be memoized on the first
+ # call.
+ #
+ # When running under JRuby the Java runtime call
+ # `java.lang.Runtime.getRuntime.availableProcessors` will be used. According
+ # to the Java documentation this "value may change during a particular
+ # invocation of the virtual machine... [applications] should therefore
+ # occasionally poll this property." Subsequently the result will NOT be
+ # memoized under JRuby.
+ #
+ # Otherwise Ruby's Etc.nprocessors will be used.
+ #
+ # @return [Integer] number of processors seen by the OS or Java runtime
+ # @see http://docs.oracle.com/javase/6/docs/api/java/lang/Runtime.html#availableProcessors()
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#86
def processor_count; end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/utility/processor_counter.rb#68
def processor_counter; end
+
+ # Use logger created by #create_simple_logger to log concurrent-ruby messages.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#63
def use_simple_logger(level = T.unsafe(nil), output = T.unsafe(nil)); end
+
+ # Use logger created by #create_stdlib_logger to log concurrent-ruby messages.
+ #
+ # @deprecated
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/concern/logging.rb#96
def use_stdlib_logger(level = T.unsafe(nil), output = T.unsafe(nil)); end
end
end
+# source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#38
class Concurrent::AbstractExchanger < ::Concurrent::Synchronization::Object
+ # @return [AbstractExchanger] a new instance of AbstractExchanger
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#44
def initialize; end
+ # Waits for another thread to arrive at this exchange point (unless the
+ # current thread is interrupted), and then transfers the given object to
+ # it, receiving its object in return. The timeout value indicates the
+ # approximate number of seconds the method should block while waiting
+ # for the exchange. When the timeout value is `nil` the method will
+ # block indefinitely.
+ #
+ #
+ # In some edge cases when a `timeout` is given a return value of `nil` may be
+ # ambiguous. Specifically, if `nil` is a valid value in the exchange it will
+ # be impossible to tell whether `nil` is the actual return value or if it
+ # signifies timeout. When `nil` is a valid value in the exchange consider
+ # using {#exchange!} or {#try_exchange} instead.
+ #
+ # @param value [Object] the value to exchange with another thread
+ # @param timeout [Numeric, nil] in seconds, `nil` blocks indefinitely
+ # @return [Object] the value exchanged by the other thread or `nil` on timeout
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#69
def exchange(value, timeout = T.unsafe(nil)); end
+
+ # Waits for another thread to arrive at this exchange point (unless the
+ # current thread is interrupted), and then transfers the given object to
+ # it, receiving its object in return. The timeout value indicates the
+ # approximate number of seconds the method should block while waiting
+ # for the exchange. When the timeout value is `nil` the method will
+ # block indefinitely.
+ #
+ #
+ # On timeout a {Concurrent::TimeoutError} exception will be raised.
+ #
+ # @param value [Object] the value to exchange with another thread
+ # @param timeout [Numeric, nil] in seconds, `nil` blocks indefinitely
+ # @raise [Concurrent::TimeoutError] on timeout
+ # @return [Object] the value exchanged by the other thread
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#80
def exchange!(value, timeout = T.unsafe(nil)); end
+
+ # Waits for another thread to arrive at this exchange point (unless the
+ # current thread is interrupted), and then transfers the given object to
+ # it, receiving its object in return. The timeout value indicates the
+ # approximate number of seconds the method should block while waiting
+ # for the exchange. When the timeout value is `nil` the method will
+ # block indefinitely.
+ #
+ #
+ # The return value will be a {Concurrent::Maybe} set to `Just` on success or
+ # `Nothing` on timeout.
+ #
+ # @example
+ #
+ # exchanger = Concurrent::Exchanger.new
+ #
+ # result = exchanger.exchange(:foo, 0.5)
+ #
+ # if result.just?
+ # puts result.value #=> :bar
+ # else
+ # puts 'timeout'
+ # end
+ # @param value [Object] the value to exchange with another thread
+ # @param timeout [Numeric, nil] in seconds, `nil` blocks indefinitely
+ # @return [Concurrent::Maybe] on success a `Just` maybe will be returned with
+ # the item exchanged by the other thread as `#value`; on timeout a
+ # `Nothing` maybe will be returned with {Concurrent::TimeoutError} as `#reason`
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#109
def try_exchange(value, timeout = T.unsafe(nil)); end
private
+ # Waits for another thread to arrive at this exchange point (unless the
+ # current thread is interrupted), and then transfers the given object to
+ # it, receiving its object in return. The timeout value indicates the
+ # approximate number of seconds the method should block while waiting
+ # for the exchange. When the timeout value is `nil` the method will
+ # block indefinitely.
+ #
+ # @param value [Object] the value to exchange with another thread
+ # @param timeout [Numeric, nil] in seconds, `nil` blocks indefinitely
+ # @raise [NotImplementedError]
+ # @return [Object, CANCEL] the value exchanged by the other thread; {CANCEL} on timeout
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#122
def do_exchange(value, timeout); end
end
+# source://concurrent-ruby//lib/concurrent-ruby/concurrent/exchanger.rb#41
Concurrent::AbstractExchanger::CANCEL = T.let(T.unsafe(nil), Object)
+# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#10
class Concurrent::AbstractExecutorService < ::Concurrent::Synchronization::LockableObject
include ::Logger::Severity
include ::Concurrent::Concern::Logging
include ::Concurrent::ExecutorService
include ::Concurrent::Concern::Deprecation
+ # Create a new thread pool.
+ #
+ # @return [AbstractExecutorService] a new instance of AbstractExecutorService
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#23
def initialize(opts = T.unsafe(nil), &block); end
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#72
def auto_terminate=(value); end
+
+ # @return [Boolean]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#67
def auto_terminate?; end
+
+ # Returns the value of attribute fallback_policy.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#18
def fallback_policy; end
+
+ # @raise [NotImplementedError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#42
def kill; end
+
+ # Returns the value of attribute name.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#20
def name; end
+
+ # @return [Boolean]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#52
def running?; end
+
+ # @raise [NotImplementedError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#37
def shutdown; end
+
+ # @return [Boolean]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#62
def shutdown?; end
+
+ # @return [Boolean]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#57
def shuttingdown?; end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#32
def to_s; end
+
+ # @raise [NotImplementedError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#47
def wait_for_termination(timeout = T.unsafe(nil)); end
private
+ # Returns an action which executes the `fallback_policy` once the queue
+ # size reaches `max_queue`. The reason for the indirection of an action
+ # is so that the work can be deferred outside of synchronization.
+ #
+ # @param args [Array] the arguments to the task which is being handled.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#85
def fallback_action(*args); end
+
+ # @return [Boolean]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#126
def ns_auto_terminate?; end
+
+ # @raise [NotImplementedError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#106
def ns_execute(*args, &task); end
+
+ # Callback method called when the executor has been killed.
+ # The default behavior is to do nothing.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#122
def ns_kill_execution; end
+
+ # Callback method called when an orderly shutdown has completed.
+ # The default behavior is to signal all waiting threads.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#114
def ns_shutdown_execution; end
end
+# The set of possible fallback policies that may be set at thread pool creation.
+#
+# source://concurrent-ruby//lib/concurrent-ruby/concurrent/executor/abstract_executor_service.rb#15
Concurrent::AbstractExecutorService::FALLBACK_POLICIES = T.let(T.unsafe(nil), Array)
+# An abstract implementation of local storage, with sub-classes for
+# per-thread and per-fiber locals.
+#
+# Each execution context (EC, thread or fiber) has a lazily initialized array
+# of local variable values. Each time a new local variable is created, we
+# allocate an "index" for it.
+#
+# For example, if the allocated index is 1, that means slot #1 in EVERY EC's
+# locals array will be used for the value of that variable.
+#
+# The good thing about using a per-EC structure to hold values, rather than
+# a global, is that no synchronization is needed when reading and writing
+# those values (since the structure is only ever accessed by a single
+# thread).
+#
+# Of course, when a local variable is GC'd, 1) we need to recover its index
+# for use by other new local variables (otherwise the locals arrays could
+# get bigger and bigger with time), and 2) we need to null out all the
+# references held in the now-unused slots (both to avoid blocking GC of those
+# objects, and also to prevent "stale" values from being passed on to a new
+# local when the index is reused).
+#
+# Because we need to null out freed slots, we need to keep references to
+# ALL the locals arrays, so we can null out the appropriate slots in all of
+# them. This is why we need to use a finalizer to clean up the locals array
+# when the EC goes out of scope.
+#
+# source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#35
class Concurrent::AbstractLocals
+ # @return [AbstractLocals] a new instance of AbstractLocals
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#36
def initialize; end
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#89
def fetch(index); end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#71
def free_index(index); end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#55
def next_index(local); end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#102
def set(index, value); end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#43
def synchronize; end
+
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#48
def weak_synchronize; end
private
+ # When the local goes out of scope, clean up that slot across all locals currently assigned.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#112
def local_finalizer(index); end
+
+ # Returns the locals for the current scope, or nil if none exist.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#128
def locals; end
+
+ # Returns the locals for the current scope, creating them if necessary.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#133
def locals!; end
+
+ # When a thread/fiber goes out of scope, remove the array from @all_arrays.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/atomic/locals.rb#119
def thread_fiber_finalizer(array_object_id); end
end
+# `Agent` is inspired by Clojure's [agent](http://clojure.org/agents)
+# function. An agent is a shared, mutable variable providing independent,
+# uncoordinated, *asynchronous* change of individual values. Best used when
+# the value will undergo frequent, complex updates. Suitable when the result
+# of an update does not need to be known immediately. `Agent` is (mostly)
+# functionally equivalent to Clojure's agent, except where the runtime
+# prevents parity.
+#
+# Agents are reactive, not autonomous - there is no imperative message loop
+# and no blocking receive. The state of an Agent should be itself immutable
+# and the `#value` of an Agent is always immediately available for reading by
+# any thread without any messages, i.e. observation does not require
+# cooperation or coordination.
+#
+# Agent action dispatches are made using the various `#send` methods. These
+# methods always return immediately. At some point later, in another thread,
+# the following will happen:
+#
+# 1. The given `action` will be applied to the state of the Agent and the
+# `args`, if any were supplied.
+# 2. The return value of `action` will be passed to the validator lambda,
+# if one has been set on the Agent.
+# 3. If the validator succeeds or if no validator was given, the return value
+# of the given `action` will become the new `#value` of the Agent. See
+# `#initialize` for details.
+# 4. If any observers were added to the Agent, they will be notified. See
+# `#add_observer` for details.
+# 5. If during the `action` execution any other dispatches are made (directly
+# or indirectly), they will be held until after the `#value` of the Agent
+# has been changed.
+#
+# If any exceptions are thrown by an action function, no nested dispatches
+# will occur, and the exception will be cached in the Agent itself. When an
+# Agent has errors cached, any subsequent interactions will immediately throw
+# an exception, until the agent's errors are cleared. Agent errors can be
+# examined with `#error` and the agent restarted with `#restart`.
+#
+# The actions of all Agents get interleaved amongst threads in a thread pool.
+# At any point in time, at most one action for each Agent is being executed.
+# Actions dispatched to an agent from another single agent or thread will
+# occur in the order they were sent, potentially interleaved with actions
+# dispatched to the same agent from other sources. The `#send` method should
+# be used for actions that are CPU limited, while the `#send_off` method is
+# appropriate for actions that may block on IO.
+#
+# Unlike in Clojure, `Agent` cannot participate in `Concurrent::TVar` transactions.
+#
+# ## Example
+#
+# ```
+# def next_fibonacci(set = nil)
+# return [0, 1] if set.nil?
+# set + [set[-2..-1].reduce{|sum,x| sum + x }]
+# end
+#
+# # create an agent with an initial value
+# agent = Concurrent::Agent.new(next_fibonacci)
+#
+# # send a few update requests
+# 5.times do
+# agent.send{|set| next_fibonacci(set) }
+# end
+#
+# # wait for them to complete
+# agent.await
+#
+# # get the current value
+# agent.value #=> [0, 1, 1, 2, 3, 5, 8]
+# ```
+#
+# ## Observation
+#
+# Agents support observers through the {Concurrent::Observable} mixin module.
+# Notification of observers occurs every time an action dispatch returns and
+# the new value is successfully validated. Observation will *not* occur if the
+# action raises an exception, if validation fails, or when a {#restart} occurs.
+#
+# When notified the observer will receive three arguments: `time`, `old_value`,
+# and `new_value`. The `time` argument is the time at which the value change
+# occurred. The `old_value` is the value of the Agent when the action began
+# processing. The `new_value` is the value to which the Agent was set when the
+# action completed. Note that `old_value` and `new_value` may be the same.
+# This is not an error. It simply means that the action returned the same
+# value.
+#
+# ## Nested Actions
+#
+# It is possible for an Agent action to post further actions back to itself.
+# The nested actions will be enqueued normally then processed *after* the
+# outer action completes, in the order they were sent, possibly interleaved
+# with action dispatches from other threads. Nested actions never deadlock
+# with one another and a failure in a nested action will never affect the
+# outer action.
+#
+# Nested actions can be called using the Agent reference from the enclosing
+# scope or by passing the reference in as a "send" argument. Nested actions
+# cannot be post using `self` from within the action block/proc/lambda; `self`
+# in this context will not reference the Agent. The preferred method for
+# dispatching nested actions is to pass the Agent as an argument. This allows
+# Ruby to more effectively manage the closing scope.
+#
+# Prefer this:
+#
+# ```
+# agent = Concurrent::Agent.new(0)
+# agent.send(agent) do |value, this|
+# this.send {|v| v + 42 }
+# 3.14
+# end
+# agent.value #=> 45.14
+# ```
+#
+# Over this:
+#
+# ```
+# agent = Concurrent::Agent.new(0)
+# agent.send do |value|
+# agent.send {|v| v + 42 }
+# 3.14
+# end
+# ```
+#
+#
+# **NOTE** Never, *under any circumstances*, call any of the "await" methods
+# ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action
+# block/proc/lambda. The call will block the Agent and will always fail.
+# Calling either {#await} or {#wait} (with a timeout of `nil`) will
+# hopelessly deadlock the Agent with no possibility of recovery.
+#
+# @see http://clojure.org/Agents Clojure Agents
+# @see http://clojure.org/state Values and Change - Clojure's approach to Identity and State
+#
+# source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#145
class Concurrent::Agent < ::Concurrent::Synchronization::LockableObject
include ::Concurrent::Concern::Observable
+ # Create a new `Agent` with the given initial value and options.
+ #
+ # The `:validator` option must be `nil` or a side-effect free proc/lambda
+ # which takes one argument. On any intended value change the validator, if
+ # provided, will be called. If the new value is invalid the validator should
+ # return `false` or raise an error.
+ #
+ # The `:error_handler` option must be `nil` or a proc/lambda which takes two
+ # arguments. When an action raises an error or validation fails, either by
+ # returning false or raising an error, the error handler will be called. The
+ # arguments to the error handler will be a reference to the agent itself and
+ # the error object which was raised.
+ #
+ # The `:error_mode` may be either `:continue` (the default if an error
+ # handler is given) or `:fail` (the default if error handler nil or not
+ # given).
+ #
+ # If an action being run by the agent throws an error or doesn't pass
+ # validation the error handler, if present, will be called. After the
+ # handler executes if the error mode is `:continue` the Agent will continue
+ # as if neither the action that caused the error nor the error itself ever
+ # happened.
+ #
+ # If the mode is `:fail` the Agent will become {#failed?} and will stop
+ # accepting new action dispatches. Any previously queued actions will be
+ # held until {#restart} is called. The {#value} method will still work,
+ # returning the value of the Agent before the error.
+ #
+ # @option opts
+ # @option opts
+ # @option opts
+ # @param initial [Object] the initial value
+ # @param opts [Hash] the configuration options
+ # @return [Agent] a new instance of Agent
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#220
def initialize(initial, opts = T.unsafe(nil)); end
+ # Dispatches an action to the Agent and returns immediately. Subsequently,
+ # in a thread from a thread pool, the {#value} will be set to the return
+ # value of the action. Appropriate for actions that may block on IO.
+ #
+ # @param action [Proc] the action dispatch to be enqueued
+ # @return [Concurrent::Agent] self
+ # @see #send_off
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#331
def <<(action); end
+
+ # Blocks the current thread (indefinitely!) until all actions dispatched
+ # thus far, from this thread or nested by the Agent, have occurred. Will
+ # block when {#failed?}. Will never return if a failed Agent is {#restart}
+ # with `:clear_actions` true.
+ #
+ # Returns a reference to `self` to support method chaining:
+ #
+ # ```
+ # current_value = agent.await.value
+ # ```
+ #
+ #
+ # **NOTE** Never, *under any circumstances*, call any of the "await" methods
+ # ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action
+ # block/proc/lambda. The call will block the Agent and will always fail.
+ # Calling either {#await} or {#wait} (with a timeout of `nil`) will
+ # hopelessly deadlock the Agent with no possibility of recovery.
+ #
+ # @return [Boolean] self
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#350
def await; end
+
+ # Blocks the current thread until all actions dispatched thus far, from this
+ # thread or nested by the Agent, have occurred, or the timeout (in seconds)
+ # has elapsed.
+ #
+ #
+ # **NOTE** Never, *under any circumstances*, call any of the "await" methods
+ # ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action
+ # block/proc/lambda. The call will block the Agent and will always fail.
+ # Calling either {#await} or {#wait} (with a timeout of `nil`) will
+ # hopelessly deadlock the Agent with no possibility of recovery.
+ #
+ # @param timeout [Float] the maximum number of seconds to wait
+ # @return [Boolean] true if all actions complete before timeout else false
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#363
def await_for(timeout); end
+
+ # Blocks the current thread until all actions dispatched thus far, from this
+ # thread or nested by the Agent, have occurred, or the timeout (in seconds)
+ # has elapsed.
+ #
+ #
+ # **NOTE** Never, *under any circumstances*, call any of the "await" methods
+ # ({#await}, {#await_for}, {#await_for!}, and {#wait}) from within an action
+ # block/proc/lambda. The call will block the Agent and will always fail.
+ # Calling either {#await} or {#wait} (with a timeout of `nil`) will
+ # hopelessly deadlock the Agent with no possibility of recovery.
+ #
+ # @param timeout [Float] the maximum number of seconds to wait
+ # @raise [Concurrent::TimeoutError] when timout is reached
+ # @return [Boolean] true if all actions complete before timeout
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#377
def await_for!(timeout); end
+
+ # The current value (state) of the Agent, irrespective of any pending or
+ # in-progress actions. The value is always available and is non-blocking.
+ #
+ # @return [Object] the current value
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#229
def deref; end
+
+ # When {#failed?} and {#error_mode} is `:fail`, returns the error object
+ # which caused the failure, else `nil`. When {#error_mode} is `:continue`
+ # will *always* return `nil`.
+ #
+ # @return [nil, Error] the error which caused the failure when {#failed?}
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#240
def error; end
+
+ # The error mode this Agent is operating in. See {#initialize} for details.
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#184
def error_mode; end
+
+ # Is the Agent in a failed state?
+ #
+ # @return [Boolean]
+ # @see #restart
+ #
+ # source://concurrent-ruby//lib/concurrent-ruby/concurrent/agent.rb#402
def failed?; end
+
+ # Dispatches an action to the Agent and returns immediately. Subsequently,
+ # in a thread from a thread pool, the {#value} will be set to the return
+ # value of the action. Action dispatches are only allowed when the Agent
+ # is not {#failed?}.
+ #
+ # The action must be a block/proc/lambda which takes 1 or more arguments.
+ # The first argument is the current {#value} of the Agent. Any arguments
+ # passed to the send method via the `args` parameter will be passed to the
+ # action as the remaining arguments. The action must return the new value
+ # of the Agent.
+ #
+ # * {#send} and {#send!} should be used for actions that are CPU limited
+ # * {#send_off}, {#send_off!}, and {#<<} are appropriate for actions that
+ # may block on IO
+ # * {#send_via} and {#send_via!} are used when a specific executor is to
+ # be used for the action
+ #
+ # @param args [Array