jwaldrip/memory_model

View on GitHub
lib/memory_model/collection/marshaled_record.rb

Summary

Maintainability
A
0 mins
Test Coverage
module MemoryModel
  class Collection
    class MarshaledRecord

      attr_reader :uuid, :string

      def initialize(record)
        @uuid   = record._uuid_
        @string = Marshal.dump record
        freeze
      end

      def load
        Marshal.load @string
      end

      def ==(other_object)
        uuid == other_object.try(:uuid)
      end

    end
  end
end