Exception: Polyphony::Interjection

Inherits:
BaseException show all
Defined in:
lib/polyphony/core/exceptions.rb

Overview

Interjection is used to run arbitrary code on arbitrary fibers at any point

Instance Attribute Summary

Attributes inherited from BaseException

#value

Attributes inherited from Exception

#raising_fiber, #source_fiber

Instance Method Summary collapse

Methods inherited from Exception

#backtrace, instantiate

Constructor Details

#initialize(proc) ⇒ Interjection

Initializes an Interjection with the given proc.

Parameters:

  • proc (Proc)

    interjection proc



43
44
45
# File 'lib/polyphony/core/exceptions.rb', line 43

def initialize(proc)
  @proc = proc
end

Instance Method Details

#invokeObject

Invokes the exception by calling the associated proc.



48
49
50
# File 'lib/polyphony/core/exceptions.rb', line 48

def invoke
  @proc.call
end