Class: Stretto::Tokens::DurationToken
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Stretto::Tokens::DurationToken
- Defined in:
- lib/stretto/grammar/tokens/duration_token.rb
Overview
Token result from parsing a duration
Instance Method Summary collapse
-
#dots ⇒ String
Returns a string with the number of dots in the duration.
-
#duration_character ⇒ String
The duration expressed as characters.
-
#end_of_tie? ⇒ true, false
If the duration ends a tie (e.g., “-w”).
-
#start_of_tie? ⇒ true, false
If the duration starts a tie (e.g., “w-”).
-
#tuplet ⇒ Hash?
A hash containing both the numerator and denominator, if present.
-
#value ⇒ Value?
A value wrapping the value of the duration, if present.
Instance Method Details
#dots ⇒ String
Returns a string with the number of dots in the duration
41 42 43 |
# File 'lib/stretto/grammar/tokens/duration_token.rb', line 41 def dots duration_string.dots end |
#duration_character ⇒ String
Returns The duration expressed as characters.
30 31 32 |
# File 'lib/stretto/grammar/tokens/duration_token.rb', line 30 def duration_character duration_string.duration_character end |
#end_of_tie? ⇒ true, false
Returns if the duration ends a tie (e.g., “-w”).
15 16 17 |
# File 'lib/stretto/grammar/tokens/duration_token.rb', line 15 def end_of_tie? _end_of_tie.text_value.present? if _end_of_tie end |
#start_of_tie? ⇒ true, false
Returns if the duration starts a tie (e.g., “w-”).
10 11 12 |
# File 'lib/stretto/grammar/tokens/duration_token.rb', line 10 def start_of_tie? _start_of_tie.text_value.present? if _start_of_tie end |
#tuplet ⇒ Hash?
Returns A hash containing both the numerator and denominator, if present.
21 22 23 24 25 26 |
# File 'lib/stretto/grammar/tokens/duration_token.rb', line 21 def tuplet if duration_string.tuplet {:numerator => duration_string.tuplet.numerator, :denominator => duration_string.tuplet.denominator} end end |