Class: HeadMusic::Instruments::StaffScheme

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of StaffScheme.



9
10
11
12
13
# File 'lib/head_music/instruments/staff_scheme.rb', line 9

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

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



7
8
9
# File 'lib/head_music/instruments/staff_scheme.rb', line 7

def key
  @key
end

#listObject (readonly)

Returns the value of attribute list.



7
8
9
# File 'lib/head_music/instruments/staff_scheme.rb', line 7

def list
  @list
end

#variantObject (readonly)

Returns the value of attribute variant.



7
8
9
# File 'lib/head_music/instruments/staff_scheme.rb', line 7

def variant
  @variant
end

Instance Method Details

#default?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/head_music/instruments/staff_scheme.rb', line 15

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

#stavesObject



19
20
21
22
23
# File 'lib/head_music/instruments/staff_scheme.rb', line 19

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