[ruby/pp] Use a proper feature check to check if Data is defined

https://github.com/ruby/pp/commit/ed602b9f2b
This commit is contained in:
Benoit Daloze 2023-11-30 17:03:59 +01:00 committed by git
parent 80f1c1e293
commit 3b9cc22536
2 changed files with 2 additions and 2 deletions

View File

@ -438,7 +438,7 @@ class Data # :nodoc:
def pretty_print_cycle(q) # :nodoc:
q.text sprintf("#<data %s:...>", PP.mcall(self, Kernel, :class).name)
end
end if "3.2" <= RUBY_VERSION
end if defined?(Data.define)
class Range # :nodoc:
def pretty_print(q) # :nodoc:

View File

@ -143,7 +143,7 @@ class PPCycleTest < Test::Unit::TestCase
assert_equal("#{a.inspect}\n", PP.pp(a, ''.dup))
end
if "3.2" <= RUBY_VERSION
if defined?(Data.define)
D = Data.define(:aaa, :bbb)
def test_data
a = D.new("aaa", "bbb")