Class: Infrastructure::Formatters::YAML
- Defined in:
- lib/infrastructure/formatters/yaml.rb
Overview
transform hashes to YAML
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#format(hash) ⇒ String
12 13 14 |
# File 'lib/infrastructure/formatters/yaml.rb', line 12 def format(hash) "---\n#{hash.map { |k, v| "#{k}: '#{v.gsub(/['\n]/, "'" => "''", "\n" => '\\n')}'" }.join("\n")}\n" end |