class Veto::CheckFactory

Public Class Methods

new(type, attribute_name, options={}) click to toggle source
# 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

Private Class Methods

camel_case(str) click to toggle source
# File lib/veto/checks/check_factory.rb, line 14
def self.camel_case(str)
  str.split('_').map{|w| w.capitalize }.join('')
end