Class: Sumac::RemoteObjectChild
- Defined in:
- lib/sumac/remote_object_child.rb
Instance Method Summary collapse
- #__key__ ⇒ Object
- #__parent__ ⇒ Object
-
#initialize(connection, parent, key) ⇒ RemoteObjectChild
constructor
A new instance of RemoteObjectChild.
- #inspect ⇒ Object
-
#method_missing(method_name, *arguments, &block) ⇒ Object
blocks not working yet.
Constructor Details
#initialize(connection, parent, key) ⇒ RemoteObjectChild
Returns a new instance of RemoteObjectChild.
4 5 6 7 8 9 10 |
# File 'lib/sumac/remote_object_child.rb', line 4 def initialize(connection, parent, key) raise "argument 'connection' must be a Connection" unless connection.is_a?(Connection) @connection = connection raise unless parent.is_a?(RemoteObject) @parent = parent @key = key end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
blocks not working yet
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sumac/remote_object_child.rb', line 12 def method_missing(method_name, *arguments, &block) # blocks not working yet @connection.mutex.lock begin arguments << block.to_lambda if block_given? return_value = @connection.call_dispatcher.make_call(self, method_name.to_s, arguments) rescue ClosedError raise StaleObjectError end return_value ensure @connection.mutex.unlock if @connection.mutex.owned? end |
Instance Method Details
#__key__ ⇒ Object
25 26 27 |
# File 'lib/sumac/remote_object_child.rb', line 25 def __key__ @key end |
#__parent__ ⇒ Object
29 30 31 |
# File 'lib/sumac/remote_object_child.rb', line 29 def __parent__ @parent end |
#inspect ⇒ Object
33 34 35 |
# File 'lib/sumac/remote_object_child.rb', line 33 def inspect "#<Sumac::RemoteObjectChild:#{"0x00%x" % (object_id << 1)}>" end |