Module: HTTP2::PackingExtensions
- Included in:
- Framer, Header::Compressor, Header::Huffman
- Defined in:
- lib/http/2/extensions.rb
Overview
this mixin handles backwards-compatibility for the new packing options shipping with ruby 3.3 (see docs.ruby-lang.org/en/3.3/packed_data_rdoc.html)
Instance Method Summary collapse
Instance Method Details
#pack(array_to_pack, template, buffer:, offset: -1)) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/http/2/extensions.rb', line 47 def pack(array_to_pack, template, buffer:, offset: -1) packed_str = array_to_pack.pack(template) case offset when -1 append_str(buffer, packed_str) when 0 buffer.prepend(packed_str) else buffer.insert(offset, packed_str) end end |