Method: ActiveForm::Validator::Base#initialize
- Defined in:
- lib/active_form/validators/base.rb
#initialize(*args) {|_self| ... } ⇒ Base
Returns a new instance of Base.
6 7 8 9 10 11 12 13 |
# File 'lib/active_form/validators/base.rb', line 6 def initialize(*args, &block) setup props = args.last.is_a?(Hash) ? args.pop : {} register_element(args.shift) if is_element?(args.first) self.code = self.class.to_s.demodulize.underscore props.each { |prop, value| send("#{prop}=", value) if respond_to?("#{prop}=") } yield self if block_given? end |