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.
Instance Method Summary collapse
- #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, #call, #config, #lookup, #namespaced
Constructor Details
#initialize(namespace, messages) ⇒ Namespaced
Returns a new instance of Namespaced.
7 8 9 10 11 |
# File 'lib/dry/validation/messages/namespaced.rb', line 7 def initialize(namespace, ) @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
#get(key, options = {}) ⇒ Object
17 18 19 |
# File 'lib/dry/validation/messages/namespaced.rb', line 17 def get(key, = {}) .get(key, ) end |
#key?(key, *args) ⇒ Boolean
13 14 15 |
# File 'lib/dry/validation/messages/namespaced.rb', line 13 def key?(key, *args) .key?(key, *args) end |
#lookup_paths(tokens) ⇒ Object
21 22 23 |
# File 'lib/dry/validation/messages/namespaced.rb', line 21 def lookup_paths(tokens) super(tokens.merge(root: "#{root}.rules.#{namespace}")) + super end |