module Myclear::Utils

Public Class Methods

binary_to_hex(str) click to toggle source
# File lib/myclear/utils.rb, line 11
def self.binary_to_hex(str)
  str.unpack("H*").first.upcase
end
hex_to_binary(str) click to toggle source
# File lib/myclear/utils.rb, line 15
def self.hex_to_binary(str)
  [str.downcase].pack("H*")
end
stringify_keys(hash) click to toggle source
# File lib/myclear/utils.rb, line 3
def self.stringify_keys(hash)
  new_hash = {}
  hash.each do |key, value|
    new_hash[(key.to_s rescue key) || key] = value
  end
  new_hash
end