Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

RubyVM::AbstractSyntaxTree::Node#source

node.source → string

Returns the code fragment that corresponds to this AST.

Note that this is an API for ruby internal use, debugging, and research. Do not use this for any other purpose. The compatibility is not guaranteed.

Also note that this API may return an incomplete code fragment that does not parse; for example, a here document following an expression may be dropped.