Class: Dizby::DistributedObject
- Inherits:
-
Object
- Object
- Dizby::DistributedObject
show all
- Defined in:
- lib/dizby/distributed/object.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of DistributedObject.
17
18
19
20
|
# File 'lib/dizby/distributed/object.rb', line 17
def initialize(obj, server)
@obj = obj
@server = server
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(msg_id, *args, &block)
40
41
42
43
44
|
# File 'lib/dizby/distributed/object.rb', line 40
def method_missing(msg_id, *args, &block)
@server.log.debug("calling: #{msg_id} #{args.join ', '}")
Dizby.check_insecure_method(@obj, msg_id)
@obj.__send__(msg_id, *args, &block)
end
|
Class Method Details
._load(str)
9
10
11
|
# File 'lib/dizby/distributed/object.rb', line 9
def self._load(str)
SemiObjectProxy.new(*Marshal.load(str))
end
|
Instance Method Details
#_dump(_)
13
14
15
|
# File 'lib/dizby/distributed/object.rb', line 13
def _dump(_)
Marshal.dump [@server.uri, @server.to_id(@obj)]
end
|
#respond_to?(msg_id, priv = false) ⇒ Boolean
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/dizby/distributed/object.rb', line 25
def respond_to?(msg_id, priv = false)
responds =
case msg_id
when :_dump
true
when :marshal_dump
false
else
method_missing(:respond_to?, msg_id, priv)
end
@server.log.debug("respond_to?(#{msg_id}) => #{responds}")
responds
end
|