Module: Babl::Operators::Array::DSL

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

Instance Method Summary collapse

Instance Method Details

#array(*templates) ⇒ Object

Produce an fixed-size array, using the provided templates to populate its elements.



9
10
11
12
13
14
15
16
17
# File 'lib/babl/operators/array.rb', line 9

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

    construct_terminal { |ctx|
        Nodes::FixedArray.new(templates.map { |t|
            t.builder.precompile(Nodes::TerminalValue.instance, ctx)
        })
    }
end