Class: SDL4R::ConstantTimezone
- Inherits:
-
TZInfo::Timezone
- Object
- TZInfo::Timezone
- SDL4R::ConstantTimezone
- Defined in:
- lib/sdl4r/constant_timezone.rb
Overview
A timezone like ‘JST’ that has only one definition whatever the place and the time.
Class Method Summary collapse
Instance Method Summary collapse
-
#_initialize(identifier, utc_offset, std_offset) ⇒ Object
:nodoc:.
- #identifier ⇒ Object
- #period_for_utc(utc) ⇒ Object
- #periods_for_local(local) ⇒ Object
Class Method Details
.new(identifier, utc_offset, std_offset) ⇒ Object
28 29 30 31 32 |
# File 'lib/sdl4r/constant_timezone.rb', line 28 def self.new(identifier, utc_offset, std_offset) o = super() o.send(:_initialize, identifier, utc_offset, std_offset) o end |
Instance Method Details
#_initialize(identifier, utc_offset, std_offset) ⇒ Object
:nodoc:
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/sdl4r/constant_timezone.rb', line 34 def _initialize(identifier, utc_offset, std_offset) # :nodoc: raise ArgumentError, 'identifier' if identifier.nil? raise ArgumentError, 'utc_offset' if utc_offset.nil? raise ArgumentError, 'std_offset' if std_offset.nil? @identifier = identifier @utc_offset = utc_offset @std_offset = std_offset @period = TZInfo::TimezonePeriod.new( nil, nil, TZInfo::TimezoneOffsetInfo.new(@utc_offset, @std_offset, @identifier.to_sym)) end |
#identifier ⇒ Object
46 47 48 |
# File 'lib/sdl4r/constant_timezone.rb', line 46 def identifier @identifier end |
#period_for_utc(utc) ⇒ Object
50 51 52 |
# File 'lib/sdl4r/constant_timezone.rb', line 50 def period_for_utc(utc) @period end |
#periods_for_local(local) ⇒ Object
54 55 56 |
# File 'lib/sdl4r/constant_timezone.rb', line 54 def periods_for_local(local) [@period] end |