Class: TZInfo::Format1::TimezoneDefiner

Inherits:
TZInfo::Format2::TimezoneDefiner show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/format1/timezone_definer.rb

Overview

Instances of TimezoneDefiner are yielded to TZInfo::Data format 1 modules by TimezoneDefinition to allow the offsets and transitions of the time zone to be specified.

Instance Attribute Summary

Attributes inherited from TZInfo::Format2::TimezoneDefiner

#transitions

Instance Method Summary collapse

Methods inherited from TZInfo::Format2::TimezoneDefiner

#first_offset, #initialize, #subsequent_rules

Constructor Details

This class inherits a constructor from TZInfo::Format2::TimezoneDefiner

Instance Method Details

#offset(id, utc_offset, std_offset, abbreviation) ⇒ Object

Defines an offset.

Parameters:

  • id (Symbol)

    an arbitrary value used identify the offset in subsequent calls to transition. It must be unique.

  • utc_offset (Integer)

    the base offset from UTC of the zone in seconds. This does not include daylight savings time.

  • std_offset (Integer)

    the daylight savings offset from the base offset in seconds. Typically either 0 or 3600.

  • abbreviation (Symbol)

    an abbreviation for the offset, for example, ‘:EST` or `:EDT`.

Raises:

  • (ArgumentError)

    if another offset has already been defined with the given id.



26
27
28
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/format1/timezone_definer.rb', line 26

def offset(id, utc_offset, std_offset, abbreviation)
  super(id, utc_offset, std_offset, abbreviation.to_s)
end

#transition(year, month, offset_id, timestamp_value, datetime_numerator = nil, datetime_denominator = nil) ⇒ Object

Defines a transition to a given offset.

Transitions must be defined in increasing time order.

Parameters:

  • year (Integer)

    the UTC year in which the transition occurs. Used in earlier versions of TZInfo, but now ignored.

  • month (Integer)

    the UTC month in which the transition occurs. Used in earlier versions of TZInfo, but now ignored.

  • offset_id (Symbol)

    references the id of a previously defined offset (see #offset).

  • timestamp_value (Integer)

    the time the transition occurs as an Integer number of seconds since 1970-01-01 00:00:00 UTC ignoring leap seconds (i.e. each day is treated as if it were 86,400 seconds long).

  • datetime_numerator (Integer) (defaults to: nil)

    the time of the transition as the numerator of the ‘Rational` returned by `DateTime#ajd`. Used in earlier versions of TZInfo, but now ignored.

  • datetime_denominator (Integer) (defaults to: nil)

    the time of the transition as the denominator of the ‘Rational` returned by `DateTime#ajd`. Used in earlier versions of TZInfo, but now ignored.

Raises:

  • (ArgumentError)

    if ‘offset_id` does not reference a defined offset.

  • (ArgumentError)

    if ‘timestamp_value` is not greater than the `timestamp_value` of the previously defined transition.

  • (ArgumentError)

    if ‘datetime_numerator` is specified, but `datetime_denominator` is not. In older versions of TZInfo, it was possible to define a transition with the `DateTime` numerator as the 4th parameter and the denominator as the 5th parameter. This style of definition is not used in released versions of TZInfo::Data.



58
59
60
61
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/tzinfo-2.0.5/lib/tzinfo/format1/timezone_definer.rb', line 58

def transition(year, month, offset_id, timestamp_value, datetime_numerator = nil, datetime_denominator = nil)
  raise ArgumentError, 'DateTime-only transitions are not supported' if datetime_numerator && !datetime_denominator
  super(offset_id, timestamp_value)
end