Class: Aequitas::Rule::Length::Equal
- Inherits:
-
Aequitas::Rule::Length
- Object
- Aequitas::Rule
- Aequitas::Rule::Length
- Aequitas::Rule::Length::Equal
- Defined in:
- lib/aequitas/rule/length/equal.rb
Instance Attribute Summary collapse
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
Attributes inherited from Aequitas::Rule
#attribute_name, #custom_message, #guard, #skip_condition
Attributes included from ValueObject
Instance Method Summary collapse
-
#initialize(attribute_name, options) ⇒ Equal
constructor
A new instance of Equal.
- #violation_data(resource) ⇒ Object
- #violation_type(resource) ⇒ Object
Methods inherited from Aequitas::Rule::Length
rules_for, #valid?, #value_length
Methods inherited from Aequitas::Rule
#attribute_value, #execute?, rules_for, #skip?, #validate, #violation_info, #violation_values
Methods included from ValueObject
Constructor Details
#initialize(attribute_name, options) ⇒ Equal
Returns a new instance of Equal.
14 15 16 17 18 |
# File 'lib/aequitas/rule/length/equal.rb', line 14 def initialize(attribute_name, ) super @expected = .fetch(:expected) end |
Instance Attribute Details
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
12 13 14 |
# File 'lib/aequitas/rule/length/equal.rb', line 12 def expected @expected end |
Instance Method Details
#violation_data(resource) ⇒ Object
24 25 26 |
# File 'lib/aequitas/rule/length/equal.rb', line 24 def violation_data(resource) [ [ :expected, expected ] ] end |
#violation_type(resource) ⇒ Object
20 21 22 |
# File 'lib/aequitas/rule/length/equal.rb', line 20 def violation_type(resource) :wrong_length end |