Class: ASTTreeViewBuilder

Inherits:
Object
  • Object
show all
Includes:
JRubyFX
Defined in:
lib/jruby_visualizer/ast_tree_view_builder.rb

Overview

Builder for the custom TreeItem from an usual JRuby AST

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tree_view) ⇒ ASTTreeViewBuilder

Returns a new instance of ASTTreeViewBuilder.



51
52
53
# File 'lib/jruby_visualizer/ast_tree_view_builder.rb', line 51

def initialize(tree_view)
  @tree_view = tree_view
end

Instance Attribute Details

#tree_viewObject

Returns the value of attribute tree_view.



49
50
51
# File 'lib/jruby_visualizer/ast_tree_view_builder.rb', line 49

def tree_view
  @tree_view
end

Instance Method Details

#build_tree_item(node) ⇒ Object



55
56
57
# File 'lib/jruby_visualizer/ast_tree_view_builder.rb', line 55

def build_tree_item(node)
  ASTTreeItem.new(node)
end

#build_view(root) ⇒ Object



59
60
61
62
# File 'lib/jruby_visualizer/ast_tree_view_builder.rb', line 59

def build_view(root)
  @tree_view.root = build_tree_item(root)
  root.child_nodes.each { |child| build_view_inner(child, @tree_view.root) }
end