Sha256: d47a4df29487554dc6bb398dc47e12ef03108f36c8a0bfc5e69e06a92f39287d

Contents?: true

Size: 430 Bytes

Versions: 8

Compression:

Stored size: 430 Bytes

Contents

module Monolens
  class ErrorHandler
    include Enumerable

    def initialize
      @errors = []
    end

    def call(error)
      @errors << error
    end

    def each(&bl)
      @errors.each(&bl)
    end

    def size
      @errors.size
    end

    def empty?
      @errors.empty?
    end

    def report
      @errors
        .map{|err| "[#{err.location.join('/')}] #{err.message}" }
        .join("\n")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
monolens-0.6.4 lib/monolens/error_handler.rb
monolens-0.6.3 lib/monolens/error_handler.rb
monolens-0.6.2 lib/monolens/error_handler.rb
monolens-0.6.1 lib/monolens/error_handler.rb
monolens-0.6.0 lib/monolens/error_handler.rb
monolens-0.5.3 lib/monolens/error_handler.rb
monolens-0.5.2 lib/monolens/error_handler.rb
monolens-0.5.1 lib/monolens/error_handler.rb