Class: AMF::Deserializer
- Inherits:
-
Object
- Object
- AMF::Deserializer
- Defined in:
- lib/amf/deserializer.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(data) ⇒ Deserializer
constructor
A new instance of Deserializer.
- #serialize ⇒ Object
-
#to_hash ⇒ Object
make this work a little bit more like a ruby object.
Constructor Details
#initialize(data) ⇒ Deserializer
Returns a new instance of Deserializer.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/amf/deserializer.rb', line 11 def initialize( data ) if StringIO == data.class @data = data else @data = StringIO.new data end readHeaders readMessages resetReferences @data = nil end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
9 10 11 |
# File 'lib/amf/deserializer.rb', line 9 def headers @headers end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
9 10 11 |
# File 'lib/amf/deserializer.rb', line 9 def @messages end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
9 10 11 |
# File 'lib/amf/deserializer.rb', line 9 def version @version end |
Instance Method Details
#serialize ⇒ Object
24 25 26 |
# File 'lib/amf/deserializer.rb', line 24 def serialize AMF::Serializer.new( headers, , version ).data end |
#to_hash ⇒ Object
make this work a little bit more like a ruby object
29 30 31 32 33 34 35 |
# File 'lib/amf/deserializer.rb', line 29 def to_hash { 'version' => self.version, 'headers' => self.headers.map{ |h| h.to_hash }, 'messages' => self..map{ |m| m.to_hash }, } end |