Class: Monolens::ErrorHandler
- Inherits:
-
Object
- Object
- Monolens::ErrorHandler
- Includes:
- Enumerable
- Defined in:
- lib/monolens/error_handler.rb
Instance Method Summary collapse
- #call(error) ⇒ Object
- #each(&bl) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ ErrorHandler
constructor
A new instance of ErrorHandler.
- #report ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize ⇒ ErrorHandler
Returns a new instance of ErrorHandler.
5 6 7 |
# File 'lib/monolens/error_handler.rb', line 5 def initialize @errors = [] end |
Instance Method Details
#call(error) ⇒ Object
9 10 11 |
# File 'lib/monolens/error_handler.rb', line 9 def call(error) @errors << error end |
#each(&bl) ⇒ Object
13 14 15 |
# File 'lib/monolens/error_handler.rb', line 13 def each(&bl) @errors.each(&bl) end |
#empty? ⇒ Boolean
21 22 23 |
# File 'lib/monolens/error_handler.rb', line 21 def empty? @errors.empty? end |
#report ⇒ Object
25 26 27 28 29 |
# File 'lib/monolens/error_handler.rb', line 25 def report @errors .map{|err| "[#{err.location.join('/')}] #{err.}" } .join("\n") end |
#size ⇒ Object
17 18 19 |
# File 'lib/monolens/error_handler.rb', line 17 def size @errors.size end |