Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def address_to_nary(str, n)
- str.split(".").map{|e| e.to_i.to_s(n)}
- end
- def address_to_binary(str)
- address_to_nary(str, 2)
- end
- def address_to_hex(str)
- address_to_nary(str, 16)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement