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(key:, list:, instrument: nil, variant: nil) ⇒ StaffScheme

Returns a new instance of StaffScheme.



11
12
13
14
15
# File 'lib/head_music/instruments/staff_scheme.rb', line 11

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

Instance Attribute Details

#instrumentObject (readonly) Also known as: variant

Returns the value of attribute instrument.



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

def instrument
  @instrument
end

#keyObject (readonly)

Returns the value of attribute key.



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

def key
  @key
end

#listObject (readonly)

Returns the value of attribute list.



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

def list
  @list
end

Instance Method Details

#default?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/head_music/instruments/staff_scheme.rb', line 17

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

#stavesObject



21
22
23
24
25
# File 'lib/head_music/instruments/staff_scheme.rb', line 21

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