Module: Mulligan::Kernel

Included in:
Object
Defined in:
lib/mulligan/kernel_pure.rb,
lib/mulligan/kernel_common.rb,
ext/mulligan/mulligan.c

Instance Method Summary collapse

Instance Method Details

#failObject




14
# File 'ext/mulligan/mulligan.c', line 14

static VALUE rb_mulligan_raise(int argc, VALUE *argv, VALUE self);

#last_recoverySymbol

Returns the identifier for the last recovery invoked in this thread.

Returns:

  • (Symbol)

    The identifier of the last recovery invoked in this thread.



8
9
10
# File 'lib/mulligan/kernel_common.rb', line 8

def last_recovery
  Thread.current[:__last_recovery__]
end

#raise(*args) ⇒ Object




13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/mulligan/kernel_pure.rb', line 13

def raise(*args)
  super
rescue Exception => e
  yield e if block_given?
  super(e) unless Mulligan.supported?
  
  # only use callcc if there are restarts otherwise re-raise it
  super(e) if e.send(:recoveries).empty?
  should_raise = true
  result = callcc do |c|
    e.send(:__set_continuation__) do |*args,&block|
      should_raise = false
      c.call(*args,&block)
    end
  end
  super(e) if should_raise
  result
end