Class: Rjq::AST::ScopedDefinition

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(definition, body) ⇒ ScopedDefinition

Returns a new instance of ScopedDefinition.



144
145
146
147
# File 'lib/rjq/ast.rb', line 144

def initialize(definition, body)
  @definition = definition
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



142
143
144
# File 'lib/rjq/ast.rb', line 142

def body
  @body
end

#definitionObject (readonly)

Returns the value of attribute definition.



142
143
144
# File 'lib/rjq/ast.rb', line 142

def definition
  @definition
end

Instance Method Details

#eval(input, context) ⇒ Object



149
150
151
# File 'lib/rjq/ast.rb', line 149

def eval(input, context)
  @body.eval(input, apply_definition(context))
end