Class: RocketAMF::MappingSet

Inherits:
Object
  • Object
show all
Defined in:
lib/rocketamf/mapping/mapping_set.rb

Overview

Container for all mapped classes

Instance Method Summary collapse

Constructor Details

#initializeMappingSet

Returns a new instance of MappingSet.



12
13
14
15
16
# File 'lib/rocketamf/mapping/mapping_set.rb', line 12

def initialize
  @as_mappings   = {}
  @ruby_mappings = {}
  map_defaults
end

Instance Method Details

#get_as_class_name(class_name) ⇒ Object

:nodoc:



51
52
53
# File 'lib/rocketamf/mapping/mapping_set.rb', line 51

def get_as_class_name(class_name) #:nodoc:
  @ruby_mappings[class_name.to_s]
end

#get_ruby_class_name(class_name) ⇒ Object

:nodoc:



58
59
60
# File 'lib/rocketamf/mapping/mapping_set.rb', line 58

def get_ruby_class_name(class_name) #:nodoc:
  @as_mappings[class_name.to_s]
end

#map(params) ⇒ Object



42
43
44
45
46
# File 'lib/rocketamf/mapping/mapping_set.rb', line 42

def map(params)
  [:as, :ruby].each { |k| params[k] = params[k].to_s } # Convert params to strings
  @as_mappings[params[:as]]     = params[:ruby]
  @ruby_mappings[params[:ruby]] = params[:as]
end

#map_defaultsObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rocketamf/mapping/mapping_set.rb', line 21

def map_defaults
  map as: 'flex.messaging.messages.AbstractMessage', ruby: 'RocketAMF::Types::AbstractMessage'
  map as: 'flex.messaging.messages.RemotingMessage', ruby: 'RocketAMF::Types::RemotingMessage'
  map as: 'flex.messaging.messages.AsyncMessage', ruby: 'RocketAMF::Types::AsyncMessage'
  map as: 'DSA', ruby: 'RocketAMF::Types::AsyncMessageExt'
  map as: 'flex.messaging.messages.CommandMessage', ruby: 'RocketAMF::Types::CommandMessage'
  map as: 'DSC', ruby: 'RocketAMF::Types::CommandMessageExt'
  map as: 'flex.messaging.messages.AcknowledgeMessage', ruby: 'RocketAMF::Types::AcknowledgeMessage'
  map as: 'DSK', ruby: 'RocketAMF::Types::AcknowledgeMessageExt'
  map as: 'flex.messaging.messages.ErrorMessage', ruby: 'RocketAMF::Types::ErrorMessage'
  self
end