Class: Meteorology::Temperature
- Inherits:
-
Object
- Object
- Meteorology::Temperature
- Defined in:
- lib/meteorology/temperature.rb
Instance Method Summary collapse
-
#initialize(system, degrees) ⇒ Temperature
constructor
A new instance of Temperature.
- #to_s ⇒ Object
Constructor Details
#initialize(system, degrees) ⇒ Temperature
Returns a new instance of Temperature.
3 4 5 6 7 8 |
# File 'lib/meteorology/temperature.rb', line 3 def initialize(system, degrees) raise ArgumentError.new("Need :farenheit or :celcius") unless [:farenheit, :celcius].include? system @degrees = degrees @system = system end |
Instance Method Details
#to_s ⇒ Object
10 11 12 |
# File 'lib/meteorology/temperature.rb', line 10 def to_s "#{@degrees} #{@system.to_s[0,1].upcase}" end |