class Delayer::Deferred::Chain::Base

Public Class Methods

new(&proc) click to toggle source
# File lib/delayer/deferred/chain/base.rb, line 9
def initialize(&proc)
  fail Error, "Delayer::Deferred::Chain can't create instance." if self.class == Delayer::Deferred::Chain::Base
  @proc = proc
end

Public Instance Methods

activate(response) click to toggle source
# File lib/delayer/deferred/chain/base.rb, line 14
def activate(response)
  change_sequence(:activate)
  if evaluate?(response)
    @proc.(response.value)
  else
    response
  end
ensure
  change_sequence(:complete)
end
inspect() click to toggle source
# File lib/delayer/deferred/chain/base.rb, line 25
def inspect
  "#<#{self.class} seq:#{sequence.name} child:#{has_child?}>"
end
node_name() click to toggle source
# File lib/delayer/deferred/chain/base.rb, line 29
def node_name
  @proc.source_location.join(':'.freeze)
end