Class: HastCI::ErrorCollector
- Inherits:
-
Object
- Object
- HastCI::ErrorCollector
- Defined in:
- lib/hastci/error_collector.rb
Instance Method Summary collapse
- #first_error ⇒ Object
-
#initialize ⇒ ErrorCollector
constructor
A new instance of ErrorCollector.
- #report(error) ⇒ Object
Constructor Details
#initialize ⇒ ErrorCollector
Returns a new instance of ErrorCollector.
5 6 7 8 |
# File 'lib/hastci/error_collector.rb', line 5 def initialize @mutex = Mutex.new @errors = [] end |
Instance Method Details
#first_error ⇒ Object
14 15 16 |
# File 'lib/hastci/error_collector.rb', line 14 def first_error @mutex.synchronize { @errors.first } end |
#report(error) ⇒ Object
10 11 12 |
# File 'lib/hastci/error_collector.rb', line 10 def report(error) @mutex.synchronize { @errors << error unless @errors.any? } end |