class Sinatra::Chiro::Parameters::ParameterFactory
Public Class Methods
validator_from_type(options)
click to toggle source
# File lib/sinatra/chiro/parameters/parameter_factory.rb, line 5 def self.validator_from_type(options) validator = case options[:type].to_s when 'String' then StringValidator when 'Fixnum' then FixnumValidator when 'Float' then FloatValidator when 'Date' then DateValidator when 'DateTime' then DateTimeValidator when 'Time' then TimeValidator when 'boolean' then BooleanValidator when '[String]' then ArrayValidator else if options[:type].is_a? Regexp RegexpValidator end end validator.new(options) end