Module: ID3Tag::NumberUtil
- Defined in:
- lib/id3tag/number_util.rb
Constant Summary collapse
- FORMAT_FOR_8_BIT_SIGNED_INTEGER =
'c'- FORMAT_FOR_32BIT_INTEGER =
'N'
Class Method Summary collapse
- .convert_32bit_integer_to_string(integer) ⇒ Object
- .convert_string_to_32bit_integer(string) ⇒ Object
Class Method Details
.convert_32bit_integer_to_string(integer) ⇒ Object
10 11 12 |
# File 'lib/id3tag/number_util.rb', line 10 def self.convert_32bit_integer_to_string(integer) [integer].pack(FORMAT_FOR_32BIT_INTEGER) end |
.convert_string_to_32bit_integer(string) ⇒ Object
5 6 7 8 |
# File 'lib/id3tag/number_util.rb', line 5 def self.convert_string_to_32bit_integer(string) integers = string.unpack(FORMAT_FOR_32BIT_INTEGER) integers.first || raise(ArgumentError, "String: '#{string}' could not be decoded as 32-bit integer") end |