Class: DRb::DRbArray

Inherits:
Object
  • Object
show all
Defined in:
lib/drb/drb.rb

Overview

An Array wrapper that can be sent to another server via DRb.

All entries in the array will be dumped or be references that point to the local server.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ary) ⇒ DRbArray

Creates a new DRbArray that either dumps or wraps all the items in the Array ary so they can be loaded by a remote DRb server.



551
552
553
554
555
556
557
558
559
560
561
562
563
564
# File 'lib/drb/drb.rb', line 551

def initialize(ary)
  @ary = ary.collect { |obj|
    if obj.kind_of? DRbUndumped
      DRbObject.new(obj)
    else
      begin
        Marshal.dump(obj)
        obj
      rescue
        DRbObject.new(obj)
      end
    end
  }
end

Class Method Details

._load(s) ⇒ Object

:nodoc:



566
567
568
# File 'lib/drb/drb.rb', line 566

def self._load(s) # :nodoc:
  Marshal::load(s)
end

Instance Method Details

#_dump(lv) ⇒ Object

:nodoc:



570
571
572
# File 'lib/drb/drb.rb', line 570

def _dump(lv) # :nodoc:
  Marshal.dump(@ary)
end