Class: RabbitMQ::FFI::Method Private
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- RabbitMQ::FFI::Method
- Defined in:
- lib/rabbitmq/ffi.rb,
lib/rabbitmq/ffi/ext/method.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- MethodClasses =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
FFI::MethodNumber.symbols.map do |name| const_name = name.to_s.gsub(/((?:\A\w)|(?:_\w))/) { |x| x[-1].upcase } [name, FFI.const_get(const_name)] end.to_h.freeze
- MethodNames =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
MethodClasses.to_a.map(&:reverse).to_h.freeze
Class Method Summary collapse
- .from(decoded) ⇒ Object private
- .has_content?(type) ⇒ Boolean private
- .lookup(kls) ⇒ Object private
- .lookup_class(name) ⇒ Object private
Instance Method Summary collapse
- #decoded ⇒ Object private
- #to_h(free = false) ⇒ Object private
Class Method Details
.from(decoded) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 33 34 35 |
# File 'lib/rabbitmq/ffi/ext/method.rb', line 30 def self.from(decoded) obj = new obj[:id] = lookup(decoded.class) obj[:decoded] = decoded.pointer obj end |
.has_content?(type) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 40 41 42 43 44 45 |
# File 'lib/rabbitmq/ffi/ext/method.rb', line 37 def self.has_content?(type) case type when :basic_publish; true when :basic_return; true when :basic_deliver; true when :basic_get_ok; true else false end end |
.lookup(kls) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
22 23 24 |
# File 'lib/rabbitmq/ffi/ext/method.rb', line 22 def self.lookup(kls) MethodNames.fetch(kls) end |
.lookup_class(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/rabbitmq/ffi/ext/method.rb', line 26 def self.lookup_class(name) MethodClasses.fetch(name) end |
Instance Method Details
#decoded ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 |
# File 'lib/rabbitmq/ffi/ext/method.rb', line 18 def decoded MethodClasses.fetch(self[:id]).new(self[:decoded]) end |
#to_h(free = false) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 16 |
# File 'lib/rabbitmq/ffi/ext/method.rb', line 13 def to_h(free=false) { method: self[:id], properties: self.decoded.to_h(free) } end |