123456789_123456789_123456789_123456789_123456789_

Class: TZInfo::DataSources::DataTimezoneInfo Abstract

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, TimezoneInfo
Instance Chain:
self, TimezoneInfo
Inherits: TZInfo::DataSources::TimezoneInfo
Defined in: lib/tzinfo/data_sources/data_timezone_info.rb

Overview

This class is abstract.

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).

Class Method Summary

TimezoneInfo - Inherited

.new

Initializes a new TimezoneInfo.

Instance Attribute Summary

Instance Method Summary

TimezoneInfo - Inherited

#create_timezone, #inspect,
#raise_not_implemented

Raises a NotImplementedError.

Constructor Details

This class inherits a constructor from TZInfo::DataSources::TimezoneInfo

Instance Method Details

#create_timezoneDataTimezone

Returns:

[ GitHub ]

  
# File 'lib/tzinfo/data_sources/data_timezone_info.rb', line 76

def create_timezone
  DataTimezone.new(self)
end

#period_for(timestamp) ⇒ TimezonePeriod

Parameters:

Returns:

Raises:

  • (ArgumentError)

    may be raised if timestamp is nil or does not have a specified utc_offset.

[ GitHub ]

  
# File 'lib/tzinfo/data_sources/data_timezone_info.rb', line 18

def period_for(timestamp)
  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.

Parameters:

Returns:

Raises:

  • (ArgumentError)

    may be raised if local_timestamp is nil, or has a specified utc_offset.

[ GitHub ]

  
# File 'lib/tzinfo/data_sources/data_timezone_info.rb', line 34

def periods_for_local(local_timestamp)
  raise_not_implemented('periods_for_local')
end

#raise_not_implemented(method_name) (private)

Raises a NotImplementedError to indicate that the base class is incorrectly being used directly.

raise [NotImplementedError] always.

Raises:

  • (NotImplementedError)
[ GitHub ]

  
# File 'lib/tzinfo/data_sources/data_timezone_info.rb', line 86

def raise_not_implemented(method_name)
  raise NotImplementedError, "Subclasses must override #{method_name}"
end

#transitions_up_to(to_timestamp, from_timestamp = nil) ⇒ Array<TimezoneTransition>

Returns an Array of ::TZInfo::TimezoneTransition instances representing the times where the UTC offset of the time zone changes.

Transitions are returned up to a given ::TZInfo::Timestamp (to_timestamp).

A from ::TZInfo::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.

Parameters:

Returns:

Raises:

  • (ArgumentError)

    may be raised if to_timestamp is nil or does not have a specified utc_offset.

  • (ArgumentError)

    may be raised if from_timestamp is specified but does not have a specified utc_offset.

  • (ArgumentError)

    may be raised if from_timestamp is specified but is not earlier than or at the same time as to_timestamp.

[ GitHub ]

  
# File 'lib/tzinfo/data_sources/data_timezone_info.rb', line 70

def transitions_up_to(to_timestamp, from_timestamp = nil)
  raise_not_implemented('transitions_up_to')
end