dm-validations/lib/dm-validations/contextual_validators.rb
# Execute all validators in the named context against the target
#
# ==== Parameters
#
#   named_context<Symbol>::  - the context we are validating against
#   target<Object>::         - the resource that we are validating
#
# ==== Return Value
# <Boolean>:: - true if all is valid otherwise false
#
Execute all validators in the named context against the target
Parameters

named_context::  - the context we are validating against
target::         - the resource that we are validating

Return Value
:: - true if all is valid otherwise false
Execute all validators in the named context against the target Parameters named_context :: - the context we are validating against target :: - the resource that we are validating Return Value :: - true if all is valid otherwise false
def execute(named_context, target)
        target.errors.clear!
        result = true
        context(named_context).each do |validator|
          if validator.execute?(target)
            result = false if !validator.call(target)
          end
        end
        return result
      end
def execute ( named_context , target ) target . errors . clear! result = true context ( named_context ) . each do | validator | if validator . execute? ( target ) result = false if ! validator . call ( target ) end end return result end
Execute all validators in the named context against the target
 Parameters
Execute all validators in the named context against the target Parameters
named_context
target