Method: Unity::Conversion#convert_to
- Defined in:
- lib/unity/conversion.rb
#convert_to(other) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/unity/conversion.rb', line 20 def convert_to other other = other.clone.tap{|o| o.value = 1.0 } #this is so that only the unit is used for the conversion new_value = self.converted_value(other) return nil if new_value.nil? self.class.new :value => new_value, :numerator => other.numerator, :denominator => other.denominator end |