Class: Brevity::StretchModifierNode
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Brevity::StretchModifierNode
- Defined in:
- lib/brevity/parsing/modifiers/stretch_modifier_node.rb
Instance Method Summary collapse
Instance Method Details
#process(primitives) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/brevity/parsing/modifiers/stretch_modifier_node.rb', line 3 def process primitives if op.text_value == "*" ratio = duration.to_r else p_duration = primitives.map do |p| p.respond_to?(:duration) ? p.duration : 0 end.inject(0,:+) if p_duration == 0 require 'pry' binding.pry end ratio = duration.to_r / p_duration end primitives.map do |p| p.respond_to?(:stretch) ? p.stretch(ratio) : p end end |