Class: HeadMusic::Instrument::Staff
- Inherits:
-
Object
- Object
- HeadMusic::Instrument::Staff
- Defined in:
- lib/head_music/instrument/staff.rb
Constant Summary collapse
- DEFAULT_CLEF =
"treble_clef"
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#staff_scheme ⇒ Object
readonly
Returns the value of attribute staff_scheme.
Instance Method Summary collapse
- #clef ⇒ Object
-
#initialize(staff_scheme, attributes) ⇒ Staff
constructor
A new instance of Staff.
- #name ⇒ Object
- #name_key ⇒ Object
- #smart_clef_key ⇒ Object
- #sounding_transposition ⇒ Object
Constructor Details
#initialize(staff_scheme, attributes) ⇒ Staff
Returns a new instance of Staff.
6 7 8 9 |
# File 'lib/head_music/instrument/staff.rb', line 6 def initialize(staff_scheme, attributes) @staff_scheme = staff_scheme @attributes = attributes || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/head_music/instrument/staff.rb', line 4 def attributes @attributes end |
#staff_scheme ⇒ Object (readonly)
Returns the value of attribute staff_scheme.
4 5 6 |
# File 'lib/head_music/instrument/staff.rb', line 4 def staff_scheme @staff_scheme end |
Instance Method Details
#clef ⇒ Object
11 12 13 |
# File 'lib/head_music/instrument/staff.rb', line 11 def clef HeadMusic::Clef.get(smart_clef_key) end |
#name ⇒ Object
27 28 29 |
# File 'lib/head_music/instrument/staff.rb', line 27 def name name_key.to_s.tr("_", " ") end |
#name_key ⇒ Object
23 24 25 |
# File 'lib/head_music/instrument/staff.rb', line 23 def name_key attributes["name_key"] || "" end |
#smart_clef_key ⇒ Object
15 16 17 |
# File 'lib/head_music/instrument/staff.rb', line 15 def smart_clef_key "#{attributes["clef"]}_clef".gsub(/_clef_clef$/, "_clef") end |
#sounding_transposition ⇒ Object
19 20 21 |
# File 'lib/head_music/instrument/staff.rb', line 19 def sounding_transposition attributes["sounding_transposition"] || 0 end |