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.

Raises:

  • (NoMethodError)


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

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

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

Instance Method Details

#arityObject



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

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

#call(*args, &block) ⇒ Object



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

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

#inspectObject



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

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

#nameObject



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

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

#parametersObject



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

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