module RSpec::Files::Leaks

Public Instance Methods

current_ios(gc: true) click to toggle source
# File lib/rspec/files/leaks.rb, line 24
def current_ios(gc: true)
        GC.start if gc
        
        all_ios = ObjectSpace.each_object(::IO).to_a.sort_by(&:object_id)
        
        # We are not interested in ios that have been closed already:
        return all_ios.reject(&:closed?)
rescue RuntimeError => error
        # This occurs on JRuby.
        warn error.message
        
        return []
end