module Babl::Operators::Pin::DSL

Public Instance Methods

goto_pin(ref) click to toggle source
# File lib/babl/operators/pin.rb, line 21
def goto_pin(ref)
    check_pin_ref(ref)
    construct_node { |node| Nodes::GotoPin.new(node, ref) }.reset_key.reset_continue
end
named_pin(ref) click to toggle source
# File lib/babl/operators/pin.rb, line 16
def named_pin(ref)
    check_pin_ref(ref)
    construct_node { |node| Nodes::CreatePin.new(node, ref) }.reset_continue
end
pin(navigation = unscoped, &block) click to toggle source

Create a pin

# File lib/babl/operators/pin.rb, line 11
def pin(navigation = unscoped, &block)
    ref = Utils::Ref.new
    named_pin(ref).call(block[unscoped.goto_pin(ref).call(navigation)])
end

Protected Instance Methods

check_pin_ref(ref) click to toggle source
# File lib/babl/operators/pin.rb, line 35
def check_pin_ref(ref)
    raise Errors::InvalidTemplate, 'Pin name must be a symbol' unless Utils::Ref === ref || ::Symbol === ref
end
validate(tree) click to toggle source
Calls superclass method
# File lib/babl/operators/pin.rb, line 28
def validate(tree)
    name = tree.pinned_dependencies.keys.first
    raise Errors::InvalidTemplate, "Unresolved pin: #{name}" if name

    super
end