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 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
#arity ⇒ Object
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 |
#inspect ⇒ Object
29 30 31 |
# File 'lib/celluloid/internals/method.rb', line 29 def inspect "#<Celluloid::Internals::Method #{@klass}##{@name}>" end |
#name ⇒ Object
17 18 19 |
# File 'lib/celluloid/internals/method.rb', line 17 def name @proxy.method_missing(:method, @name).name end |
#parameters ⇒ Object
21 22 23 |
# File 'lib/celluloid/internals/method.rb', line 21 def parameters @proxy.method_missing(:method, @name).parameters end |