Class: TZInfo::DataSources::ConstantOffsetDataTimezoneInfo
- Inherits:
-
DataTimezoneInfo
- Object
- TimezoneInfo
- DataTimezoneInfo
- TZInfo::DataSources::ConstantOffsetDataTimezoneInfo
- Defined in:
- lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb
Overview
Represents a data time zone defined by a constantly observed offset.
Instance Attribute Summary collapse
-
#constant_offset ⇒ TimezoneOffset
readonly
The offset that is constantly observed.
Attributes inherited from TimezoneInfo
Instance Method Summary collapse
-
#initialize(identifier, constant_offset) ⇒ ConstantOffsetDataTimezoneInfo
constructor
Initializes a new ConstantOffsetDataTimezoneInfo.
-
#period_for(timestamp) ⇒ TimezonePeriod
An unbounded TimezonePeriod for the time zone's constantly observed offset.
-
#periods_for_local(local_timestamp) ⇒ Array<TimezonePeriod>
An
Array
containing a single unbounded TimezonePeriod for the time zone's constantly observed offset. -
#transitions_up_to(to_timestamp, from_timestamp = nil) ⇒ Array
An empty
Array
, since there are no transitions in time zones that observe a constant offset.
Methods inherited from DataTimezoneInfo
Methods inherited from TimezoneInfo
Constructor Details
#initialize(identifier, constant_offset) ⇒ ConstantOffsetDataTimezoneInfo
Initializes a new TZInfo::DataSources::ConstantOffsetDataTimezoneInfo.
The passed in identifier
instance will be frozen. A reference to the
passed in TimezoneOffset will be retained.
19 20 21 22 23 |
# File 'lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb', line 19 def initialize(identifier, constant_offset) super(identifier) raise ArgumentError, 'constant_offset must be specified' unless constant_offset @constant_offset = constant_offset end |
Instance Attribute Details
#constant_offset ⇒ TimezoneOffset (readonly)
Returns the offset that is constantly observed.
9 10 11 |
# File 'lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb', line 9 def constant_offset @constant_offset end |
Instance Method Details
#period_for(timestamp) ⇒ TimezonePeriod
Returns an unbounded TimezonePeriod for the time zone's constantly observed offset.
28 29 30 |
# File 'lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb', line 28 def period_for() constant_period end |
#periods_for_local(local_timestamp) ⇒ Array<TimezonePeriod>
Returns an Array
containing a single unbounded
TimezonePeriod for the time zone's constantly observed offset.
35 36 37 |
# File 'lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb', line 35 def periods_for_local() [constant_period] end |
#transitions_up_to(to_timestamp, from_timestamp = nil) ⇒ Array
Returns an empty Array
, since there are no transitions in time
zones that observe a constant offset.
43 44 45 |
# File 'lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb', line 43 def transitions_up_to(, = nil) [] end |