Module: I18n::MissingTranslation::Base
- Included in:
- I18n::MissingTranslation, I18n::MissingTranslationData
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/exceptions.rb
Constant Summary collapse
- PERMITTED_KEYS =
[:scope].freeze
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #initialize(locale, key, options = EMPTY_HASH) ⇒ Object
- #keys ⇒ Object
- #message ⇒ Object (also: #to_s)
- #to_exception ⇒ Object
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
52 53 54 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/exceptions.rb', line 52 def key @key end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
52 53 54 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/exceptions.rb', line 52 def locale @locale end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
52 53 54 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/exceptions.rb', line 52 def @options end |
Instance Method Details
#initialize(locale, key, options = EMPTY_HASH) ⇒ Object
54 55 56 57 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/exceptions.rb', line 54 def initialize(locale, key, = EMPTY_HASH) @key, @locale, @options = key, locale, .slice(*PERMITTED_KEYS) .each { |k, v| self.[k] = v.inspect if v.is_a?(Proc) } end |
#keys ⇒ Object
59 60 61 62 63 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/exceptions.rb', line 59 def keys @keys ||= I18n.normalize_keys(locale, key, [:scope]).tap do |keys| keys << 'no key' if keys.size < 2 end end |
#message ⇒ Object Also known as: to_s
65 66 67 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/exceptions.rb', line 65 def "translation missing: #{keys.join('.')}" end |
#to_exception ⇒ Object
70 71 72 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/i18n-1.12.0/lib/i18n/exceptions.rb', line 70 def to_exception MissingTranslationData.new(locale, key, ) end |