Class: TwitterCldr::Timezones::GmtLocation

Inherits:
Location
  • Object
show all
Defined in:
lib/twitter_cldr/timezones/gmt_location.rb

Constant Summary collapse

FORMATS =
[:long_gmt, :short_gmt].freeze
DEFAULT_FORMAT =
:long_gmt
DEFAULT_GMT_ZERO_FORMAT =
'GMT'.freeze

Instance Attribute Summary

Attributes inherited from Location

#tz

Instance Method Summary collapse

Methods inherited from Location

#initialize, #resource, #tz_id

Constructor Details

This class inherits a constructor from TwitterCldr::Timezones::Location

Instance Method Details

#display_name_for(date, format = DEFAULT_FORMAT, dst = TZInfo::Timezone.default_dst, &block) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/twitter_cldr/timezones/gmt_location.rb', line 13

def display_name_for(date, format = DEFAULT_FORMAT, dst = TZInfo::Timezone.default_dst, &block)
  offset = tz.period_for_local(date, dst, &block).offset
  offset_secs = offset.utc_offset + offset.std_offset
  return gmt_zero_format if offset_secs == 0

  gmt_format.sub('{0}', format_offset(offset_secs, format))
end