Skip to content

Commit

Permalink
Merge pull request shaper#1 from Bodacious/master
Browse files Browse the repository at this point in the history
Case Statements re-written for Ruby 1.9
  • Loading branch information
ozeias committed Jun 26, 2011
2 parents 999548c + 9a00fb5 commit b13ba75
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/yahoo-weather/atmosphere.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ class YahooWeather::Atmosphere
# Constants representing the state of the barometric pressure.
#
class Barometer
STEADY = 'steady'
RISING = 'rising'
STEADY = 'steady'
RISING = 'rising'
FALLING = 'falling'

# lists all possible barometer constants
Expand All @@ -25,16 +25,16 @@ class Barometer
attr_reader :barometer

def initialize (payload)
@humidity = payload['humidity'].to_i
@humidity = payload['humidity'].to_i
@visibility = payload['visibility'].to_i
@pressure = payload['pressure'].to_f
@pressure = payload['pressure'].to_f

# map barometric pressure direction to appropriate constant
@barometer = nil
case payload['rising'].to_i
when 0: @barometer = Barometer::STEADY
when 1: @barometer = Barometer::RISING
when 2: @barometer = Barometer::FALLING
when 0 then @barometer = Barometer::STEADY
when 1 then @barometer = Barometer::RISING
when 2 then @barometer = Barometer::FALLING
end
end
end

0 comments on commit b13ba75

Please sign in to comment.