Class: HeadMusic::Instrument::StaffScheme

Inherits:
Object
  • Object
show all
Defined in:
lib/head_music/instrument/staff_scheme.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pitch_variant:, key:, list:) ⇒ StaffScheme

Returns a new instance of StaffScheme.



4
5
6
7
8
# File 'lib/head_music/instrument/staff_scheme.rb', line 4

def initialize(pitch_variant:, key:, list:)
  @pitch_variant = pitch_variant
  @key = key || "default"
  @list = list
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



2
3
4
# File 'lib/head_music/instrument/staff_scheme.rb', line 2

def key
  @key
end

#listObject (readonly)

Returns the value of attribute list.



2
3
4
# File 'lib/head_music/instrument/staff_scheme.rb', line 2

def list
  @list
end

#pitch_variantObject (readonly)

Returns the value of attribute pitch_variant.



2
3
4
# File 'lib/head_music/instrument/staff_scheme.rb', line 2

def pitch_variant
  @pitch_variant
end

Instance Method Details

#default?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/head_music/instrument/staff_scheme.rb', line 10

def default?
  key.to_s == "default"
end

#stavesObject



14
15
16
17
18
# File 'lib/head_music/instrument/staff_scheme.rb', line 14

def staves
  @staves ||= list.map do |attributes|
    HeadMusic::Instrument::Staff.new(self, attributes)
  end
end