Class: Envault::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/envault/formatter.rb

Class Method Summary collapse

Class Method Details

.escape_yaml(hash, quote = true) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/envault/formatter.rb', line 3

def self.escape_yaml(hash, quote = true)
  lines = []
  hash.map do |k, v|
    lines << %Q{#{k}: #{quote ? v.inspect : v}}
  end
  lines.join("\n")
end

.write_escape_yaml(path, hash, quote = true) ⇒ Object



11
12
13
# File 'lib/envault/formatter.rb', line 11

def self.write_escape_yaml(path, hash, quote = true)
  File.write(path, escape_yaml(hash))
end