module Noteshred::Tools
Public Class Methods
decode_utf8(string)
click to toggle source
# File lib/noteshred/tools.rb, line 8 def self.decode_utf8(string) Base64.decode64(string.encode('ascii-8bit')).force_encoding('utf-8') end
encode_utf8(string)
click to toggle source
# File lib/noteshred/tools.rb, line 4 def self.encode_utf8(string) Base64.encode64(string).encode('utf-8') end
hashify(obj)
click to toggle source
# File lib/noteshred/tools.rb, line 12 def self.hashify(obj) obj.instance_variables.each_with_object({}) { |var, hsh| hsh[var.to_s.delete("@")] = obj.instance_variable_get(var) } end