Skip to content

Commit

Permalink
Implement Enumerator::Product#inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Dec 17, 2024
1 parent 9d380bc commit 3ea2847
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core/src/main/ruby/jruby/kernel/enumerator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,20 @@ def rewind
self
end

def inspect
JRuby::Util.safe_recurse(@__enums, self, "inspect") do |state, obj, recur|
if state.nil?
return "#<#{obj.class}: uninitialized>"
end

if recur
return "#<#{obj.class}: ...>"
end

return "#<#{obj.class}: #{state.inspect}>"
end
end

private def initialize_copy(other)
return self if self.equal?(other)

Expand Down

0 comments on commit 3ea2847

Please sign in to comment.