class BlockChain
Constants
- VERSION
Public Class Methods
new(*methods)
click to toggle source
# File lib/block_chain.rb, line 4 def initialize *methods @procs = methods.map(&:to_proc) end
Public Instance Methods
call(*args) { || ... }
click to toggle source
# File lib/block_chain.rb, line 8 def call *args if @procs.none? yield elsif @procs.one? @procs.first.call(*args) { yield } else current = @procs.first nexts = self.class.new(*@procs.slice(1..-1)) current.call(*args) do nexts.call(*args) { yield } end end end