"a"*1_000_000_000:
+#
+# require 'benchmark'
+#
+# puts Benchmark.measure { "a"*1_000_000_000 }
+#
+# On my machine (OSX 10.8.3 on i5 1.7 GHz) this generates:
+#
+# 0.350000 0.400000 0.750000 ( 0.835234)
+#
+# This report shows the user CPU time, system CPU time, the total time
+# (sum of user CPU time, system CPU time, children's user CPU time,
+# and children's system CPU time), and the elapsed real time. The unit
+# of time is seconds.
+#
+# * Do some experiments sequentially using the #bm method:
+#
+# require 'benchmark'
+#
+# n = 5000000
+# Benchmark.bm do |x|
+# x.report { for i in 1..n; a = "1"; end }
+# x.report { n.times do ; a = "1"; end }
+# x.report { 1.upto(n) do ; a = "1"; end }
+# end
+#
+# The result:
+#
+# user system total real
+# 1.010000 0.000000 1.010000 ( 1.014479)
+# 1.000000 0.000000 1.000000 ( 0.998261)
+# 0.980000 0.000000 0.980000 ( 0.981335)
+#
+# * Continuing the previous example, put a label in each report:
+#
+# require 'benchmark'
+#
+# n = 5000000
+# Benchmark.bm(7) do |x|
+# x.report("for:") { for i in 1..n; a = "1"; end }
+# x.report("times:") { n.times do ; a = "1"; end }
+# x.report("upto:") { 1.upto(n) do ; a = "1"; end }
+# end
+#
+# The result:
+#
+# user system total real
+# for: 1.010000 0.000000 1.010000 ( 1.015688)
+# times: 1.000000 0.000000 1.000000 ( 1.003611)
+# upto: 1.030000 0.000000 1.030000 ( 1.028098)
+#
+# * The times for some benchmarks depend on the order in which items
+# are run. These differences are due to the cost of memory
+# allocation and garbage collection. To avoid these discrepancies,
+# the #bmbm method is provided. For example, to compare ways to
+# sort an array of floats:
+#
+# require 'benchmark'
+#
+# array = (1..1000000).map { rand }
+#
+# Benchmark.bmbm do |x|
+# x.report("sort!") { array.dup.sort! }
+# x.report("sort") { array.dup.sort }
+# end
+#
+# The result:
+#
+# Rehearsal -----------------------------------------
+# sort! 1.490000 0.010000 1.500000 ( 1.490520)
+# sort 1.460000 0.000000 1.460000 ( 1.463025)
+# -------------------------------- total: 2.960000sec
+#
+# user system total real
+# sort! 1.460000 0.000000 1.460000 ( 1.460465)
+# sort 1.450000 0.010000 1.460000 ( 1.448327)
+#
+# * Report statistics of sequential experiments with unique labels,
+# using the #benchmark method:
+#
+# require 'benchmark'
+# include Benchmark # we need the CAPTION and FORMAT constants
+#
+# n = 5000000
+# Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
+# tf = x.report("for:") { for i in 1..n; a = "1"; end }
+# tt = x.report("times:") { n.times do ; a = "1"; end }
+# tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
+# [tf+tt+tu, (tf+tt+tu)/3]
+# end
+#
+# The result:
+#
+# user system total real
+# for: 0.950000 0.000000 0.950000 ( 0.952039)
+# times: 0.980000 0.000000 0.980000 ( 0.984938)
+# upto: 0.950000 0.000000 0.950000 ( 0.946787)
+# >total: 2.880000 0.000000 2.880000 ( 2.883764)
+# >avg: 0.960000 0.000000 0.960000 ( 0.961255)
+#
+# source://benchmark//lib/benchmark.rb#123
+module Benchmark
+ private
+
+ # Invokes the block with a Benchmark::Report object, which
+ # may be used to collect and report on the results of individual
+ # benchmark tests. Reserves +label_width+ leading spaces for
+ # labels on each line. Prints +caption+ at the top of the
+ # report, and uses +format+ to format each line.
+ # (Note: +caption+ must contain a terminating newline character,
+ # see the default Benchmark::Tms::CAPTION for an example.)
+ #
+ # Returns an array of Benchmark::Tms objects.
+ #
+ # If the block returns an array of
+ # Benchmark::Tms objects, these will be used to format
+ # additional lines of output. If +labels+ parameter are
+ # given, these are used to label these extra lines.
+ #
+ # _Note_: Other methods provide a simpler interface to this one, and are
+ # suitable for nearly all benchmarking requirements. See the examples in
+ # Benchmark, and the #bm and #bmbm methods.
+ #
+ # Example:
+ #
+ # require 'benchmark'
+ # include Benchmark # we need the CAPTION and FORMAT constants
+ #
+ # n = 5000000
+ # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
+ # tf = x.report("for:") { for i in 1..n; a = "1"; end }
+ # tt = x.report("times:") { n.times do ; a = "1"; end }
+ # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
+ # [tf+tt+tu, (tf+tt+tu)/3]
+ # end
+ #
+ # Generates:
+ #
+ # user system total real
+ # for: 0.970000 0.000000 0.970000 ( 0.970493)
+ # times: 0.990000 0.000000 0.990000 ( 0.989542)
+ # upto: 0.970000 0.000000 0.970000 ( 0.972854)
+ # >total: 2.930000 0.000000 2.930000 ( 2.932889)
+ # >avg: 0.976667 0.000000 0.976667 ( 0.977630)
+ #
+ # source://benchmark//lib/benchmark.rb#171
+ def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end
+
+ # A simple interface to the #benchmark method, #bm generates sequential
+ # reports with labels. +label_width+ and +labels+ parameters have the same
+ # meaning as for #benchmark.
+ #
+ # require 'benchmark'
+ #
+ # n = 5000000
+ # Benchmark.bm(7) do |x|
+ # x.report("for:") { for i in 1..n; a = "1"; end }
+ # x.report("times:") { n.times do ; a = "1"; end }
+ # x.report("upto:") { 1.upto(n) do ; a = "1"; end }
+ # end
+ #
+ # Generates:
+ #
+ # user system total real
+ # for: 0.960000 0.000000 0.960000 ( 0.957966)
+ # times: 0.960000 0.000000 0.960000 ( 0.960423)
+ # upto: 0.950000 0.000000 0.950000 ( 0.954864)
+ #
+ # source://benchmark//lib/benchmark.rb#216
+ def bm(label_width = T.unsafe(nil), *labels, &blk); end
+
+ # Sometimes benchmark results are skewed because code executed
+ # earlier encounters different garbage collection overheads than
+ # that run later. #bmbm attempts to minimize this effect by running
+ # the tests twice, the first time as a rehearsal in order to get the
+ # runtime environment stable, the second time for
+ # real. GC.start is executed before the start of each of
+ # the real timings; the cost of this is not included in the
+ # timings. In reality, though, there's only so much that #bmbm can
+ # do, and the results are not guaranteed to be isolated from garbage
+ # collection and other effects.
+ #
+ # Because #bmbm takes two passes through the tests, it can
+ # calculate the required label width.
+ #
+ # require 'benchmark'
+ #
+ # array = (1..1000000).map { rand }
+ #
+ # Benchmark.bmbm do |x|
+ # x.report("sort!") { array.dup.sort! }
+ # x.report("sort") { array.dup.sort }
+ # end
+ #
+ # Generates:
+ #
+ # Rehearsal -----------------------------------------
+ # sort! 1.440000 0.010000 1.450000 ( 1.446833)
+ # sort 1.440000 0.000000 1.440000 ( 1.448257)
+ # -------------------------------- total: 2.890000sec
+ #
+ # user system total real
+ # sort! 1.460000 0.000000 1.460000 ( 1.458065)
+ # sort 1.450000 0.000000 1.450000 ( 1.455963)
+ #
+ # #bmbm yields a Benchmark::Job object and returns an array of
+ # Benchmark::Tms objects.
+ #
+ # source://benchmark//lib/benchmark.rb#258
+ def bmbm(width = T.unsafe(nil)); end
+
+ # Returns the time used to execute the given block as a
+ # Benchmark::Tms object. Takes +label+ option.
+ #
+ # require 'benchmark'
+ #
+ # n = 1000000
+ #
+ # time = Benchmark.measure do
+ # n.times { a = "1" }
+ # end
+ # puts time
+ #
+ # Generates:
+ #
+ # 0.220000 0.000000 0.220000 ( 0.227313)
+ #
+ # source://benchmark//lib/benchmark.rb#303
+ def measure(label = T.unsafe(nil)); end
+
+ # Returns the elapsed real time used to execute the given block.
+ # The unit of time is milliseconds.
+ #
+ # Benchmark.ms { "a" * 1_000_000_000 }
+ # #=> 509.8029999935534
+ #
+ # source://benchmark//lib/benchmark.rb#335
+ def ms; end
+
+ # Returns the elapsed real time used to execute the given block.
+ # The unit of time is seconds.
+ #
+ # Benchmark.realtime { "a" * 1_000_000_000 }
+ # #=> 0.5098029999935534
+ #
+ # source://benchmark//lib/benchmark.rb#322
+ def realtime; end
+
+ class << self
+ # Invokes the block with a Benchmark::Report object, which
+ # may be used to collect and report on the results of individual
+ # benchmark tests. Reserves +label_width+ leading spaces for
+ # labels on each line. Prints +caption+ at the top of the
+ # report, and uses +format+ to format each line.
+ # (Note: +caption+ must contain a terminating newline character,
+ # see the default Benchmark::Tms::CAPTION for an example.)
+ #
+ # Returns an array of Benchmark::Tms objects.
+ #
+ # If the block returns an array of
+ # Benchmark::Tms objects, these will be used to format
+ # additional lines of output. If +labels+ parameter are
+ # given, these are used to label these extra lines.
+ #
+ # _Note_: Other methods provide a simpler interface to this one, and are
+ # suitable for nearly all benchmarking requirements. See the examples in
+ # Benchmark, and the #bm and #bmbm methods.
+ #
+ # Example:
+ #
+ # require 'benchmark'
+ # include Benchmark # we need the CAPTION and FORMAT constants
+ #
+ # n = 5000000
+ # Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
+ # tf = x.report("for:") { for i in 1..n; a = "1"; end }
+ # tt = x.report("times:") { n.times do ; a = "1"; end }
+ # tu = x.report("upto:") { 1.upto(n) do ; a = "1"; end }
+ # [tf+tt+tu, (tf+tt+tu)/3]
+ # end
+ #
+ # Generates:
+ #
+ # user system total real
+ # for: 0.970000 0.000000 0.970000 ( 0.970493)
+ # times: 0.990000 0.000000 0.990000 ( 0.989542)
+ # upto: 0.970000 0.000000 0.970000 ( 0.972854)
+ # >total: 2.930000 0.000000 2.930000 ( 2.932889)
+ # >avg: 0.976667 0.000000 0.976667 ( 0.977630)
+ #
+ # source://benchmark//lib/benchmark.rb#341
+ def benchmark(caption = T.unsafe(nil), label_width = T.unsafe(nil), format = T.unsafe(nil), *labels); end
+
+ # A simple interface to the #benchmark method, #bm generates sequential
+ # reports with labels. +label_width+ and +labels+ parameters have the same
+ # meaning as for #benchmark.
+ #
+ # require 'benchmark'
+ #
+ # n = 5000000
+ # Benchmark.bm(7) do |x|
+ # x.report("for:") { for i in 1..n; a = "1"; end }
+ # x.report("times:") { n.times do ; a = "1"; end }
+ # x.report("upto:") { 1.upto(n) do ; a = "1"; end }
+ # end
+ #
+ # Generates:
+ #
+ # user system total real
+ # for: 0.960000 0.000000 0.960000 ( 0.957966)
+ # times: 0.960000 0.000000 0.960000 ( 0.960423)
+ # upto: 0.950000 0.000000 0.950000 ( 0.954864)
+ #
+ # source://benchmark//lib/benchmark.rb#341
+ def bm(label_width = T.unsafe(nil), *labels, &blk); end
+
+ # Sometimes benchmark results are skewed because code executed
+ # earlier encounters different garbage collection overheads than
+ # that run later. #bmbm attempts to minimize this effect by running
+ # the tests twice, the first time as a rehearsal in order to get the
+ # runtime environment stable, the second time for
+ # real. GC.start is executed before the start of each of
+ # the real timings; the cost of this is not included in the
+ # timings. In reality, though, there's only so much that #bmbm can
+ # do, and the results are not guaranteed to be isolated from garbage
+ # collection and other effects.
+ #
+ # Because #bmbm takes two passes through the tests, it can
+ # calculate the required label width.
+ #
+ # require 'benchmark'
+ #
+ # array = (1..1000000).map { rand }
+ #
+ # Benchmark.bmbm do |x|
+ # x.report("sort!") { array.dup.sort! }
+ # x.report("sort") { array.dup.sort }
+ # end
+ #
+ # Generates:
+ #
+ # Rehearsal -----------------------------------------
+ # sort! 1.440000 0.010000 1.450000 ( 1.446833)
+ # sort 1.440000 0.000000 1.440000 ( 1.448257)
+ # -------------------------------- total: 2.890000sec
+ #
+ # user system total real
+ # sort! 1.460000 0.000000 1.460000 ( 1.458065)
+ # sort 1.450000 0.000000 1.450000 ( 1.455963)
+ #
+ # #bmbm yields a Benchmark::Job object and returns an array of
+ # Benchmark::Tms objects.
+ #
+ # source://benchmark//lib/benchmark.rb#341
+ def bmbm(width = T.unsafe(nil)); end
+
+ # Returns the time used to execute the given block as a
+ # Benchmark::Tms object. Takes +label+ option.
+ #
+ # require 'benchmark'
+ #
+ # n = 1000000
+ #
+ # time = Benchmark.measure do
+ # n.times { a = "1" }
+ # end
+ # puts time
+ #
+ # Generates:
+ #
+ # 0.220000 0.000000 0.220000 ( 0.227313)
+ #
+ # source://benchmark//lib/benchmark.rb#341
+ def measure(label = T.unsafe(nil)); end
+
+ # Returns the elapsed real time used to execute the given block.
+ # The unit of time is milliseconds.
+ #
+ # Benchmark.ms { "a" * 1_000_000_000 }
+ # #=> 509.8029999935534
+ #
+ # source://benchmark//lib/benchmark.rb#341
+ def ms; end
+
+ # Returns the elapsed real time used to execute the given block.
+ # The unit of time is seconds.
+ #
+ # Benchmark.realtime { "a" * 1_000_000_000 }
+ # #=> 0.5098029999935534
+ #
+ # source://benchmark//lib/benchmark.rb#341
+ def realtime; end
+ end
+end
+
+# A Job is a sequence of labelled blocks to be processed by the
+# Benchmark.bmbm method. It is of little direct interest to the user.
+#
+# source://benchmark//lib/benchmark.rb#347
+class Benchmark::Job
+ # Returns an initialized Job instance.
+ # Usually, one doesn't call this method directly, as new
+ # Job objects are created by the #bmbm method.
+ # +width+ is a initial value for the label offset used in formatting;
+ # the #bmbm method passes its +width+ argument to this constructor.
+ #
+ # @return [Job] a new instance of Job
+ #
+ # source://benchmark//lib/benchmark.rb#355
+ def initialize(width); end
+
+ # Registers the given label and block pair in the job list.
+ #
+ # @raise [ArgumentError]
+ #
+ # source://benchmark//lib/benchmark.rb#363
+ def item(label = T.unsafe(nil), &blk); end
+
+ # An array of 2-element arrays, consisting of label and block pairs.
+ #
+ # source://benchmark//lib/benchmark.rb#375
+ def list; end
+
+ # Registers the given label and block pair in the job list.
+ #
+ # @raise [ArgumentError]
+ #
+ # source://benchmark//lib/benchmark.rb#372
+ def report(label = T.unsafe(nil), &blk); end
+
+ # Length of the widest label in the #list.
+ #
+ # source://benchmark//lib/benchmark.rb#378
+ def width; end
+end
+
+# This class is used by the Benchmark.benchmark and Benchmark.bm methods.
+# It is of little direct interest to the user.
+#
+# source://benchmark//lib/benchmark.rb#385
+class Benchmark::Report
+ # Returns an initialized Report instance.
+ # Usually, one doesn't call this method directly, as new
+ # Report objects are created by the #benchmark and #bm methods.
+ # +width+ and +format+ are the label offset and
+ # format string used by Tms#format.
+ #
+ # @return [Report] a new instance of Report
+ #
+ # source://benchmark//lib/benchmark.rb#393
+ def initialize(width = T.unsafe(nil), format = T.unsafe(nil)); end
+
+ # An array of Benchmark::Tms objects representing each item.
+ #
+ # source://benchmark//lib/benchmark.rb#412
+ def format; end
+
+ # Prints the +label+ and measured time for the block,
+ # formatted by +format+. See Tms#format for the
+ # formatting rules.
+ #
+ # source://benchmark//lib/benchmark.rb#402
+ def item(label = T.unsafe(nil), *format, &blk); end
+
+ # An array of Benchmark::Tms objects representing each item.
+ #
+ # source://benchmark//lib/benchmark.rb#412
+ def list; end
+
+ # Prints the +label+ and measured time for the block,
+ # formatted by +format+. See Tms#format for the
+ # formatting rules.
+ #
+ # source://benchmark//lib/benchmark.rb#409
+ def report(label = T.unsafe(nil), *format, &blk); end
+
+ # An array of Benchmark::Tms objects representing each item.
+ #
+ # source://benchmark//lib/benchmark.rb#412
+ def width; end
+end
+
+# A data object, representing the times associated with a benchmark
+# measurement.
+#
+# source://benchmark//lib/benchmark.rb#421
+class Benchmark::Tms
+ # Returns an initialized Tms object which has
+ # +utime+ as the user CPU time, +stime+ as the system CPU time,
+ # +cutime+ as the children's user CPU time, +cstime+ as the children's
+ # system CPU time, +real+ as the elapsed real time and +label+ as the label.
+ #
+ # @return [Tms] a new instance of Tms
+ #
+ # source://benchmark//lib/benchmark.rb#456
+ def initialize(utime = T.unsafe(nil), stime = T.unsafe(nil), cutime = T.unsafe(nil), cstime = T.unsafe(nil), real = T.unsafe(nil), label = T.unsafe(nil)); end
+
+ # Returns a new Tms object obtained by memberwise multiplication
+ # of the individual times for this Tms object by +x+.
+ #
+ # source://benchmark//lib/benchmark.rb#504
+ def *(x); end
+
+ # Returns a new Tms object obtained by memberwise summation
+ # of the individual times for this Tms object with those of the +other+
+ # Tms object.
+ # This method and #/() are useful for taking statistics.
+ #
+ # source://benchmark//lib/benchmark.rb#491
+ def +(other); end
+
+ # Returns a new Tms object obtained by memberwise subtraction
+ # of the individual times for the +other+ Tms object from those of this
+ # Tms object.
+ #
+ # source://benchmark//lib/benchmark.rb#498
+ def -(other); end
+
+ # Returns a new Tms object obtained by memberwise division
+ # of the individual times for this Tms object by +x+.
+ # This method and #+() are useful for taking statistics.
+ #
+ # source://benchmark//lib/benchmark.rb#511
+ def /(x); end
+
+ # Returns a new Tms object whose times are the sum of the times for this
+ # Tms object, plus the time required to execute the code block (+blk+).
+ #
+ # source://benchmark//lib/benchmark.rb#465
+ def add(&blk); end
+
+ # An in-place version of #add.
+ # Changes the times of this Tms object by making it the sum of the times
+ # for this Tms object, plus the time required to execute
+ # the code block (+blk+).
+ #
+ # source://benchmark//lib/benchmark.rb#475
+ def add!(&blk); end
+
+ # System CPU time of children
+ #
+ # source://benchmark//lib/benchmark.rb#439
+ def cstime; end
+
+ # User CPU time of children
+ #
+ # source://benchmark//lib/benchmark.rb#436
+ def cutime; end
+
+ # Returns the contents of this Tms object as
+ # a formatted string, according to a +format+ string
+ # like that passed to Kernel.format. In addition, #format
+ # accepts the following extensions:
+ #
+ # %u:: Replaced by the user CPU time, as reported by Tms#utime.
+ # %y:: Replaced by the system CPU time, as reported by Tms#stime (Mnemonic: y of "s*y*stem")
+ # %U:: Replaced by the children's user CPU time, as reported by Tms#cutime
+ # %Y:: Replaced by the children's system CPU time, as reported by Tms#cstime
+ # %t:: Replaced by the total CPU time, as reported by Tms#total
+ # %r:: Replaced by the elapsed real time, as reported by Tms#real
+ # %n:: Replaced by the label string, as reported by Tms#label (Mnemonic: n of "*n*ame")
+ #
+ # If +format+ is not given, FORMAT is used as default value, detailing the
+ # user, system, total and real elapsed time.
+ #
+ # source://benchmark//lib/benchmark.rb#530
+ def format(format = T.unsafe(nil), *args); end
+
+ # Label
+ #
+ # source://benchmark//lib/benchmark.rb#448
+ def label; end
+
+ # Elapsed real time
+ #
+ # source://benchmark//lib/benchmark.rb#442
+ def real; end
+
+ # System CPU time
+ #
+ # source://benchmark//lib/benchmark.rb#433
+ def stime; end
+
+ # Returns a new 6-element array, consisting of the
+ # label, user CPU time, system CPU time, children's
+ # user CPU time, children's system CPU time and elapsed
+ # real time.
+ #
+ # source://benchmark//lib/benchmark.rb#555
+ def to_a; end
+
+ # Returns a hash containing the same data as `to_a`.
+ #
+ # source://benchmark//lib/benchmark.rb#562
+ def to_h; end
+
+ # Same as #format.
+ #
+ # source://benchmark//lib/benchmark.rb#545
+ def to_s; end
+
+ # Total time, that is +utime+ + +stime+ + +cutime+ + +cstime+
+ #
+ # source://benchmark//lib/benchmark.rb#445
+ def total; end
+
+ # User CPU time
+ #
+ # source://benchmark//lib/benchmark.rb#430
+ def utime; end
+
+ protected
+
+ # Returns a new Tms object obtained by memberwise operation +op+
+ # of the individual times for this Tms object with those of the other
+ # Tms object (+x+).
+ #
+ # +op+ can be a mathematical operation such as +, -,
+ # *, /
+ #
+ # source://benchmark//lib/benchmark.rb#583
+ def memberwise(op, x); end
+end
+
+# source://benchmark//lib/benchmark.rb#125
+Benchmark::VERSION = T.let(T.unsafe(nil), String)
diff --git a/spec/test_app/sorbet/rbi/gems/builder@3.3.0.rbi b/spec/test_app/sorbet/rbi/gems/builder@3.3.0.rbi
new file mode 100644
index 0000000..177ba9a
--- /dev/null
+++ b/spec/test_app/sorbet/rbi/gems/builder@3.3.0.rbi
@@ -0,0 +1,9 @@
+# typed: true
+
+# DO NOT EDIT MANUALLY
+# This is an autogenerated file for types exported from the `builder` gem.
+# Please instead update this file by running `bin/tapioca gem builder`.
+
+
+# THIS IS AN EMPTY RBI FILE.
+# see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem
diff --git a/spec/test_app/sorbet/rbi/gems/connection_pool@3.0.2.rbi b/spec/test_app/sorbet/rbi/gems/connection_pool@3.0.2.rbi
new file mode 100644
index 0000000..3d9f595
--- /dev/null
+++ b/spec/test_app/sorbet/rbi/gems/connection_pool@3.0.2.rbi
@@ -0,0 +1,9 @@
+# typed: true
+
+# DO NOT EDIT MANUALLY
+# This is an autogenerated file for types exported from the `connection_pool` gem.
+# Please instead update this file by running `bin/tapioca gem connection_pool`.
+
+
+# THIS IS AN EMPTY RBI FILE.
+# see https://github.com/Shopify/tapioca#manually-requiring-parts-of-a-gem
diff --git a/spec/test_app/sorbet/rbi/gems/constant_resolver@0.3.0.rbi b/spec/test_app/sorbet/rbi/gems/constant_resolver@0.3.0.rbi
new file mode 100644
index 0000000..a80924e
--- /dev/null
+++ b/spec/test_app/sorbet/rbi/gems/constant_resolver@0.3.0.rbi
@@ -0,0 +1,100 @@
+# typed: true
+
+# DO NOT EDIT MANUALLY
+# This is an autogenerated file for types exported from the `constant_resolver` gem.
+# Please instead update this file by running `bin/tapioca gem constant_resolver`.
+
+
+# Get information about (partially qualified) constants without loading the application code.
+# We infer the fully qualified name and the filepath.
+#
+# The implementation makes a few assumptions about the code base:
+# - `Something::SomeOtherThing` is defined in a path of either `something/some_other_thing.rb` or `something.rb`,
+# relative to the load path. Constants that have their own file do not have all-uppercase names like MAGIC_NUMBER or
+# all-uppercase parts like SomeID. Rails' `zeitwerk` autoloader makes the same assumption.
+# - It is OK to not always infer the exact file defining the constant. For example, when a constant is inherited, we
+# have no way of inferring the file it is defined in. You could argue though that inheritance means that another
+# constant with the same name exists in the inheriting class, and this view is sufficient for all our use cases.
+#
+# source://constant_resolver//lib/constant_resolver/version.rb#3
+class ConstantResolver
+ # @example usage in a Rails app
+ # config = Rails.application.config
+ # load_paths = (config.eager_load_paths + config.autoload_paths + config.autoload_once_paths)
+ # .map { |p| Pathname.new(p).relative_path_from(Rails.root).to_s }
+ # ConstantResolver.new(
+ # root_path: Rails.root.to_s,
+ # load_paths: load_paths
+ # )
+ # @param exclude [Arraydruby://:? . The option is optional.
+#
+# source://drb//lib/drb/drb.rb#843
+class DRb::DRbTCPSocket
+ # Create a new DRbTCPSocket instance.
+ #
+ # +uri+ is the URI we are connected to.
+ # +soc+ is the tcp socket we are bound to. +config+ is our
+ # configuration.
+ #
+ # @return [DRbTCPSocket] a new instance of DRbTCPSocket
+ #
+ # source://drb//lib/drb/drb.rb#931
+ def initialize(uri, soc, config = T.unsafe(nil)); end
+
+ # On the server side, for an instance returned by #open_server,
+ # accept a client connection and return a new instance to handle
+ # the server's side of this client-server session.
+ #
+ # source://drb//lib/drb/drb.rb#999
+ def accept; end
+
+ # Check to see if this connection is alive.
+ #
+ # @return [Boolean]
+ #
+ # source://drb//lib/drb/drb.rb#1029
+ def alive?; end
+
+ # Close the connection.
+ #
+ # If this is an instance returned by #open_server, then this stops
+ # listening for new connections altogether. If this is an instance
+ # returned by #open or by #accept, then it closes this particular
+ # client-server session.
+ #
+ # source://drb//lib/drb/drb.rb#981
+ def close; end
+
+ # Get the address of our TCP peer (the other end of the socket
+ # we are bound to.
+ #
+ # source://drb//lib/drb/drb.rb#946
+ def peeraddr; end
+
+ # On the client side, receive a reply from the server.
+ #
+ # source://drb//lib/drb/drb.rb#969
+ def recv_reply; end
+
+ # On the server side, receive a request from the client.
+ #
+ # source://drb//lib/drb/drb.rb#959
+ def recv_request; end
+
+ # On the server side, send a reply to the client.
+ #
+ # source://drb//lib/drb/drb.rb#964
+ def send_reply(succ, result); end
+
+ # On the client side, send a request to the server.
+ #
+ # source://drb//lib/drb/drb.rb#954
+ def send_request(ref, msg_id, arg, b); end
+
+ # source://drb//lib/drb/drb.rb#1038
+ def set_sockopt(soc); end
+
+ # Graceful shutdown
+ #
+ # source://drb//lib/drb/drb.rb#1024
+ def shutdown; end
+
+ # Get the socket.
+ #
+ # source://drb//lib/drb/drb.rb#951
+ def stream; end
+
+ # Get the URI that we are connected to.
+ #
+ # source://drb//lib/drb/drb.rb#942
+ def uri; end
+
+ private
+
+ # source://drb//lib/drb/drb.rb#1014
+ def accept_or_shutdown; end
+
+ # source://drb//lib/drb/drb.rb#990
+ def close_shutdown_pipe; end
+
+ class << self
+ # Returns the hostname of this server
+ #
+ # source://drb//lib/drb/drb.rb#873
+ def getservername; end
+
+ # Open a client connection to +uri+ (DRb URI string) using configuration
+ # +config+.
+ #
+ # This can raise DRb::DRbBadScheme or DRb::DRbBadURI if +uri+ is not for a
+ # recognized protocol. See DRb::DRbServer.new for information on built-in
+ # URI protocols.
+ #
+ # source://drb//lib/drb/drb.rb#866
+ def open(uri, config); end
+
+ # Open a server listening for connections at +uri+ using
+ # configuration +config+.
+ #
+ # source://drb//lib/drb/drb.rb#904
+ def open_server(uri, config); end
+
+ # For the families available for +host+, returns a TCPServer on +port+.
+ # If +port+ is 0 the first available port is used. IPv4 servers are
+ # preferred over IPv6 servers.
+ #
+ # source://drb//lib/drb/drb.rb#889
+ def open_server_inaddr_any(host, port); end
+
+ # source://drb//lib/drb/drb.rb#846
+ def parse_uri(uri); end
+
+ # Parse +uri+ into a [uri, option] pair.
+ #
+ # source://drb//lib/drb/drb.rb#921
+ def uri_option(uri, config); end
+ end
+end
+
+# Implements DRb over a UNIX socket
+#
+# DRb UNIX socket URIs look like drbunix:? . The
+# option is optional.
+#
+# source://drb//lib/drb/unix.rb#15
+class DRb::DRbUNIXSocket < ::DRb::DRbTCPSocket
+ # @return [DRbUNIXSocket] a new instance of DRbUNIXSocket
+ #
+ # source://drb//lib/drb/unix.rb#62
+ def initialize(uri, soc, config = T.unsafe(nil), server_mode = T.unsafe(nil)); end
+
+ # source://drb//lib/drb/unix.rb#105
+ def accept; end
+
+ # source://drb//lib/drb/unix.rb#95
+ def close; end
+
+ # source://drb//lib/drb/unix.rb#111
+ def set_sockopt(soc); end
+
+ class << self
+ # source://drb//lib/drb/unix.rb#28
+ def open(uri, config); end
+
+ # source://drb//lib/drb/unix.rb#34
+ def open_server(uri, config); end
+
+ # :stopdoc:
+ #
+ # source://drb//lib/drb/unix.rb#17
+ def parse_uri(uri); end
+
+ # source://drb//lib/drb/unix.rb#72
+ def temp_server; end
+
+ # source://drb//lib/drb/unix.rb#57
+ def uri_option(uri, config); end
+ end
+end
+
+# import from tempfile.rb
+#
+# source://drb//lib/drb/unix.rb#70
+DRb::DRbUNIXSocket::Max_try = T.let(T.unsafe(nil), Integer)
+
+# source://drb//lib/drb/drb.rb#1049
+class DRb::DRbURIOption
+ # @return [DRbURIOption] a new instance of DRbURIOption
+ #
+ # source://drb//lib/drb/drb.rb#1050
+ def initialize(option); end
+
+ # source://drb//lib/drb/drb.rb#1056
+ def ==(other); end
+
+ # source://drb//lib/drb/drb.rb#1065
+ def eql?(other); end
+
+ # source://drb//lib/drb/drb.rb#1061
+ def hash; end
+
+ # Returns the value of attribute option.
+ #
+ # source://drb//lib/drb/drb.rb#1053
+ def option; end
+
+ # source://drb//lib/drb/drb.rb#1054
+ def to_s; end
+end
+
+# Mixin module making an object undumpable or unmarshallable.
+#
+# If an object which includes this module is returned by method
+# called over drb, then the object remains in the server space
+# and a reference to the object is returned, rather than the
+# object being marshalled and moved into the client space.
+#
+# source://drb//lib/drb/drb.rb#418
+module DRb::DRbUndumped
+ # @raise [TypeError]
+ #
+ # source://drb//lib/drb/drb.rb#419
+ def _dump(dummy); end
+end
+
+# Class wrapping a marshalled object whose type is unknown locally.
+#
+# If an object is returned by a method invoked over drb, but the
+# class of the object is unknown in the client namespace, or
+# the object is a constant unknown in the client namespace, then
+# the still-marshalled object is returned wrapped in a DRbUnknown instance.
+#
+# If this object is passed as an argument to a method invoked over
+# drb, then the wrapped object is passed instead.
+#
+# The class or constant name of the object can be read from the
+# +name+ attribute. The marshalled object is held in the +buf+
+# attribute.
+#
+# source://drb//lib/drb/drb.rb#485
+class DRb::DRbUnknown
+ # Create a new DRbUnknown object.
+ #
+ # +buf+ is a string containing a marshalled object that could not
+ # be unmarshalled. +err+ is the error message that was raised
+ # when the unmarshalling failed. It is used to determine the
+ # name of the unmarshalled object.
+ #
+ # @return [DRbUnknown] a new instance of DRbUnknown
+ #
+ # source://drb//lib/drb/drb.rb#493
+ def initialize(err, buf); end
+
+ # source://drb//lib/drb/drb.rb#522
+ def _dump(lv); end
+
+ # Buffer contained the marshalled, unknown object.
+ #
+ # source://drb//lib/drb/drb.rb#512
+ def buf; end
+
+ # Create a DRbUnknownError exception containing this object.
+ #
+ # source://drb//lib/drb/drb.rb#536
+ def exception; end
+
+ # The name of the unknown thing.
+ #
+ # Class name for unknown objects; variable name for unknown
+ # constants.
+ #
+ # source://drb//lib/drb/drb.rb#509
+ def name; end
+
+ # Attempt to load the wrapped marshalled object again.
+ #
+ # If the class of the object is now known locally, the object
+ # will be unmarshalled and returned. Otherwise, a new
+ # but identical DRbUnknown object will be returned.
+ #
+ # source://drb//lib/drb/drb.rb#531
+ def reload; end
+
+ class << self
+ # source://drb//lib/drb/drb.rb#514
+ def _load(s); end
+ end
+end
+
+# An exception wrapping a DRb::DRbUnknown object
+#
+# source://drb//lib/drb/drb.rb#438
+class DRb::DRbUnknownError < ::DRb::DRbError
+ # Create a new DRbUnknownError for the DRb::DRbUnknown object +unknown+
+ #
+ # @return [DRbUnknownError] a new instance of DRbUnknownError
+ #
+ # source://drb//lib/drb/drb.rb#441
+ def initialize(unknown); end
+
+ # source://drb//lib/drb/drb.rb#453
+ def _dump(lv); end
+
+ # Get the wrapped DRb::DRbUnknown object.
+ #
+ # source://drb//lib/drb/drb.rb#447
+ def unknown; end
+
+ class << self
+ # source://drb//lib/drb/drb.rb#449
+ def _load(s); end
+ end
+end
+
+# source://drb//lib/drb/drb.rb#1227
+class DRb::ThreadObject
+ include ::MonitorMixin
+
+ # @return [ThreadObject] a new instance of ThreadObject
+ #
+ # source://drb//lib/drb/drb.rb#1230
+ def initialize(&blk); end
+
+ # source://drb//lib/drb/drb.rb#1265
+ def _execute; end
+
+ # @return [Boolean]
+ #
+ # source://drb//lib/drb/drb.rb#1241
+ def alive?; end
+
+ # source://drb//lib/drb/drb.rb#1245
+ def kill; end
+
+ # source://drb//lib/drb/drb.rb#1250
+ def method_missing(msg, *arg, &blk); end
+end
+
+# source://drb//lib/drb/version.rb#2
+DRb::VERSION = T.let(T.unsafe(nil), String)
+
+# source://drb//lib/drb/drb.rb#1993
+DRbIdConv = DRb::DRbIdConv
+
+# :stopdoc:
+#
+# source://drb//lib/drb/drb.rb#1991
+DRbObject = DRb::DRbObject
+
+# source://drb//lib/drb/drb.rb#1992
+DRbUndumped = DRb::DRbUndumped
diff --git a/spec/test_app/sorbet/rbi/gems/i18n@1.15.2.rbi b/spec/test_app/sorbet/rbi/gems/i18n@1.15.2.rbi
new file mode 100644
index 0000000..80c536b
--- /dev/null
+++ b/spec/test_app/sorbet/rbi/gems/i18n@1.15.2.rbi
@@ -0,0 +1,2425 @@
+# typed: true
+
+# DO NOT EDIT MANUALLY
+# This is an autogenerated file for types exported from the `i18n` gem.
+# Please instead update this file by running `bin/tapioca gem i18n`.
+
+
+# source://i18n//lib/i18n/gettext/po_parser.rb#15
+module GetText; end
+
+# source://i18n//lib/i18n/gettext/po_parser.rb#17
+class GetText::PoParser < ::Racc::Parser
+ # source://i18n//lib/i18n/gettext/po_parser.rb#19
+ def _(x); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#282
+ def _reduce_10(val, _values, result); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#295
+ def _reduce_12(val, _values, result); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#302
+ def _reduce_13(val, _values, result); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#309
+ def _reduce_14(val, _values, result); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#316
+ def _reduce_15(val, _values, result); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#235
+ def _reduce_5(val, _values, result); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#246
+ def _reduce_8(val, _values, result); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#264
+ def _reduce_9(val, _values, result); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#323
+ def _reduce_none(val, _values, result); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#23
+ def next_token; end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#23
+ def on_comment(comment); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#23
+ def on_message(msgid, msgstr); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#23
+ def parse(str, data, ignore_fuzzy = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/gettext/po_parser.rb#23
+ def unescape(orig); end
+end
+
+# source://i18n//lib/i18n/gettext/po_parser.rb#184
+GetText::PoParser::Racc_arg = T.let(T.unsafe(nil), Array)
+
+# source://i18n//lib/i18n/gettext/po_parser.rb#221
+GetText::PoParser::Racc_debug_parser = T.let(T.unsafe(nil), TrueClass)
+
+# source://i18n//lib/i18n/gettext/po_parser.rb#200
+GetText::PoParser::Racc_token_to_s_table = T.let(T.unsafe(nil), Array)
+
+# Simple Locale tag implementation that computes subtags by simply splitting
+# the locale tag at '-' occurrences.
+#
+# source://i18n//lib/i18n/version.rb#3
+module I18n
+ extend ::I18n::Base
+
+ class << self
+ # source://i18n//lib/i18n/backend/cache.rb#64
+ def cache_key_digest; end
+
+ # source://i18n//lib/i18n/backend/cache.rb#68
+ def cache_key_digest=(key_digest); end
+
+ # source://i18n//lib/i18n/backend/cache.rb#56
+ def cache_namespace; end
+
+ # source://i18n//lib/i18n/backend/cache.rb#60
+ def cache_namespace=(namespace); end
+
+ # source://i18n//lib/i18n/backend/cache.rb#48
+ def cache_store; end
+
+ # source://i18n//lib/i18n/backend/cache.rb#52
+ def cache_store=(store); end
+
+ # Returns the current fallbacks implementation. Defaults to +I18n::Locale::Fallbacks+.
+ #
+ # source://i18n//lib/i18n/backend/fallbacks.rb#17
+ def fallbacks; end
+
+ # Sets the current fallbacks implementation. Use this to set a different fallbacks implementation.
+ #
+ # source://i18n//lib/i18n/backend/fallbacks.rb#27
+ def fallbacks=(fallbacks); end
+
+ # Return String or raises MissingInterpolationArgument exception.
+ # Missing argument's logic is handled by I18n.config.missing_interpolation_argument_handler.
+ #
+ # @raise [ReservedInterpolationKey]
+ #
+ # source://i18n//lib/i18n/interpolate/ruby.rb#23
+ def interpolate(string, values); end
+
+ # source://i18n//lib/i18n/interpolate/ruby.rb#29
+ def interpolate_hash(string, values); end
+
+ # source://i18n//lib/i18n.rb#38
+ def new_double_nested_cache; end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/cache.rb#72
+ def perform_caching?; end
+
+ # Marks a key as reserved. Reserved keys are used internally,
+ # and can't also be used for interpolation. If you are using any
+ # extra keys as I18n options, you should call I18n.reserve_key
+ # before any I18n.translate (etc) calls are made.
+ #
+ # source://i18n//lib/i18n.rb#46
+ def reserve_key(key); end
+
+ # source://i18n//lib/i18n.rb#51
+ def reserved_keys_pattern; end
+ end
+end
+
+# source://i18n//lib/i18n/exceptions.rb#14
+class I18n::ArgumentError < ::ArgumentError; end
+
+# source://i18n//lib/i18n/backend.rb#4
+module I18n::Backend; end
+
+# source://i18n//lib/i18n/backend/base.rb#8
+module I18n::Backend::Base
+ include ::I18n::Backend::Transliterator
+
+ # Returns an array of locales for which translations are available
+ # ignoring the reserved translation meta data key :i18n.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://i18n//lib/i18n/backend/base.rb#97
+ def available_locales; end
+
+ # source://i18n//lib/i18n/backend/base.rb#105
+ def eager_load!; end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/base.rb#71
+ def exists?(locale, key, options = T.unsafe(nil)); end
+
+ # Accepts a list of paths to translation files. Loads translations from
+ # plain Ruby (*.rb), YAML files (*.yml), or JSON files (*.json). See #load_rb, #load_yml, and #load_json
+ # for details.
+ #
+ # source://i18n//lib/i18n/backend/base.rb#14
+ def load_translations(*filenames); end
+
+ # Acts the same as +strftime+, but uses a localized version of the
+ # format string. Takes a key from the date/time formats translations as
+ # a format argument (e.g., :short in :'date.formats').
+ #
+ # @raise [ArgumentError]
+ #
+ # source://i18n//lib/i18n/backend/base.rb#78
+ def localize(locale, object, format = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/backend/base.rb#101
+ def reload!; end
+
+ # This method receives a locale, a data hash and options for storing translations.
+ # Should be implemented
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://i18n//lib/i18n/backend/base.rb#24
+ def store_translations(locale, data, options = T.unsafe(nil)); end
+
+ # @raise [I18n::ArgumentError]
+ #
+ # source://i18n//lib/i18n/backend/base.rb#28
+ def translate(locale, key, options = T.unsafe(nil)); end
+
+ protected
+
+ # Deep interpolation
+ #
+ # deep_interpolate { people: { ann: "Ann is %{ann}", john: "John is %{john}" } },
+ # ann: 'good', john: 'big'
+ # #=> { people: { ann: "Ann is good", john: "John is big" } }
+ #
+ # source://i18n//lib/i18n/backend/base.rb#217
+ def deep_interpolate(locale, data, values = T.unsafe(nil)); end
+
+ # Evaluates defaults.
+ # If given subject is an Array, it walks the array and returns the
+ # first translation that can be resolved. Otherwise it tries to resolve
+ # the translation directly.
+ #
+ # source://i18n//lib/i18n/backend/base.rb#128
+ def default(locale, object, subject, options = T.unsafe(nil)); end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/base.rb#111
+ def eager_loaded?; end
+
+ # Interpolates values into a given subject.
+ #
+ # if the given subject is a string then:
+ # method interpolates "file %{file} opened by %%{user}", :file => 'test.txt', :user => 'Mr. X'
+ # # => "file test.txt opened by %{user}"
+ #
+ # if the given subject is an array then:
+ # each element of the array is recursively interpolated (until it finds a string)
+ # method interpolates ["yes, %{user}", ["maybe no, %{user}", "no, %{user}"]], :user => "bartuz"
+ # # => ["yes, bartuz", ["maybe no, bartuz", "no, bartuz"]]
+ #
+ # source://i18n//lib/i18n/backend/base.rb#201
+ def interpolate(locale, subject, values = T.unsafe(nil)); end
+
+ # Loads a single translations file by delegating to #load_rb or
+ # #load_yml depending on the file extension and directly merges the
+ # data to the existing translations. Raises I18n::UnknownFileType
+ # for all other file extensions.
+ #
+ # @raise [UnknownFileType]
+ #
+ # source://i18n//lib/i18n/backend/base.rb#240
+ def load_file(filename); end
+
+ # Loads a JSON translations file. The data must have locales as
+ # toplevel keys.
+ #
+ # source://i18n//lib/i18n/backend/base.rb#276
+ def load_json(filename); end
+
+ # Loads a plain Ruby translations file. eval'ing the file must yield
+ # a Hash containing translation data with locales as toplevel keys.
+ #
+ # source://i18n//lib/i18n/backend/base.rb#254
+ def load_rb(filename); end
+
+ # Loads a YAML translations file. The data must have locales as
+ # toplevel keys.
+ #
+ # source://i18n//lib/i18n/backend/base.rb#272
+ def load_yaml(filename); end
+
+ # Loads a YAML translations file. The data must have locales as
+ # toplevel keys.
+ #
+ # source://i18n//lib/i18n/backend/base.rb#261
+ def load_yml(filename); end
+
+ # The method which actually looks up for the translation in the store.
+ #
+ # @raise [NotImplementedError]
+ #
+ # source://i18n//lib/i18n/backend/base.rb#116
+ def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/backend/base.rb#308
+ def pluralization_key(entry, count); end
+
+ # Picks a translation from a pluralized mnemonic subkey according to English
+ # pluralization rules :
+ # - It will pick the :one subkey if count is equal to 1.
+ # - It will pick the :other subkey otherwise.
+ # - It will pick the :zero subkey in the special case where count is
+ # equal to 0 and there is a :zero subkey present. This behaviour is
+ # not standard with regards to the CLDR pluralization rules.
+ # Other backends can implement more flexible or complex pluralization rules.
+ #
+ # @raise [InvalidPluralizationData]
+ #
+ # source://i18n//lib/i18n/backend/base.rb#182
+ def pluralize(locale, entry, count); end
+
+ # Resolves a translation.
+ # If the given subject is a Symbol, it will be translated with the
+ # given options. If it is a Proc then it will be evaluated. All other
+ # subjects will be returned directly.
+ #
+ # source://i18n//lib/i18n/backend/base.rb#150
+ def resolve(locale, object, subject, options = T.unsafe(nil)); end
+
+ # Resolves a translation.
+ # If the given subject is a Symbol, it will be translated with the
+ # given options. If it is a Proc then it will be evaluated. All other
+ # subjects will be returned directly.
+ #
+ # source://i18n//lib/i18n/backend/base.rb#172
+ def resolve_entry(locale, object, subject, options = T.unsafe(nil)); end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/base.rb#120
+ def subtrees?; end
+
+ # source://i18n//lib/i18n/backend/base.rb#289
+ def translate_localization_format(locale, object, format, options); end
+end
+
+# TODO Should the cache be cleared if new translations are stored?
+#
+# source://i18n//lib/i18n/backend/cache.rb#79
+module I18n::Backend::Cache
+ # source://i18n//lib/i18n/backend/cache.rb#80
+ def translate(locale, key, options = T.unsafe(nil)); end
+
+ protected
+
+ # source://i18n//lib/i18n/backend/cache.rb#93
+ def _fetch(cache_key, &block); end
+
+ # source://i18n//lib/i18n/backend/cache.rb#101
+ def cache_key(locale, key, options); end
+
+ # source://i18n//lib/i18n/backend/cache.rb#86
+ def fetch(cache_key, &block); end
+
+ private
+
+ # source://i18n//lib/i18n/backend/cache.rb#108
+ def digest_item(key); end
+end
+
+# Overwrites the Base load_file method to cache loaded file contents.
+#
+# source://i18n//lib/i18n/backend/cache_file.rb#8
+module I18n::Backend::CacheFile
+ # Optionally provide path_roots array to normalize filename paths,
+ # to make the cached i18n data portable across environments.
+ #
+ # source://i18n//lib/i18n/backend/cache_file.rb#11
+ def path_roots; end
+
+ # Optionally provide path_roots array to normalize filename paths,
+ # to make the cached i18n data portable across environments.
+ #
+ # source://i18n//lib/i18n/backend/cache_file.rb#11
+ def path_roots=(_arg0); end
+
+ protected
+
+ # Track loaded translation files in the `i18n.load_file` scope,
+ # and skip loading the file if its contents are still up-to-date.
+ #
+ # source://i18n//lib/i18n/backend/cache_file.rb#17
+ def load_file(filename); end
+
+ # Translate absolute filename to relative path for i18n key.
+ #
+ # source://i18n//lib/i18n/backend/cache_file.rb#28
+ def normalized_path(file); end
+end
+
+# source://i18n//lib/i18n/backend/cascade.rb#35
+module I18n::Backend::Cascade
+ # source://i18n//lib/i18n/backend/cascade.rb#36
+ def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
+end
+
+# Backend that chains multiple other backends and checks each of them when
+# a translation needs to be looked up. This is useful when you want to use
+# standard translations with a Simple backend but store custom application
+# translations in a database or other backends.
+#
+# To use the Chain backend instantiate it and set it to the I18n module.
+# You can add chained backends through the initializer or backends
+# accessor:
+#
+# # preserves the existing Simple backend set to I18n.backend
+# I18n.backend = I18n::Backend::Chain.new(I18n::Backend::ActiveRecord.new, I18n.backend)
+#
+# The implementation assumes that all backends added to the Chain implement
+# a lookup method with the same API as Simple backend does.
+#
+# Fallback translations using the :default option are only used by the last backend of a chain.
+#
+# source://i18n//lib/i18n/backend/chain.rb#21
+class I18n::Backend::Chain
+ include ::I18n::Backend::Transliterator
+ include ::I18n::Backend::Base
+ include ::I18n::Backend::Chain::Implementation
+end
+
+# source://i18n//lib/i18n/backend/chain.rb#22
+module I18n::Backend::Chain::Implementation
+ include ::I18n::Backend::Transliterator
+ include ::I18n::Backend::Base
+
+ # source://i18n//lib/i18n/backend/chain.rb#27
+ def initialize(*backends); end
+
+ # source://i18n//lib/i18n/backend/chain.rb#52
+ def available_locales; end
+
+ # Returns the value of attribute backends.
+ #
+ # source://i18n//lib/i18n/backend/chain.rb#25
+ def backends; end
+
+ # Sets the attribute backends
+ #
+ # @param value the value to set the attribute backends to.
+ #
+ # source://i18n//lib/i18n/backend/chain.rb#25
+ def backends=(_arg0); end
+
+ # source://i18n//lib/i18n/backend/chain.rb#44
+ def eager_load!; end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/chain.rb#76
+ def exists?(locale, key, options = T.unsafe(nil)); end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/chain.rb#31
+ def initialized?; end
+
+ # source://i18n//lib/i18n/backend/chain.rb#82
+ def localize(locale, object, format = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/backend/chain.rb#40
+ def reload!; end
+
+ # source://i18n//lib/i18n/backend/chain.rb#48
+ def store_translations(locale, data, options = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/backend/chain.rb#56
+ def translate(locale, key, default_options = T.unsafe(nil)); end
+
+ protected
+
+ # source://i18n//lib/i18n/backend/chain.rb#92
+ def init_translations; end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/chain.rb#108
+ def namespace_lookup?(result, options); end
+
+ # source://i18n//lib/i18n/backend/chain.rb#98
+ def translations; end
+
+ private
+
+ # This is approximately what gets used in ActiveSupport.
+ # However since we are not guaranteed to run in an ActiveSupport context
+ # it is wise to have our own copy. We underscore it
+ # to not pollute the namespace of the including class.
+ #
+ # source://i18n//lib/i18n/backend/chain.rb#117
+ def _deep_merge(hash, other_hash); end
+end
+
+# source://i18n//lib/i18n/backend/fallbacks.rb#38
+module I18n::Backend::Fallbacks
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/fallbacks.rb#106
+ def exists?(locale, key, options = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/backend/fallbacks.rb#97
+ def extract_non_symbol_default!(options); end
+
+ # source://i18n//lib/i18n/backend/fallbacks.rb#75
+ def resolve_entry(locale, object, subject, options = T.unsafe(nil)); end
+
+ # Overwrites the Base backend translate method so that it will try each
+ # locale given by I18n.fallbacks for the given locale. E.g. for the
+ # locale :"de-DE" it might try the locales :"de-DE", :de and :en
+ # (depends on the fallbacks implementation) until it finds a result with
+ # the given options. If it does not find any result for any of the
+ # locales it will then throw MissingTranslation as usual.
+ #
+ # The default option takes precedence over fallback locales only when
+ # it's a Symbol. When the default contains a String, Proc or Hash
+ # it is evaluated last after all the fallback locales have been tried.
+ #
+ # source://i18n//lib/i18n/backend/fallbacks.rb#49
+ def translate(locale, key, options = T.unsafe(nil)); end
+
+ private
+
+ # Overwrite on_fallback to add specified logic when the fallback succeeds.
+ #
+ # source://i18n//lib/i18n/backend/fallbacks.rb#122
+ def on_fallback(_original_locale, _fallback_locale, _key, _options); end
+end
+
+# This module contains several helpers to assist flattening translations.
+# You may want to flatten translations for:
+#
+# 1) speed up lookups, as in the Memoize backend;
+# 2) In case you want to store translations in a data store, as in ActiveRecord backend;
+#
+# You can check both backends above for some examples.
+# This module also keeps all links in a hash so they can be properly resolved when flattened.
+#
+# source://i18n//lib/i18n/backend/flatten.rb#13
+module I18n::Backend::Flatten
+ # Flatten keys for nested Hashes by chaining up keys:
+ #
+ # >> { "a" => { "b" => { "c" => "d", "e" => "f" }, "g" => "h" }, "i" => "j"}.wind
+ # => { "a.b.c" => "d", "a.b.e" => "f", "a.g" => "h", "i" => "j" }
+ #
+ # source://i18n//lib/i18n/backend/flatten.rb#59
+ def flatten_keys(hash, escape, prev_key = T.unsafe(nil), &block); end
+
+ # Receives a hash of translations (where the key is a locale and
+ # the value is another hash) and return a hash with all
+ # translations flattened.
+ #
+ # Nested hashes are included in the flattened hash just if subtree
+ # is true and Symbols are automatically stored as links.
+ #
+ # source://i18n//lib/i18n/backend/flatten.rb#74
+ def flatten_translations(locale, data, escape, subtree); end
+
+ # Store flattened links.
+ #
+ # source://i18n//lib/i18n/backend/flatten.rb#50
+ def links; end
+
+ # Shortcut to I18n::Backend::Flatten.normalize_flat_keys
+ # and then resolve_links.
+ #
+ # source://i18n//lib/i18n/backend/flatten.rb#44
+ def normalize_flat_keys(locale, key, scope, separator); end
+
+ protected
+
+ # source://i18n//lib/i18n/backend/flatten.rb#112
+ def escape_default_separator(key); end
+
+ # source://i18n//lib/i18n/backend/flatten.rb#106
+ def find_link(locale, key); end
+
+ # source://i18n//lib/i18n/backend/flatten.rb#93
+ def resolve_link(locale, key); end
+
+ # source://i18n//lib/i18n/backend/flatten.rb#89
+ def store_link(locale, key, link); end
+
+ class << self
+ # Receives a string and escape the default separator.
+ #
+ # source://i18n//lib/i18n/backend/flatten.rb#38
+ def escape_default_separator(key); end
+
+ # normalize_keys the flatten way. This method is significantly faster
+ # and creates way less objects than the one at I18n.normalize_keys.
+ # It also handles escaping the translation keys.
+ #
+ # source://i18n//lib/i18n/backend/flatten.rb#20
+ def normalize_flat_keys(locale, key, scope, separator); end
+ end
+end
+
+# source://i18n//lib/i18n/backend/flatten.rb#15
+I18n::Backend::Flatten::FLATTEN_SEPARATOR = T.let(T.unsafe(nil), String)
+
+# source://i18n//lib/i18n/backend/flatten.rb#14
+I18n::Backend::Flatten::SEPARATOR_ESCAPE_CHAR = T.let(T.unsafe(nil), String)
+
+# Experimental support for using Gettext po files to store translations.
+#
+# To use this you can simply include the module to the Simple backend - or
+# whatever other backend you are using.
+#
+# I18n::Backend::Simple.include(I18n::Backend::Gettext)
+#
+# Now you should be able to include your Gettext translation (*.po) files to
+# the +I18n.load_path+ so they're loaded to the backend and you can use them as
+# usual:
+#
+# I18n.load_path += Dir["path/to/locales/*.po"]
+#
+# Following the Gettext convention this implementation expects that your
+# translation files are named by their locales. E.g. the file en.po would
+# contain the translations for the English locale.
+#
+# To translate text you must use one of the translate methods provided by
+# I18n::Gettext::Helpers.
+#
+# include I18n::Gettext::Helpers
+# puts _("some string")
+#
+# Without it strings containing periods (".") will not be translated.
+#
+# source://i18n//lib/i18n/backend/gettext.rb#33
+module I18n::Backend::Gettext
+ protected
+
+ # source://i18n//lib/i18n/backend/gettext.rb#41
+ def load_po(filename); end
+
+ # source://i18n//lib/i18n/backend/gettext.rb#51
+ def normalize(locale, data); end
+
+ # source://i18n//lib/i18n/backend/gettext.rb#68
+ def normalize_pluralization(locale, key, value); end
+
+ # source://i18n//lib/i18n/backend/gettext.rb#47
+ def parse(filename); end
+end
+
+# source://i18n//lib/i18n/backend/gettext.rb#34
+class I18n::Backend::Gettext::PoData < ::Hash
+ # source://i18n//lib/i18n/backend/gettext.rb#35
+ def set_comment(msgid_or_sym, comment); end
+end
+
+# source://i18n//lib/i18n/backend/interpolation_compiler.rb#20
+module I18n::Backend::InterpolationCompiler
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#98
+ def interpolate(locale, string, values); end
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#108
+ def store_translations(locale, data, options = T.unsafe(nil)); end
+
+ protected
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#114
+ def compile_all_strings_in(data); end
+end
+
+# source://i18n//lib/i18n/backend/interpolation_compiler.rb#21
+module I18n::Backend::InterpolationCompiler::Compiler
+ extend ::I18n::Backend::InterpolationCompiler::Compiler
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#26
+ def compile_if_an_interpolation(string); end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#39
+ def interpolated_str?(str); end
+
+ protected
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#59
+ def compile_interpolation_token(key); end
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#49
+ def compiled_interpolation_body(str); end
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#72
+ def direct_key(key); end
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#92
+ def escape_key_sym(key); end
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#88
+ def escape_plain_str(str); end
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#55
+ def handle_interpolation_token(token); end
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#68
+ def interpolate_key(key); end
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#63
+ def interpolate_or_raise_missing(key); end
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#80
+ def missing_key(key); end
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#76
+ def nil_key(key); end
+
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#84
+ def reserved_key(key); end
+
+ # tokenize("foo %{bar} baz %%{buz}") # => ["foo ", "%{bar}", " baz ", "%%{buz}"]
+ #
+ # source://i18n//lib/i18n/backend/interpolation_compiler.rb#45
+ def tokenize(str); end
+end
+
+# source://i18n//lib/i18n/backend/interpolation_compiler.rb#24
+I18n::Backend::InterpolationCompiler::Compiler::TOKENIZER = T.let(T.unsafe(nil), Regexp)
+
+# This is a basic backend for key value stores. It receives on
+# initialization the store, which should respond to three methods:
+#
+# * store#[](key) - Used to get a value
+# * store#[]=(key, value) - Used to set a value
+# * store#keys - Used to get all keys
+#
+# Since these stores only supports string, all values are converted
+# to JSON before being stored, allowing it to also store booleans,
+# hashes and arrays. However, this store does not support Procs.
+#
+# As the ActiveRecord backend, Symbols are just supported when loading
+# translations from the filesystem or through explicit store translations.
+#
+# Also, avoid calling I18n.available_locales since it's a somehow
+# expensive operation in most stores.
+#
+# == Example
+#
+# To setup I18n to use TokyoCabinet in memory is quite straightforward:
+#
+# require 'rufus/tokyo/cabinet' # gem install rufus-tokyo
+# I18n.backend = I18n::Backend::KeyValue.new(Rufus::Tokyo::Cabinet.new('*'))
+#
+# == Performance
+#
+# You may make this backend even faster by including the Memoize module.
+# However, notice that you should properly clear the cache if you change
+# values directly in the key-store.
+#
+# == Subtrees
+#
+# In most backends, you are allowed to retrieve part of a translation tree:
+#
+# I18n.backend.store_translations :en, :foo => { :bar => :baz }
+# I18n.t "foo" #=> { :bar => :baz }
+#
+# This backend supports this feature by default, but it slows down the storage
+# of new data considerably and makes hard to delete entries. That said, you are
+# allowed to disable the storage of subtrees on initialization:
+#
+# I18n::Backend::KeyValue.new(@store, false)
+#
+# This is useful if you are using a KeyValue backend chained to a Simple backend.
+#
+# source://i18n//lib/i18n/backend/key_value.rb#69
+class I18n::Backend::KeyValue
+ include ::I18n::Backend::Flatten
+ include ::I18n::Backend::Transliterator
+ include ::I18n::Backend::Base
+ include ::I18n::Backend::KeyValue::Implementation
+end
+
+# source://i18n//lib/i18n/backend/key_value.rb#70
+module I18n::Backend::KeyValue::Implementation
+ include ::I18n::Backend::Flatten
+ include ::I18n::Backend::Transliterator
+ include ::I18n::Backend::Base
+
+ # source://i18n//lib/i18n/backend/key_value.rb#75
+ def initialize(store, subtrees = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/backend/key_value.rb#102
+ def available_locales; end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/key_value.rb#79
+ def initialized?; end
+
+ # Returns the value of attribute store.
+ #
+ # source://i18n//lib/i18n/backend/key_value.rb#71
+ def store; end
+
+ # Sets the attribute store
+ #
+ # @param value the value to set the attribute store to.
+ #
+ # source://i18n//lib/i18n/backend/key_value.rb#71
+ def store=(_arg0); end
+
+ # source://i18n//lib/i18n/backend/key_value.rb#83
+ def store_translations(locale, data, options = T.unsafe(nil)); end
+
+ protected
+
+ # source://i18n//lib/i18n/backend/key_value.rb#124
+ def init_translations; end
+
+ # source://i18n//lib/i18n/backend/key_value.rb#136
+ def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/backend/key_value.rb#150
+ def pluralize(locale, entry, count); end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/key_value.rb#132
+ def subtrees?; end
+
+ # Queries the translations from the key-value store and converts
+ # them into a hash such as the one returned from loading the
+ # haml files
+ #
+ # source://i18n//lib/i18n/backend/key_value.rb#115
+ def translations; end
+end
+
+# source://i18n//lib/i18n/backend/key_value.rb#161
+class I18n::Backend::KeyValue::SubtreeProxy
+ # @return [SubtreeProxy] a new instance of SubtreeProxy
+ #
+ # source://i18n//lib/i18n/backend/key_value.rb#162
+ def initialize(master_key, store); end
+
+ # source://i18n//lib/i18n/backend/key_value.rb#172
+ def [](key); end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/key_value.rb#168
+ def has_key?(key); end
+
+ # source://i18n//lib/i18n/backend/key_value.rb#196
+ def inspect; end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/key_value.rb#188
+ def instance_of?(klass); end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/key_value.rb#183
+ def is_a?(klass); end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/key_value.rb#186
+ def kind_of?(klass); end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/key_value.rb#192
+ def nil?; end
+end
+
+# source://i18n//lib/i18n/backend/lazy_loadable.rb#65
+class I18n::Backend::LazyLoadable < ::I18n::Backend::Simple
+ # @return [LazyLoadable] a new instance of LazyLoadable
+ #
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#66
+ def initialize(lazy_load: T.unsafe(nil)); end
+
+ # Parse the load path and extract all locales.
+ #
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#99
+ def available_locales; end
+
+ # Eager loading is not supported in the lazy context.
+ #
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#90
+ def eager_load!; end
+
+ # Returns whether the current locale is initialized.
+ #
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#71
+ def initialized?; end
+
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#107
+ def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # Clean up translations and uninitialize all locales.
+ #
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#80
+ def reload!; end
+
+ protected
+
+ # Load translations from files that belong to the current locale.
+ #
+ # @raise [InvalidFilenames]
+ #
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#121
+ def init_translations; end
+
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#133
+ def initialized_locales; end
+
+ private
+
+ # Checks if a filename is named in correspondence to the translations it loaded.
+ # The locale extracted from the path must be the single locale loaded in the translations.
+ #
+ # @raise [FilenameIncorrect]
+ #
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#175
+ def assert_file_named_correctly!(file, translations); end
+
+ # Select all files from I18n load path that belong to current locale.
+ # These files must start with the locale identifier (ie. "en", "pt-BR"),
+ # followed by an "_" demarcation to separate proceeding text.
+ #
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#167
+ def filenames_for_current_locale; end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#139
+ def lazy_load?; end
+
+ # Loads each file supplied and asserts that the file only loads
+ # translations as expected by the name. The method returns a list of
+ # errors corresponding to offending files.
+ #
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#152
+ def load_translations_and_collect_file_errors(files); end
+end
+
+# source://i18n//lib/i18n/backend/lazy_loadable.rb#143
+class I18n::Backend::LazyLoadable::FilenameIncorrect < ::StandardError
+ # @return [FilenameIncorrect] a new instance of FilenameIncorrect
+ #
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#144
+ def initialize(file, expected_locale, unexpected_locales); end
+end
+
+# Backend that lazy loads translations based on the current locale. This
+# implementation avoids loading all translations up front. Instead, it only
+# loads the translations that belong to the current locale. This offers a
+# performance incentive in local development and test environments for
+# applications with many translations for many different locales. It's
+# particularly useful when the application only refers to a single locales'
+# translations at a time (ex. A Rails workload). The implementation
+# identifies which translation files from the load path belong to the
+# current locale by pattern matching against their path name.
+#
+# Specifically, a translation file is considered to belong to a locale if:
+# a) the filename is in the I18n load path
+# b) the filename ends in a supported extension (ie. .yml, .json, .po, .rb)
+# c) the filename starts with the locale identifier
+# d) the locale identifier and optional proceeding text is separated by an underscore, ie. "_".
+#
+# Examples:
+# Valid files that will be selected by this backend:
+#
+# "files/locales/en_translation.yml" (Selected for locale "en")
+# "files/locales/fr.po" (Selected for locale "fr")
+#
+# Invalid files that won't be selected by this backend:
+#
+# "files/locales/translation-file"
+# "files/locales/en-translation.unsupported"
+# "files/locales/french/translation.yml"
+# "files/locales/fr/translation.yml"
+#
+# The implementation uses this assumption to defer the loading of
+# translation files until the current locale actually requires them.
+#
+# The backend has two working modes: lazy_load and eager_load.
+#
+# Note: This backend should only be enabled in test environments!
+# When the mode is set to false, the backend behaves exactly like the
+# Simple backend, with an additional check that the paths being loaded
+# abide by the format. If paths can't be matched to the format, an error is raised.
+#
+# You can configure lazy loaded backends through the initializer or backends
+# accessor:
+#
+# # In test environments
+#
+# I18n.backend = I18n::Backend::LazyLoadable.new(lazy_load: true)
+#
+# # In other environments, such as production and CI
+#
+# I18n.backend = I18n::Backend::LazyLoadable.new(lazy_load: false) # default
+#
+# source://i18n//lib/i18n/backend/lazy_loadable.rb#55
+class I18n::Backend::LocaleExtractor
+ class << self
+ # source://i18n//lib/i18n/backend/lazy_loadable.rb#57
+ def locale_from_path(path); end
+ end
+end
+
+# source://i18n//lib/i18n/backend/memoize.rb#14
+module I18n::Backend::Memoize
+ # source://i18n//lib/i18n/backend/memoize.rb#15
+ def available_locales; end
+
+ # source://i18n//lib/i18n/backend/memoize.rb#29
+ def eager_load!; end
+
+ # source://i18n//lib/i18n/backend/memoize.rb#24
+ def reload!; end
+
+ # source://i18n//lib/i18n/backend/memoize.rb#19
+ def store_translations(locale, data, options = T.unsafe(nil)); end
+
+ protected
+
+ # source://i18n//lib/i18n/backend/memoize.rb#37
+ def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/backend/memoize.rb#44
+ def memoized_lookup; end
+
+ # source://i18n//lib/i18n/backend/memoize.rb#48
+ def reset_memoizations!(locale = T.unsafe(nil)); end
+end
+
+# source://i18n//lib/i18n/backend/metadata.rb#21
+module I18n::Backend::Metadata
+ # source://i18n//lib/i18n/backend/metadata.rb#52
+ def interpolate(locale, entry, values = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/backend/metadata.rb#57
+ def pluralize(locale, entry, count); end
+
+ # source://i18n//lib/i18n/backend/metadata.rb#40
+ def translate(locale, key, options = T.unsafe(nil)); end
+
+ protected
+
+ # source://i18n//lib/i18n/backend/metadata.rb#63
+ def with_metadata(metadata, &block); end
+
+ class << self
+ # @private
+ #
+ # source://i18n//lib/i18n/backend/metadata.rb#23
+ def included(base); end
+ end
+end
+
+# source://i18n//lib/i18n/backend/pluralization.rb#16
+module I18n::Backend::Pluralization
+ # Overwrites the Base backend translate method so that it will check the
+ # translation meta data space (:i18n) for a locale specific pluralization
+ # rule and use it to pluralize the given entry. I.e., the library expects
+ # pluralization rules to be stored at I18n.t(:'i18n.plural.rule')
+ #
+ # Pluralization rules are expected to respond to #call(count) and
+ # return a pluralization key. Valid keys depend on the pluralization
+ # rules for the locale, as defined in the CLDR.
+ # As of v41, 6 locale-specific plural categories are defined:
+ # :few, :many, :one, :other, :two, :zero
+ #
+ # n.b., The :one plural category does not imply the number 1.
+ # Instead, :one is a category for any number that behaves like 1 in
+ # that locale. For example, in some locales, :one is used for numbers
+ # that end in "1" (like 1, 21, 151) but that don't end in
+ # 11 (like 11, 111, 10311).
+ # Similar notes apply to the :two, and :zero plural categories.
+ #
+ # If you want to have different strings for the categories of count == 0
+ # (e.g. "I don't have any cars") or count == 1 (e.g. "I have a single car")
+ # use the explicit `"0"` and `"1"` keys.
+ # https://unicode-org.github.io/cldr/ldml/tr35-numbers.html#Explicit_0_1_rules
+ #
+ # source://i18n//lib/i18n/backend/pluralization.rb#39
+ def pluralize(locale, entry, count); end
+
+ protected
+
+ # source://i18n//lib/i18n/backend/pluralization.rb#81
+ def pluralizer(locale); end
+
+ # source://i18n//lib/i18n/backend/pluralization.rb#77
+ def pluralizers; end
+
+ private
+
+ # Normalizes categories of 0.0 and 1.0
+ # and returns the symbolic version
+ #
+ # source://i18n//lib/i18n/backend/pluralization.rb#89
+ def symbolic_count(count); end
+end
+
+# A simple backend that reads translations from YAML files and stores them in
+# an in-memory hash. Relies on the Base backend.
+#
+# The implementation is provided by a Implementation module allowing to easily
+# extend Simple backend's behavior by including modules. E.g.:
+#
+# module I18n::Backend::Pluralization
+# def pluralize(*args)
+# # extended pluralization logic
+# super
+# end
+# end
+#
+# I18n::Backend::Simple.include(I18n::Backend::Pluralization)
+#
+# source://i18n//lib/i18n/backend/simple.rb#21
+class I18n::Backend::Simple
+ include ::I18n::Backend::Transliterator
+ include ::I18n::Backend::Base
+ include ::I18n::Backend::Simple::Implementation
+end
+
+# source://i18n//lib/i18n/backend/simple.rb#22
+module I18n::Backend::Simple::Implementation
+ include ::I18n::Backend::Transliterator
+ include ::I18n::Backend::Base
+
+ # Get available locales from the translations hash
+ #
+ # source://i18n//lib/i18n/backend/simple.rb#49
+ def available_locales; end
+
+ # source://i18n//lib/i18n/backend/simple.rb#64
+ def eager_load!; end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n/backend/simple.rb#28
+ def initialized?; end
+
+ # Clean up translations hash and set initialized to false on reload!
+ #
+ # source://i18n//lib/i18n/backend/simple.rb#58
+ def reload!; end
+
+ # Stores translations for the given locale in memory.
+ # This uses a deep merge for the translations hash, so existing
+ # translations will be overwritten by new ones only at the deepest
+ # level of the hash.
+ #
+ # source://i18n//lib/i18n/backend/simple.rb#36
+ def store_translations(locale, data, options = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/backend/simple.rb#69
+ def translations(do_init: T.unsafe(nil)); end
+
+ protected
+
+ # source://i18n//lib/i18n/backend/simple.rb#83
+ def init_translations; end
+
+ # Looks up a translation from the translations hash. Returns nil if
+ # either key is nil, or locale, scope or key do not exist as a key in the
+ # nested translations hash. Splits keys or scopes containing dots
+ # into multiple keys, i.e. currency.format is regarded the same as
+ # %w(currency format).
+ #
+ # source://i18n//lib/i18n/backend/simple.rb#93
+ def lookup(locale, key, scope = T.unsafe(nil), options = T.unsafe(nil)); end
+end
+
+# Mutex to ensure that concurrent translations loading will be thread-safe
+#
+# source://i18n//lib/i18n/backend/simple.rb#26
+I18n::Backend::Simple::Implementation::MUTEX = T.let(T.unsafe(nil), Thread::Mutex)
+
+# source://i18n//lib/i18n/backend/transliterator.rb#6
+module I18n::Backend::Transliterator
+ # Given a locale and a UTF-8 string, return the locale's ASCII
+ # approximation for the string.
+ #
+ # source://i18n//lib/i18n/backend/transliterator.rb#11
+ def transliterate(locale, string, replacement = T.unsafe(nil)); end
+
+ class << self
+ # Get a transliterator instance.
+ #
+ # source://i18n//lib/i18n/backend/transliterator.rb#19
+ def get(rule = T.unsafe(nil)); end
+ end
+end
+
+# source://i18n//lib/i18n/backend/transliterator.rb#7
+I18n::Backend::Transliterator::DEFAULT_REPLACEMENT_CHAR = T.let(T.unsafe(nil), String)
+
+# A transliterator which accepts a Hash of characters as its translation
+# rule.
+#
+# source://i18n//lib/i18n/backend/transliterator.rb#42
+class I18n::Backend::Transliterator::HashTransliterator
+ # @return [HashTransliterator] a new instance of HashTransliterator
+ #
+ # source://i18n//lib/i18n/backend/transliterator.rb#75
+ def initialize(rule = T.unsafe(nil)); end
+
+ # source://i18n//lib/i18n/backend/transliterator.rb#81
+ def transliterate(string, replacement = T.unsafe(nil)); end
+
+ private
+
+ # Add transliteration rules to the approximations hash.
+ #
+ # source://i18n//lib/i18n/backend/transliterator.rb#101
+ def add(hash); end
+
+ # source://i18n//lib/i18n/backend/transliterator.rb#94
+ def add_default_approximations; end
+
+ # source://i18n//lib/i18n/backend/transliterator.rb#90
+ def approximations; end
+end
+
+# source://i18n//lib/i18n/backend/transliterator.rb#43
+I18n::Backend::Transliterator::HashTransliterator::DEFAULT_APPROXIMATIONS = T.let(T.unsafe(nil), Hash)
+
+# A transliterator which accepts a Proc as its transliteration rule.
+#
+# source://i18n//lib/i18n/backend/transliterator.rb#30
+class I18n::Backend::Transliterator::ProcTransliterator
+ # @return [ProcTransliterator] a new instance of ProcTransliterator
+ #
+ # source://i18n//lib/i18n/backend/transliterator.rb#31
+ def initialize(rule); end
+
+ # source://i18n//lib/i18n/backend/transliterator.rb#35
+ def transliterate(string, replacement = T.unsafe(nil)); end
+end
+
+# source://i18n//lib/i18n.rb#55
+module I18n::Base
+ # source://i18n//lib/i18n.rb#99
+ def available_locales; end
+
+ # source://i18n//lib/i18n.rb#99
+ def available_locales=(value); end
+
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n.rb#416
+ def available_locales_initialized?; end
+
+ # source://i18n//lib/i18n.rb#99
+ def backend; end
+
+ # source://i18n//lib/i18n.rb#99
+ def backend=(value); end
+
+ # Gets I18n configuration object.
+ #
+ # source://i18n//lib/i18n.rb#57
+ def config; end
+
+ # Sets I18n configuration object.
+ #
+ # source://i18n//lib/i18n.rb#87
+ def config=(value); end
+
+ # source://i18n//lib/i18n.rb#99
+ def default_locale; end
+
+ # source://i18n//lib/i18n.rb#99
+ def default_locale=(value); end
+
+ # source://i18n//lib/i18n.rb#99
+ def default_separator; end
+
+ # source://i18n//lib/i18n.rb#99
+ def default_separator=(value); end
+
+ # Tells the backend to load translations now. Used in situations like the
+ # Rails production environment. Backends can implement whatever strategy
+ # is useful.
+ #
+ # source://i18n//lib/i18n.rb#121
+ def eager_load!; end
+
+ # source://i18n//lib/i18n.rb#99
+ def enforce_available_locales; end
+
+ # Raises an InvalidLocale exception when the passed locale is not available.
+ #
+ # source://i18n//lib/i18n.rb#410
+ def enforce_available_locales!(locale); end
+
+ # source://i18n//lib/i18n.rb#99
+ def enforce_available_locales=(value); end
+
+ # source://i18n//lib/i18n.rb#99
+ def exception_handler; end
+
+ # source://i18n//lib/i18n.rb#99
+ def exception_handler=(value); end
+
+ # Returns true if a translation exists for a given key, otherwise returns false.
+ #
+ # @raise [Disabled]
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n.rb#295
+ def exists?(key, _locale = T.unsafe(nil), locale: T.unsafe(nil), **options); end
+
+ # Returns an array of interpolation keys for the given translation key
+ #
+ # *Examples*
+ #
+ # Suppose we have the following:
+ # I18n.t 'example.zero' == 'Zero interpolations'
+ # I18n.t 'example.one' == 'One interpolation %{foo}'
+ # I18n.t 'example.two' == 'Two interpolations %{foo} %{bar}'
+ # I18n.t 'example.three' == ['One %{foo}', 'Two %{bar}', 'Three %{baz}']
+ # I18n.t 'example.one', locale: :other == 'One interpolation %{baz}'
+ #
+ # Then we can expect the following results:
+ # I18n.interpolation_keys('example.zero') #=> []
+ # I18n.interpolation_keys('example.one') #=> ['foo']
+ # I18n.interpolation_keys('example.two') #=> ['foo', 'bar']
+ # I18n.interpolation_keys('example.three') #=> ['foo', 'bar', 'baz']
+ # I18n.interpolation_keys('one', scope: 'example', locale: :other) #=> ['baz']
+ # I18n.interpolation_keys('does-not-exist') #=> []
+ # I18n.interpolation_keys('example') #=> []
+ #
+ # @raise [I18n::ArgumentError]
+ #
+ # source://i18n//lib/i18n.rb#284
+ def interpolation_keys(key, **options); end
+
+ # Localizes certain objects, such as dates and numbers to local formatting.
+ #
+ # @raise [Disabled]
+ #
+ # source://i18n//lib/i18n.rb#373
+ def l(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end
+
+ # source://i18n//lib/i18n.rb#99
+ def load_path; end
+
+ # source://i18n//lib/i18n.rb#99
+ def load_path=(value); end
+
+ # source://i18n//lib/i18n.rb#99
+ def locale; end
+
+ # source://i18n//lib/i18n.rb#99
+ def locale=(value); end
+
+ # Returns true when the passed locale, which can be either a String or a
+ # Symbol, is in the list of available locales. Returns false otherwise.
+ #
+ # @return [Boolean]
+ #
+ # source://i18n//lib/i18n.rb#405
+ def locale_available?(locale); end
+
+ # Localizes certain objects, such as dates and numbers to local formatting.
+ #
+ # @raise [Disabled]
+ #
+ # source://i18n//lib/i18n.rb#365
+ def localize(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end
+
+ # Merges the given locale, key and scope into a single array of keys.
+ # Splits keys that contain dots into multiple keys. Makes sure all
+ # keys are Symbols.
+ #
+ # source://i18n//lib/i18n.rb#393
+ def normalize_keys(locale, key, scope, separator = T.unsafe(nil)); end
+
+ # Tells the backend to reload translations. Used in situations like the
+ # Rails development environment. Backends can implement whatever strategy
+ # is useful.
+ #
+ # source://i18n//lib/i18n.rb#113
+ def reload!; end
+
+ # Translates, pluralizes and interpolates a given key using a given locale,
+ # scope, and default, as well as interpolation values.
+ #
+ # *LOOKUP*
+ #
+ # Translation data is organized as a nested hash using the upper-level keys
+ # as namespaces. E.g., ActionView ships with the translation:
+ # :date => {:formats => {:short => "%b %d"}}.
+ #
+ # Translations can be looked up at any level of this hash using the key argument
+ # and the scope option. E.g., in this example I18n.t :date
+ # returns the whole translations hash {:formats => {:short => "%b %d"}}.
+ #
+ # Key can be either a single key or a dot-separated key (both Strings and Symbols
+ # work). E.g., the short format can be looked up using both:
+ # I18n.t 'date.formats.short'
+ # I18n.t :'date.formats.short'
+ #
+ # Scope can be either a single key, a dot-separated key or an array of keys
+ # or dot-separated keys. Keys and scopes can be combined freely. So these
+ # examples will all look up the same short date format:
+ # I18n.t 'date.formats.short'
+ # I18n.t 'formats.short', :scope => 'date'
+ # I18n.t 'short', :scope => 'date.formats'
+ # I18n.t 'short', :scope => %w(date formats)
+ #
+ # *INTERPOLATION*
+ #
+ # Translations can contain interpolation variables which will be replaced by
+ # values passed to #translate as part of the options hash, with the keys matching
+ # the interpolation variable names.
+ #
+ # E.g., with a translation :foo => "foo %{bar}" the option
+ # value for the key +bar+ will be interpolated into the translation:
+ # I18n.t :foo, :bar => 'baz' # => 'foo baz'
+ #
+ # *PLURALIZATION*
+ #
+ # Translation data can contain pluralized translations. Pluralized translations
+ # are arrays of singular/plural versions of translations like ['Foo', 'Foos'].
+ #
+ # Note that I18n::Backend::Simple only supports an algorithm for English
+ # pluralization rules. Other algorithms can be supported by custom backends.
+ #
+ # This returns the singular version of a pluralized translation:
+ # I18n.t :foo, :count => 1 # => 'Foo'
+ #
+ # These both return the plural version of a pluralized translation:
+ # I18n.t :foo, :count => 0 # => 'Foos'
+ # I18n.t :foo, :count => 2 # => 'Foos'
+ #
+ # The :count option can be used both for pluralization and interpolation.
+ # E.g., with the translation
+ # :foo => ['%{count} foo', '%{count} foos'], count will
+ # be interpolated to the pluralized translation:
+ # I18n.t :foo, :count => 1 # => '1 foo'
+ #
+ # *DEFAULTS*
+ #
+ # This returns the translation for :foo or default if no translation was found:
+ # I18n.t :foo, :default => 'default'
+ #
+ # This returns the translation for :foo or the translation for :bar if no
+ # translation for :foo was found:
+ # I18n.t :foo, :default => :bar
+ #
+ # Returns the translation for :foo or the translation for :bar
+ # or default if no translations for :foo and :bar were found.
+ # I18n.t :foo, :default => [:bar, 'default']
+ #
+ # BULK LOOKUP
+ #
+ # This returns an array with the translations for :foo and :bar.
+ # I18n.t [:foo, :bar]
+ #
+ # Can be used with dot-separated nested keys:
+ # I18n.t [:'baz.foo', :'baz.bar']
+ #
+ # Which is the same as using a scope option:
+ # I18n.t [:foo, :bar], :scope => :baz
+ #
+ # *LAMBDAS*
+ #
+ # Both translations and defaults can be given as Ruby lambdas. Lambdas will be
+ # called and passed the key and options.
+ #
+ # E.g. assuming the key :salutation resolves to:
+ # lambda { |key, options| options[:gender] == 'm' ? "Mr. #{options[:name]}" : "Mrs. #{options[:name]}" }
+ #
+ # Then I18n.t(:salutation, :gender => 'w', :name => 'Smith') will result in "Mrs. Smith".
+ #
+ # Note that the string returned by lambda will go through string interpolation too,
+ # so the following lambda would give the same result:
+ # lambda { |key, options| options[:gender] == 'm' ? "Mr. %{name}" : "Mrs. %{name}" }
+ #
+ # It is recommended to use/implement lambdas in an "idempotent" way. E.g. when
+ # a cache layer is put in front of I18n.translate it will generate a cache key
+ # from the argument values passed to #translate. Therefore your lambdas should
+ # always return the same translations/values per unique combination of argument
+ # values.
+ #
+ # Ruby 2.7+ keyword arguments warning
+ #
+ # This method uses keyword arguments.
+ # There is a breaking change in ruby that produces warning with ruby 2.7 and won't work as expected with ruby 3.0
+ # The "hash" parameter must be passed as keyword argument.
+ #
+ # Good:
+ # I18n.t(:salutation, :gender => 'w', :name => 'Smith')
+ # I18n.t(:salutation, **{ :gender => 'w', :name => 'Smith' })
+ # I18n.t(:salutation, **any_hash)
+ #
+ # Bad:
+ # I18n.t(:salutation, { :gender => 'w', :name => 'Smith' })
+ # I18n.t(:salutation, any_hash)
+ #
+ # @raise [Disabled]
+ #
+ # source://i18n//lib/i18n.rb#256
+ def t(key = T.unsafe(nil), throw: T.unsafe(nil), raise: T.unsafe(nil), locale: T.unsafe(nil), **options); end
+
+ # Wrapper for translate that adds :raise => true. With
+ # this option, if no translation is found, it will raise I18n::MissingTranslationData
+ #
+ # source://i18n//lib/i18n.rb#263
+ def t!(key, **options); end
+
+ # Translates, pluralizes and interpolates a given key using a given locale,
+ # scope, and default, as well as interpolation values.
+ #
+ # *LOOKUP*
+ #
+ # Translation data is organized as a nested hash using the upper-level keys
+ # as namespaces. E.g., ActionView ships with the translation:
+ # :date => {:formats => {:short => "%b %d"}}.
+ #
+ # Translations can be looked up at any level of this hash using the key argument
+ # and the scope option. E.g., in this example I18n.t :date
+ # returns the whole translations hash {:formats => {:short => "%b %d"}}.
+ #
+ # Key can be either a single key or a dot-separated key (both Strings and Symbols
+ # work). E.g., the short format can be looked up using both:
+ # I18n.t 'date.formats.short'
+ # I18n.t :'date.formats.short'
+ #
+ # Scope can be either a single key, a dot-separated key or an array of keys
+ # or dot-separated keys. Keys and scopes can be combined freely. So these
+ # examples will all look up the same short date format:
+ # I18n.t 'date.formats.short'
+ # I18n.t 'formats.short', :scope => 'date'
+ # I18n.t 'short', :scope => 'date.formats'
+ # I18n.t 'short', :scope => %w(date formats)
+ #
+ # *INTERPOLATION*
+ #
+ # Translations can contain interpolation variables which will be replaced by
+ # values passed to #translate as part of the options hash, with the keys matching
+ # the interpolation variable names.
+ #
+ # E.g., with a translation :foo => "foo %{bar}" the option
+ # value for the key +bar+ will be interpolated into the translation:
+ # I18n.t :foo, :bar => 'baz' # => 'foo baz'
+ #
+ # *PLURALIZATION*
+ #
+ # Translation data can contain pluralized translations. Pluralized translations
+ # are arrays of singular/plural versions of translations like ['Foo', 'Foos'].
+ #
+ # Note that I18n::Backend::Simple only supports an algorithm for English
+ # pluralization rules. Other algorithms can be supported by custom backends.
+ #
+ # This returns the singular version of a pluralized translation:
+ # I18n.t :foo, :count => 1 # => 'Foo'
+ #
+ # These both return the plural version of a pluralized translation:
+ # I18n.t :foo, :count => 0 # => 'Foos'
+ # I18n.t :foo, :count => 2 # => 'Foos'
+ #
+ # The :count option can be used both for pluralization and interpolation.
+ # E.g., with the translation
+ # :foo => ['%{count} foo', '%{count} foos'], count will
+ # be interpolated to the pluralized translation:
+ # I18n.t :foo, :count => 1 # => '1 foo'
+ #
+ # *DEFAULTS*
+ #
+ # This returns the translation for :foo or default if no translation was found:
+ # I18n.t :foo, :default => 'default'
+ #
+ # This returns the translation for :foo or the translation for :bar if no
+ # translation for :foo was found:
+ # I18n.t :foo, :default => :bar
+ #
+ # Returns the translation for :foo or the translation for :bar
+ # or default if no translations for :foo and :bar were found.
+ # I18n.t :foo, :default => [:bar, 'default']
+ #
+ # BULK LOOKUP
+ #
+ # This returns an array with the translations for :foo and :bar.
+ # I18n.t [:foo, :bar]
+ #
+ # Can be used with dot-separated nested keys:
+ # I18n.t [:'baz.foo', :'baz.bar']
+ #
+ # Which is the same as using a scope option:
+ # I18n.t [:foo, :bar], :scope => :baz
+ #
+ # *LAMBDAS*
+ #
+ # Both translations and defaults can be given as Ruby lambdas. Lambdas will be
+ # called and passed the key and options.
+ #
+ # E.g. assuming the key :salutation resolves to:
+ # lambda { |key, options| options[:gender] == 'm' ? "Mr. #{options[:name]}" : "Mrs. #{options[:name]}" }
+ #
+ # Then I18n.t(:salutation, :gender => 'w', :name => 'Smith') will result in "Mrs. Smith".
+ #
+ # Note that the string returned by lambda will go through string interpolation too,
+ # so the following lambda would give the same result:
+ # lambda { |key, options| options[:gender] == 'm' ? "Mr. %{name}" : "Mrs. %{name}" }
+ #
+ # It is recommended to use/implement lambdas in an "idempotent" way. E.g. when
+ # a cache layer is put in front of I18n.translate it will generate a cache key
+ # from the argument values passed to #translate. Therefore your lambdas should
+ # always return the same translations/values per unique combination of argument
+ # values.
+ #
+ # Ruby 2.7+ keyword arguments warning
+ #
+ # This method uses keyword arguments.
+ # There is a breaking change in ruby that produces warning with ruby 2.7 and won't work as expected with ruby 3.0
+ # The "hash" parameter must be passed as keyword argument.
+ #
+ # Good:
+ # I18n.t(:salutation, :gender => 'w', :name => 'Smith')
+ # I18n.t(:salutation, **{ :gender => 'w', :name => 'Smith' })
+ # I18n.t(:salutation, **any_hash)
+ #
+ # Bad:
+ # I18n.t(:salutation, { :gender => 'w', :name => 'Smith' })
+ # I18n.t(:salutation, any_hash)
+ #
+ # @raise [Disabled]
+ #
+ # source://i18n//lib/i18n.rb#241
+ def translate(key = T.unsafe(nil), throw: T.unsafe(nil), raise: T.unsafe(nil), locale: T.unsafe(nil), **options); end
+
+ # Wrapper for translate that adds :raise => true. With
+ # this option, if no translation is found, it will raise I18n::MissingTranslationData
+ #
+ # source://i18n//lib/i18n.rb#260
+ def translate!(key, **options); end
+
+ # Transliterates UTF-8 characters to ASCII. By default this method will
+ # transliterate only Latin strings to an ASCII approximation:
+ #
+ # I18n.transliterate("Ærøskøbing")
+ # # => "AEroskobing"
+ #
+ # I18n.transliterate("日本語")
+ # # => "???"
+ #
+ # It's also possible to add support for per-locale transliterations. I18n
+ # expects transliteration rules to be stored at
+ # i18n.transliterate.rule.
+ #
+ # Transliteration rules can either be a Hash or a Proc. Procs must accept a
+ # single string argument. Hash rules inherit the default transliteration
+ # rules, while Procs do not.
+ #
+ # *Examples*
+ #
+ # Setting a Hash in bar
").scrub!(span2div).to_s +# # => "bar
" +# +# or +# +# unsafe_html = "ohai!bar
").scrub!(span2div).to_s +# # => "bar
" +# +# Scrubbers can be run on a document in either a top-down traversal (the +# default) or bottom-up. Top-down scrubbers can optionally return +# Scrubber::STOP to terminate the traversal of a subtree. +# +# source://loofah//lib/loofah/scrubber.rb#35 +class Loofah::Scrubber + # Options may include + # :direction => :top_down (the default) + # or + # :direction => :bottom_up + # + # For top_down traversals, if the block returns + # Loofah::Scrubber::STOP, then the traversal will be terminated + # for the current node's subtree. + # + # Alternatively, a Scrubber may inherit from Loofah::Scrubber, + # and implement +scrub+, which is slightly faster than using a + # block. + # + # @return [Scrubber] a new instance of Scrubber + # + # source://loofah//lib/loofah/scrubber.rb#65 + def initialize(options = T.unsafe(nil), &block); end + + # If the attribute is not set, add it + # If the attribute is set, don't overwrite the existing value + # + # source://loofah//lib/loofah/scrubber.rb#96 + def append_attribute(node, attribute, value); end + + # When a scrubber is initialized, the optional block is saved as + # :block. Note that, if no block is passed, then the +scrub+ + # method is assumed to have been implemented. + # + # source://loofah//lib/loofah/scrubber.rb#49 + def block; end + + # When a scrubber is initialized, the :direction may be specified + # as :top_down (the default) or :bottom_up. + # + # source://loofah//lib/loofah/scrubber.rb#44 + def direction; end + + # When +new+ is not passed a block, the class may implement + # +scrub+, which will be called for each document node. + # + # @raise [ScrubberNotFound] + # + # source://loofah//lib/loofah/scrubber.rb#88 + def scrub(node); end + + # Calling +traverse+ will cause the document to be traversed by + # either the lambda passed to the initializer or the +scrub+ + # method, in the direction specified at +new+ time. + # + # source://loofah//lib/loofah/scrubber.rb#80 + def traverse(node); end + + private + + # source://loofah//lib/loofah/scrubber.rb#105 + def html5lib_sanitize(node); end + + # source://loofah//lib/loofah/scrubber.rb#131 + def traverse_conditionally_bottom_up(node); end + + # source://loofah//lib/loofah/scrubber.rb#122 + def traverse_conditionally_top_down(node); end +end + +# Top-down Scrubbers may return CONTINUE to indicate that the subtree should be traversed. +# +# source://loofah//lib/loofah/scrubber.rb#37 +Loofah::Scrubber::CONTINUE = T.let(T.unsafe(nil), Object) + +# Top-down Scrubbers may return STOP to indicate that the subtree should not be traversed. +# +# source://loofah//lib/loofah/scrubber.rb#40 +Loofah::Scrubber::STOP = T.let(T.unsafe(nil), Object) + +# A RuntimeError raised when Loofah could not find an appropriate scrubber. +# +# source://loofah//lib/loofah/scrubber.rb#7 +class Loofah::ScrubberNotFound < ::RuntimeError; end + +# Loofah provides some built-in scrubbers for sanitizing with +# HTML5lib's safelist and for accomplishing some common +# transformation tasks. +# +# +# === Loofah::Scrubbers::Strip / scrub!(:strip) +# +# +:strip+ removes unknown/unsafe tags, but leaves behind the pristine contents: +# +# unsafe_html = "ohai!Some text with an unprintable character at the end\u2028
" +# Loofah.html5_fragment(markup).scrub!(:unprintable) +# => "Some text with an unprintable character at the end
" +# +# You may not be able to see the unprintable character in the above example, but there is a +# U+2028 character right before the closing tag. These characters can cause issues if +# the content is ever parsed by JavaScript - more information here: +# +# http://timelessrepo.com/json-isnt-a-javascript-subset +# +# source://loofah//lib/loofah/scrubbers.rb#104 +module Loofah::Scrubbers + class << self + # Returns an array of symbols representing the built-in scrubbers + # + # source://loofah//lib/loofah/scrubbers.rb#425 + def scrubber_symbols; end + end +end + +# === scrub!(:double_breakpoint) +# +# +:double_breakpoint+ replaces double-break tags with closing/opening paragraph tags. +# +# markup = "Some text here in a logical paragraph.
Some more text, apparently a second paragraph.
Some text here in a logical paragraph.
Some more text, apparently a second paragraph.
" +# +# source://loofah//lib/loofah/scrubbers.rb#362 +class Loofah::Scrubbers::DoubleBreakpoint < ::Loofah::Scrubber + # @return [DoubleBreakpoint] a new instance of DoubleBreakpoint + # + # source://loofah//lib/loofah/scrubbers.rb#363 + def initialize; end + + # source://loofah//lib/loofah/scrubbers.rb#367 + def scrub(node); end + + private + + # source://loofah//lib/loofah/scrubbers.rb#400 + def remove_blank_text_nodes(node); end +end + +# === scrub!(:escape) +# +# +:escape+ performs HTML entity escaping on the unknown/unsafe tags: +# +# unsafe_html = "ohai!Some text with an unprintable character at the end\u2028
" +# Loofah.html5_fragment(markup).scrub!(:unprintable) +# => "Some text with an unprintable character at the end
" +# +# You may not be able to see the unprintable character in the above example, but there is a +# U+2028 character right before the closing tag. These characters can cause issues if +# the content is ever parsed by JavaScript - more information here: +# +# http://timelessrepo.com/json-isnt-a-javascript-subset +# +# source://loofah//lib/loofah/scrubbers.rb#340 +class Loofah::Scrubbers::Unprintable < ::Loofah::Scrubber + # @return [Unprintable] a new instance of Unprintable + # + # source://loofah//lib/loofah/scrubbers.rb#341 + def initialize; end + + # source://loofah//lib/loofah/scrubbers.rb#345 + def scrub(node); end +end + +# === scrub!(:whitewash) +# +# +:whitewash+ removes all comments, styling and attributes in +# addition to doing markup-fixer-uppery and pruning unsafe tags. I +# like to call this "whitewashing", since it's like putting a new +# layer of paint on top of the HTML input to make it look nice. +# +# messy_markup = "ohai! " +# Loofah.html5_fragment(messy_markup).scrub!(:whitewash) +# => "ohai!first
+ #second
+ # + #