Class: LintTrappings::LinterPlugin
- Inherits:
-
Object
- Object
- LintTrappings::LinterPlugin
- Defined in:
- lib/lint_trappings/linter_plugin.rb
Overview
Represents a collection of linters/configuration which are loaded from a gem.
This is just a wrapper to make accessing files in the gem easier.
Instance Method Summary collapse
-
#config_file_path ⇒ String
Returns path to the configuration file that ships with this linter plugin.
-
#initialize(require_path) ⇒ LinterPlugin
constructor
A new instance of LinterPlugin.
- #load ⇒ Object
Constructor Details
#initialize(require_path) ⇒ LinterPlugin
Returns a new instance of LinterPlugin.
9 10 11 |
# File 'lib/lint_trappings/linter_plugin.rb', line 9 def initialize(require_path) @require_path = require_path end |
Instance Method Details
#config_file_path ⇒ String
Returns path to the configuration file that ships with this linter plugin.
Note that this may not exist if no configuration is shipped with the gem.
25 26 27 |
# File 'lib/lint_trappings/linter_plugin.rb', line 25 def config_file_path File.join(gem_dir, 'config.yaml') end |
#load ⇒ Object
13 14 15 16 17 18 |
# File 'lib/lint_trappings/linter_plugin.rb', line 13 def load require @require_path rescue LoadError, SyntaxError => ex raise LinterLoadError, "Unable to load linter plugin at path '#{@require_path}': #{ex.}" end |