Class: Dry::Validation::Messages::Namespaced
- Defined in:
- lib/dry/validation/messages/namespaced.rb
Constant Summary
Constants inherited from Abstract
Instance Attribute Summary collapse
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Attributes inherited from Abstract
Instance Method Summary collapse
- #default_locale ⇒ Object
- #get(key, options = {}) ⇒ Object
-
#initialize(namespace, messages) ⇒ Namespaced
constructor
A new instance of Namespaced.
- #key?(key, *args) ⇒ Boolean
- #lookup_paths(tokens) ⇒ Object
Methods inherited from Abstract
cache, #cache, #call, #hash, #lookup, #namespaced, #rule
Constructor Details
#initialize(namespace, messages) ⇒ Namespaced
Returns a new instance of Namespaced.
7 8 9 10 11 12 |
# File 'lib/dry/validation/messages/namespaced.rb', line 7 def initialize(namespace, ) super() @namespace = namespace @messages = @root = .root end |
Instance Attribute Details
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
5 6 7 |
# File 'lib/dry/validation/messages/namespaced.rb', line 5 def @messages end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
5 6 7 |
# File 'lib/dry/validation/messages/namespaced.rb', line 5 def namespace @namespace end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
5 6 7 |
# File 'lib/dry/validation/messages/namespaced.rb', line 5 def root @root end |
Instance Method Details
#default_locale ⇒ Object
26 27 28 |
# File 'lib/dry/validation/messages/namespaced.rb', line 26 def default_locale .default_locale end |
#get(key, options = {}) ⇒ Object
18 19 20 |
# File 'lib/dry/validation/messages/namespaced.rb', line 18 def get(key, = {}) .get(key, ) end |
#key?(key, *args) ⇒ Boolean
14 15 16 |
# File 'lib/dry/validation/messages/namespaced.rb', line 14 def key?(key, *args) .key?(key, *args) end |
#lookup_paths(tokens) ⇒ Object
22 23 24 |
# File 'lib/dry/validation/messages/namespaced.rb', line 22 def lookup_paths(tokens) super(tokens.merge(root: "#{root}.rules.#{namespace}")) + super end |