Module: Windoo::Converters
- Defined in:
- lib/windoo/converters.rb
Overview
Methods for converting values in standard ways Usually used for converting between Ruby values and JSON values between Windoo and the Server
Class Method Summary collapse
-
.time_to_api(time) ⇒ String
The time in UTC and ISO8601 format.
-
.to_time(time) ⇒ Time
The timestamp as a Time object.
Class Method Details
.time_to_api(time) ⇒ String
Returns The time in UTC and ISO8601 format.
17 18 19 |
# File 'lib/windoo/converters.rb', line 17 def self.time_to_api(time) time.utc.iso8601 end |
.to_time(time) ⇒ Time
Returns The timestamp as a Time object.
23 24 25 26 27 |
# File 'lib/windoo/converters.rb', line 23 def self.to_time(time) return time if time.is_a? Time Time.parse time.to_s end |