lib/head_music/instrument.rb in head_music-2.0.1 vs lib/head_music/instrument.rb in head_music-3.0.0

- old
+ new

@@ -12,11 +12,11 @@ # default_clefs: the default clef or system of clefs for the instrument # - [treble] for instruments that use the treble clef # - [treble, bass] for instruments that use the grand staff # notation: # a hash of default and alternative notation systems, -# each with a staffs key with an array of hashes +# each with a staff's key with an array of hashes # including clef and transposition (where applicable) # Associations: # family: the family of the instrument (e.g. "saxophone") # orchestra_section: the section of the orchestra (e.g. "strings") class HeadMusic::Instrument @@ -38,11 +38,11 @@ attr_reader( :name_key, :alias_name_keys, :family_key, :orchestra_section_key, :notation, :classification_keys, :fundamental_pitch_spelling, :transposition, - :default_staffs, :default_clefs + :default_staves, :default_clefs ) def ==(other) to_s == other.to_s end @@ -68,15 +68,15 @@ def transposing_at_the_octave? transposing? && transposition % 12 == 0 end def single_staff? - default_staffs.length == 1 + default_staves.length == 1 end - def multiple_staffs? - default_staffs.length > 1 + def multiple_staves? + default_staves.length > 1 end def pitched? return false if default_clefs.compact.uniq == ["percussion"] @@ -145,12 +145,12 @@ def initialize_attributes(record) @orchestra_section_key ||= record["orchestra_section_key"] @classification_keys = [@classification_keys, record["classification_keys"]].flatten.compact.uniq @fundamental_pitch_spelling = record["fundamental_pitch_spelling"] - @default_staffs = (record.dig("notation", "default", "staffs") || []) - @default_clefs = @default_staffs.map { |staff| staff["clef"] } - @transposition = @default_staffs&.first&.[]("transposition") || 0 + @default_staves = (record.dig("notation", "default", "staves") || []) + @default_clefs = @default_staves.map { |staff| staff["clef"] } + @transposition = @default_staves&.first&.[]("transposition") || 0 end def inferred_name name_key.to_s.tr("_", " ") end