gxg-web-client/gxg/core/throw_catch.rb
2021-11-16 08:58:51 -08:00

23 lines
427 B
Ruby

module Rubinius
module ThrownValue
def self.register(obj)
cur = (Thread.current[:__catches__] ||= [])
cur << obj
begin
yield
ensure
cur.pop
end
end
def self.available?(obj)
cur = Thread.current[:__catches__]
return false unless cur
cur.each do |c|
return true if Rubinius::Type.object_equal(c, obj)
end
false
end
end
end