Class: SkyConditions

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

Instance Method Summary collapse

Constructor Details

#initialize(clear_range, partly_range, cloudy_range) ⇒ SkyConditions

Returns a new instance of SkyConditions.



4
5
6
7
8
# File 'lib/skyconditions.rb', line 4

def initialize (clear_range, partly_range, cloudy_range)
  hash = { clear_range => :clear, partly_range => :partly_cloudy, cloudy_range => :cloudy}
  @condition_ranges = RangeHash.new(:none)
  @condition_ranges.merge! hash
end

Instance Method Details

#condition(roller) ⇒ Object



10
11
12
13
14
# File 'lib/skyconditions.rb', line 10

def condition(roller)
  roll = roller.roll(100)
  roll = 100 if roll == 0
  @condition_ranges[roll]
end