class AMF::Message

Attributes

data[RW]
responseURL[RW]
targetURL[RW]

Public Class Methods

new( targetURL, responseURL, data ) click to toggle source
# File lib/amf/message.rb, line 5
def initialize( targetURL, responseURL, data )
  @targetURL = targetURL
  @responseURL = responseURL
  @data = data
end

Public Instance Methods

to_hash() click to toggle source
# File lib/amf/message.rb, line 11
def to_hash
  { 'targetUri' => self.targetURL, 'responseUri' => self.responseURL, 'data' => recursive_marshal( data ) }
end

Private Instance Methods

recursive_marshal( data ) click to toggle source
# File lib/amf/message.rb, line 17
def recursive_marshal( data )
  ret = Hash.new
  if data.class == OpenStruct
    data.marshal_dump.each{ |k,v|
      ret[k] = recursive_marshal v
    }
  elsif data.class == Hash
    data.each{ |k,v|
      ret[k] = recursive_marshal v
    }
  else
    ret = data
  end

  ret
end