Module: Quebert::AsyncSender::Instance

Defined in:
lib/quebert/async_sender/instance.rb

Overview

Perform jobs on instances of classes

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: InstanceJob

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/quebert/async_sender/instance.rb', line 11

def self.included(base)
  # Its not as simple as including initialize in a class, we
  # have to do some tricks to make it work so we can put the include
  # before the initialize method as opposed to after. Ah, and thanks PivotalLabs for this.
  base.send(:include, AsyncSender::Promise::DSL)
  base.send(:include, InstanceMethods)
  base.send(:extend,  ClassMethods)
  base.overwrite_initialize
  base.instance_eval do
    def method_added(name)
      return if name != :initialize
      return if @__initialize_overwritten__
      @__initialize_overwritten__ = true
      overwrite_initialize
    end
  end
end