Skip to content

Commit 0101e7d

Browse files
chrisseatonLillian Zhang
authored andcommitted
Use respond_to?
1 parent 01b8d3a commit 0101e7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spec/truffle/thread/detect_recursion_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
module TruffleThreadDetectRecursionSpecFixtures
1212
def self.check_recursion_to_depth(obj, depth)
1313
# checks that obj recurses to a given depth
14-
return false unless obj.class.method_defined? :each
14+
return false unless obj.respond_to?(:each)
1515
Thread.detect_recursion(obj) do
1616
if depth > 1
1717
obj.each do |el|
@@ -28,7 +28,7 @@ def self.check_double_recursion_equality_to_depth(obj1, obj2, depth)
2828
# (because detect_recursion on two objects is only used during object comparison,
2929
# and aborts after inequality is discovered)
3030
return false unless obj1.class == obj2.class
31-
return false unless obj1.class.method_defined? :each
31+
return false unless obj1.respond_to?(:each)
3232
return false unless obj1.size == obj2.size
3333

3434
Thread.detect_recursion(obj1, obj2) do

0 commit comments

Comments
 (0)