Class: NodeVisitor::SyntaxTreeAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/node_visitor/adapter/syntax_tree.rb

Instance Method Summary collapse

Instance Method Details

#get_children(node) ⇒ Object



15
16
17
18
# File 'lib/node_visitor/adapter/syntax_tree.rb', line 15

def get_children(node)
  node.deconstruct_keys([]).filter { |key, _value| ![:location, :comments].include?(key) }
      .values
end

#get_node_type(node) ⇒ Object



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

def get_node_type(node)
  node.class.name.split('::').last.to_sym
end

#is_node?(node) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/node_visitor/adapter/syntax_tree.rb', line 7

def is_node?(node)
  node.is_a?(SyntaxTree::Node)
end