lib/how_is/analyzer.rb in how_is-17.0.0 vs lib/how_is/analyzer.rb in how_is-18.0.0

- old
+ new

@@ -19,11 +19,15 @@ super("Unsupported import format: #{format}") end end ## - # Generates and returns an analysis. + # Generates and returns an analysis.i + # + # @param data [Fetcher::Results] The results gathered by Fetcher. + # @param analysis_class (You don't need this.) A class to use instead of + # HowIs::Analysis. Contract Fetcher::Results, C::KeywordArgs[analysis_class: C::Optional[Class]] => Analysis def call(data, analysis_class: Analysis) issues = data.issues pulls = data.pulls @@ -51,13 +55,14 @@ pulse: data.pulse, ) end ## - # Generates an analysis from a JSON report. - def self.from_json(json) - hash = JSON.parse(json) - hash = hash.map do |k, v| + # Generates an analysis from a hash of report data. + # + # @param data [Hash] The hash to generate an Analysis from. + def self.from_hash(data) + hash = data.map do |k, v| v = DateTime.parse(v) if k.end_with?('_date') [k, v] end.to_h