class TZInfo::DataTimezone
Represents time zones that are defined by rules that set out when transitions occur.
Public Instance Methods
Returns the canonical {Timezone} instance for this {DataTimezone}.
For a {DataTimezone}, this is always ‘self`.
@return [Timezone] ‘self`.
# File lib/tzinfo/data_timezone.rb, line 40 def canonical_zone self end
(see Timezone#period_for
)
# File lib/tzinfo/data_timezone.rb, line 9 def period_for(time) raise ArgumentError, 'time must be specified' unless time timestamp = Timestamp.for(time) raise ArgumentError, 'time must have a specified utc_offset' unless timestamp.utc_offset info.period_for(timestamp) end
(see Timezone#periods_for_local
)
# File lib/tzinfo/data_timezone.rb, line 17 def periods_for_local(local_time) raise ArgumentError, 'local_time must be specified' unless local_time info.periods_for_local(Timestamp.for(local_time, :ignore)) end
(see Timezone#transitions_up_to
)
# File lib/tzinfo/data_timezone.rb, line 23 def transitions_up_to(to, from = nil) raise ArgumentError, 'to must be specified' unless to to_timestamp = Timestamp.for(to) from_timestamp = from && Timestamp.for(from) begin info.transitions_up_to(to_timestamp, from_timestamp) rescue ArgumentError => e raise ArgumentError, e.message.gsub('_timestamp', '') end end