Class: Hprose::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/hprose/io.rb

Overview

class Writer

Class Method Summary collapse

Class Method Details

.serialize(variable, simple = false) ⇒ Object



911
912
913
914
915
916
917
918
# File 'lib/hprose/io.rb', line 911

def serialize(variable, simple = false)
  stream = StringIO.new
  writer = Writer.new(stream, simple)
  writer.serialize(variable)
  s = stream.string
  stream.close
  return s
end

.unserialize(variable_representation, simple = false) ⇒ Object



919
920
921
922
923
924
925
# File 'lib/hprose/io.rb', line 919

def unserialize(variable_representation, simple = false)
  stream = StringIO.new(variable_representation, 'rb')
  reader = Reader.new(stream, simple)
  obj = reader.unserialize
  stream.close
  return obj
end