Class: Browsable::Analyzers::Base
- Inherits:
-
Object
- Object
- Browsable::Analyzers::Base
- Defined in:
- lib/browsable/analyzers/base.rb
Overview
Base class for analyzers. An analyzer turns a list of files into Findings.
browsable owns no parsing or compat-data logic of its own: analyzers are thin adapters over Herb (in-process) or stylelint/eslint (shelled out).
Direct Known Subclasses
CSS, ERB, Javascript
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Class Method Summary collapse
-
.compat_data ⇒ Object
The bundled MDN browser-compat-data subset, parsed once and shared.
Instance Method Summary collapse
- #analyze(_files) ⇒ Array<Finding>
-
#initialize(target:, config:) ⇒ Base
constructor
A new instance of Base.
-
#required_tools ⇒ Object
External binaries this analyzer needs on PATH.
Constructor Details
#initialize(target:, config:) ⇒ Base
Returns a new instance of Base.
15 16 17 18 |
# File 'lib/browsable/analyzers/base.rb', line 15 def initialize(target:, config:) @target = target @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/browsable/analyzers/base.rb', line 13 def config @config end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
13 14 15 |
# File 'lib/browsable/analyzers/base.rb', line 13 def target @target end |
Class Method Details
Instance Method Details
#analyze(_files) ⇒ Array<Finding>
22 23 24 |
# File 'lib/browsable/analyzers/base.rb', line 22 def analyze(_files) raise NotImplementedError, "#{self.class} must implement #analyze" end |
#required_tools ⇒ Object
External binaries this analyzer needs on PATH. Empty for in-process ones.
27 |
# File 'lib/browsable/analyzers/base.rb', line 27 def required_tools = [] |