Hacked By AnonymousFox
--- !ruby/object:RI::MethodDescription
aliases: []
block_params:
comment:
- !ruby/struct:SM::Flow::P
body: Packs the contents of <em>arr</em> into a binary sequence according to the directives in <em>aTemplateString</em> (see the table below) Directives ``A,'' ``a,'' and ``Z'' may be followed by a count, which gives the width of the resulting field. The remaining directives also may take a count, indicating the number of array elements to convert. If the count is an asterisk (``<tt>*</tt>''), all remaining array elements will be converted. Any of the directives ``<tt>sSiIlL</tt>'' may be followed by an underscore (``<tt>_</tt>'') to use the underlying platform's native size for the specified type; otherwise, they use a platform-independent size. Spaces are ignored in the template string. See also <tt>String#unpack</tt>.
- !ruby/struct:SM::Flow::VERB
body: " a = [ "a", "b", "c" ]\n n = [ 65, 66, 67 ]\n a.pack("A3A3A3") #=> "a b c "\n a.pack("a3a3a3") #=> "a\\000\\000b\\000\\000c\\000\\000"\n n.pack("ccc") #=> "ABC"\n"
- !ruby/struct:SM::Flow::P
body: Directives for <tt>pack</tt>.
- !ruby/struct:SM::Flow::VERB
body: " Integer | Array |\n Directive | Element | Meaning\n ------------------------------------------------------------------------\n C | Integer | 8-bit unsigned integer (unsigned char)\n S | Integer | 16-bit unsigned integer, native endian (uint16_t)\n L | Integer | 32-bit unsigned integer, native endian (uint32_t)\n Q | Integer | 64-bit unsigned integer, native endian (uint64_t)\n | |\n c | Integer | 8-bit signed integer (char)\n s | Integer | 16-bit signed integer, native endian (int16_t)\n l | Integer | 32-bit signed integer, native endian (int32_t)\n q | Integer | 64-bit signed integer, native endian (int64_t)\n | |\n S_ | Integer | unsigned short, native endian\n I, I_ | Integer | unsigned int, native endian\n L_ | Integer | unsigned long, native endian\n | |\n s_ | Integer | signed short, native endian\n i, i_ | Integer | signed int, native endian\n l_ | Integer | signed long, native endian\n | |\n n | Integer | 16-bit unsigned integer, network (big-endian) byte order\n N | Integer | 32-bit unsigned integer, network (big-endian) byte order\n v | Integer | 16-bit unsigned integer, VAX (little-endian) byte order\n V | Integer | 32-bit unsigned integer, VAX (little-endian) byte order\n | |\n U | Integer | UTF-8 character\n w | Integer | BER-compressed integer\n\n Float | |\n Directive | | Meaning\n ------------------------------------------------------------------------\n D, d | Float | double-precision float, native format\n F, f | Float | single-precision float, native format\n E | Float | double-precision float, little-endian byte order\n e | Float | single-precision float, little-endian byte order\n G | Float | double-precision float, network (big-endian) byte order\n g | Float | single-precision float, network (big-endian) byte order\n\n String | |\n Directive | | Meaning\n ------------------------------------------------------------------------\n A | String | arbitrary binary string (space padded, count is width)\n a | String | arbitrary binary string (null padded, count is width)\n Z | String | same as ``a'', except that null is added with *\n B | String | bit string (MSB first)\n b | String | bit string (LSB first)\n H | String | hex string (high nibble first)\n h | String | hex string (low nibble first)\n u | String | UU-encoded string\n M | String | quoted printable, MIME encoding (see RFC2045)\n m | String | base64 encoded string (see RFC 2045, count is width)\n P | String | pointer to a structure (fixed-length string)\n p | String | pointer to a null-terminated string\n\n Misc. | |\n Directive | | Meaning\n ------------------------------------------------------------------------\n @ | --- | moves to absolute position\n X | --- | back up a byte\n x | --- | null byte\n"
full_name: Array#pack
is_singleton: false
name: pack
params: |
arr.pack ( aTemplateString ) -> aBinaryString
visibility: public
Hacked By AnonymousFox1.0, Coded By AnonymousFox