class TZInfo::DataSources::ConstantOffsetDataTimezoneInfo
Represents a data time zone defined by a constantly observed offset.
Attributes
@return [TimezoneOffset] the offset that is constantly observed.
Public Class Methods
Initializes a new {ConstantOffsetDataTimezoneInfo}.
The passed in ‘identifier` instance will be frozen. A reference to the passed in {TimezoneOffset} will be retained.
@param identifier [String] the identifier of the time zone. @param constant_offset
[TimezoneOffset] the constantly observed offset. @raise [ArgumentError] if ‘identifier` or `constant_offset` is `nil`.
# 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
Public Instance Methods
@param timestamp [Timestamp] ignored. @return [TimezonePeriod] an unbounded {TimezonePeriod} for the time
zone's constantly observed offset.
# File lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb, line 28 def period_for(timestamp) constant_period end
@param local_timestamp [Timestamp] ignored. @return [Array<TimezonePeriod>] an ‘Array` containing a single unbounded
{TimezonePeriod} for the time zone's constantly observed offset.
# File lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb, line 35 def periods_for_local(local_timestamp) [constant_period] end
@param to_timestamp [Timestamp] ignored. @param from_timestamp [Timestamp] ignored. @return [Array] an empty ‘Array`, since there are no transitions in time
zones that observe a constant offset.
# File lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb, line 43 def transitions_up_to(to_timestamp, from_timestamp = nil) [] end