lib/how_is.rb in how_is-10.0.0 vs lib/how_is.rb in how_is-11.0.0

- old
+ new

@@ -13,30 +13,40 @@ require 'how_is/analyzer' require 'how_is/report' DEFAULT_FORMAT = :html + ## + # Generate a report file. def self.generate_report_file(report:, **kw_args) analysis = self.generate_analysis(**kw_args) - Report.export!(analysis, report) + Report.export_file(analysis, report) end + ## + # Generates and returns a report as a String. def self.generate_report(format:, **kw_args) analysis = self.generate_analysis(**kw_args) Report.export(analysis, format) end + ## + # Returns a list of possible export formats. def self.supported_formats report_constants = HowIs.constants.grep(/.Report/) - [:BaseReport] report_constants.map {|x| x.to_s.split('Report').first.downcase } end + ## + # Returns whether or not the specified +file+ can be exported to. def self.can_export_to?(file) + # TODO: Check if the file is writable? supported_formats.include?(file.split('.').last) end + # Generate an analysis. Used internally for generate_report{,_file}. Contract C::KeywordArgs[repository: String, from: C::Optional[C::Or[String, nil]], fetcher: C::Optional[Class], analyzer: C::Optional[Class], github: C::Optional[C::Any]] => C::Any