Sha256: 67b1dc3c6338046b94556e4a4fb3941cdb37106fb99f34ab070a8d2ca7674018
Contents?: true
Size: 410 Bytes
Versions: 8
Compression:
Stored size: 410 Bytes
Contents
module Imb # @!group Internal # Numeric conversions module NumericConversions # Convert a numeric to an array of at least +min_bytes+ bytes. # @param [Numeric] n # @param [Integer] min_bytes # @return [[Integer]] Array of bytes def numeric_to_bytes(n, min_bytes=0) n.to_s(16).rjust(2 * min_bytes, '0').scan(/../).map do |s| s.to_i(16) end end end end
Version data entries
8 entries across 7 versions & 2 rubygems