Class: Attractor::JsCalculator
- Inherits:
-
BaseCalculator
- Object
- BaseCalculator
- Attractor::JsCalculator
- Defined in:
- lib/attractor/calculators/js_calculator.rb
Instance Method Summary collapse
- #calculate ⇒ Object
-
#initialize(file_prefix: '', ignores: '', minimum_churn_count: 3, start_ago: 365 * 5, verbose: false) ⇒ JsCalculator
constructor
A new instance of JsCalculator.
Constructor Details
#initialize(file_prefix: '', ignores: '', minimum_churn_count: 3, start_ago: 365 * 5, verbose: false) ⇒ JsCalculator
Returns a new instance of JsCalculator.
5 6 7 8 |
# File 'lib/attractor/calculators/js_calculator.rb', line 5 def initialize(file_prefix: '', ignores: '', minimum_churn_count: 3, start_ago: 365 * 5, verbose: false) super(file_prefix: file_prefix, ignores: ignores, file_extension: '(js|jsx)', minimum_churn_count: minimum_churn_count, start_ago: start_ago, verbose: verbose) @type = "JavaScript" end |
Instance Method Details
#calculate ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/attractor/calculators/js_calculator.rb', line 10 def calculate super do |change| complexity, details = JSON.parse(`node #{__dir__}/../../../dist/calculator.bundle.js #{Dir.pwd}/#{change[:file_path]}`) [complexity, details] end end |