Class: Parser::Diagnostic::Engine
- Inherits:
-
Object
- Object
- Parser::Diagnostic::Engine
- Defined in:
- lib/parser/diagnostic/engine.rb
Instance Attribute Summary collapse
-
#all_errors_are_fatal ⇒ Object
Returns the value of attribute all_errors_are_fatal.
-
#consumer ⇒ Object
Returns the value of attribute consumer.
-
#ignore_warnings ⇒ Object
Returns the value of attribute ignore_warnings.
Instance Method Summary collapse
-
#initialize(consumer = nil) ⇒ Engine
constructor
A new instance of Engine.
- #process(diagnostic) ⇒ Object
Constructor Details
#initialize(consumer = nil) ⇒ Engine
Returns a new instance of Engine.
9 10 11 12 13 14 |
# File 'lib/parser/diagnostic/engine.rb', line 9 def initialize(consumer=nil) @consumer = consumer @all_errors_are_fatal = false @ignore_warnings = false end |
Instance Attribute Details
#all_errors_are_fatal ⇒ Object
Returns the value of attribute all_errors_are_fatal.
6 7 8 |
# File 'lib/parser/diagnostic/engine.rb', line 6 def all_errors_are_fatal @all_errors_are_fatal end |
#consumer ⇒ Object
Returns the value of attribute consumer.
4 5 6 |
# File 'lib/parser/diagnostic/engine.rb', line 4 def consumer @consumer end |
#ignore_warnings ⇒ Object
Returns the value of attribute ignore_warnings.
7 8 9 |
# File 'lib/parser/diagnostic/engine.rb', line 7 def ignore_warnings @ignore_warnings end |
Instance Method Details
#process(diagnostic) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/parser/diagnostic/engine.rb', line 16 def process(diagnostic) if ignore?(diagnostic) # do nothing elsif @consumer @consumer.call(diagnostic) end if raise?(diagnostic) raise Parser::SyntaxError, diagnostic. end self end |