Method: String#decode_hex

Defined in:
lib/pentex/core.rb

#decode_hexObject



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/pentex/core.rb', line 67

def decode_hex
# first normalize hex-string

s = self.gsub(/\\x/,'')
s.gsub!(/0x/,'')
s.gsub!(/\W/,'')
r = ''
0.step(s.length-1,2) do |x|
  r << s.slice(x,2).hex.chr
end
r
end