Class: SingleDayWeather
- Inherits:
-
Object
- Object
- SingleDayWeather
- Defined in:
- lib/singledayweather.rb
Instance Attribute Summary collapse
-
#precipitation ⇒ Object
readonly
Returns the value of attribute precipitation.
-
#sky_conditions ⇒ Object
readonly
Returns the value of attribute sky_conditions.
-
#temperature_range ⇒ Object
readonly
Returns the value of attribute temperature_range.
-
#wind ⇒ Object
readonly
Returns the value of attribute wind.
Instance Method Summary collapse
-
#initialize(month, dieroller, precipitation_occurance_chart = PrecipitationOccurance.new({ 0..100 => NullPrecipitationInfo.new() }), record_temp = nil, terrain = :plains, latitude = 40) ⇒ SingleDayWeather
constructor
A new instance of SingleDayWeather.
- #inspect ⇒ Object
Constructor Details
#initialize(month, dieroller, precipitation_occurance_chart = PrecipitationOccurance.new({ 0..100 => NullPrecipitationInfo.new() }), record_temp = nil, terrain = :plains, latitude = 40) ⇒ SingleDayWeather
Returns a new instance of SingleDayWeather.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/singledayweather.rb', line 13 def initialize (month, dieroller, precipitation_occurance_chart=PrecipitationOccurance.new({ 0..100 => NullPrecipitationInfo.new() }), record_temp=nil, terrain = :plains, latitude = 40) @temperature_range = adjust_for_latitude(month.temp_range(dieroller, record_temp), latitude) @sky_conditions = month.sky_conditions(dieroller) @record_temp = record_temp @precipitation = precipitation_occurance_chart.type(month.has_precipitation(dieroller) ? dieroller : NullDieRoller.new(), @temperature_range, terrain) @wind = Wind.new(dieroller) end |
Instance Attribute Details
#precipitation ⇒ Object (readonly)
Returns the value of attribute precipitation.
10 11 12 |
# File 'lib/singledayweather.rb', line 10 def precipitation @precipitation end |
#sky_conditions ⇒ Object (readonly)
Returns the value of attribute sky_conditions.
9 10 11 |
# File 'lib/singledayweather.rb', line 9 def sky_conditions @sky_conditions end |
#temperature_range ⇒ Object (readonly)
Returns the value of attribute temperature_range.
8 9 10 |
# File 'lib/singledayweather.rb', line 8 def temperature_range @temperature_range end |
#wind ⇒ Object (readonly)
Returns the value of attribute wind.
11 12 13 |
# File 'lib/singledayweather.rb', line 11 def wind @wind end |
Instance Method Details
#inspect ⇒ Object
27 28 29 |
# File 'lib/singledayweather.rb', line 27 def inspect "#{@record_temp} #{@temperature_range} #{@sky_conditions} #{@precipitation} #{@wind}" end |