require 'dionysus' require 'active_support/base64' ## # Adds string encoding convenience methods. # # require 'dionysus/string' class String ## # Encode the Base64 (without newlines) def encode64s() Base64.encode64s(self); end ## # Encode to Base 64 def encode64() Base64.encode64(self); end ## # Decode from Base 64 def decode64() Base64.decode64(self); end ## # Encode to hexidecimal def encodeHexidecimal() self.unpack('H*').first; end alias_method :encodeHex, :encodeHexidecimal ## # Decode from hexidecimal def decodeHexidecimal() [self].pack('H*'); end alias_method :decodeHex, :decodeHexidecimal end