Class: Integer
Instance Method Summary collapse
-
#to_hex_string(pack = false) ⇒ Object
Return a copy of the integer in base 16.
Instance Method Details
#to_hex_string(pack = false) ⇒ Object
Return a copy of the integer in base 16. The pack argument determines whether or not the value should be packed to binary form using Array::pack().
6 7 8 9 10 11 12 13 14 |
# File 'lib/aastdlib/integer.rb', line 6 def to_hex_string(pack=false) out = self.to_s(16) out = ("0"+out) if out.length == 1 out = [out].pack('H*') if pack return out end |