Class: Aequitas::Rule::Value::NotEqual

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

#equalizer

Instance Method Summary collapse

Methods inherited from Aequitas::Rule::Value

#expected, #initialize, rules_for, #valid_value?

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

#expected_value?(value) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
# File 'lib/aequitas/rule/value/not_equal.rb', line 10

def expected_value?(value)
  value != expected
rescue ArgumentError
  # TODO: figure out better solution for: can't compare String with Integer
  true
end

#violation_dataObject



21
22
23
# File 'lib/aequitas/rule/value/not_equal.rb', line 21

def violation_data
  [ [ :not_expected, expected ] ]
end

#violation_typeObject



17
18
19
# File 'lib/aequitas/rule/value/not_equal.rb', line 17

def violation_type
  :not_equal_to
end