Sha256: 1df8dea0f93ef321ce1e77f16f678217c67eaa1c7aba8ef9f6ade97907e8ebb3

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

module DataMapper
  module Validations
    
    # All Validators should inherit from the GenericValidator.
    class GenericValidator
    
      # Adds an error message to the target class.
      def add_error(target, message, attribute = :base)
        target.errors.add(attribute, message)
      end
      
      # Call the validator. We use "call" so the operation
      # is BoundMethod and Block compatible.
      # The result should always be TRUE or FALSE.
      def call(target)
        raise 'You must overwrite this method'
      end
      
    end
        
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datamapper-0.2.3 lib/data_mapper/validations/generic_validator.rb