Sha256: ff45fd76f9ab3b9c83c1551dc21b1a5b48f3f5bf35b02454d715403591850875

Contents?: true

Size: 703 Bytes

Versions: 8

Compression:

Stored size: 703 Bytes

Contents

module Bolt
  class Outputter
    def self.for_format(format)
      case format
      when 'human'
        Bolt::Outputter::Human.new
      when 'json'
        Bolt::Outputter::JSON.new
      when nil
        raise "Cannot use outputter before parsing."
      end
    end

    def initialize(stream = $stdout)
      @stream = stream
    end

    # This method replaces data types tha have the name 'Data'
    # with the string 'Any'
    # This was a problem when using 'bolt task show <task_name>'
    def replace_data_type(params)
      params.map do |_, v|
        v['type'] = 'Any' if v['type'].to_s == 'Data'
      end
    end
  end
end

require 'bolt/outputter/human'
require 'bolt/outputter/json'

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bolt-0.17.2 lib/bolt/outputter.rb
bolt-0.17.1 lib/bolt/outputter.rb
bolt-0.17.0 lib/bolt/outputter.rb
bolt-0.16.4 lib/bolt/outputter.rb
bolt-0.16.3 lib/bolt/outputter.rb
bolt-0.16.2 lib/bolt/outputter.rb
bolt-0.16.1 lib/bolt/outputter.rb
bolt-0.16.0 lib/bolt/outputter.rb