Hi
I have a slightly different problem. I have an array stored in the
object:
class Room
include DRb::DRbUndumped
attr_accessor :name
attr_accessor :game
attr_accessor :observers
def initialize(name=nil)
@game = nil
@observers = []
@name = name
end
end
And the object is stored at the 'server'. At the 'client' I got the
object and is able to modify the @name instance variable at the
'server'. However when I tried to add objects to the @observers array it
doesn't seem to appear at the 'server'. What could be wrong?
Brian Candler wrote:
> Master Marv wrote:
>> if a client modifies the status variable of a class instance in the
>> array it does not get changed.
>>
>> dump = DRbObject.new nil, ARGV.shift
>> myclass = IEB_wrapper1.new
>> dump.push myclass
>> dump[0].status = "Hello"
>> p dump[0].status => results in "ready" not in "Hello"
>>
>> how can i modify the status of my class in the array on the drb server?
>
> class IEB_wrapper1
> include DRbUndumped
> end
>
> This means that instead of passing across a *copy* of the object (made
> using Marshal.dump and load), it will pass across a DRb *proxy object*.
> All operations made on that proxy are sent across as remote method calls
> and therefore made on the server.
>
> I wrote a document called "DrbTutorial" on rubygarden.org, which
> unfortunately is long since gone. You might be able to find a cached
> copy somewhere.
--
Posted via http://www.ruby-forum.com/.