I've found it weird that String#hex in Ruby doesn't return the right hex value for a given char. I might be misunderstanding the method, but take the following example:

'a'.hex
=> 10

Whereas the right hex value for 'a' would be 61:

'a'.unpack('H*')
=> 61

Am I missing something? What's hex for? Any hints appreciated!

Thanks

Edit
Report