Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/mext/numeric/meter.rb
Overview
we extend the String class to carry a to_meter which will convert a string into a meter
Instance Method Summary collapse
Instance Method Details
#to_meter ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/mext/numeric/meter.rb', line 38 def to_meter div = num = 1.0 (nums, divs) = self.split(/\s*\/\s*/, 2) num = nums.to_f div = divs.to_f Meter(num, div) end |