class Qpid::Proton::Mapping
Maps between Proton types and their Ruby native language counterparts.
Attributes
code[R]
get_method[R]
put_method[R]
Public Class Methods
for_code(code)
click to toggle source
# File lib/qpid_proton/mapping.rb, line 84 def self.for_code(code) @@by_code["#{code}"] end
new(code, name, klasses = nil, getter = nil)
click to toggle source
Creates a new mapping.
Arguments¶ ↑
-
code - the AMQP code for this type
-
name - the AMQP name for this type
-
klasses - the Ruby classes for this type
-
getter - overrides the get method for the type
# File lib/qpid_proton/mapping.rb, line 40 def initialize(code, name, klasses = nil, getter = nil) @debug = (name == "bool") @code = code @name = name @@by_preferred ||= {} @@by_code ||= {} @@by_code["#{code}"] = self @@by_name ||= {} @@by_name[name] = self @@by_class ||= {} unless klasses.nil? klasses.each do |klass| raise "entry exists for #{klass}" if @@by_class.keys.include? klass @@by_class[klass] = self unless klass.nil? end end @put_method = (name + "=").intern if getter.nil? @get_method = name.intern else @get_method = getter.intern end end
Public Instance Methods
get(data)
click to toggle source
# File lib/qpid_proton/mapping.rb, line 76 def get(data) data.send(@get_method) end
put(data, value)
click to toggle source
# File lib/qpid_proton/mapping.rb, line 72 def put(data, value) data.send(@put_method, value) end
to_s()
click to toggle source
# File lib/qpid_proton/mapping.rb, line 70 def to_s; @name; end