mirror of
https://github.com/mistergibson/gxg-web-client.git
synced 2026-08-15 03:26:00 -07:00
23 lines
427 B
Ruby
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
|