Sha256: ce961397c577ecef6bbea83579660d8380df777b4b91d6ad7dc055eea4c2f28e

Contents?: true

Size: 714 Bytes

Versions: 10

Compression:

Stored size: 714 Bytes

Contents

# frozen_string_literal: true

# An instrument can be assigned to a staff.
class HeadMusic::Instrument
  include HeadMusic::NamedRudiment

  INSTRUMENTS = {
    violin: {
      name: 'violin',
      family: :string,
      default_clef: :treble,
    },
    piano: {
      name: 'piano',
      family: :string,
      default_system: %i[treble bass],
    },
  }.freeze

  def self.get(name)
    get_by_name(name)
  end

  def initialize(name)
    @name = name.to_s
  end

  def data
    @data ||= INSTRUMENTS[hash_key]
  end

  def family
    data[:family]
  end

  def default_system
    data[:default_system]
  end

  def default_clef
    data[:default_clef]
  end

  def ==(other)
    to_s == other.to_s
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
head_music-0.23.3 lib/head_music/instrument.rb
head_music-0.23.2 lib/head_music/instrument.rb
head_music-0.23.1 lib/head_music/instrument.rb
head_music-0.23.0 lib/head_music/instrument.rb
head_music-0.22.0 lib/head_music/instrument.rb
head_music-0.20.0 lib/head_music/instrument.rb
head_music-0.19.2 lib/head_music/instrument.rb
head_music-0.19.1 lib/head_music/instrument.rb
head_music-0.19.0 lib/head_music/instrument.rb
head_music-0.18.0 lib/head_music/instrument.rb