Method: Glyph::SyntaxNode#inspect

Defined in:
lib/glyph/syntax_node.rb

#inspectString

Returns a textual representation of self.

Returns:

  • (String)

    a textual representation of self

Since:

  • 0.4.0

[View source]

18
19
20
21
22
23
24
25
26
# File 'lib/glyph/syntax_node.rb', line 18

def inspect
  string = ""
  descend do |e, level|
    # Remove document key to avoid endless resursion
    hash = e.to_hash.reject{|k,v| k == :document}
    string << "  "*level+"(#{e.class})"+hash.inspect+"\n"
  end
  string.chomp
end