Method: Flt::Bytes#to_hex
- Defined in:
- lib/float-formats/bytes.rb
#to_hex(sep_bytes = false) ⇒ Object
return an hex representation of a byte string
154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/float-formats/bytes.rb', line 154 def to_hex(sep_bytes=false) hx = @bytes.unpack('H*')[0].upcase if sep_bytes sep = "" (0...hx.size).step(2) do |i| sep << " " unless i==0 sep << hx[i,2] end hx = sep end hx end |