Class: Snails::TimeZone::TimeZoneData
- 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
- #name ⇒ String readonly
Instance Method Summary collapse
-
#initialize(name, transitions, offsets, initial_offset, rule) ⇒ TimeZoneData
constructor
A new instance of TimeZoneData.
-
#offset_at(epoch) ⇒ Integer
the UTC offset in seconds that applies at that instant.
-
#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].
Constructor Details
#initialize(name, transitions, offsets, initial_offset, rule) ⇒ TimeZoneData
Returns a new instance of TimeZoneData.
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
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.
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
|