Class: BinData::String

Inherits:
Object
  • Object
show all
Defined in:
lib/pio/monkey_patch/bindata_string.rb

Overview

Add BinData::String#to_bytes

Instance Method Summary collapse

Instance Method Details

#to_bytesObject



6
7
8
9
10
# File 'lib/pio/monkey_patch/bindata_string.rb', line 6

def to_bytes
  to_s.unpack('H*').pop.scan(/[0-9a-f]{2}/).map do |each|
    "0x#{each}"
  end.join(', ')
end