Fix ruby 2.0 incompatibilities

This commit is contained in:
Matthias Neeracher 2013-06-01 22:56:02 +02:00
parent b2d71c4ea6
commit 5b6d4feaa6
2 changed files with 5 additions and 2 deletions

View File

@ -20,6 +20,7 @@ PITCH = {
'A' => 9, 'A' => 9,
'B' => 11 'B' => 11
} }
PITCH.default = 0
SYLL = { SYLL = {
'single' => 0, 'single' => 0,
@ -27,6 +28,7 @@ SYLL = {
'end' => 2, 'end' => 2,
'middle' => 3 'middle' => 3
} }
SYLL.default = 0
CHORD = { CHORD = {
# #
@ -80,6 +82,7 @@ CHORD = {
'other' => VL::Unison, 'other' => VL::Unison,
'none' => 0 'none' => 0
} }
CHORD.default = 0
DEGREE = [ DEGREE = [
[VL::Unison, VL::Unison], [VL::Unison, VL::Unison],

View File

@ -124,7 +124,7 @@ def _pitch(name, pitch, accidental, prefix="")
oct = pitch/12 - 1 oct = pitch/12 - 1
stp = (pitch%12)+2 stp = (pitch%12)+2
step = STEPS[stp] step = STEPS[stp]
if step == 0x20 if step == ' '
if $LAST_KEY > 0 if $LAST_KEY > 0
step = STEPS[stp-1] step = STEPS[stp-1]
accidental = 1 accidental = 1
@ -531,7 +531,7 @@ def _melody
end end
type = ending['last'] ? "discontinue" : "stop" type = ending['last'] ? "discontinue" : "stop"
eEnding = REXML::Element.new('ending') eEnding = REXML::Element.new('ending')
eEnding.add_attributes({'type', type, 'number', num}) eEnding.add_attributes({'type' => type, 'number' => num})
if !ending['last'] && !eRepeat if !ending['last'] && !eRepeat
eRepeat = REXML::Element.new('repeat') eRepeat = REXML::Element.new('repeat')
eRepeat.add_attribute('direction', 'backward') eRepeat.add_attribute('direction', 'backward')