Class: Veto::AttributeCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/veto/checks/attribute_check.rb

Instance Method Summary collapse

Constructor Details

#initialize(attribute_name, options = {}) ⇒ AttributeCheck

Returns a new instance of AttributeCheck.



3
4
5
6
# File 'lib/veto/checks/attribute_check.rb', line 3

def initialize(attribute_name, options={})
  @attribute_name = attribute_name
  @options = options
end

Instance Method Details

#call(cco) ⇒ Object



8
9
10
11
# File 'lib/veto/checks/attribute_check.rb', line 8

def call(cco)
  value = cco.entity.public_send(@attribute_name)
  check(@attribute_name, value, cco.errors, @options)
end