Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/sinatra/params/integer.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.convert_to(type) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# 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 |
Instance Method Details
#to_date ⇒ Object
21 22 23 |
# File 'lib/sinatra/params/integer.rb', line 21 def to_date Time.at(self).to_date end |
#to_datetime ⇒ Object
25 26 27 |
# File 'lib/sinatra/params/integer.rb', line 25 def to_datetime Time.at(self).to_datetime end |
#to_time ⇒ Object
17 18 19 |
# File 'lib/sinatra/params/integer.rb', line 17 def to_time Time.at(self) end |