class ActiveModel::BlockValidator

Validator.
and call this block for each attribute being validated. validates_each uses this
BlockValidator is a special EachValidator which receives a block on initialization

def initialize(options, &block)

def initialize(options, &block)
  @block = block
  super
end

def validate_each(record, attribute, value)

def validate_each(record, attribute, value)
  @block.call(record, attribute, value)
end