Class: Lydown::Parsing::Chord

Inherits:
Root
  • Object
show all
Defined in:
lib/lydown/parsing/nodes.rb

Instance Method Summary collapse

Methods inherited from Root

#initialize

Methods included from RootMethods

#_to_stream, #add_event, #each_child, #event_hash

Constructor Details

This class inherits a constructor from Lydown::Parsing::Root

Instance Method Details

#to_stream(stream, opts) ⇒ Object



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/lydown/parsing/nodes.rb', line 192

def to_stream(stream, opts)
  chord = event_hash(stream, opts, {
    type: :chord, notes: []
  })
  each_child do |c|
    if c.is_a?(Note)
      c.to_stream(chord[:notes], opts)
    elsif c.is_a?(Note::Expression)
      c.to_stream(chord, opts)
    end
  end
       
  # _to_stream(self, chord[:notes], opts)
  stream << chord
end