Class: Dizby::DistributedArray

Inherits:
Object
  • Object
show all
Defined in:
lib/dizby/distributed/array.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ary, server) ⇒ DistributedArray

Returns a new instance of DistributedArray.


9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dizby/distributed/array.rb', line 9

def initialize(ary, server)
  @ary = ary.map do |obj|
    if obj.is_a? UndumpableObject
      DistributedObject.new(obj, server)
    else
      begin
        Marshal.dump(obj)
        obj
      rescue
        DistributedObject.new(obj, server)
      end
    end
  end
end

Class Method Details

._load(str)


24
25
26
# File 'lib/dizby/distributed/array.rb', line 24

def self._load(str)
  Marshal.load(str)
end

Instance Method Details

#_dump(_)


28
29
30
# File 'lib/dizby/distributed/array.rb', line 28

def _dump(_)
  Marshal.dump(@ary)
end