Module: Interruptible::ClassMethods

Defined in:
lib/interruptible.rb

Overview

class methods of Interruptible

Instance Method Summary collapse

Instance Method Details

#interruptible(signal = :interrupt, method_name) ⇒ Object

marks a method as interruptible, once one of methods marked with it is interrupted, all other methods will not execute any more



28
29
30
31
32
33
34
35
36
# File 'lib/interruptible.rb', line 28

def interruptible(signal = :interrupt, method_name)
  alias_method :"uninterruptible_#{method_name}", method_name
  define_method method_name do |*params|
    interruptible(signal) do
      __send__(:"uninterruptible_#{method_name}", *params)
    end
  end
  method_name
end