Class: NodeVisitor::PrismAdapter
- Inherits:
-
Object
- Object
- NodeVisitor::PrismAdapter
- Defined in:
- lib/node_visitor/adapter/prism.rb
Instance Method Summary collapse
Instance Method Details
#get_children(node) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/node_visitor/adapter/prism.rb', line 15 def get_children(node) keys = [] children = [] node.deconstruct_keys([]).each do |key, value| next if [:flags, :location].include?(key) if key.to_s.end_with?('_loc') new_key = key.to_s[0..-5] unless keys.include?(new_key) keys << new_key children << node.send(new_key) end else unless keys.include?(key.to_s) keys << key.to_s children << value end end end children end |
#get_node_type(node) ⇒ Object
11 12 13 |
# File 'lib/node_visitor/adapter/prism.rb', line 11 def get_node_type(node) node.type end |
#is_node?(node) ⇒ Boolean
7 8 9 |
# File 'lib/node_visitor/adapter/prism.rb', line 7 def is_node?(node) node.is_a?(Prism::Node) end |