Class: SDL4R::Serializer::Ref

Inherits:
Object
  • Object
show all
Defined in:
lib/sdl4r/serializer.rb

Overview

Represents a reference to an object during serialization or deserialization. Used in order to avoid infinite cycles, repetitions, etc.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(o, oid) ⇒ Ref

Initializes a reference with a reference counter of 0.



89
90
91
92
93
94
# File 'lib/sdl4r/serializer.rb', line 89

def initialize(o, oid)
  @tag = nil
  @o = o
  @oid = oid
  @count = 0
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



84
85
86
# File 'lib/sdl4r/serializer.rb', line 84

def count
  @count
end

#oObject (readonly)

Returns the value of attribute o.



84
85
86
# File 'lib/sdl4r/serializer.rb', line 84

def o
  @o
end

#oidObject (readonly)

Returns the value of attribute oid.



84
85
86
# File 'lib/sdl4r/serializer.rb', line 84

def oid
  @oid
end

#tagObject

Returns the value of attribute tag.



85
86
87
# File 'lib/sdl4r/serializer.rb', line 85

def tag
  @tag
end

Instance Method Details

#incObject

Increments the reference counter by one.



98
99
100
# File 'lib/sdl4r/serializer.rb', line 98

def inc
  @count += 1
end