Class: SyntaxTree::JSONVisitor

Inherits:
FieldVisitor show all
Defined in:
lib/syntax_tree/json_visitor.rb

Overview

This visitor transforms the AST into a hash that contains only primitives that can be easily serialized into JSON.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BasicVisitor

valid_visit_methods, #visit, #visit_all, #visit_child_nodes, visit_method, visit_methods

Constructor Details

#initializeJSONVisitor

Returns a new instance of JSONVisitor.



11
12
13
# File 'lib/syntax_tree/json_visitor.rb', line 11

def initialize
  @target = nil
end

Instance Attribute Details

#targetObject (readonly)

Returns the value of attribute target.



9
10
11
# File 'lib/syntax_tree/json_visitor.rb', line 9

def target
  @target
end