Class: Yweather::Atmosphere

Inherits:
Object
  • Object
show all
Defined in:
lib/yweather/atmosphere.rb

Defined Under Namespace

Classes: Barometer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Atmosphere

Returns a new instance of Atmosphere.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/yweather/atmosphere.rb', line 18

def initialize(data)
  @humidity = data[:humidity].to_i
  @visibility = data[:visibility].to_i
  @pressure = data[:pressure].to_f
  @barometer = nil
  case data[:rising].to_i
  when 0
    @barometer = Barometer::STEADY
  when 1
    @barometer = Barometer::RISING
  when 2
    @barometer = Barometer::FALLING
  end
end

Instance Attribute Details

#barometerObject (readonly)

Returns the value of attribute barometer.



16
17
18
# File 'lib/yweather/atmosphere.rb', line 16

def barometer
  @barometer
end

#humidityObject (readonly)

Returns the value of attribute humidity.



13
14
15
# File 'lib/yweather/atmosphere.rb', line 13

def humidity
  @humidity
end

#pressureObject (readonly)

Returns the value of attribute pressure.



15
16
17
# File 'lib/yweather/atmosphere.rb', line 15

def pressure
  @pressure
end

#visibilityObject (readonly)

Returns the value of attribute visibility.



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

def visibility
  @visibility
end