Class: HeadMusic::Instruments::StaffScheme
- Inherits:
-
Object
- Object
- HeadMusic::Instruments::StaffScheme
- Defined in:
- lib/head_music/instruments/staff_scheme.rb
Instance Attribute Summary collapse
-
#instrument ⇒ Object
(also: #variant)
readonly
Returns the value of attribute instrument.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#list ⇒ Object
readonly
Returns the value of attribute list.
Instance Method Summary collapse
-
#default? ⇒ Boolean
-
#initialize(key:, list:, instrument: nil, variant: nil) ⇒ StaffScheme
constructor
A new instance of StaffScheme.
-
#staves ⇒ Object
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
#instrument ⇒ Object (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 |
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/head_music/instruments/staff_scheme.rb', line 6 def key @key end |
#list ⇒ Object (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
17 18 19 |
# File 'lib/head_music/instruments/staff_scheme.rb', line 17 def default? key.to_s == "default" end |
#staves ⇒ Object
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 |