Class: Guard::Eslint::Runner
- Inherits:
-
Object
- Object
- Guard::Eslint::Runner
- Defined in:
- lib/guard/eslint/runner.rb
Overview
This class runs ‘eslint` command, retrieves result and notifies. An instance of this class is intended to invoke `eslint` only once in its lifetime.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #failed_paths ⇒ Object
-
#initialize(options) ⇒ Runner
constructor
A new instance of Runner.
- #run(paths) ⇒ Object
Constructor Details
#initialize(options) ⇒ Runner
Returns a new instance of Runner.
11 12 13 |
# File 'lib/guard/eslint/runner.rb', line 11 def initialize() @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
15 16 17 |
# File 'lib/guard/eslint/runner.rb', line 15 def @options end |
Instance Method Details
#failed_paths ⇒ Object
33 34 35 |
# File 'lib/guard/eslint/runner.rb', line 33 def failed_paths result.reject { |f| f[:messages].empty? }.map { |f| f[:filePath] } end |
#run(paths) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/guard/eslint/runner.rb', line 17 def run(paths) paths = [:default_paths] unless paths passed = run_for_check(paths) case [:notification] when :failed notify(passed) unless passed when true notify(passed) end run_for_output(paths) passed end |