Class: Synapse::Serialization::SerializedObject

Inherits:
Object
  • Object
show all
Defined in:
lib/synapse/serialization/serialized_object.rb

Direct Known Subclasses

SerializedMetadata

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content, content_type, type) ⇒ undefined

Parameters:



17
18
19
20
21
# File 'lib/synapse/serialization/serialized_object.rb', line 17

def initialize(content, content_type, type)
  @content = content
  @content_type = content_type
  @type = type
end

Instance Attribute Details

#contentObject (readonly)

Returns:

  • (Object)


5
6
7
# File 'lib/synapse/serialization/serialized_object.rb', line 5

def content
  @content
end

#content_typeClass (readonly)

Returns:

  • (Class)


8
9
10
# File 'lib/synapse/serialization/serialized_object.rb', line 8

def content_type
  @content_type
end

#typeSerializedType (readonly)

Returns:



11
12
13
# File 'lib/synapse/serialization/serialized_object.rb', line 11

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



23
24
25
26
27
28
# File 'lib/synapse/serialization/serialized_object.rb', line 23

def ==(other)
  self.class === other and
    other.content == @content and
    other.content_type == @content_type and
    other.type == @type
end

#hashObject



32
33
34
# File 'lib/synapse/serialization/serialized_object.rb', line 32

def hash
  @content.hash ^ @content_type.hash ^ @type.hash
end