1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/pp] Only do RubyVM patches if class exists

This class does not exist in any implementation except CRuby.

I would recommend moving this code somewhere else, like a separate
file loaded only on CRuby or into CRuby itself. For now this
change is sufficient to load the library on other implementations.

https://github.com/ruby/pp/commit/7d5a220f64
This commit is contained in:
Charles Oliver Nutter 2021-09-23 23:57:26 -05:00 committed by Hiroshi SHIBATA
parent de6ef2ca71
commit 5a6baaba38
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2

View file

@ -539,7 +539,8 @@ class MatchData # :nodoc:
end
end
class RubyVM::AbstractSyntaxTree::Node
if defined?(RubyVM::AbstractSyntaxTree)
class RubyVM::AbstractSyntaxTree::Node
def pretty_print_children(q, names = [])
children.zip(names) do |c, n|
if n
@ -571,6 +572,7 @@ class RubyVM::AbstractSyntaxTree::Node
end
}
end
end
end
class Object < BasicObject # :nodoc: