Sha256: 202466bbfbf3bf0b6092c72f682e53e02a65e0e71ff050045bb9087a22336d78
Contents?: true
Size: 609 Bytes
Versions: 1
Compression:
Stored size: 609 Bytes
Contents
module Imb # @!group Internal # Numeric conversions module NumericConversions # Convert a numeric to an array of at least +min_bytes+ bytes. If # the resulting array is larger than is needed, then the most # significant bytes are zero padded. # # @param n [Numeric] The number to convert. # @param min_bytes [Integer] The minimum number of bytes to return # @return [Array<Integer>] Array of bytes between 0 and 255 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
usps_intelligent_barcode-1.0.0 | lib/usps_intelligent_barcode/numeric_conversions.rb |