lib/how_is.rb in how_is-2.0.0 vs lib/how_is.rb in how_is-3.0.0
- old
+ new
@@ -19,9 +19,18 @@
def self.generate_report(format:, **kw_args)
analysis = self.generate_analysis(**kw_args)
Report.export(analysis, format)
end
+
+ def self.supported_formats
+ report_constants = HowIs.constants.grep(/.Report/) - [:BaseReport]
+ report_constants.map {|x| x.to_s.split('Report').first.downcase }
+ end
+
+ def self.can_export_to?(file)
+ supported_formats.include?(file.split('.').last)
+ end
private
Contract C::KeywordArgs[repository: String,
from_file: C::Optional[C::Or[String, nil]],