Class: Rjq::AST::Optional

Inherits:
Node
  • Object
show all
Defined in:
lib/rjq/ast.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#source_span

Instance Method Summary collapse

Methods inherited from Node

#assign_value, #invalid_path_message, #paths, #take, #with_source_span

Constructor Details

#initialize(node) ⇒ Optional

Returns a new instance of Optional.



616
617
618
# File 'lib/rjq/ast.rb', line 616

def initialize(node)
  @node = node
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



614
615
616
# File 'lib/rjq/ast.rb', line 614

def node
  @node
end

Instance Method Details

#eval(input, context) ⇒ Object



620
621
622
623
624
# File 'lib/rjq/ast.rb', line 620

def eval(input, context)
  @node.eval(input, context)
rescue Rjq::RuntimeError
  []
end