Module: Musa::Datasets::Score::Render

Included in:
Musa::Datasets::Score
Defined in:
lib/musa-dsl/datasets/score/render.rb

Instance Method Summary collapse

Instance Method Details

#render(on:, &block) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/musa-dsl/datasets/score/render.rb', line 8

def render(on:, &block)
  @score.keys.each do |score_at|
    effective_wait = score_at - 1r

    @score[score_at].each do |element|
      case element
      when Score
        on.wait effective_wait do
          element.render(on: on, &block)
        end

      when Abs
        on.wait effective_wait do
          block.call(element)
        end

      else
        raise ArgumentError, "Can't sequence #{element} because it's not an Abs dataset"
      end
    end
  end

  nil
end