Class: EMRPC::MethodProxy
- Inherits:
-
Object
- Object
- EMRPC::MethodProxy
show all
- Defined in:
- lib/emrpc/method_proxy.rb
Overview
Sends all the messages to a specified backend FIXME: deal with Object’s methods gracefully.
Constant Summary
collapse
- EMPTY_ARGS =
[ ].freeze
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(backend) ⇒ MethodProxy
Returns a new instance of MethodProxy.
8
9
10
|
# File 'lib/emrpc/method_proxy.rb', line 8
def initialize(backend)
@__emrpc_backend = backend
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object
12
13
14
|
# File 'lib/emrpc/method_proxy.rb', line 12
def method_missing(meth, *args, &blk)
@__emrpc_backend.send_message(meth, args, blk)
end
|
Instance Attribute Details
#__emrpc_backend ⇒ Object
Returns the value of attribute __emrpc_backend.
7
8
9
|
# File 'lib/emrpc/method_proxy.rb', line 7
def __emrpc_backend
@__emrpc_backend
end
|
Instance Method Details
#__class__ ⇒ Object
28
|
# File 'lib/emrpc/method_proxy.rb', line 28
alias :__class__ :class
|
#class ⇒ Object
29
30
31
|
# File 'lib/emrpc/method_proxy.rb', line 29
def class
@__emrpc_backend.send_message(:class, EMPTY_ARGS, nil)
end
|
#id ⇒ Object
16
17
18
|
# File 'lib/emrpc/method_proxy.rb', line 16
def id
@__emrpc_backend.send_message(:id, EMPTY_ARGS, nil)
end
|
#inspect ⇒ Object
33
34
35
|
# File 'lib/emrpc/method_proxy.rb', line 33
def inspect
"#<#{self.__class__.name}:0x#{__id__.to_s(16)} remote:#{@__emrpc_backend.send_message(:inspect, EMPTY_ARGS, nil)}>"
end
|
#to_s ⇒ Object
20
21
22
|
# File 'lib/emrpc/method_proxy.rb', line 20
def to_s
@__emrpc_backend.send_message(:to_s, EMPTY_ARGS, nil)
end
|
#to_str ⇒ Object
24
25
26
|
# File 'lib/emrpc/method_proxy.rb', line 24
def to_str
@__emrpc_backend.send_message(:to_str, EMPTY_ARGS, nil)
end
|