Class: CI::Syntax::Tool::Language::Base
- Inherits:
-
Object
- Object
- CI::Syntax::Tool::Language::Base
- Defined in:
- lib/ci-syntax-tool/language/base.rb
Overview
CI::Syntax::Tool::Language::Base
Base class for syntax checkers. Sketches out the
API you need if you want to add a language.
Class Method Summary collapse
Instance Method Summary collapse
-
#check_ending(_result) ⇒ Object
Called once after all files are checked Use for cleanup, or adding metadata to the result.
-
#check_file(_file_result) ⇒ Object
Called once for each file being checked.
-
#check_starting(_lang_result) ⇒ Object
Called once before any files are checked An opportunity to spawn a process, for example.
-
#combined_globs ⇒ Object
The globs that will actually be expanded.
-
#default_globs ⇒ Object
The globs you are interested in - you must override this to match any files.
-
#initialize(args) ⇒ Base
constructor
Args is a hash, contents unspecified as yet.
Constructor Details
#initialize(args) ⇒ Base
Args is a hash, contents unspecified as yet.
11 12 |
# File 'lib/ci-syntax-tool/language/base.rb', line 11 def initialize(args) end |
Class Method Details
.descendant_classes ⇒ Object
14 15 16 17 |
# File 'lib/ci-syntax-tool/language/base.rb', line 14 def self.descendant_classes # Fairly expensive call... ObjectSpace.each_object(Class).select { |klass| klass < self } end |
Instance Method Details
#check_ending(_result) ⇒ Object
Called once after all files are checked Use for cleanup, or adding metadata to the result. result [Language::Result] - populated results of the run.
49 50 |
# File 'lib/ci-syntax-tool/language/base.rb', line 49 def check_ending(_result) end |
#check_file(_file_result) ⇒ Object
Called once for each file being checked.
file_result [Result::File] - Results object for the outcome. Returns: Result::File
40 41 42 |
# File 'lib/ci-syntax-tool/language/base.rb', line 40 def check_file(_file_result) fail end |
#check_starting(_lang_result) ⇒ Object
Called once before any files are checked An opportunity to spawn a process, for example.
34 35 |
# File 'lib/ci-syntax-tool/language/base.rb', line 34 def check_starting(_lang_result) end |
#combined_globs ⇒ Object
The globs that will actually be expanded. You probably don’t need to override this.
21 22 23 |
# File 'lib/ci-syntax-tool/language/base.rb', line 21 def combined_globs default_globs end |
#default_globs ⇒ Object
The globs you are interested in - you must override this to match any files. Will be fed to Dir.glob().
28 29 30 |
# File 'lib/ci-syntax-tool/language/base.rb', line 28 def default_globs [] end |