Class: ASTTreeItem

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

Overview

Custom TreeItem, to store the JRuby’s AST Node within the item

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ ASTTreeItem

Returns a new instance of ASTTreeItem.



29
30
31
32
33
# File 'lib/jruby_visualizer/ast_tree_view_builder.rb', line 29

def initialize(node)
  @node = node
  super(node_string)
  set_expanded(true)
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



27
28
29
# File 'lib/jruby_visualizer/ast_tree_view_builder.rb', line 27

def node
  @node
end

Instance Method Details

#node_stringObject



35
36
37
38
# File 'lib/jruby_visualizer/ast_tree_view_builder.rb', line 35

def node_string
  node_information = @node.respond_to?(:name) ? ":#{@node.name}" : ''
  "#{@node.node_name}#{node_information} #{@node.position.start_line}"
end