123456789_123456789_123456789_123456789_123456789_

Class: DRb::DRbArray

Relationships & Source Files
Inherits: Object
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

  • .new(ary) ⇒ DRbArray constructor

    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.

  • ._load(s) Internal use only

Instance Method Summary

Constructor Details

.new(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.

[ GitHub ]

  
# File 'lib/drb/drb.rb', line 523

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)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/drb/drb.rb', line 538

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

Instance Method Details

#_dump(lv)

This method is for internal use only.
[ GitHub ]

  
# File 'lib/drb/drb.rb', line 542

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