Class: Stretto::Tokens::HarmonicChordToken

Inherits:
HashToken
  • Object
show all
Defined in:
lib/stretto/grammar/tokens/harmonic_chord_token.rb

Overview

Token result from parsing a duration

Examples:

“C+D+E”

Instance Method Summary collapse

Methods inherited from HashToken

#[]

Instance Method Details

#notesArray<MusicElement>

Returns The notes that form this chord.

Returns:

  • (Array<MusicElement>)

    The notes that form this chord



18
19
20
21
# File 'lib/stretto/grammar/tokens/harmonic_chord_token.rb', line 18

def notes
  [_first_element.to_stretto(@pattern)] +
      _other_elements.elements.map{|element| element._element.to_stretto(@pattern)}
end

#to_stretto(pattern = nil) ⇒ MusicElements::HarmonicChord

Returns The constructed HarmonicChord element.

Returns:



12
13
14
15
# File 'lib/stretto/grammar/tokens/harmonic_chord_token.rb', line 12

def to_stretto(pattern = nil)
  @pattern = pattern
  Stretto::MusicElements::HarmonicChord.new(self, pattern)
end