Class: Rex::Proto::Amqp::Version091::Types::AmqpVersion091FieldTable

Inherits:
BinData::Primitive
  • Object
show all
Defined in:
lib/rex/proto/amqp/version_0_9_1/types.rb,
lib/rex/proto/amqp/version_0_9_1/types.rb

Overview

Compound Forward Declarations

Instance Method Summary collapse

Instance Method Details

#coerceHash<String, Object>

Coerce the table into a Ruby hash without the AMQP type metadata.

Returns:

  • (Hash<String, Object>)


149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/rex/proto/amqp/version_0_9_1/types.rb', line 149

def coerce
  content.map do |item|
    case item.data.data_type
    when 'A'.ord # field-array
      [item.name.to_s, item.data.data.coerce]
    when 'F'.ord # field-table
      [item.name.to_s, item.data.data.coerce]
    else
      [item.name.to_s, item.data.data.snapshot]
    end
  end.to_h
end

#getObject



138
139
140
# File 'lib/rex/proto/amqp/version_0_9_1/types.rb', line 138

def get
  self.content
end

#set(v) ⇒ Object



142
143
144
# File 'lib/rex/proto/amqp/version_0_9_1/types.rb', line 142

def set(v)
  self.content = v
end