Class: Lintrunner::Executor
- Inherits:
-
Object
- Object
- Lintrunner::Executor
- Defined in:
- lib/lintrunner/executor.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#plugin ⇒ Object
readonly
Returns the value of attribute plugin.
Instance Method Summary collapse
- #execute(filename, options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Executor
constructor
A new instance of Executor.
Constructor Details
#initialize(options = {}) ⇒ Executor
Returns a new instance of Executor.
7 8 9 10 11 |
# File 'lib/lintrunner/executor.rb', line 7 def initialize( = {}) @command = [:command] @parser = [:parser] @plugin = [:plugin] end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
5 6 7 |
# File 'lib/lintrunner/executor.rb', line 5 def command @command end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
5 6 7 |
# File 'lib/lintrunner/executor.rb', line 5 def parser @parser end |
#plugin ⇒ Object (readonly)
Returns the value of attribute plugin.
5 6 7 |
# File 'lib/lintrunner/executor.rb', line 5 def plugin @plugin end |
Instance Method Details
#execute(filename, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/lintrunner/executor.rb', line 13 def execute(filename, = {}) if command && parser output = `#{command} #{filename} 2>/dev/null` exit_code = $?.exitstatus parser.parse(output, exit_code, ) elsif plugin plugin.new(filename).run() end end |