Class: HeadMusic::Instruments::Staff
- Inherits:
-
Object
- Object
- HeadMusic::Instruments::Staff
- Defined in:
- lib/head_music/instruments/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.
9 10 11 12 |
# File 'lib/head_music/instruments/staff.rb', line 9 def initialize(staff_scheme, attributes) @staff_scheme = staff_scheme @attributes = attributes || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
7 8 9 |
# File 'lib/head_music/instruments/staff.rb', line 7 def attributes @attributes end |
#staff_scheme ⇒ Object (readonly)
Returns the value of attribute staff_scheme.
7 8 9 |
# File 'lib/head_music/instruments/staff.rb', line 7 def staff_scheme @staff_scheme end |
Instance Method Details
#clef ⇒ Object
14 15 16 |
# File 'lib/head_music/instruments/staff.rb', line 14 def clef HeadMusic::Rudiment::Clef.get(smart_clef_key) end |
#name ⇒ Object
30 31 32 |
# File 'lib/head_music/instruments/staff.rb', line 30 def name name_key.to_s.tr("_", " ") end |
#name_key ⇒ Object
26 27 28 |
# File 'lib/head_music/instruments/staff.rb', line 26 def name_key attributes["name_key"] || "" end |
#smart_clef_key ⇒ Object
18 19 20 |
# File 'lib/head_music/instruments/staff.rb', line 18 def smart_clef_key "#{attributes["clef"]}_clef".gsub(/_clef_clef$/, "_clef") end |
#sounding_transposition ⇒ Object
22 23 24 |
# File 'lib/head_music/instruments/staff.rb', line 22 def sounding_transposition attributes["sounding_transposition"] || 0 end |