Module: Veto::AgainstAttributeCco

Included in:
DoesntEqualAttributeCheck, EqualsAttributeCheck
Defined in:
lib/veto_checks.rb

Constant Summary collapse

MSG_MISSING_ATTR =
"missing required option :attribute"

Instance Method Summary collapse

Instance Method Details

#call(cco) ⇒ Object

Raises:

  • (StandardError)


5
6
7
8
9
10
11
12
# File 'lib/veto_checks.rb', line 5

def call(cco)
  raise StandardError, MSG_MISSING_ATTR unless @options[:attribute]

  value = cco.entity.public_send(@attribute_name)
  value_against = cco.entity.public_send(@options[:attribute])

  check @attribute_name, value, value_against, cco.errors, @options
end