Class: Trixie::Formatter
- Inherits:
-
Object
- Object
- Trixie::Formatter
- Defined in:
- lib/trixie/formatter.rb
Overview
Inlcludes the possible formats to output the secrets and the main entrypoint with Formatter.for(format)
Constant Summary collapse
- FORMATTERS =
{ "env" => ->(secrets) { secrets.map { |secret| "#{secret["env"]}=#{secret["value"]}" }.join("\n") }, "sh" => ->(secrets) { secrets.map { |secret| "export #{secret["env"]}=#{secret["value"]}" }.join("\n") }, "json" => ->(secrets) { secrets.to_json }, "pretty_json" => ->(secrets) { JSON.pretty_generate(secrets) } }.freeze
Class Method Summary collapse
Class Method Details
.for(format) ⇒ Object
13 14 15 |
# File 'lib/trixie/formatter.rb', line 13 def self.for(format) FORMATTERS[format] end |