From: "matz (Yukihiro Matsumoto) via ruby-dev" Date: 2023-10-12T04:21:47+00:00 Subject: [ruby-dev:52052] [Ruby master Feature#18573] Object#pack1 Issue #18573 has been updated by matz (Yukihiro Matsumoto). Array.pack1 is unlikely because there is no connection between the responsibilities of the method and the Array class. I also disagree with String.pack1 for the same reason. The most natural candidate is Object#pack1, but I question the need to pollute the namespace for this trivial method. Matz. ---------------------------------------- Feature #18573: Object#pack1 https://bugs.ruby-lang.org/issues/18573#change-104876 * Author: os (Shigeki OHARA) * Status: Open * Priority: Normal ---------------------------------------- # ������ String#unpack1 ��������� Object#pack1 ��������������� # ������ Array#pack ������������������������������������������������������������ Array ��������������� 1 ��������������������������������������������� ``` ruby [codepoint].pack('U') [digest].pack('m0') [mail_body].pack('M') [ip_address].pack('N') ``` ������������������������������������������������������������������������������������������ ��������������������������������������������������������������������������������������� Array ������������������������������������������������������������������������������ # ������ String#unpack ������������ String#unpack1 ������������������������������������������ Array#pack ������������ Object#pack1 ������������������������������������������ ��������������������������������������������������������������������� ``` ruby class Object def pack1(template, option = {}) [self].pack(template, **option) end end ``` # ��������������� * Object ��������������������������������������������������������������������� * ������������������ pack1 ������������������������������������������������������������������������������������������ -- https://bugs.ruby-lang.org/