Class: Veto::CheckFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/veto/checks/check_factory.rb

Class Method Summary collapse

Class Method Details

.new(type, attribute_name, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/veto/checks/check_factory.rb', line 3

def self.new(type, attribute_name, options={})
  class_name = "#{camel_case(type.to_s)}Check"
  begin
    Veto.const_get(class_name).new(attribute_name, options)
  rescue NameError => e
    raise(CheckNotAssigned, "Check not found: ::Veto::#{class_name}")
  end
end