Module: Teasy

Includes:
AmbiguousTimeHandling, PeriodNotFoundHandling
Defined in:
lib/teasy.rb,
lib/teasy/version.rb,
lib/teasy/floating_time.rb,
lib/teasy/time_with_zone.rb,
lib/teasy/ambiguous_time_handling.rb,
lib/teasy/period_not_found_handling.rb

Defined Under Namespace

Modules: AmbiguousTimeHandling, PeriodNotFoundHandling Classes: FloatingTime, TimeWithZone

Constant Summary collapse

VERSION =
'0.2.5'

Constants included from PeriodNotFoundHandling

PeriodNotFoundHandling::UnknownPeriodNotFoundHandler

Constants included from AmbiguousTimeHandling

AmbiguousTimeHandling::UnknownAmbiguousTimeHandler

Class Method Summary collapse

Methods included from PeriodNotFoundHandling

included

Methods included from AmbiguousTimeHandling

included

Class Method Details

.default_zoneObject



14
15
16
# File 'lib/teasy.rb', line 14

def default_zone
  Thread.current[:teasy_default_zone] ||= 'UTC'
end

.default_zone=(zone) ⇒ Object



18
19
20
# File 'lib/teasy.rb', line 18

def default_zone=(zone)
  Thread.current[:teasy_default_zone] = zone
end

.with_zone(zone) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/teasy.rb', line 22

def with_zone(zone)
  old_zone = default_zone
  self.default_zone = zone
  yield zone
ensure
  self.default_zone = old_zone
end