Class: Aequitas::Rule::Value::GreaterThanOrEqual
- Inherits:
-
Aequitas::Rule::Value
- Object
- Aequitas::Rule
- Aequitas::Rule::Value
- Aequitas::Rule::Value::GreaterThanOrEqual
- Defined in:
- lib/aequitas/rule/value/greater_than_or_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/greater_than_or_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/greater_than_or_equal.rb', line 21 def violation_data(resource) [ [ :minimum, expected ] ] end |
#violation_type(resource) ⇒ Object
17 18 19 |
# File 'lib/aequitas/rule/value/greater_than_or_equal.rb', line 17 def violation_type(resource) :greater_than_or_equal_to end |