Class: SerizableVariable
- Inherits:
-
Object
- Object
- SerizableVariable
- Defined in:
- lib/steamd/generator/ruby/serializable_variable.rb
Overview
Represents a Serialized var
Direct Known Subclasses
Instance Attribute Summary collapse
-
#flag ⇒ Object
Returns the value of attribute flag.
-
#modifier ⇒ Object
readonly
Returns the value of attribute modifier.
-
#modifier_size ⇒ Object
readonly
Returns the value of attribute modifier_size.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#deserialize(io) ⇒ Object
Serialize the object.
-
#initialize(var) ⇒ SerizableVariable
constructor
Initialize a SteamSerializable from a hash.
-
#serialize ⇒ Object
Serialize the object.
Constructor Details
#initialize(var) ⇒ SerizableVariable
Initialize a SteamSerializable from a hash
9 10 11 12 13 14 15 |
# File 'lib/steamd/generator/ruby/serializable_variable.rb', line 9 def initialize(var) @name = var[:name] @value = var[:value] @modifier = var[:modifier] @modifier_size = var[:modifier_size] @type = Type.new(var[:type]) end |
Instance Attribute Details
#flag ⇒ Object
Returns the value of attribute flag.
6 7 8 |
# File 'lib/steamd/generator/ruby/serializable_variable.rb', line 6 def flag @flag end |
#modifier ⇒ Object (readonly)
Returns the value of attribute modifier.
5 6 7 |
# File 'lib/steamd/generator/ruby/serializable_variable.rb', line 5 def modifier @modifier end |
#modifier_size ⇒ Object (readonly)
Returns the value of attribute modifier_size.
5 6 7 |
# File 'lib/steamd/generator/ruby/serializable_variable.rb', line 5 def modifier_size @modifier_size end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/steamd/generator/ruby/serializable_variable.rb', line 5 def name @name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
5 6 7 |
# File 'lib/steamd/generator/ruby/serializable_variable.rb', line 5 def size @size end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/steamd/generator/ruby/serializable_variable.rb', line 5 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
5 6 7 |
# File 'lib/steamd/generator/ruby/serializable_variable.rb', line 5 def value @value end |
Instance Method Details
#deserialize(io) ⇒ Object
Serialize the object
31 32 33 34 35 36 37 38 39 |
# File 'lib/steamd/generator/ruby/serializable_variable.rb', line 31 def deserialize(io) @value = if type.primitive? deserialize_primitive(io) elsif type.encodable? deserialize_encodable(io) else deserialize_object(io) end end |
#serialize ⇒ Object
Serialize the object
18 19 20 21 22 23 24 25 26 |
# File 'lib/steamd/generator/ruby/serializable_variable.rb', line 18 def serialize if type.primitive? serialize_primitive elsif type.encodable? serialize_encodable else serialize_object end end |