Class: Aequitas::Rule::Value::Range

Inherits:
Aequitas::Rule::Value show all
Defined in:
lib/aequitas/rule/value/range.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
# File 'lib/aequitas/rule/value/range.rb', line 10

def valid_value?(value)
  expected.cover?(value)
end

#violation_data(resource) ⇒ Object



18
19
20
# File 'lib/aequitas/rule/value/range.rb', line 18

def violation_data(resource)
  [ [ :minimum, expected.begin ], [ :maximum, expected.end ] ]
end

#violation_type(resource) ⇒ Object



14
15
16
# File 'lib/aequitas/rule/value/range.rb', line 14

def violation_type(resource)
  :value_between
end