Class: Powcloud::Insurance::Channel::ProcChain
- Inherits:
-
Object
- Object
- Powcloud::Insurance::Channel::ProcChain
- Defined in:
- lib/powcloud/insurance/channel.rb
Overview
Collection of procs, which could be called one by one asynchronously. Each proc should call next() on ProcChain instance.
Instance Method Summary collapse
- #<<(blk) ⇒ Object
- #call ⇒ Object
-
#initialize ⇒ ProcChain
constructor
A new instance of ProcChain.
- #next ⇒ Object
Constructor Details
#initialize ⇒ ProcChain
Returns a new instance of ProcChain.
7 8 9 |
# File 'lib/powcloud/insurance/channel.rb', line 7 def initialize @collection = [] end |
Instance Method Details
#<<(blk) ⇒ Object
16 17 18 |
# File 'lib/powcloud/insurance/channel.rb', line 16 def <<(blk) @collection << blk end |
#call ⇒ Object
20 21 22 |
# File 'lib/powcloud/insurance/channel.rb', line 20 def call self.next end |
#next ⇒ Object
11 12 13 14 |
# File 'lib/powcloud/insurance/channel.rb', line 11 def next next_proc = @collection.shift next_proc.call if next_proc end |