Module: Vanguard::InstanceMethods
- Includes:
- Adamantium
- Defined in:
- lib/vanguard/instance_methods.rb
Overview
Instance level mixins
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
private
Return validated resource.
Instance Method Summary collapse
-
#on(attribute_name) ⇒ Enumerable<Violation>
private
Return violations on attribute name.
-
#result ⇒ ViolationSet
private
Return violation set.
-
#valid? ⇒ true, false
private
Test if validator is valid.
-
#violations ⇒ Enumerable<Violation>
private
Return violations.
Instance Attribute Details
#resource ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return validated resource
12 13 14 |
# File 'lib/vanguard/instance_methods.rb', line 12 def resource @resource end |
Instance Method Details
#on(attribute_name) ⇒ Enumerable<Violation>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return violations on attribute name
47 48 49 |
# File 'lib/vanguard/instance_methods.rb', line 47 def on(attribute_name) result.on(attribute_name) end |
#result ⇒ ViolationSet
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return violation set
20 21 22 |
# File 'lib/vanguard/instance_methods.rb', line 20 def result self.class.validator.evaluate(resource) end |
#valid? ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Test if validator is valid
35 36 37 |
# File 'lib/vanguard/instance_methods.rb', line 35 def valid? result.valid? end |
#violations ⇒ Enumerable<Violation>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return violations
57 58 59 |
# File 'lib/vanguard/instance_methods.rb', line 57 def violations result.violations end |