Class: HastCI::ErrorCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/hastci/error_collector.rb

Instance Method Summary collapse

Constructor Details

#initializeErrorCollector

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_errorObject



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