Sha256: b11dd3f17666097aebae63a4bb7e5ad1a77e98069dd02e6ddb74f19bf24c6c2e

Contents?: true

Size: 837 Bytes

Versions: 4

Compression:

Stored size: 837 Bytes

Contents

module AMF
  class << self
    # Deserialize the AMF string _source_ into a Ruby data structure and return it.
    def deserialize source, amf_version = 0
      if amf_version == 0
        AMF::Deserializer.new.deserialize(source)
      elsif amf_version == 3
        AMF::AMF3Deserializer.new.deserialize(source)
      else
        raise AMFError, "unsupported version #{amf_version}"
      end
    end

    # Serialize the given Ruby data structure _obj_ into an AMF stream
    def serialize obj, amf_version = 0
      if amf_version == 0
        AMF::Serializer.new.serialize(obj)
      elsif amf_version == 3
        AMF::AMF3Serializer.new.serialize(obj)
      else
        raise AMFError, "unsupported version #{amf_version}"
      end
    end
  end

  # The base exception for AMF errors.
  class AMFError < StandardError; end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rack-amf-0.0.4 lib/amf/common.rb
rack-amf-0.0.3 lib/amf/common.rb
rack-amf-0.0.2 lib/amf/common.rb
rack-amf-0.0.1 lib/amf/common.rb