lib/how_is/analyzer.rb in how_is-15.0.0 vs lib/how_is/analyzer.rb in how_is-16.0.0
- old
+ new
@@ -52,14 +52,11 @@
)
end
##
# Generates an analysis from a JSON report.
- def from_file(file)
- extension = file.split('.').last
- raise UnsupportedImportFormat, extension unless extension == 'json'
-
- hash = JSON.parse(open(file).read)
+ def self.from_json(json)
+ hash = JSON.parse(json)
hash = hash.map do |k, v|
v = DateTime.parse(v) if k.end_with?('_date')
[k, v]
end.to_h