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(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(variant:, key:, list:)
  @variant = 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

#variantObject (readonly)

Returns the value of attribute variant.



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

def variant
  @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