mhuggins / ruby-measurement

Simple Ruby gem for calculating and converting measurements.
MIT License
46 stars 21 forks source link

Fix documentation for listing all unit keys #12

Closed mklemme closed 7 years ago

mklemme commented 7 years ago

The documentation method for listing the keys doesn't work. v 1.2.3

> Measurement.names
NoMethodError: undefined method `names' for Measurement:Class

Tested if the other method worked for defining a new unit (it does)

Measurement.define(:day) do |unit|
  unit.alias :days
  unit.convert_to(:week) { |value| value / 7.0 }
  unit.convert_to(:year) { |value| value / 365.0 }
end
=> #<Measurement::Unit::Builder:0x007ffd36de9938 @unit=day>
> 

Tried Measurement::Unit.names and 💥 , it worked! This pr is to update the documentation.