class Date

Public Class Methods

convert_to(type) click to toggle source
# File lib/sinatra/params/date.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

Public Instance Methods

to_f() click to toggle source
# File lib/sinatra/params/date.rb, line 22
def to_f
    self.to_time.to_f
end
to_i() click to toggle source
# File lib/sinatra/params/date.rb, line 18
def to_i
    self.to_time.to_i
end