Sha256: e3d0a37db19114f963896419dd9be9da2fa1971ef0954e16a0570136a6565ce8

Contents?: true

Size: 628 Bytes

Versions: 5

Compression:

Stored size: 628 Bytes

Contents

module Redlander
  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
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
redlander-0.3.6 lib/redlander/error_container.rb
redlander-0.3.5 lib/redlander/error_container.rb
redlander-0.3.3 lib/redlander/error_container.rb
redlander-0.3.2 lib/redlander/error_container.rb
redlander-0.3.1 lib/redlander/error_container.rb