Class: Celluloid::Internals::Method

Inherits:
Object
  • Object
show all
Defined in:
lib/celluloid/internals/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.



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

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

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

Instance Method Details

#arityObject



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

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

#call(*args, &block) ⇒ Object



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

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

#inspectObject



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

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

#nameObject



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

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

#parametersObject



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

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