Class: Snails::TimeZone::TimeZoneData

Inherits:
Object
  • Object
show all
Defined in:
runtime/snails/time_zone.rb,
runtime/snails/time_zone.rbs

Overview

Not ENV swapped for the block: that is process-wide, and a concurrent request would render in this one's zone.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, transitions, offsets, initial_offset, rule) ⇒ TimeZoneData

Returns a new instance of TimeZoneData.

Parameters:



10
# File 'runtime/snails/time_zone.rbs', line 10

def initialize: (String name, Array[Integer] transitions, Array[Integer] offsets, Integer initial_offset, Array[Integer] rule) -> void

Instance Attribute Details

#name ⇒ String (readonly)

Returns:



9
# File 'runtime/snails/time_zone.rbs', line 9

def name: () -> String

Instance Method Details

#offset_at(epoch) ⇒ Integer

the UTC offset in seconds that applies at that instant. Transitions decide up to the last one; past it the zone file's POSIX DST rule takes over, and a zone with no transitions keeps its initial offset.

Parameters:

  • epoch (Integer) —

    the instant, as a Unix timestamp

Returns:

  • (Integer) —

    the offset in seconds



242
# File 'runtime/snails/time_zone.rb', line 242

def offset_at: (Integer epoch) -> Integer

#rule_or(epoch, fallback) ⇒ Object

Resolve the offset past the last transition: a slim TZif file leaves DST to its POSIX footer: [std, dst, m, w, d, secs, m, w, d, secs]. A footer the parser cannot read — a Jn / n form, or none at all — leaves the rule empty, and fallback stands.



264
# File 'runtime/snails/time_zone.rb', line 264

def rule_or: (Integer epoch, Integer fallback) -> Integer