lib/music-transcription/accent.rb in music-transcription-0.4.3 vs lib/music-transcription/accent.rb in music-transcription-0.5.2
- old
+ new
@@ -12,37 +12,24 @@
def clone
self.class.new
end
- class Stacatto < Accent
- def to_s
- return "."
+ { :Staccato => ".",
+ :Staccatissimo => "'",
+ :Marcato => ">",
+ :Martellato => "^",
+ :Tenuto => "_",
+ :Forte => "f",
+ :Fortissimo => "ff",
+ :Fortississimo => "fff"
+ }.each do |name,print_str|
+ klass = Class.new(Accent) do
+ def to_s
+ print_str
+ end
end
- end
-
- class Stacattissimo < Accent
- def to_s
- return "'"
- end
- end
-
- class Marcato < Accent
- def to_s
- return ">"
- end
- end
-
- class Martellato < Accent
- def to_s
- return "^"
- end
- end
-
- class Tenuto < Accent
- def to_s
- return "_"
- end
+ Accent.const_set(name.to_sym, klass)
end
end
end
end