summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2023-11-30 17:03:59 +0100
committergit <svn-admin@ruby-lang.org>2024-01-11 13:44:00 +0000
commit3b9cc22536f2a72ece034881aaf568767e8e1e86 (patch)
tree72b35f821d23aee59063c6ea5cebdb441382f9f8
parent80f1c1e2937939d95374aee7215a68cef9c7175a (diff)
[ruby/pp] Use a proper feature check to check if Data is defined
https://github.com/ruby/pp/commit/ed602b9f2b
-rw-r--r--lib/pp.rb2
-rw-r--r--test/test_pp.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/pp.rb b/lib/pp.rb
index 1708dee05e..7c4ba0e672 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -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:
diff --git a/test/test_pp.rb b/test/test_pp.rb
index f6c2f65df2..d7cca82a00 100644
--- a/test/test_pp.rb
+++ b/test/test_pp.rb
@@ -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")