Sha256: 62c01aec2d1a9fe22de5f906ef56c033a123db9ce55ca1c16229501ef5bb479d

Contents?: true

Size: 409 Bytes

Versions: 14

Compression:

Stored size: 409 Bytes

Contents

class Proc
  # 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.
  def chain *procs, &block
    procs << block if block
    lambda{ |*args|
      result = []
      ([self] + procs).each{ |i|
        result += [i[*args]].flatten
      }
      result
    }
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
godfat-ludy-0.1.13 lib/ludy/proc/chain.rb
ludy-0.1.15 lib/ludy/proc/chain.rb
ludy-0.1.11 lib/ludy/proc/chain.rb
ludy-0.1.13 lib/ludy/proc/chain.rb
ludy-0.1.2 lib/ludy/proc/chain.rb
ludy-0.1.10 lib/ludy/proc/chain.rb
ludy-0.1.1 lib/ludy/proc/chain.rb
ludy-0.1.3 lib/ludy/proc/chain.rb
ludy-0.1.4 lib/ludy/proc/chain.rb
ludy-0.1.5 lib/ludy/proc/chain.rb
ludy-0.1.6 lib/ludy/proc/chain.rb
ludy-0.1.8 lib/ludy/proc/chain.rb
ludy-0.1.9 lib/ludy/proc/chain.rb
ludy-0.1.7 lib/ludy/proc/chain.rb