Class: FacebookGoogleCalendarSync::Timezone::TimeZoneProxy

Inherits:
BasicObject
Defined in:
lib/facebook_google_calendar_sync/timezone.rb

Instance Method Summary collapse

Constructor Details

#initialize(target, timezone) ⇒ TimeZoneProxy

Returns a new instance of TimeZoneProxy.



12
13
14
15
# File 'lib/facebook_google_calendar_sync/timezone.rb', line 12

def initialize target, timezone
  @target = target
  @timezone = timezone
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



17
18
19
20
# File 'lib/facebook_google_calendar_sync/timezone.rb', line 17

def method_missing(method, *args, &block)
  result = @target.send(method, *args, &block)
  convert_timezone_if_date(result)
end

Instance Method Details

#convert_timezone_if_date(result) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/facebook_google_calendar_sync/timezone.rb', line 22

def convert_timezone_if_date result
  if result.respond_to?(:convert_time_zone)
    result.convert_time_zone(@timezone)
  else
    result
  end
end