Sha256: 6bcf10fa33b015035fb5c6a60f38703fa451a152bcef588f594e89bf76447ee4

Contents?: true

Size: 846 Bytes

Versions: 4

Compression:

Stored size: 846 Bytes

Contents

require_relative '../display'

require 'json'

module OctocatalogDiff
  module CatalogDiff
    class Display
      # Display the output from a diff in JSON format.
      class Json < OctocatalogDiff::CatalogDiff::Display
        # Generate JSON representation of the 'diff' suitable for further analysis.
        # @param diff [Array<Diff results>] The diff which *must* be in this format
        # @param options [Hash] Options which are:
        #           - :header => [String] Header to print; no header is printed if not specified
        # @param _logger [Logger] Not used here
        def self.generate(diff, options = {}, _logger = nil)
          result = {
            'diff' => diff
          }
          result['header'] = options[:header] unless options[:header].nil?
          result.to_json
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
octocatalog-diff-0.5.6 lib/octocatalog-diff/catalog-diff/display/json.rb
octocatalog-diff-0.5.4 lib/octocatalog-diff/catalog-diff/display/json.rb
octocatalog-diff-0.5.3 lib/octocatalog-diff/catalog-diff/display/json.rb
octocatalog-diff-0.5.1 lib/octocatalog-diff/catalog-diff/display/json.rb