I have a situation where I need to convert a binary value to hex in Ruby. My situation is as follows:
When bin = "0000111", my output should be: hex = "07".
When bin = "010001111", my output should be: hex = "08f".
Could someone help me out on how to do this? Thanks in advance.