Class: FoodCritic::ErrorChecker
- Inherits:
-
Ripper::SexpBuilder
- Object
- Ripper::SexpBuilder
- FoodCritic::ErrorChecker
- Defined in:
- lib/foodcritic/error_checker.rb
Overview
Expose if any errors are found in parsing
Class Method Summary collapse
-
.register_error_handlers ⇒ Object
Register with all available error handlers.
Instance Method Summary collapse
-
#error? ⇒ Boolean
Was an error encountered during parsing?.
-
#initialize(*args) ⇒ ErrorChecker
constructor
Create a new instance of ErrorChecker.
Constructor Details
#initialize(*args) ⇒ ErrorChecker
Create a new instance of ErrorChecker
7 8 9 10 |
# File 'lib/foodcritic/error_checker.rb', line 7 def initialize(*args) super(*args) @found_error = false end |
Class Method Details
.register_error_handlers ⇒ Object
Register with all available error handlers.
18 19 20 21 22 23 |
# File 'lib/foodcritic/error_checker.rb', line 18 def self.register_error_handlers error_methods = SexpBuilder.public_instance_methods.grep(/^on_.*_error$/) error_methods.sort.each do |err_meth| define_method(err_meth) { |*| @found_error = true } end end |
Instance Method Details
#error? ⇒ Boolean
Was an error encountered during parsing?
13 14 15 |
# File 'lib/foodcritic/error_checker.rb', line 13 def error? @found_error end |