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.


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

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)


22
23
24
# File 'lib/dizby/distributed/array.rb', line 22

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

Instance Method Details

#_dump(_)


26
27
28
# File 'lib/dizby/distributed/array.rb', line 26

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