<commit_before>require 'how_is/report/base_report'

class HowIs
  class JsonReport < BaseReport
    def format
      :json
    end

    def export
      to_json
    end

    def export_file(file)
      File.open(file, 'w') do |f|
        f.write export
      end
    end
  end
end<commit_msg>Document methods and classes in lib/how_is/report/json.rb.<commit_after>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
{'fraction_non_alphanumeric': 0.07733619763694952, 'fraction_numerical': 0.0, 'mean_word_length': 2.0860927152317883, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7358974', 'n_tokens_mistral': 305, 'n_tokens_neox': 299, 'n_words': 98}