Class: AWS::Record::BlockValidator

Inherits:
Validator
  • Object
show all
Defined in:
lib/aws/record/validators/block.rb

Constant Summary collapse

ACCEPTED_OPTIONS =
[:allow_nil, :on, :if, :unless]

Instance Attribute Summary collapse

Attributes inherited from Validator

#attribute_names, #options

Instance Method Summary collapse

Methods inherited from Validator

#validate

Constructor Details

#initialize(*args, &block) ⇒ BlockValidator

Returns a new instance of BlockValidator.


24
25
26
27
# File 'lib/aws/record/validators/block.rb', line 24

def initialize *args, &block
  @block = block
  super(*args)
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block


29
30
31
# File 'lib/aws/record/validators/block.rb', line 29

def block
  @block
end

Instance Method Details

#validate_attribute(record, attribute_name, value) ⇒ Object


31
32
33
# File 'lib/aws/record/validators/block.rb', line 31

def validate_attribute record, attribute_name, value
  block.call(record, attribute_name, value)
end