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.

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.

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