Class: Object

Inherits:
BasicObject
Defined in:
lib/continuable/core_ext/object.rb

Instance Method Summary collapse

Instance Method Details

#__raise__Object



3
# File 'lib/continuable/core_ext/object.rb', line 3

alias :__raise__ :raise

#raise(*args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/continuable/core_ext/object.rb', line 4

def raise(*args)
callcc do |continuation|
	begin
		super
	rescue Exception => ex
		ex.continuation = continuation if ex.respond_to?(:continue)
    	super ex
    end
  end
end

#raise_continuable(*args) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/continuable/core_ext/object.rb', line 15

def raise_continuable(*args)
	begin
		__raise__ *args
	rescue Exception => ex
		(class << ex; self; end).send(:include,Continuable)
		raise ex
	end
end