Class: TZInfo::DataSources::DataTimezoneInfo Abstract
- Inherits:
-
TimezoneInfo
- Object
- TimezoneInfo
- TZInfo::DataSources::DataTimezoneInfo
- Defined in:
- lib/tzinfo/data_sources/data_timezone_info.rb
Overview
Data sources return instances of DataTimezoneInfo subclasses.
The base class for time zones defined as either a series of transitions (TransitionsDataTimezoneInfo) or a constantly observed offset (ConstantOffsetDataTimezoneInfo).
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from TimezoneInfo
Instance Method Summary collapse
-
#create_timezone ⇒ DataTimezone
A new TZInfo::DataTimezone instance for the time zone represented by this DataTimezoneInfo.
-
#period_for(timestamp) ⇒ TimezonePeriod
The TimezonePeriod observed at the time specified by
timestamp
. -
#periods_for_local(local_timestamp) ⇒ Array<TimezonePeriod>
Returns an
Array
containing the TimezonePeriods that could be observed at the local time specified bylocal_timestamp
. -
#transitions_up_to(to_timestamp, from_timestamp = nil) ⇒ Array<TimezoneTransition>
Returns an
Array
of TimezoneTransition instances representing the times where the UTC offset of the time zone changes.
Methods inherited from TimezoneInfo
Constructor Details
This class inherits a constructor from TZInfo::DataSources::TimezoneInfo
Instance Method Details
#create_timezone ⇒ DataTimezone
Returns a new TZInfo::DataTimezone instance for the time zone represented by this TZInfo::DataSources::DataTimezoneInfo.
76 77 78 |
# File 'lib/tzinfo/data_sources/data_timezone_info.rb', line 76 def create_timezone DataTimezone.new(self) end |
#period_for(timestamp) ⇒ TimezonePeriod
Returns the TimezonePeriod observed at the time
specified by timestamp
.
18 19 20 |
# File 'lib/tzinfo/data_sources/data_timezone_info.rb', line 18 def period_for() raise_not_implemented('period_for') end |
#periods_for_local(local_timestamp) ⇒ Array<TimezonePeriod>
Returns an Array
containing the TimezonePeriods that
could be observed at the local time specified by local_timestamp
. The
results are are ordered by increasing UTC start date. An empty Array
is returned if no periods are found for the given local time.
34 35 36 |
# File 'lib/tzinfo/data_sources/data_timezone_info.rb', line 34 def periods_for_local() raise_not_implemented('periods_for_local') end |
#transitions_up_to(to_timestamp, from_timestamp = nil) ⇒ Array<TimezoneTransition>
Returns an Array
of TimezoneTransition instances representing the
times where the UTC offset of the time zone changes.
Transitions are returned up to a given Timestamp (to_timestamp
).
A from Timestamp may also be supplied using the from_timestamp
parameter. If from_timestamp
is specified, only transitions from that
time onwards will be returned.
Comparisons with to_timestamp
are exclusive. Comparisons with
from_timestamp
are inclusive. If a transition falls precisely on
to_timestamp
, it will be excluded. If a transition falls on
from_timestamp
, it will be included.
Transitions returned are ordered by when they occur, from earliest to latest.
70 71 72 |
# File 'lib/tzinfo/data_sources/data_timezone_info.rb', line 70 def transitions_up_to(, = nil) raise_not_implemented('transitions_up_to') end |