Sha256: 77ac3e88e0f518d25463994f926e71ffa4043888057c671712822930d2809319

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8

module Attestor

  # The exception to be raised when a validation fails
  class InvalidError < RuntimeError

    # @!scope class
    # @!method new(object, validations: nil, messages: [], context: :all)
    # Creates an exception for given object
    #
    # @param  [Object] object
    #   The invalid object
    # @option [Array<String>] :messages
    #   The list of validation error messages
    # @option [Symbol] :context
    #   The list of context for validation
    # @option [Array<Symbol>] :validations
    #   The list of all validations that was checked out
    #
    # @return [Attestor::InvalidError]

    # @private
    def initialize(object, messages = [])
      @object   = object
      @messages = messages.dup.freeze
      freeze
    end

    # @!attribute [r] object
    # The invalid object
    #
    # @return [Object]
    attr_reader :object

    # @!attribute [r] messages
    # The list of validation error messages
    #
    # @return [Array<String>]
    attr_reader :messages

  end # class InvalidError

end # module Attestor

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
attestor-0.2.0 lib/attestor/invalid_error.rb
attestor-0.1.0 lib/attestor/invalid_error.rb
attestor-0.0.1 lib/attestor/invalid_error.rb