Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/mext/music/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_meterObject



69
70
71
72
73
74
75
# File 'lib/mext/music/meter.rb', line 69

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