module Helper

Public Instance Methods

write(filename, hash) click to toggle source
# File lib/encrypter_decrypter/helper.rb, line 4
  def write(filename, hash)
  File.open(filename, "w+") do |f|
    f.write(yaml(hash))
  end
end
yaml(hash) click to toggle source
# File lib/encrypter_decrypter/helper.rb, line 10
def yaml(hash)
  method = hash.respond_to?(:ya2yaml) ? :ya2yaml : :to_yaml
  string = hash.deep_stringify_keys.send(method)
  string.gsub("!ruby/symbol ", ":").sub("---","").split("\n").map(&:rstrip).join("\n").strip
end