Method: UnitMeasurements::Conversion#to_i

Defined in:
lib/unit_measurements/conversion.rb

#to_iMeasurement

Converts quantity of the measurement to Integer.

Examples:

UnitMeasurements::Length.new(2.25567, "km").to_i
=> 2 km

Returns:

  • (Measurement)

    A new Measurement instance with the quantity converted to an Integer.

Author:

Since:

  • 1.7.0



28
29
30
# File 'lib/unit_measurements/conversion.rb', line 28

def to_i
  self.class.new(quantity.to_i, unit)
end