lib/head_music/octave.rb in head_music-0.16.2 vs lib/head_music/octave.rb in head_music-0.17.0
- old
+ new
@@ -1,12 +1,10 @@
class HeadMusic::Octave
include Comparable
DEFAULT = 4
- MATCHER = /(-?\d+)$/
-
def self.get(identifier)
from_number(identifier) || from_name(identifier) || default
end
def self.from_number(identifier)
@@ -16,10 +14,10 @@
@octaves[identifier.to_i] ||= new(identifier.to_i)
end
def self.from_name(string)
if string.to_s.match(HeadMusic::Spelling::MATCHER)
- _letter, _accidental, octave_string = string.to_s.match(HeadMusic::Spelling::MATCHER).captures
+ _letter, _sign, octave_string = string.to_s.match(HeadMusic::Spelling::MATCHER).captures
@octaves ||= {}
@octaves[octave_string.to_i] ||= new(octave_string.to_i) if octave_string
end
end