repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/unit/list_test.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/unit/list_test.rb | require "test_helper"
class PublicSuffix::ListTest < Minitest::Test
def setup
@list = PublicSuffix::List.new
end
def teardown
PublicSuffix::List.default = nil
end
def test_initialize
assert_instance_of PublicSuffix::List, @list
assert_equal 0, @list.size
end
def test_equality_with_s... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/find_profiler.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/find_profiler.rb | $LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
require "memory_profiler"
require "public_suffix"
PublicSuffix::List.default
report = MemoryProfiler.report do
PublicSuffix::List.default.find("www.example.com")
end
report.pretty_print
| ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/list_profsize.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/list_profsize.rb | $LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
require_relative "object_binsize"
require "public_suffix"
list = PublicSuffix::List.default
puts "#{list.size} rules:"
prof = ObjectBinsize.new
prof.report(PublicSuffix::List.default, label: "PublicSuffix::List size")
prof.report(PublicSuffix::List.default.in... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/initialization_profiler.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/initialization_profiler.rb | $LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
require "memory_profiler"
require "public_suffix"
report = MemoryProfiler.report do
PublicSuffix::List.default
end
report.pretty_print
# report.pretty_print(to_file: 'profiler-%s-%d.txt' % [ARGV[0], Time.now.to_i])
| ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/object_binsize.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/object_binsize.rb | require 'tempfile'
# A very simple memory profiles that checks the full size of a variable
# by serializing into a binary file.
#
# Yes, I know this is very rough, but there are cases where ObjectSpace.memsize_of
# doesn't cooperate, and this is one of the possible workarounds.
#
# For certain cases, it works (TM).
cl... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/domain_profiler.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/domain_profiler.rb | $LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
require "memory_profiler"
require "public_suffix"
PublicSuffix::List.default
report = MemoryProfiler.report do
PublicSuffix.domain("www.example.com")
end
report.pretty_print
| ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/find_profiler_jp.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/test/profilers/find_profiler_jp.rb | $LOAD_PATH.unshift File.expand_path("../../lib", __dir__)
require "memory_profiler"
require "public_suffix"
PublicSuffix::List.default
report = MemoryProfiler.report do
PublicSuffix::List.default.find("a.b.ide.kyoto.jp")
end
report.pretty_print
| ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix.rb | # = Public Suffix
#
# Domain name parser based on the Public Suffix List.
#
# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
require_relative "public_suffix/domain"
require_relative "public_suffix/version"
require_relative "public_suffix/errors"
require_relative "public_suffix/rule"
require_relative "publ... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix/version.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix/version.rb | # = Public Suffix
#
# Domain name parser based on the Public Suffix List.
#
# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
module PublicSuffix
# The current library version.
VERSION = "3.0.3".freeze
end
| ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix/errors.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix/errors.rb | # = Public Suffix
#
# Domain name parser based on the Public Suffix List.
#
# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
module PublicSuffix
class Error < StandardError
end
# Raised when trying to parse an invalid name.
# A name is considered invalid when no rule is found in the definition l... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix/domain.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix/domain.rb | # = Public Suffix
#
# Domain name parser based on the Public Suffix List.
#
# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
module PublicSuffix
# Domain represents a domain name, composed by a TLD, SLD and TRD.
class Domain
# Splits a string into the labels, that is the dot-separated parts.
... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix/list.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix/list.rb | # = Public Suffix
#
# Domain name parser based on the Public Suffix List.
#
# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
module PublicSuffix
# A {PublicSuffix::List} is a collection of one
# or more {PublicSuffix::Rule}.
#
# Given a {PublicSuffix::List},
# you can add or remove {PublicSuffi... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix/rule.rb | _vendor/ruby/2.6.0/gems/public_suffix-3.0.3/lib/public_suffix/rule.rb | # = Public Suffix
#
# Domain name parser based on the Public Suffix List.
#
# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
module PublicSuffix
# A Rule is a special object which holds a single definition
# of the Public Suffix List.
#
# There are 3 types of rules, each one represented by a spec... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/trollop-2.1.2/test/test_helper.rb | _vendor/ruby/2.6.0/gems/trollop-2.1.2/test/test_helper.rb | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
unless ENV['MUTANT']
begin
require "coveralls"
Coveralls.wear!
rescue LoadError
end
end
begin
require "pry"
rescue LoadError
end
require 'minitest/autorun'
require 'trollop'
| ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/trollop-2.1.2/test/test_trollop.rb | _vendor/ruby/2.6.0/gems/trollop-2.1.2/test/test_trollop.rb | require 'stringio'
require 'test_helper'
module Trollop
module Test
class Trollop < ::MiniTest::Unit::TestCase
def setup
@p = Parser.new
end
def test_die_without_options_ever_run
::Trollop.send(:instance_variable_set, "@last_parser", nil)
assert_raises(ArgumentError) { ::Trollop.die 'hello' }
end... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | true |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/trollop-2.1.2/lib/trollop.rb | _vendor/ruby/2.6.0/gems/trollop-2.1.2/lib/trollop.rb | # lib/trollop.rb -- trollop command-line processing library
# Copyright (c) 2008-2014 William Morgan.
# Copyright (c) 2014 Red Hat, Inc.
# trollop is licensed under the same terms as Ruby.
require 'date'
module Trollop
VERSION = "2.1.2"
## Thrown by Parser in the event of a commandline error. Not needed if
## you're... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/test_helper.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/test_helper.rb | $KCODE = 'u' if RUBY_VERSION <= '1.9'
require 'minitest/autorun'
TEST_CASE = defined?(Minitest::Test) ? Minitest::Test : MiniTest::Unit::TestCase
# TODO: Remove these aliases and update tests accordingly.
class TEST_CASE
alias :assert_raise :assert_raises
alias :assert_not_equal :refute_equal
def assert_nothin... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n_test.rb | # encoding: utf-8
require 'test_helper'
class I18nTest < I18n::TestCase
def setup
super
store_translations(:en, :currency => { :format => { :separator => '.', :delimiter => ',', } })
store_translations(:nl, :currency => { :format => { :separator => ',', :delimiter => '.', } })
store_translations(:en,... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/run_all.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/run_all.rb | def bundle_check
`bundle check` == "Resolving dependencies...\nThe Gemfile's dependencies are satisfied\n"
end
def execute(command)
puts command
system command
end
gemfiles = %w(Gemfile) + Dir['gemfiles/Gemfile*'].reject { |f| f.end_with?('.lock') }
results = gemfiles.map do |gemfile|
puts "\nBUNDLE_GEMFILE=... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/core_ext/hash_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/core_ext/hash_test.rb | require 'test_helper'
require 'i18n/core_ext/hash'
class I18nCoreExtHashInterpolationTest < I18n::TestCase
test "#deep_symbolize_keys" do
hash = { 'foo' => { 'bar' => { 'baz' => 'bar' } } }
expected = { :foo => { :bar => { :baz => 'bar' } } }
assert_equal expected, hash.deep_symbolize_keys
end
test ... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n/load_path_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n/load_path_test.rb | require 'test_helper'
class I18nLoadPathTest < I18n::TestCase
def setup
super
I18n.locale = :en
I18n.backend = I18n::Backend::Simple.new
store_translations(:en, :foo => {:bar => 'bar', :baz => 'baz'})
end
test "nested load paths do not break locale loading" do
I18n.load_path = [[locales_dir ... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n/middleware_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n/middleware_test.rb | require 'test_helper'
class I18nMiddlewareTest < I18n::TestCase
def setup
super
I18n.default_locale = :fr
@app = DummyRackApp.new
@middleware = I18n::Middleware.new(@app)
end
test "middleware initializes new config object after request" do
old_i18n_config_object_id = Thread.current[:i18n_con... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n/gettext_plural_keys_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n/gettext_plural_keys_test.rb | require 'test_helper'
class I18nGettextPluralKeysTest < I18n::TestCase
def setup
super
I18n::Gettext.plural_keys[:zz] = [:value1, :value2]
end
test "Returns the plural keys of the given locale if present" do
assert_equal I18n::Gettext.plural_keys(:zz), [:value1, :value2]
end
test "Returns the p... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n/interpolate_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n/interpolate_test.rb | require 'test_helper'
# thanks to Masao's String extensions, some tests taken from Masao's tests
# http://github.com/mutoh/gettext/blob/edbbe1fa8238fa12c7f26f2418403015f0270e47/test/test_string.rb
class I18nInterpolateTest < I18n::TestCase
test "String interpolates a hash argument w/ named placeholders" do
asse... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n/exceptions_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/i18n/exceptions_test.rb | require 'test_helper'
class I18nExceptionsTest < I18n::TestCase
def test_invalid_locale_stores_locale
force_invalid_locale
rescue I18n::ArgumentError => exception
assert_nil exception.locale
end
test "passing an invalid locale raises an InvalidLocale exception" do
force_invalid_locale do |exceptio... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/fallbacks_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/fallbacks_test.rb | require 'test_helper'
class I18nFallbacksApiTest < I18n::TestCase
class Backend < I18n::Backend::Simple
include I18n::Backend::Fallbacks
end
def setup
I18n.backend = Backend.new
super
end
include I18n::Tests::Basics
include I18n::Tests::Defaults
include I18n::Tests::Interpolation
include ... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/memoize_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/memoize_test.rb | require 'test_helper'
class I18nMemoizeBackendWithSimpleApiTest < I18n::TestCase
include I18n::Tests::Basics
include I18n::Tests::Defaults
include I18n::Tests::Interpolation
include I18n::Tests::Link
include I18n::Tests::Lookup
include I18n::Tests::Pluralization
include I18n::Tests::Procs
include I18n:... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/override_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/override_test.rb | require 'test_helper'
class I18nOverrideTest < I18n::TestCase
module OverrideInverse
def translate(*args)
super(*args).reverse
end
alias :t :translate
end
module OverrideSignature
def translate(*args)
args.first + args[1]
end
alias :t :translate
end
def setup
super
... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/key_value_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/key_value_test.rb | require 'test_helper'
class I18nKeyValueApiTest < I18n::TestCase
include I18n::Tests::Basics
include I18n::Tests::Defaults
include I18n::Tests::Interpolation
include I18n::Tests::Link
include I18n::Tests::Lookup
include I18n::Tests::Pluralization
# include Tests::Api::Procs
include I18n::Tests::Localiz... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/pluralization_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/pluralization_test.rb | require 'test_helper'
class I18nPluralizationApiTest < I18n::TestCase
class Backend < I18n::Backend::Simple
include I18n::Backend::Pluralization
end
def setup
I18n.backend = Backend.new
super
end
include I18n::Tests::Basics
include I18n::Tests::Defaults
include I18n::Tests::Interpolation
... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/simple_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/simple_test.rb | require 'test_helper'
class I18nSimpleBackendApiTest < I18n::TestCase
class Backend < I18n::Backend::Simple
include I18n::Backend::Pluralization
end
def setup
I18n.backend = I18n::Backend::Simple.new
super
end
include I18n::Tests::Basics
include I18n::Tests::Defaults
include I18n::Tests::In... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/chain_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/chain_test.rb | require 'test_helper'
class I18nApiChainTest < I18n::TestCase
def setup
super
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::Simple.new, I18n.backend)
end
include I18n::Tests::Basics
include I18n::Tests::Defaults
include I18n::Tests::Interpolation
include I18n::Tests::Link
include I18n::... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/all_features_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/all_features_test.rb | require 'test_helper'
begin
require 'rubygems'
require 'active_support'
rescue LoadError
puts "not testing with Cache enabled because active_support can not be found"
end
class I18nAllFeaturesApiTest < I18n::TestCase
class Backend < I18n::Backend::Simple
include I18n::Backend::Metadata
include I18n::B... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/cascade_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/api/cascade_test.rb | require 'test_helper'
class I18nCascadeApiTest < I18n::TestCase
class Backend < I18n::Backend::Simple
include I18n::Backend::Cascade
end
def setup
I18n.backend = Backend.new
super
end
include I18n::Tests::Basics
include I18n::Tests::Defaults
include I18n::Tests::Interpolation
include I18n... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/transliterator_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/transliterator_test.rb | # encoding: utf-8
require 'test_helper'
class I18nBackendTransliterator < I18n::TestCase
def setup
super
I18n.backend = I18n::Backend::Simple.new
@proc = lambda { |n| n.upcase }
@hash = { "ü" => "ue", "ö" => "oe", "a" => "a" }
@transliterator = I18n::Backend::Transliterator.get
end
test "tra... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/fallbacks_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/fallbacks_test.rb | require 'test_helper'
class I18nBackendFallbacksTranslateTest < I18n::TestCase
class Backend < I18n::Backend::Simple
include I18n::Backend::Fallbacks
end
def setup
super
I18n.backend = Backend.new
store_translations(:en, :foo => 'Foo in :en', :bar => 'Bar in :en', :buz => 'Buz in :en', :interpol... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/memoize_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/memoize_test.rb | require 'test_helper'
# TODO: change back to "require 'backend/simple'" when dropping support to Ruby 1.8.7.
require File.expand_path('../simple_test', __FILE__)
class I18nBackendMemoizeTest < I18nBackendSimpleTest
module MemoizeSpy
attr_accessor :spy_calls
def available_locales
self.spy_calls = (self... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/metadata_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/metadata_test.rb | require 'test_helper'
class I18nBackendMetadataTest < I18n::TestCase
class Backend < I18n::Backend::Simple
include I18n::Backend::Metadata
end
def setup
super
I18n.backend = Backend.new
store_translations(:en, :foo => 'Hi %{name}')
end
test "translation strings carry metadata" do
transl... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/key_value_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/key_value_test.rb | require 'test_helper'
class I18nBackendKeyValueTest < I18n::TestCase
def setup_backend!(subtree=true)
I18n.backend = I18n::Backend::KeyValue.new({}, subtree)
store_translations(:en, :foo => { :bar => 'bar', :baz => 'baz' })
end
def assert_flattens(expected, nested, escape=true, subtree=true)
assert_... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/interpolation_compiler_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/interpolation_compiler_test.rb | require 'test_helper'
class InterpolationCompilerTest < I18n::TestCase
Compiler = I18n::Backend::InterpolationCompiler::Compiler
def compile_and_interpolate(str, values = {})
Compiler.compile_if_an_interpolation(str).i18n_interpolate(values)
end
def assert_escapes_interpolation_key(expected, malicious_st... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/pluralization_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/pluralization_test.rb | require 'test_helper'
class I18nBackendPluralizationTest < I18n::TestCase
class Backend < I18n::Backend::Simple
include I18n::Backend::Pluralization
include I18n::Backend::Fallbacks
end
def setup
super
I18n.backend = Backend.new
@rule = lambda { |n| n == 1 ? :one : n == 0 || (2..10).include?... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/simple_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/simple_test.rb | require 'test_helper'
class I18nBackendSimpleTest < I18n::TestCase
def setup
super
I18n.backend = I18n::Backend::Simple.new
I18n.load_path = [locales_dir + '/en.yml']
end
# useful because this way we can use the backend with no key for interpolation/pluralization
test "simple backend translate: gi... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/chain_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/chain_test.rb | require 'test_helper'
class I18nBackendChainTest < I18n::TestCase
def setup
super
@first = backend(:en => {
:foo => 'Foo', :formats => {
:short => 'short',
:subformats => {:short => 'short'},
},
:plural_1 => { :one => '%{count}' },
:dates => {:a => "A"}
})
@se... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/cascade_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/cascade_test.rb | require 'test_helper'
class I18nBackendCascadeTest < I18n::TestCase
class Backend < I18n::Backend::Simple
include I18n::Backend::Cascade
end
def setup
super
I18n.backend = Backend.new
store_translations(:en, :foo => 'foo', :bar => { :baz => 'baz' })
@cascade_options = { :step => 1, :offset =... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/exceptions_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/exceptions_test.rb | require 'test_helper'
class I18nBackendExceptionsTest < I18n::TestCase
def setup
super
I18n.backend = I18n::Backend::Simple.new
end
test "throw message: MissingTranslation message from #translate includes the given scope and full key" do
exception = catch(:exception) do
I18n.t(:'baz.missing', ... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/cache_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/backend/cache_test.rb | require 'test_helper'
require 'digest/md5'
begin
require 'active_support'
rescue LoadError
$stderr.puts "Skipping cache tests using ActiveSupport"
else
class I18nBackendCacheTest < I18n::TestCase
class Backend < I18n::Backend::Simple
include I18n::Backend::Cache
end
def setup
I18n.backend = Backend... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/locale/fallbacks_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/locale/fallbacks_test.rb | require 'test_helper'
include I18n::Locale
class I18nFallbacksDefaultsTest < I18n::TestCase
test "defaults reflect the I18n.default_locale if no default has been set manually" do
I18n.default_locale = :'en-US'
fallbacks = Fallbacks.new
assert_equal [:'en-US', :en], fallbacks.defaults
end
test "defa... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/locale/tag/rfc4646_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/locale/tag/rfc4646_test.rb | # encoding: utf-8
require 'test_helper'
class I18nLocaleTagRfc4646ParserTest < I18n::TestCase
include I18n::Locale
test "Rfc4646::Parser given a valid tag 'de' returns an array of subtags" do
assert_equal ['de', nil, nil, nil, nil, nil, nil], Tag::Rfc4646::Parser.match('de')
end
test "Rfc4646::Parser giv... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/locale/tag/simple_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/locale/tag/simple_test.rb | # encoding: utf-8
require 'test_helper'
class I18nLocaleTagSimpleTest < I18n::TestCase
include I18n::Locale
test "returns 'de' as the language subtag in lowercase" do
assert_equal %w(de Latn DE), Tag::Simple.new('de-Latn-DE').subtags
end
test "returns a formatted tag string from #to_s" do
assert_equa... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/test_data/locales/en.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/test_data/locales/en.rb | # encoding: utf-8
{ :en => { :fuh => { :bah => "bas" } } } | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/test_data/locales/plurals.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/test_data/locales/plurals.rb | # encoding: utf-8
{
:af => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
:am => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
:ar => { :i18n => { :plural => { :keys => [:zero, :one, :... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/gettext/backend_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/gettext/backend_test.rb | # encoding: utf-8
require 'test_helper'
class I18nGettextBackendTest < I18n::TestCase
include I18n::Gettext::Helpers
class Backend < I18n::Backend::Simple
include I18n::Backend::Gettext
end
def setup
super
I18n.backend = Backend.new
I18n.locale = :en
I18n.load_path = ["#{locales_dir}/de.... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/test/gettext/api_test.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/test/gettext/api_test.rb | # encoding: utf-8
require 'test_helper'
require 'i18n/gettext/helpers'
include I18n::Gettext::Helpers
class I18nGettextApiTest < I18n::TestCase
def setup
super
I18n.locale = :en
I18n.backend.store_translations :de, {
'Hi Gettext!' => 'Hallo Gettext!',
'Sentence 1. Sentence 2.' => 'Satz 1. Sa... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n.rb | require 'concurrent/map'
require 'i18n/version'
require 'i18n/exceptions'
require 'i18n/interpolate/ruby'
module I18n
autoload :Backend, 'i18n/backend'
autoload :Config, 'i18n/config'
autoload :Gettext, 'i18n/gettext'
autoload :Locale, 'i18n/locale'
autoload :Tests, 'i18n/tests'
autoload :Middleware, ... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/version.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/version.rb | module I18n
VERSION = "0.9.5"
end
| ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/exceptions.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/exceptions.rb | require 'cgi'
module I18n
# Handles exceptions raised in the backend. All exceptions except for
# MissingTranslationData exceptions are re-thrown. When a MissingTranslationData
# was caught the handler returns an error message string containing the key/scope.
# Note that the exception handler is not called whe... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/middleware.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/middleware.rb | module I18n
class Middleware
def initialize(app)
@app = app
end
def call(env)
@app.call(env)
ensure
Thread.current[:i18n_config] = I18n::Config.new
end
end
end
| ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/gettext.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/gettext.rb | module I18n
module Gettext
PLURAL_SEPARATOR = "\001"
CONTEXT_SEPARATOR = "\004"
autoload :Helpers, 'i18n/gettext/helpers'
@@plural_keys = { :en => [:one, :other] }
class << self
# returns an array of plural keys for the given locale or the whole hash
# of locale mappings to plural ... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend.rb | module I18n
module Backend
autoload :Base, 'i18n/backend/base'
autoload :InterpolationCompiler, 'i18n/backend/interpolation_compiler'
autoload :Cache, 'i18n/backend/cache'
autoload :Cascade, 'i18n/backend/cascade'
autoload :Chain, 'i18... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale.rb | module I18n
module Locale
autoload :Fallbacks, 'i18n/locale/fallbacks'
autoload :Tag, 'i18n/locale/tag'
end
end
| ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/config.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/config.rb | require 'set'
module I18n
class Config
# The only configuration value that is not global and scoped to thread is :locale.
# It defaults to the default_locale.
def locale
defined?(@locale) && @locale ? @locale : default_locale
end
# Sets the current locale pseudo-globally, i.e. in the Threa... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests.rb | module I18n
module Tests
autoload :Basics, 'i18n/tests/basics'
autoload :Defaults, 'i18n/tests/defaults'
autoload :Interpolation, 'i18n/tests/interpolation'
autoload :Link, 'i18n/tests/link'
autoload :Localization, 'i18n/tests/localization'
autoload :Lookup, 'i18n/... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/pluralization.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/pluralization.rb | # encoding: utf-8
module I18n
module Tests
module Pluralization
test "pluralization: given 0 it returns the :zero translation if it is defined" do
assert_equal 'zero', I18n.t(:default => { :zero => 'zero' }, :count => 0)
end
test "pluralization: given 0 it returns the :other translatio... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/procs.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/procs.rb | # encoding: utf-8
module I18n
module Tests
module Procs
test "lookup: given a translation is a proc it calls the proc with the key and interpolation values" do
I18n.backend.store_translations(:en, :a_lambda => lambda { |*args| I18n::Tests::Procs.filter_args(*args) })
assert_equal '[:a_lambd... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/interpolation.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/interpolation.rb | # encoding: utf-8
module I18n
module Tests
module Interpolation
# If no interpolation parameter is not given, I18n should not alter the string.
# This behavior is due to three reasons:
#
# * Checking interpolation keys in all strings hits performance, badly;
#
# * This all... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/localization.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/localization.rb | module I18n
module Tests
module Localization
autoload :Date, 'i18n/tests/localization/date'
autoload :DateTime, 'i18n/tests/localization/date_time'
autoload :Time, 'i18n/tests/localization/time'
autoload :Procs, 'i18n/tests/localization/procs'
def self.included(base)
... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/link.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/link.rb | # encoding: utf-8
module I18n
module Tests
module Link
test "linked lookup: if a key resolves to a symbol it looks up the symbol" do
I18n.backend.store_translations 'en', {
:link => :linked,
:linked => 'linked'
}
assert_equal 'linked', I18n.backend.translate('en... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/basics.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/basics.rb | module I18n
module Tests
module Basics
def teardown
I18n.available_locales = nil
end
test "available_locales returns the locales stored to the backend by default" do
I18n.backend.store_translations('de', :foo => 'bar')
I18n.backend.store_translations('en', :foo => 'foo')... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/defaults.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/defaults.rb | # encoding: utf-8
module I18n
module Tests
module Defaults
def setup
super
I18n.backend.store_translations(:en, :foo => { :bar => 'bar', :baz => 'baz' })
end
test "defaults: given nil as a key it returns the given default" do
assert_equal 'default', I18n.t(nil, :default... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/lookup.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/lookup.rb | # encoding: utf-8
module I18n
module Tests
module Lookup
def setup
super
I18n.backend.store_translations(:en, :foo => { :bar => 'bar', :baz => 'baz' }, :falsy => false, :truthy => true,
:string => "a", :array => %w(a b c), :hash => { "a" => "b" })
end
test "lookup: it... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/localization/procs.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/localization/procs.rb | # encoding: utf-8
module I18n
module Tests
module Localization
module Procs
test "localize: using day names from lambdas" do
setup_time_proc_translations
time = ::Time.utc(2008, 3, 1, 6, 0)
assert_match(/Суббота/, I18n.l(time, :format => "%A, %d %B", :locale => :ru))
... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/localization/time.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/localization/time.rb | # encoding: utf-8
module I18n
module Tests
module Localization
module Time
def setup
super
setup_time_translations
@time = ::Time.utc(2008, 3, 1, 6, 0)
@other_time = ::Time.utc(2008, 3, 1, 18, 0)
end
test "localize Time: given the short forma... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/localization/date_time.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/localization/date_time.rb | # encoding: utf-8
module I18n
module Tests
module Localization
module DateTime
def setup
super
setup_datetime_translations
@datetime = ::DateTime.new(2008, 3, 1, 6)
@other_datetime = ::DateTime.new(2008, 3, 1, 18)
end
test "localize DateTime:... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/localization/date.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/tests/localization/date.rb | # encoding: utf-8
module I18n
module Tests
module Localization
module Date
def setup
super
setup_date_translations
@date = ::Date.new(2008, 3, 1)
end
test "localize Date: given the short format it uses it" do
# TODO should be Mrz, shouldn't i... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/interpolate/ruby.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/interpolate/ruby.rb | # heavily based on Masao Mutoh's gettext String interpolation extension
# http://github.com/mutoh/gettext/blob/f6566738b981fe0952548c421042ad1e0cdfb31e/lib/gettext/core_ext/string.rb
module I18n
INTERPOLATION_PATTERN = Regexp.union(
/%%/,
/%\{(\w+)\}/, # matches placeholders lik... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/core_ext/hash.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/core_ext/hash.rb | class Hash
def slice(*keep_keys)
h = {}
keep_keys.each { |key| h[key] = fetch(key) if has_key?(key) }
h
end unless Hash.method_defined?(:slice)
def except(*less_keys)
slice(*keys - less_keys)
end unless Hash.method_defined?(:except)
def deep_symbolize_keys
inject({}) { |result, (key, val... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/core_ext/string/interpolate.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/core_ext/string/interpolate.rb | # This file used to backport the Ruby 1.9 String interpolation syntax to Ruby 1.8.
#
# Since I18n has dropped support to Ruby 1.8, this file is not required anymore,
# however, Rails 3.2 still requires it directly:
#
# https://github.com/rails/rails/blob/3-2-stable/activesupport/lib/active_support/core_ext/string/inter... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/core_ext/kernel/suppress_warnings.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/core_ext/kernel/suppress_warnings.rb | module Kernel
def suppress_warnings
original_verbosity, $VERBOSE = $VERBOSE, nil
yield
ensure
$VERBOSE = original_verbosity
end
end
| ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/memoize.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/memoize.rb | # Memoize module simply memoizes the values returned by lookup using
# a flat hash and can tremendously speed up the lookup process in a backend.
#
# To enable it you can simply include the Memoize module to your backend:
#
# I18n::Backend::Simple.include(I18n::Backend::Memoize)
#
# Notice that it's the responsibilit... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/pluralization.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/pluralization.rb | # I18n Pluralization are useful when you want your application to
# customize pluralization rules.
#
# To enable locale specific pluralizations you can simply include the
# Pluralization module to the Simple backend - or whatever other backend you
# are using.
#
# I18n::Backend::Simple.include(I18n::Backend::Pluraliz... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/cascade.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/cascade.rb | # The Cascade module adds the ability to do cascading lookups to backends that
# are compatible to the Simple backend.
#
# By cascading lookups we mean that for any key that can not be found the
# Cascade module strips one segment off the scope part of the key and then
# tries to look up the key in that scope.
#
# E.g.... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/chain.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/chain.rb | module I18n
module Backend
# 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.
... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/transliterator.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/transliterator.rb | # encoding: utf-8
module I18n
module Backend
module Transliterator
DEFAULT_REPLACEMENT_CHAR = "?"
# Given a locale and a UTF-8 string, return the locale's ASCII
# approximation for the string.
def transliterate(locale, string, replacement = nil)
@transliterators ||= {}
@tr... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/key_value.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/key_value.rb | require 'i18n/backend/base'
module I18n
begin
require 'oj'
class JSON
class << self
def encode(value)
Oj::Rails.encode(value)
end
def decode(value)
Oj.load(value)
end
end
end
rescue LoadError
require 'active_support/json'
JSON = A... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/base.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/base.rb | require 'yaml'
require 'i18n/core_ext/hash'
require 'i18n/core_ext/kernel/suppress_warnings'
module I18n
module Backend
module Base
include I18n::Backend::Transliterator
# Accepts a list of paths to translation files. Loads translations from
# plain Ruby (*.rb) or YAML files (*.yml). See #load... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/gettext.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/gettext.rb | require 'i18n/gettext'
require 'i18n/gettext/po_parser'
module I18n
module Backend
# 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::... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/interpolation_compiler.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/interpolation_compiler.rb | # The InterpolationCompiler module contains optimizations that can tremendously
# speed up the interpolation process on the Simple backend.
#
# It works by defining a pre-compiled method on stored translation Strings that
# already bring all the knowledge about contained interpolation variables etc.
# so that the actua... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/simple.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/simple.rb | module I18n
module Backend
# 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.:
... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/fallbacks.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/fallbacks.rb | # I18n locale fallbacks are useful when you want your application to use
# translations from other locales when translations for the current locale are
# missing. E.g. you might want to use :en translations when translations in
# your applications main locale :de are missing.
#
# To enable locale fallbacks you can simp... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/cache.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/cache.rb | # This module allows you to easily cache all responses from the backend - thus
# speeding up the I18n aspects of your application quite a bit.
#
# To enable caching you can simply include the Cache module to the Simple
# backend - or whatever other backend you are using:
#
# I18n::Backend::Simple.send(:include, I18n:... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/metadata.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/metadata.rb | # I18n translation metadata is useful when you want to access information
# about how a translation was looked up, pluralized or interpolated in
# your application.
#
# msg = I18n.t(:message, :default => 'Hi!', :scope => :foo)
# msg.translation_metadata
# # => { :key => :message, :scope => :foo, :default => 'Hi!'... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/flatten.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/backend/flatten.rb | module I18n
module Backend
# 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;
#
... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale/tag.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale/tag.rb | # encoding: utf-8
module I18n
module Locale
module Tag
autoload :Parents, 'i18n/locale/tag/parents'
autoload :Rfc4646, 'i18n/locale/tag/rfc4646'
autoload :Simple, 'i18n/locale/tag/simple'
class << self
# Returns the current locale tag implementation. Defaults to +I18n::Locale::T... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale/fallbacks.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale/fallbacks.rb | # Locale Fallbacks
#
# Extends the I18n module to hold a fallbacks instance which is set to an
# instance of I18n::Locale::Fallbacks by default but can be swapped with a
# different implementation.
#
# Locale fallbacks will compute a number of fallback locales for a given locale.
# For example:
#
# <pre><code>
# I18n.f... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale/tag/parents.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale/tag/parents.rb | module I18n
module Locale
module Tag
module Parents
def parent
@parent ||= begin
segs = to_a.compact
segs.length > 1 ? self.class.tag(*segs[0..(segs.length-2)].join('-')) : nil
end
end
def self_and_parents
@self_and_parents ||= [... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale/tag/simple.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale/tag/simple.rb | # Simple Locale tag implementation that computes subtags by simply splitting
# the locale tag at '-' occurences.
module I18n
module Locale
module Tag
class Simple
class << self
def tag(tag)
new(tag)
end
end
include Parents
attr_reader :tag
... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale/tag/rfc4646.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/locale/tag/rfc4646.rb | # RFC 4646/47 compliant Locale tag implementation that parses locale tags to
# subtags such as language, script, region, variant etc.
#
# For more information see by http://en.wikipedia.org/wiki/IETF_language_tag
#
# Rfc4646::Parser does not implement grandfathered tags.
module I18n
module Locale
module Tag
... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/gettext/helpers.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/gettext/helpers.rb | require 'i18n/gettext'
module I18n
module Gettext
# Implements classical Gettext style accessors. To use this include the
# module to the global namespace or wherever you want to use it.
#
# include I18n::Gettext::Helpers
module Helpers
# Makes dynamic translation messages readable for th... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/gettext/po_parser.rb | _vendor/ruby/2.6.0/gems/i18n-0.9.5/lib/i18n/gettext/po_parser.rb | =begin
poparser.rb - Generate a .mo
Copyright (C) 2003-2009 Masao Mutoh <mutoh at highway.ne.jp>
You may redistribute it and/or modify it under the same
license terms as Ruby.
=end
#MODIFIED
# removed include GetText etc
# added stub translation method _(x)
require 'racc/parser'
module GetText
class PoPa... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
grab/engineering-blog | https://github.com/grab/engineering-blog/blob/d8026a4e9cc6348bf38951ee96c523f4ec19f3c4/_vendor/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb | _vendor/ruby/2.6.0/gems/pathutil-0.16.2/lib/pathutil.rb | # Frozen-string-literal: true
# Copyright: 2015 - 2017 Jordon Bedwell - MIT License
# Encoding: utf-8
require "pathutil/helpers"
require "forwardable/extended"
require "find"
class Pathutil
attr_writer :encoding
extend Forwardable::Extended
extend Helpers
# --
# @note A lot of this class can be compatible ... | ruby | MIT | d8026a4e9cc6348bf38951ee96c523f4ec19f3c4 | 2026-01-04T17:45:10.474201Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.