Use compare_by_identity hash [Bug #16250]
This commit is contained in:
parent
b7079e5384
commit
f94202fcc2
@ -70,7 +70,7 @@ module IRB # :nodoc:
|
|||||||
$stdout.tty? && supported? && (/mswin|mingw/ =~ RUBY_PLATFORM || (ENV.key?('TERM') && ENV['TERM'] != 'dumb'))
|
$stdout.tty? && supported? && (/mswin|mingw/ =~ RUBY_PLATFORM || (ENV.key?('TERM') && ENV['TERM'] != 'dumb'))
|
||||||
end
|
end
|
||||||
|
|
||||||
def inspect_colorable?(obj, seen: {})
|
def inspect_colorable?(obj, seen: {}.compare_by_identity)
|
||||||
case obj
|
case obj
|
||||||
when String, Symbol, Regexp, Integer, Float, FalseClass, TrueClass, NilClass
|
when String, Symbol, Regexp, Integer, Float, FalseClass, TrueClass, NilClass
|
||||||
true
|
true
|
||||||
@ -137,8 +137,8 @@ module IRB # :nodoc:
|
|||||||
private
|
private
|
||||||
|
|
||||||
def without_circular_ref(obj, seen:, &block)
|
def without_circular_ref(obj, seen:, &block)
|
||||||
return false if seen.key?(obj.object_id)
|
return false if seen.key?(obj)
|
||||||
seen[obj.object_id] = true
|
seen[obj] = true
|
||||||
block.call
|
block.call
|
||||||
ensure
|
ensure
|
||||||
seen.delete(obj.object_id)
|
seen.delete(obj.object_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user