Class: Babl::Nodes::With

Inherits:
Object
  • Object
show all
Defined in:
lib/babl/nodes/with.rb

Instance Method Summary collapse

Instance Method Details

#dependenciesObject



11
12
13
14
# File 'lib/babl/nodes/with.rb', line 11

def dependencies
    # Dependencies of 'node' are explicitely ignored
    nodes.map(&:dependencies).reduce({}) { |a, b| Babl::Utils::Hash.deep_merge(a, b) }
end

#pinned_dependenciesObject



16
17
18
# File 'lib/babl/nodes/with.rb', line 16

def pinned_dependencies
    (nodes + [node]).map(&:pinned_dependencies).reduce({}) { |a, b| Babl::Utils::Hash.deep_merge(a, b) }
end

#render(ctx) ⇒ Object



20
21
22
23
24
25
# File 'lib/babl/nodes/with.rb', line 20

def render(ctx)
    values = nodes.map { |n| n.render(ctx) }
    node.render(ctx.move_forward_block(:__block__) do
        block.arity.zero? ? ctx.object.instance_exec(&block) : block.call(*values)
    end)
end

#schemaObject



7
8
9
# File 'lib/babl/nodes/with.rb', line 7

def schema
    node.schema
end