Class: Aequitas::Rule::Value::GreaterThanOrEqual

Inherits:
Aequitas::Rule::Value show all
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

#equalizer

Instance Method Summary collapse

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

#equalize_on

Constructor Details

This class inherits a constructor from Aequitas::Rule::Value

Instance Method Details

#valid_value?(value) ⇒ Boolean

Returns:

  • (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