Class: PrecipitationInfo

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

Direct Known Subclasses

NullPrecipitationInfo

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, min_temp = nil, max_temp = nil, chance_to_continue = 0, chance_of_rainbow = 0, not_allowed_in = []) ⇒ PrecipitationInfo

Returns a new instance of PrecipitationInfo.



18
19
20
21
22
23
24
25
# File 'lib/precipitationinfo.rb', line 18

def initialize(name, min_temp=nil, max_temp=nil, chance_to_continue=0, chance_of_rainbow=0, not_allowed_in=[])
  @name = name
  @min_temp = min_temp
  @max_temp = max_temp
  @chance_to_continue = chance_to_continue || 0
  @chance_of_rainbow = chance_of_rainbow || 0
  @not_allowed_in = not_allowed_in || []
end

Instance Attribute Details

#chance_of_rainbowObject (readonly)

Returns the value of attribute chance_of_rainbow.



6
7
8
# File 'lib/precipitationinfo.rb', line 6

def chance_of_rainbow
  @chance_of_rainbow
end

#chance_to_continueObject (readonly)

Returns the value of attribute chance_to_continue.



5
6
7
# File 'lib/precipitationinfo.rb', line 5

def chance_to_continue
  @chance_to_continue
end

#max_tempObject (readonly)

Returns the value of attribute max_temp.



4
5
6
# File 'lib/precipitationinfo.rb', line 4

def max_temp
  @max_temp
end

#min_tempObject (readonly)

Returns the value of attribute min_temp.



3
4
5
# File 'lib/precipitationinfo.rb', line 3

def min_temp
  @min_temp
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/precipitationinfo.rb', line 2

def name
  @name
end

#not_allowed_inObject (readonly)

Returns the value of attribute not_allowed_in.



7
8
9
# File 'lib/precipitationinfo.rb', line 7

def not_allowed_in
  @not_allowed_in
end

Class Method Details

.create_from_data(arg_hash) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/precipitationinfo.rb', line 9

def self.create_from_data(arg_hash)
  PrecipitationInfo.new(arg_hash[:name], 
                        arg_hash[:min_temp], 
                        arg_hash[:max_temp], 
                        arg_hash[:chance_to_continue], 
                        arg_hash[:chance_of_rainbow], 
                        arg_hash[:not_allowed_in])
end