Module: Musa::Neumalang::Neumalang::Parser::ProcessOfVectors Private

Defined in:
lib/musa-dsl/neumalang/neumalang.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Semantic action for process notation (rhythmic process).

Transforms process notation "<< 1 _ _ 2 _ >>" into P structure. P represents rhythmic/temporal processes with values and rests.

Instance Method Summary collapse

Instance Method Details

#valueHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds process structure.

Interleaves durations and rests: [first, duration1, rest1, duration2, rest2, ...]

Returns:

  • (Hash)

    p with kind :p



575
576
577
578
579
580
581
582
583
584
585
586
587
588
# File 'lib/musa-dsl/neumalang/neumalang.rb', line 575

def value
  durations_rest = []
  i = 0

  rests = captures(:rest).collect(&:value)
  captures(:durations).collect(&:value).each do |duration|
    durations_rest[i * 2] = duration
    durations_rest[i * 2 + 1] = rests[i]
    i += 1
  end

  p = ([ capture(:first).value ] + durations_rest).extend(Musa::Datasets::P)
  { kind: :p, p: p }.extend(Musa::Neumas::Neuma)
end