Class: Celluloid::Method

Inherits:
Object
  • Object
show all
Defined in:
lib/celluloid/method.rb

Overview

Method handles that route through an actor proxy

Instance Method Summary collapse

Constructor Details

#initialize(proxy, name) ⇒ Method

Returns a new instance of Method.

Raises:

  • (NameError)

4
5
6
7
8
9
# File 'lib/celluloid/method.rb', line 4

def initialize(proxy, name)
  raise NameError, "undefined method `#{name}'" unless proxy.respond_to? name

  @proxy, @name = proxy, name
  @klass = @proxy.class
end

Instance Method Details

#arityObject


11
12
13
# File 'lib/celluloid/method.rb', line 11

def arity
  @proxy.method_missing(:method, @name).arity
end

#call(*args, &block) ⇒ Object


23
24
25
# File 'lib/celluloid/method.rb', line 23

def call(*args, &block)
  @proxy.__send__(@name, *args, &block)
end

#inspectObject


27
28
29
# File 'lib/celluloid/method.rb', line 27

def inspect
  "#<Celluloid::Method #{@klass}##{@name}>"
end

#nameObject


15
16
17
# File 'lib/celluloid/method.rb', line 15

def name
  @proxy.method_missing(:method, @name).name
end

#parametersObject


19
20
21
# File 'lib/celluloid/method.rb', line 19

def parameters
  @proxy.method_missing(:method, @name).parameters
end