DRb::DRbArray

class DRb::DRbArray

Parent:
Object

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.

Public Class Methods

new(ary) Show source

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.

# 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

Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部