Module: Stretto::Tokens::NoteKeyAccidentalOctaveToken
- Defined in:
- lib/stretto/grammar/tokens/note_string_token.rb
Overview
Token result from parsing the part of a note that contains key, and optional accidental and octave values
Instance Method Summary collapse
-
#accidental ⇒ String?
The accidental of the note, if present (one of ‘bb’, ‘b’, ‘n’, ‘#’, ‘##’).
-
#key ⇒ String
The key of the note (‘A’ through ‘G’).
-
#octave ⇒ String?
The octave of the note, if present.
-
#pitch ⇒ nil
Always return nil, as this is used to differentiate a note with a given pitch from one with key, octave and accidental whose pitch has to be calculated.
Instance Method Details
#accidental ⇒ String?
Returns The accidental of the note, if present (one of ‘bb’, ‘b’, ‘n’, ‘#’, ‘##’).
56 57 58 |
# File 'lib/stretto/grammar/tokens/note_string_token.rb', line 56 def accidental note_key.accidental.text_value if note_key.accidental and note_key.accidental.text_value.present? end |
#key ⇒ String
Returns The key of the note (‘A’ through ‘G’).
50 51 52 |
# File 'lib/stretto/grammar/tokens/note_string_token.rb', line 50 def key note_key.key.text_value end |
#octave ⇒ String?
Returns The octave of the note, if present.
69 70 71 |
# File 'lib/stretto/grammar/tokens/note_string_token.rb', line 69 def octave _octave.text_value if _octave and _octave.text_value.present? end |
#pitch ⇒ nil
Always return nil, as this is used to differentiate a note with a given pitch from one with key, octave and accidental whose pitch has to be calculated
63 64 65 |
# File 'lib/stretto/grammar/tokens/note_string_token.rb', line 63 def pitch nil end |