class ConvertUnit::HighPressure
Constants
- CONVERSION_RATE
- UNITS
- UNITS_SYMBOL
Attributes
unit[RW]
value[RW]
Public Class Methods
new(value, unit)
click to toggle source
Calls superclass method
Base::new
# File lib/convert_unit/high_pressure.rb, line 13 def initialize(value, unit) unit_symbol = HighPressure::UNITS_SYMBOL[unit] || unit @conversion_rate_for_one_unit = HighPressure::CONVERSION_RATE super(value, unit_symbol, HighPressure::UNITS) end
Public Instance Methods
to(c_unit)
click to toggle source
# File lib/convert_unit/high_pressure.rb, line 19 def to(c_unit) c_unit.downcase! unit_symbol = HighPressure::UNITS_SYMBOL[c_unit] || c_unit raise ArgumentError, 'Impossible conversion type' unless HighPressure::UNITS.include?(unit_symbol) HighPressure.new(convert_to(unit_symbol), unit_symbol) end