class TZInfo::TimezoneProxy
exception will be raised at this point.
real Timezone is loaded. If the proxy’s identifier was not valid, then an
The first time an attempt is made to access the data for the timezone, the
Timezone.get.
inherits from Timezone and can be treated like any Timezone loaded with
A proxy class representing a timezone with a given identifier. TimezoneProxy
def self._load(data)
def self._load(data) TimezoneProxy.new(data) end
def self.new(identifier)
is not checked when constructing the proxy. It will be validated on the
Construct a new TimezoneProxy for the given identifier. The identifier
def self.new(identifier) # Need to override new to undo the behaviour introduced in Timezone#new. tzp = super() tzp.send(:setup, identifier) tzp end
def _dump(limit)
def _dump(limit) identifier end
def identifier
def identifier @real_timezone ? @real_timezone.identifier : @identifier end
def period_for_utc(utc)
a DateTime, Time or integer timestamp (Time.to_i). Any timezone
Returns the TimezonePeriod for the given UTC time. utc can either be
def period_for_utc(utc) real_timezone.period_for_utc(utc) end
def periods_for_local(local)
period_for_local instead and specify how abiguities should be resolved.
local time as an array. If you just want a single period, use
Returns the set of TimezonePeriod instances that are valid for the given
def periods_for_local(local) real_timezone.periods_for_local(local) end
def real_timezone
def real_timezone @real_timezone ||= Timezone.get(@identifier) end
def setup(identifier)
def setup(identifier) @identifier = identifier @real_timezone = nil end