Class: Time

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra/params/time.rb

Class Method Summary collapse

Class Method Details

.convert_to(type) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/sinatra/params/time.rb', line 4

def self.convert_to(type)
    table = {
        String => :to_s,
        Integer => :to_i,
        Float => :to_f,
        Array => :to_a,
        Date => :to_date,
        DateTime => :to_datetime,
        Time => :to_time
    }

    table[type]
end