Class: Skunk::Generator::Json::Simple
- Inherits:
-
Object
- Object
- Skunk::Generator::Json::Simple
- Defined in:
- lib/skunk/generators/json/simple.rb
Overview
Generates a JSON report for the analysed modules.
Constant Summary collapse
- FILE_NAME =
"skunk_report.json"
Instance Method Summary collapse
- #data ⇒ Object
- #file_directory ⇒ Object
- #file_pathname ⇒ Object
-
#initialize(analysed_modules) ⇒ Simple
constructor
A new instance of Simple.
- #render ⇒ Object
Constructor Details
#initialize(analysed_modules) ⇒ Simple
Returns a new instance of Simple.
12 13 14 |
# File 'lib/skunk/generators/json/simple.rb', line 12 def initialize(analysed_modules) @analysed_modules = analysed_modules end |
Instance Method Details
#data ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/skunk/generators/json/simple.rb', line 22 def data { analysed_modules_count: analysed_modules_count, skunk_score_total: skunk_score_total, skunk_score_average: calculate_average, worst_pathname: find_worst_module&.pathname, worst_score: find_worst_module&.skunk_score, files: build_files } end |
#file_directory ⇒ Object
33 34 35 |
# File 'lib/skunk/generators/json/simple.rb', line 33 def file_directory @file_directory ||= Pathname.new(RubyCritic::Config.root) end |
#file_pathname ⇒ Object
37 38 39 |
# File 'lib/skunk/generators/json/simple.rb', line 37 def file_pathname Pathname.new(file_directory).join(FILE_NAME) end |
#render ⇒ Object
18 19 20 |
# File 'lib/skunk/generators/json/simple.rb', line 18 def render JSON.dump(data) end |