Module: GorgonAMQ::Pack
- Defined in:
- lib/gorgon_amq-protocol/lib/gorgon_amq/pack.rb
Overview
Implements pack to/unpack from 64bit string in network byte order compatible with Ruby 1.8+.
Constant Summary collapse
- UINT64 =
"Q".freeze
- INT16 =
"c".freeze
Class Method Summary collapse
- .pack_int16_big_endian(short) ⇒ Object
- .pack_uint64_big_endian(long_long) ⇒ Object
- .unpack_int16_big_endian(data) ⇒ Object
- .unpack_uint64_big_endian(data) ⇒ Object
Class Method Details
.pack_int16_big_endian(short) ⇒ Object
21 22 23 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/pack.rb', line 21 def self.pack_int16_big_endian(short) [long_long].pack(INT16) end |
.pack_uint64_big_endian(long_long) ⇒ Object
13 14 15 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/pack.rb', line 13 def self.pack_uint64_big_endian(long_long) [long_long].pack(UINT64) end |
.unpack_int16_big_endian(data) ⇒ Object
25 26 27 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/pack.rb', line 25 def self.unpack_int16_big_endian(data) data.unpack(INT16) end |
.unpack_uint64_big_endian(data) ⇒ Object
17 18 19 |
# File 'lib/gorgon_amq-protocol/lib/gorgon_amq/pack.rb', line 17 def self.unpack_uint64_big_endian(data) data.unpack(UINT64) end |