module Babl::Operators::Enter::DSL

Public Instance Methods

_() click to toggle source

Simple convenience alias

# File lib/babl/operators/enter.rb, line 37
def _
    enter
end
_?() click to toggle source

Simple convenience alias

# File lib/babl/operators/enter.rb, line 42
def _?
    enter?
end
enter() click to toggle source

Navigate to a property whose name is inferred based on parent object()'s key

# File lib/babl/operators/enter.rb, line 23
def enter
    construct_node { |node, context|
        raise Errors::InvalidTemplate, 'No key to enter into' unless context.key?(:key)

        Nodes::Nav.new(context[:key], node)
    }.reset_key.reset_continue
end
enter?() click to toggle source

Navigate to a property whose name is inferred based on parent object()'s key + '?'

# File lib/babl/operators/enter.rb, line 32
def enter?
    construct_context(&KEY_QUESTIONIFIER).enter
end

Protected Instance Methods

reset_key() click to toggle source

Clear contextual information about current property name for the rest of the chain

# File lib/babl/operators/enter.rb, line 49
def reset_key
    construct_context { |context|
        next context unless context.key?(:key)

        context.reject { |k, _v| :key == k }
    }
end