Module: Babl::Operators::Enter::DSL

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

Instance Method Summary collapse

Instance Method Details

#_Object

Simple convenience alias



37
38
39
# File 'lib/babl/operators/enter.rb', line 37

def _
    enter
end

#_?Boolean

Simple convenience alias

Returns:

  • (Boolean)


42
43
44
# File 'lib/babl/operators/enter.rb', line 42

def _?
    enter?
end

#enterObject

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



23
24
25
26
27
28
29
# 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?Boolean

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

Returns:

  • (Boolean)


32
33
34
# File 'lib/babl/operators/enter.rb', line 32

def enter?
    construct_context(&KEY_QUESTIONIFIER).enter
end