class TZInfo::TimezoneProxy
valid, then an exception will be raised at this point.
real {Timezone} will be loaded is loaded. If the proxy’s identifier was not
The first time an attempt is made to access the data for the time zone, the
loading time zone data into memory, for example, by {Timezone.all}.
{TimezoneProxy} instances are used to avoid the performance overhead of
{Timezone} instances loaded with {Timezone.get}.
{TimezoneProxy} inherits from {Timezone} and can be treated identically to
A proxy class standing in for a {Timezone} with a given identifier.
def self._load(data)
-
(TimezoneProxy)
- the result of converting `data` back into a
Parameters:
-
data
(String
) -- a serialized representation of a {TimezoneProxy}.
def self._load(data) TimezoneProxy.new(data) end
def _dump(limit)
-
(String)
- a serialized representation of this {TimezoneProxy}.
Parameters:
-
limit
(Integer
) -- the maximum depth to dump - ignored. @return
def _dump(limit) identifier end
def canonical_zone
def canonical_zone real_timezone.canonical_zone end
def identifier
def identifier @real_timezone ? @real_timezone.identifier : @identifier end
def initialize(identifier)
-
identifier
(String
) -- an IANA Time Zone Database time zone
def initialize(identifier) super() @identifier = identifier @real_timezone = nil end
def period_for(time)
def period_for(time) real_timezone.period_for_utc(time) end
def periods_for_local(local_time)
def periods_for_local(local_time) real_timezone.periods_for_local(local_time) end
def real_timezone
-
(Timezone)
- the real {Timezone} instance being proxied.
def real_timezone # Thread-safety: It is possible that the value of @real_timezone may be # calculated multiple times in concurrently executing threads. It is not # worth the overhead of locking to ensure that @real_timezone is only # calculated once. unless @real_timezone result = Timezone.get(@identifier) return result if frozen? @real_timezone = result end @real_timezone end
def transitions_up_to(to, from = nil)
def transitions_up_to(to, from = nil) real_timezone.transitions_up_to(to, from) end