lib/head_music/instrument.rb in head_music-0.11.9 vs lib/head_music/instrument.rb in head_music-0.13.2
- old
+ new
@@ -1,6 +1,8 @@
class HeadMusic::Instrument
+ include HeadMusic::NamedRudiment
+
INSTRUMENTS = {
violin: {
name: "violin",
family: :string,
default_clef: :treble
@@ -11,27 +13,18 @@
default_system: [:treble, :bass]
}
}
def self.get(name)
- @instruments ||= {}
- key = HeadMusic::Utilities::HashKey.for(name)
- @instruments[key] ||= new(name.to_s)
+ get_by_name(name)
end
- attr_reader :name
- delegate :to_s, to: :name
-
def initialize(name)
@name = name.to_s
end
def data
@data ||= INSTRUMENTS[hash_key]
- end
-
- def hash_key
- HeadMusic::Utilities::HashKey.for(name)
end
def family
data[:family]
end