Class: TemperatureRange

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

Instance Method Summary collapse

Constructor Details

#initialize(base, high_adj, low_adj) ⇒ TemperatureRange

Returns a new instance of TemperatureRange.



2
3
4
5
6
# File 'lib/temperaturerange.rb', line 2

def initialize (base, high_adj, low_adj)
  @base = base
  @high_adj = high_adj
  @low_adj = low_adj
end

Instance Method Details

#range(roller, record = nil) ⇒ Object



8
9
10
11
# File 'lib/temperaturerange.rb', line 8

def range (roller, record=nil)
  base = calculate_todays_base(record)
  (base - roller.roll(@low_adj[0], @low_adj[1])..base+ roller.roll(@high_adj[0], @high_adj[1]))
end