Class: Aequitas::Rule::Value::NotEqual
- Inherits:
-
Aequitas::Rule::Value
- Object
- Aequitas::Rule
- Aequitas::Rule::Value
- Aequitas::Rule::Value::NotEqual
- Defined in:
- lib/aequitas/rule/value/not_equal.rb
Instance Attribute Summary
Attributes inherited from Aequitas::Rule
#attribute_name, #custom_message, #guard, #skip_condition
Attributes included from ValueObject
Instance Method Summary collapse
- #valid_value?(value) ⇒ Boolean
- #violation_data(resource) ⇒ Object
- #violation_type(resource) ⇒ Object
Methods inherited from Aequitas::Rule::Value
#expected, #initialize, rules_for, #valid?
Methods inherited from Aequitas::Rule
#attribute_value, #execute?, #initialize, rules_for, #skip?, #validate, #violation_info, #violation_values
Methods included from ValueObject
Constructor Details
This class inherits a constructor from Aequitas::Rule::Value
Instance Method Details
#valid_value?(value) ⇒ Boolean
10 11 12 13 14 15 |
# File 'lib/aequitas/rule/value/not_equal.rb', line 10 def valid_value?(value) value != expected rescue ArgumentError # TODO: figure out better solution for: can't compare String with Integer true end |
#violation_data(resource) ⇒ Object
21 22 23 |
# File 'lib/aequitas/rule/value/not_equal.rb', line 21 def violation_data(resource) [ [ :not_expected, expected ] ] end |
#violation_type(resource) ⇒ Object
17 18 19 |
# File 'lib/aequitas/rule/value/not_equal.rb', line 17 def violation_type(resource) :not_equal_to end |