def to_h
      results = {}
      defaults = @config["default_reports"] || {}

      @config["repositories"].map { |repo_config|
        repo = repo_config["repository"]
        config = config_for(repo)

        config["reports"].map { |format, report_config|
          # Sometimes report_data has unused keys, which generates a warning, but
          # we're okay with it, so we wrap it with silence_warnings {}.
          filename = silence_warnings {
            tmp_filename = report_config["filename"] || defaults[format]["filename"]
            tmp_filename % metadata(repo)
          }

          directory = report_config["directory"] || defaults[format]["directory"]
          file = File.join(directory, filename)

          # Export +report+ to the specified +format+ with the specified
          # +frontmatter+.
          frontmatter = report_config["frontmatter"] || {}
          if defaults.has_key?(format) && defaults[format].has_key?("frontmatter")
            frontmatter = defaults[format]["frontmatter"].merge(frontmatter)
          end
          frontmatter = nil if frontmatter == {}

          export = @reports[repo].send("to_#{format}", frontmatter)

          results[file] = export
        }
      }
      results
    end
def to_h
      results = {}
      defaults = @config["default_reports"] || {}

      @config["repositories"].map { |repo_config|
        repo = repo_config["repository"]
        config = config_for(repo)

        config["reports"].map { |format, report_config|
          # Sometimes report_data has unused keys, which generates a warning, but
          # we're okay with it, so we wrap it with silence_warnings {}.
          filename = silence_warnings {
            tmp_filename = report_config["filename"] || defaults[format]["filename"]
            tmp_filename % metadata(repo)
          }

          directory = report_config["directory"] || defaults[format]["directory"]
          file = File.join(directory, filename)

          # Export +report+ to the specified +format+ with the specified
          # +frontmatter+.
          frontmatter = report_config["frontmatter"] || {}
          if defaults.has_key?(format) && defaults[format].has_key?("frontmatter")
            frontmatter = defaults[format]["frontmatter"].merge(frontmatter)
          end
          frontmatter = nil if frontmatter == {}

          export = @reports[repo].send("to_#{format}", frontmatter)

          results[file] = export
        }
      }
      results
    end
Converts a ReportCollection to a Hash.

 Also good for giving programmers nightmares, I suspect.