Module: Delayer::Deferred::Deferredable::Trigger

Includes:
Chainable, NodeSequence
Included in:
Promise
Defined in:
lib/delayer/deferred/deferredable/trigger.rb

Overview

Promiseなど、親を持たず、自身がWorkerを作成できるもの。

Constant Summary

Constants included from NodeSequence

NodeSequence::AWAIT, NodeSequence::AWAIT_C, NodeSequence::BURST_OUT, NodeSequence::CALL_CHILD, NodeSequence::CONNECTED, NodeSequence::FRESH, NodeSequence::GENOCIDE, NodeSequence::GRAFT, NodeSequence::GRAFT_C, NodeSequence::PASS, NodeSequence::PASS_C, NodeSequence::RESERVED, NodeSequence::RESERVED_C, NodeSequence::ROTTEN, NodeSequence::RUN, NodeSequence::RUN_C, NodeSequence::SEQUENCE_LOCK, NodeSequence::STOP, NodeSequence::WAIT

Instance Attribute Summary

Attributes included from Chainable

#child

Instance Method Summary collapse

Methods included from Chainable

#add_awaited, #add_child, #add_child_observer, #awaited, #cancel, #enter_pass, #exit_pass, #has_awaited?, #has_child?, #next, #reserve_activate, #trap

Methods included from NodeSequence

#activated?, #change_sequence, #on_sequence_changed, #sequence, #spoiled?

Methods included from Graph

#graph, #graph_child, #graph_draw, #graph_save

Methods included from Awaitable

#[email protected], #enter_await, #exit_await

Instance Method Details

#call(value = nil) ⇒ Object

Deferredを直ちに実行する。 このメソッドはスレッドセーフです。


16
17
18
# File 'lib/delayer/deferred/deferredable/trigger.rb', line 16

def call(value = nil)
  execute(Delayer::Deferred::Response::Ok.new(value))
end

#fail(exception = nil) ⇒ Object

Deferredを直ちに失敗させる。 このメソッドはスレッドセーフです。


22
23
24
# File 'lib/delayer/deferred/deferredable/trigger.rb', line 22

def fail(exception = nil)
  execute(Delayer::Deferred::Response::Ng.new(exception))
end