Class: LIVR::Rules::Special::EqualToField
- Inherits:
-
LIVR::Rule
- Object
- LIVR::Rule
- LIVR::Rules::Special::EqualToField
- Defined in:
- lib/livr/rules/special.rb
Instance Method Summary collapse
- #call(value, user_data, field_results) ⇒ Object
-
#initialize(field) ⇒ EqualToField
constructor
A new instance of EqualToField.
Constructor Details
#initialize(field) ⇒ EqualToField
Returns a new instance of EqualToField.
20 21 22 |
# File 'lib/livr/rules/special.rb', line 20 def initialize(field) @field = field end |
Instance Method Details
#call(value, user_data, field_results) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/livr/rules/special.rb', line 24 def call(value, user_data, field_results) return if is_no_value(value) return 'FORMAT_ERROR' if !is_primitive(value) return "FIELDS_NOT_EQUAL" if value != user_data[@field] end |