Method: Proc#chain

Defined in:
lib/ludy/proc/chain.rb

#chain(*procs, &block) ⇒ Object

TODO: missing traversal of chain create a chain of proc. whenever you call the chain, each proc would be called. the return value would be all the results saved orderly in a array.



7
8
9
10
11
12
13
14
15
16
# File 'lib/ludy/proc/chain.rb', line 7

def chain *procs, &block
  procs << block if block
  lambda{ |*args|
    result = []
    ([self] + procs).each{ |i|
      result += [i[*args]].flatten
    }
    result
  }
end