Module DRb::UndumpedIndexedObject
In: lib/drb/undumped_indexed_object.rb

Methods

Public Class methods

[Source]

# File lib/drb/undumped_indexed_object.rb, line 40
        def self._load(data)
          klass, attribs = Marshal.load(data)
          obj = klass.new
          attribs.each do |key, value|
            obj[key] = Marshal.load(value)
          end
          obj
        end

[Source]

# File lib/drb/undumped_indexed_object.rb, line 16
    def UndumpedIndexedObject.append_features(cl)
      super
      cl.module_eval do

        def _dump(depth)
          if self.class.include?(DRb::DRbUndumped)
            raise(TypeError, 'can\'t dump')
          end
          attribs = {}
          each_pair do |k, v|
            begin
              attribs[k] = Marshal.dump(v)
            rescue TypeError
              if (defined? LOG) and (not v.class.include? DRb::DRbUndumped)
                LOG.warn("#{self.class}._dump") do
                  "can't dump a #{k}:#{v.class}"
                end
              end
              attribs[k] = Marshal.dump(DRbObject.new(v))
            end
          end
          Marshal.dump([self.class, attribs])
        end

        def self._load(data)
          klass, attribs = Marshal.load(data)
          obj = klass.new
          attribs.each do |key, value|
            obj[key] = Marshal.load(value)
          end
          obj
        end
      end

    end

Public Instance methods

[Source]

# File lib/drb/undumped_indexed_object.rb, line 20
        def _dump(depth)
          if self.class.include?(DRb::DRbUndumped)
            raise(TypeError, 'can\'t dump')
          end
          attribs = {}
          each_pair do |k, v|
            begin
              attribs[k] = Marshal.dump(v)
            rescue TypeError
              if (defined? LOG) and (not v.class.include? DRb::DRbUndumped)
                LOG.warn("#{self.class}._dump") do
                  "can't dump a #{k}:#{v.class}"
                end
              end
              attribs[k] = Marshal.dump(DRbObject.new(v))
            end
          end
          Marshal.dump([self.class, attribs])
        end

[Validate]