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)
-
- (String?) accidental
The accidental of the note, if present (one of 'bb', 'b', 'n', '#', '##').
-
- (String) key
The key of the note ('A' through 'G').
-
- (String?) octave
The octave of the note, if present.
-
- (nil) pitch
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
- (String?) accidental
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 |
- (String) key
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 |
- (String?) octave
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 |
- (nil) pitch
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 |