Class: MemoryModel::Collection::MarshaledRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/memory_model/collection/marshaled_record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ MarshaledRecord

Returns a new instance of MarshaledRecord.



7
8
9
10
11
# File 'lib/memory_model/collection/marshaled_record.rb', line 7

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

Instance Attribute Details

#stringObject (readonly)

Returns the value of attribute string.



5
6
7
# File 'lib/memory_model/collection/marshaled_record.rb', line 5

def string
  @string
end

#uuidObject (readonly)

Returns the value of attribute uuid.



5
6
7
# File 'lib/memory_model/collection/marshaled_record.rb', line 5

def uuid
  @uuid
end

Instance Method Details

#==(other_object) ⇒ Object



17
18
19
# File 'lib/memory_model/collection/marshaled_record.rb', line 17

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

#loadObject



13
14
15
# File 'lib/memory_model/collection/marshaled_record.rb', line 13

def load
  Marshal.load @string
end