Class: Google::Apis::CalendarV3::EventDateTime

Inherits:
Object
  • Object
show all
Defined in:
lib/calendar_assistant/extensions/google_apis_extensions.rb

Instance Method Summary collapse

Instance Method Details

#==(rhs) ⇒ Object



24
25
26
27
28
29
# File 'lib/calendar_assistant/extensions/google_apis_extensions.rb', line 24

def ==(rhs)
  if date
    return to_date == rhs.to_date
  end
  date_time == rhs.date_time
end

#to_dateObject



8
9
10
11
12
# File 'lib/calendar_assistant/extensions/google_apis_extensions.rb', line 8

def to_date
  return nil if date.nil?
  return Date.parse(date) if date.is_a?(String)
  date
end

#to_date!Object



14
15
16
17
# File 'lib/calendar_assistant/extensions/google_apis_extensions.rb', line 14

def to_date!
  return date_time.to_date if date.nil?
  to_date
end

#to_sObject



19
20
21
22
# File 'lib/calendar_assistant/extensions/google_apis_extensions.rb', line 19

def to_s
  return date.to_s if date
  date_time.strftime "%Y-%m-%d %H:%M"
end