Module: Babl::Operators::Concat::DSL

Included in:
Template
Defined in:
lib/babl/operators/concat.rb

Instance Method Summary collapse

Instance Method Details

#concat(*templates) ⇒ Object

Produce an array by concatening the provided result of the given templates. (they therefor have to produce arrays, or nil, which is interpreted as an empty array)



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/babl/operators/concat.rb', line 10

def concat(*templates)
    templates = templates.map { |t| unscoped.call(t) }

    construct_terminal { |context|
        Nodes::Concat.new(
            templates.map { |t|
                t.builder.precompile(
                    Nodes::TerminalValue.instance,
                    context.merge(continue: nil)
                )
            }
        )
    }
end