Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
require 'celluloid'
module Celluloid
class Chain
class Call
def initialize(method_name, args, block)
@method_name = method_name
@args = args
@block = block
end
attr_reader :method_name, :args, :block
end
include Celluloid
def initialize(target)
@target = target
@calls = []
@running = false
end
def add(method_name, *args, &block)
@calls << Call.new(method_name, args, block)
unless @running
process!
end
end
def process
while call = @calls.shift
@running = true
@target.send(call.method_name, *call.args, &call.block)
end
@running = false
end
end
end