Class: Delayer::Deferred::Chain::Base
- Inherits:
-
Object
- Object
- Delayer::Deferred::Chain::Base
- Defined in:
- lib/delayer/deferred/chain/base.rb
Constant Summary
Constants included from Deferredable::NodeSequence
Deferredable::NodeSequence::AWAIT, Deferredable::NodeSequence::AWAIT_C, Deferredable::NodeSequence::BURST_OUT, Deferredable::NodeSequence::CALL_CHILD, Deferredable::NodeSequence::CONNECTED, Deferredable::NodeSequence::FRESH, Deferredable::NodeSequence::GENOCIDE, Deferredable::NodeSequence::GRAFT, Deferredable::NodeSequence::GRAFT_C, Deferredable::NodeSequence::PASS, Deferredable::NodeSequence::PASS_C, Deferredable::NodeSequence::RESERVED, Deferredable::NodeSequence::RESERVED_C, Deferredable::NodeSequence::ROTTEN, Deferredable::NodeSequence::RUN, Deferredable::NodeSequence::RUN_C, Deferredable::NodeSequence::SEQUENCE_LOCK, Deferredable::NodeSequence::STOP, Deferredable::NodeSequence::WAIT
Instance Attribute Summary
Attributes included from Deferredable::Chainable
Instance Method Summary collapse
- #activate(response) ⇒ Object
-
#initialize(&proc) ⇒ Base
constructor
A new instance of Base.
- #inspect ⇒ Object
- #node_name ⇒ Object
Methods included from Deferredable::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 Deferredable::NodeSequence
#activated?, #change_sequence, #on_sequence_changed, #sequence, #spoiled?
Methods included from Deferredable::Graph
#graph, #graph_child, #graph_draw, #graph_save
Methods included from Deferredable::Awaitable
#+@, #enter_await, #exit_await
Constructor Details
Instance Method Details
#activate(response) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/delayer/deferred/chain/base.rb', line 15 def activate(response) change_sequence(:activate) if evaluate?(response) @proc.(response.value) else response end ensure change_sequence(:complete) end |
#inspect ⇒ Object
26 27 28 |
# File 'lib/delayer/deferred/chain/base.rb', line 26 def inspect "#<#{self.class} seq:#{sequence.name} child:#{has_child?}>" end |
#node_name ⇒ Object
30 31 32 |
# File 'lib/delayer/deferred/chain/base.rb', line 30 def node_name @proc.source_location.join(':'.freeze) end |