Class: ActiveModel::BlockValidator

Inherits:
EachValidator show all
Defined in:
activemodel/lib/active_model/validator.rb

Overview

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

Instance Attribute Summary

Attributes inherited from EachValidator

#attributes

Attributes inherited from Validator

#options

Instance Method Summary collapse

Methods inherited from EachValidator

#check_validity!, #validate

Methods inherited from Validator

kind, #kind, #validate

Constructor Details

#initialize(options, &block) ⇒ BlockValidator

Returns a new instance of BlockValidator.



173
174
175
176
# File 'activemodel/lib/active_model/validator.rb', line 173

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