Sha256: 5a6e360bd914f6b62c6cd21d95bb456f9b1be3591472ff8359be7a282b764e0e

Contents?: true

Size: 544 Bytes

Versions: 2

Compression:

Stored size: 544 Bytes

Contents

module ErrorContainer

  class Errors
    include Enumerable

    def initialize
      @container = []
    end

    def add(error_message)
      if @container.include?(error_message)
        @container
      else
        @container << error_message
      end
    end

    def each
      @container.each do |err|
        yield err
      end
    end

    def empty?
      @container.empty?
    end

    def clear
      @container.clear
    end

    def size
      @container.size
    end
  end

  def errors
    @errors ||= Errors.new
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
redlander-0.2.2 lib/redlander/error_container.rb
redlander-0.2.1 lib/redlander/error_container.rb