class Newgistics::TimeZone
Attributes
tz_timezone[R]
Public Class Methods
new(name)
click to toggle source
# File lib/newgistics/time_zone.rb, line 5 def initialize(name) @tz_timezone = TZInfo::Timezone.get(name) end
Public Instance Methods
utc_offset()
click to toggle source
# File lib/newgistics/time_zone.rb, line 9 def utc_offset @utc_offset ||= formatted_utc_offset end
utc_offset_in_seconds()
click to toggle source
# File lib/newgistics/time_zone.rb, line 13 def utc_offset_in_seconds current_period.utc_total_offset end
Private Instance Methods
current_period()
click to toggle source
# File lib/newgistics/time_zone.rb, line 19 def current_period tz_timezone.current_period end
formatted_utc_offset()
click to toggle source
# File lib/newgistics/time_zone.rb, line 23 def formatted_utc_offset seconds = utc_offset_in_seconds hours = seconds / 3600 minutes = seconds % 3600 / 60 sign = hours < 0 ? "-" : "+" "%s%02d:%02d" % [sign, hours.abs, minutes.abs] end