Class: Parser::AST::Node
- Inherits:
-
Object
- Object
- Parser::AST::Node
- Defined in:
- lib/macros.rb
Instance Method Summary collapse
Instance Method Details
#inspect(indent = 0) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/macros.rb', line 23 def inspect(indent=0) indented = " " * indent sexp = "#{indented}s(:#{@type}" first_node_child = children.index do |child| child.is_a?(AST::Node) || child.is_a?(Array) end || children.count children.each_with_index do |child, idx| if child.is_a?(AST::Node) && idx >= first_node_child sexp << ",\n#{child.inspect(indent + 1)}" else sexp << ", #{child.inspect}" end end sexp << ")" sexp end |