Class: Barometer::Data::Zone

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/barometer/data/zone.rb

Instance Method Summary collapse

Constructor Details

#initialize(zone) ⇒ Zone

Returns a new instance of Zone.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/barometer/data/zone.rb', line 7

def initialize(zone)
  zone = if ZoneFull.detect?(zone)
    ZoneFull.new(zone)
  elsif ZoneOffset.detect?(zone)
    ZoneOffset.new(zone)
  elsif ZoneCode.detect?(zone)
    ZoneCode.new(zone)
  else
    raise(ArgumentError, "invalid time zone")
  end
  super(zone)
end