Sha256: 600b32f7b44d6eb4f080ee247998af98c0315540c5c57412371b616bf1b0fb98

Contents?: true

Size: 378 Bytes

Versions: 1

Compression:

Stored size: 378 Bytes

Contents

module MicroValidator
  class Errors
    def add(attribute, message)
      errors[attribute] ||= []
      errors[attribute] << message
    end

    def clear
      @errors = {}
    end

    def empty?
      errors.empty?
    end

    def all
      @errors
    end

    def field(name)
      @errors[name]
    end

  private
    def errors
      @errors ||= {}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
micro_validator-0.0.2 lib/micro_validator/errors.rb