Sha256: b19b9ba64184170dbfa0852f0f6eab1a93f280faab4885f6674ec5cb43871f2e

Contents?: true

Size: 599 Bytes

Versions: 3

Compression:

Stored size: 599 Bytes

Contents

# frozen_string_literal: true

require "how_is/report/base_report"

class HowIs
  ##
  # A JSON report.
  class JsonReport < BaseReport
    # A JSON report is simply a JSON dump of the corresponding
    # HowIs::Analysis instance.

    ##
    # The format of the report.
    #
    # @return [Symbol] The name of the format.
    def format
      :json
    end

    ##
    # Generates a report.
    def export
      to_json
    end

    ##
    # Generates a report and writes it to a file.
    def export_file(file)
      File.open(file, "w") do |f|
        f.write export
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
how_is-19.0.0 lib/how_is/report/json.rb
how_is-18.1.0 lib/how_is/report/json.rb
how_is-18.0.5 lib/how_is/report/json.rb