Class: Dry::Validation::Messages::I18n
- Defined in:
- lib/dry/validation/messages/i18n.rb
Constant Summary
Constants inherited from Abstract
Instance Attribute Summary collapse
-
#t ⇒ Object
readonly
Returns the value of attribute t.
Attributes inherited from Abstract
Instance Method Summary collapse
- #get(key, options = {}) ⇒ Object
-
#initialize ⇒ I18n
constructor
A new instance of I18n.
- #key?(key, options) ⇒ Boolean
Methods inherited from Abstract
cache, #cache, #call, #lookup, #lookup_paths, #namespaced, #root, #rule
Constructor Details
Instance Attribute Details
#t ⇒ Object (readonly)
Returns the value of attribute t.
7 8 9 |
# File 'lib/dry/validation/messages/i18n.rb', line 7 def t @t end |
Instance Method Details
#get(key, options = {}) ⇒ Object
16 17 18 |
# File 'lib/dry/validation/messages/i18n.rb', line 16 def get(key, = {}) t.(key, ) if key end |
#key?(key, options) ⇒ Boolean
20 21 22 |
# File 'lib/dry/validation/messages/i18n.rb', line 20 def key?(key, ) ::I18n.exists?(key, .fetch(:locale, I18n.default_locale)) end |