Calls represent requests to an actor
# File lib/celluloid/calls.rb, line 6 def initialize(method, arguments = [], block = nil) @method, @arguments = method, arguments if block if Celluloid.exclusive? # FIXME: nicer exception raise "Cannot execute blocks on sender in exclusive mode" end @block = BlockProxy.new(self, Celluloid.mailbox, block) else @block = nil end end
# File lib/celluloid/calls.rb, line 29 def check(obj) raise NoMethodError, "undefined method `#{@method}' for #{obj.inspect}" unless obj.respond_to? @method begin arity = obj.method(@method).arity rescue NameError return end if arity >= 0 raise ArgumentError, "wrong number of arguments (#{@arguments.size} for #{arity})" if @arguments.size != arity elsif arity < -1 mandatory_args = -arity - 1 raise ArgumentError, "wrong number of arguments (#{@arguments.size} for #{mandatory_args}+)" if arguments.size < mandatory_args end rescue => ex raise AbortError.new(ex) end
Generated with the Darkfish Rdoc Generator 2.