Method: Cure::Validator::Candidate#with_rule

Defined in:
lib/cure/validator/candidate.rb

#with_rule(method_name, options = {}) ⇒ Object



46
47
48
49
50
51
# File 'lib/cure/validator/candidate.rb', line 46

def with_rule(method_name, options={})
  klass_name = "Cure::Validator::#{method_name.to_s.split("_").map(&:capitalize).join}Rule"
  raise "#{method_name} is not valid" unless class_exists?(klass_name)

  @rules << Kernel.const_get(klass_name).new(@named_range, @column, options)
end