Class: Lucid::AST::Walker

Inherits:
Object show all
Defined in:
lib/lucid/ast/walker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runtime, listeners = [], context = Lucid::Context.default) ⇒ Walker

Returns a new instance of Walker.



7
8
9
# File 'lib/lucid/ast/walker.rb', line 7

def initialize(runtime, listeners = [], context = Lucid::Context.default)
  @runtime, @listeners, @context = runtime, listeners, context
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(message, *args, &block) ⇒ Object

This is being used to forward on messages from the AST to the formatters.



13
14
15
# File 'lib/lucid/ast/walker.rb', line 13

def method_missing(message, *args, &block)
  send_message(message, *args, &block)
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



4
5
6
# File 'lib/lucid/ast/walker.rb', line 4

def context
  @context
end

#runtimeObject (readonly)

Returns the value of attribute runtime.



5
6
7
# File 'lib/lucid/ast/walker.rb', line 5

def runtime
  @runtime
end

Instance Method Details

#visit_multiline_arg(multiline_arg) ⇒ Object



17
18
19
20
21
# File 'lib/lucid/ast/walker.rb', line 17

def visit_multiline_arg(multiline_arg)
  broadcast(multiline_arg) do
    multiline_arg.accept(self)
  end
end