Class: HeadMusic::Rudiment::Pitch::HelmholtzNotation
- Inherits:
-
Object
- Object
- HeadMusic::Rudiment::Pitch::HelmholtzNotation
- Defined in:
- lib/head_music/rudiment/pitch/helmholtz_notation.rb
Overview
Helmholtz pitch notation, in which the register is spelled by the case of the letter and the marks after it: C,, C, C c cā cāā.
Instance Attribute Summary collapse
-
#register ⇒ Object
readonly
Returns the value of attribute register.
-
#spelling ⇒ Object
readonly
Returns the value of attribute spelling.
Instance Method Summary collapse
-
#cased_spelling ⇒ Object
private
-
#initialize(spelling, register) ⇒ HelmholtzNotation
constructor
A new instance of HelmholtzNotation.
-
#to_s ⇒ Object
Constructor Details
#initialize(spelling, register) ⇒ HelmholtzNotation
Returns a new instance of HelmholtzNotation.
7 8 9 10 |
# File 'lib/head_music/rudiment/pitch/helmholtz_notation.rb', line 7 def initialize(spelling, register) @spelling = spelling @register = HeadMusic::Rudiment::Register.get(register) end |
Instance Attribute Details
#register ⇒ Object (readonly)
Returns the value of attribute register.
5 6 7 |
# File 'lib/head_music/rudiment/pitch/helmholtz_notation.rb', line 5 def register @register end |
#spelling ⇒ Object (readonly)
Returns the value of attribute spelling.
5 6 7 |
# File 'lib/head_music/rudiment/pitch/helmholtz_notation.rb', line 5 def spelling @spelling end |
Instance Method Details
#cased_spelling ⇒ Object (private)
18 19 20 21 22 |
# File 'lib/head_music/rudiment/pitch/helmholtz_notation.rb', line 18 def cased_spelling return spelling.to_s.downcase if register.helmholtz_case == :lower spelling.to_s end |
#to_s ⇒ Object
12 13 14 |
# File 'lib/head_music/rudiment/pitch/helmholtz_notation.rb', line 12 def to_s cased_spelling + register.helmholtz_marks end |