Class: Stretto::MusicElements::Measure
- Inherits:
-
MusicElement
- Object
- MusicElement
- Stretto::MusicElements::Measure
- Defined in:
- lib/stretto/music_elements/measure.rb
Overview
Does not have effect in the playback, it represents a measure for readability of the music texts
Instance Attribute Summary
Attributes inherited from MusicElement
Attributes included from Node
Instance Method Summary collapse
-
#initialize(string_or_options, pattern = nil) ⇒ Measure
constructor
A new instance of Measure.
-
#tied_duration ⇒ Object
TODO: Make tests for other elements inside ties, move this to MusicElement.
-
#tied_elements ⇒ Object
TODO: Make tests for other elements inside ties, move this to MusicElement.
Methods inherited from MusicElement
#build_music_string, #duration, #end_of_tie?, #start_of_tie?, #substitute_variables!, #to_s
Constructor Details
#initialize(string_or_options, pattern = nil) ⇒ Measure
Returns a new instance of Measure.
10 11 12 13 14 15 16 |
# File 'lib/stretto/music_elements/measure.rb', line 10 def initialize(, pattern = nil) token = case when String then Stretto::Parser.parse_measure!() else end super(token[:text_value], pattern) end |
Instance Method Details
#tied_duration ⇒ Object
TODO: Make tests for other elements inside ties, move this to MusicElement
31 32 33 |
# File 'lib/stretto/music_elements/measure.rb', line 31 def tied_duration tied_elements.inject(0){|sum, element| sum + element.duration} end |
#tied_elements ⇒ Object
TODO: Make tests for other elements inside ties, move this to MusicElement
20 21 22 23 24 25 26 27 |
# File 'lib/stretto/music_elements/measure.rb', line 20 def tied_elements next_element = self.next if next_element next_element.tied_elements else [] end end |