Module: CalendarAssistant::DateHelpers
- Defined in:
- lib/calendar_assistant/date_helpers.rb
Class Method Summary collapse
Class Method Details
.cast_dates(attributes) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/calendar_assistant/date_helpers.rb', line 3 def self.cast_dates(attributes) attributes.each_with_object({}) do |(key, value), object| if value.is_a?(Time) || value.is_a?(DateTime) object[key] = Google::Apis::CalendarV3::EventDateTime.new(date_time: value) elsif value.is_a?(Date) object[key] = Google::Apis::CalendarV3::EventDateTime.new(date: value.to_s) else object[key] = value end end end |