Class: Celluloid::Internals::Method
- Inherits:
-
Object
- Object
- Celluloid::Internals::Method
- Defined in:
- lib/celluloid/internals/method.rb
Overview
Method handles that route through an actor proxy
Instance Method Summary collapse
- #arity ⇒ Object
- #call(*args, &block) ⇒ Object
-
#initialize(proxy, name) ⇒ Method
constructor
A new instance of Method.
- #inspect ⇒ Object
- #name ⇒ Object
- #parameters ⇒ Object
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
#arity ⇒ Object
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 |
#inspect ⇒ Object
28 29 30 |
# File 'lib/celluloid/internals/method.rb', line 28 def inspect "#<Celluloid::Internals::Method #{@klass}##{@name}>" end |
#name ⇒ Object
16 17 18 |
# File 'lib/celluloid/internals/method.rb', line 16 def name @proxy.method_missing(:method, @name).name end |
#parameters ⇒ Object
20 21 22 |
# File 'lib/celluloid/internals/method.rb', line 20 def parameters @proxy.method_missing(:method, @name).parameters end |