Class: Weight

Inherits:
Measurement::Base show all
Defined in:
lib/measurement/weight.rb

Overview

This class represents a Weight measurement. The base units are grams. The available conversions are:

  • grams (g)

  • kilograms (kg)

  • pounds (lbs)

  • ounces (oz)

  • stone (st)

Example usage:

require 'measurement/weight'
puts Length.parse('100kg').in_lbs_and_oz => 220lbs 7oz

Method Summary

Methods inherited from Measurement::Base

#<=>, add_unit, #as, base, fetch_group, fetch_scale, find_scale, format, from, #initialize, #method_missing, parse, register_measurement, to, #to_f, #to_i, #to_s, unit, units

Constructor Details

This class inherits a constructor from Measurement::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Measurement::Base