class Integer

Public Class Methods

convert_to(type) click to toggle source
# File lib/sinatra/params/integer.rb, line 4
def self.convert_to(type)
    table = {
        String => :to_s,
        Integer => :to_i,
        Float => :to_f,
        Time => :to_time,
        Date => :to_date,
        DateTime => :to_datetime
    }

    table[type]
end

Public Instance Methods

to_date() click to toggle source
# File lib/sinatra/params/integer.rb, line 21
def to_date
    Time.at(self).to_date
end
to_datetime() click to toggle source
# File lib/sinatra/params/integer.rb, line 25
def to_datetime
    Time.at(self).to_datetime
end
to_time() click to toggle source
# File lib/sinatra/params/integer.rb, line 17
def to_time
    Time.at(self)
end