Class: BaselineData

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ BaselineData

Returns a new instance of BaselineData.



12
13
14
# File 'lib/baselinedata.rb', line 12

def initialize(data)
  @all_data = data
end

Class Method Details

.load(file) ⇒ Object



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

def self.load (file)
  BaselineData.new(YAML.load_file(file))
end

Instance Method Details

#make_skyconditions(condition_hash) ⇒ Object



25
26
27
# File 'lib/baselinedata.rb', line 25

def make_skyconditions(condition_hash)
  SkyConditions.new condition_hash[:clear], condition_hash[:partly], condition_hash[:cloudy]
end

#month(monthnum) ⇒ Object



20
21
22
23
# File 'lib/baselinedata.rb', line 20

def month(monthnum)
  month_data = @all_data[monthnum - 1]
  Month.new(month_data[:temp_range], make_skyconditions(month_data[:sky_conditions]), month_data[:precipitation_chance])
end

#num_monthsObject



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

def num_months
  @all_data.length
end