Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/sinatra/params/array.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 |
# File 'lib/sinatra/params/array.rb', line 4 def self.convert_to(type) table = { Array => :to_a, String => :to_s, Date => :to_date, DateTime => :to_datetime } table[type] end |
Instance Method Details
#to_date ⇒ Object
15 16 17 |
# File 'lib/sinatra/params/array.rb', line 15 def to_date Date.parse(self.join('-')) end |
#to_datetime ⇒ Object
19 20 21 |
# File 'lib/sinatra/params/array.rb', line 19 def to_datetime DateTime.parse(self.join('-')) end |