dm-validations/lib/dm-validations/generic_validator.rb
# Determine if this validator should be run against the target
#
# ==== Parameters
#   target<Object>:: the resource that we check against
#
# ==== Returns
# <Boolean>:: TRUE if should be run otherwise FALSE
#
Determine if this validator should be run against the target
Parameters
target:: the resource that we check against

Returns
:: TRUE if should be run otherwise FALSE
Determine if this validator should be run against the target Parameters target :: the resource that we check against Returns :: TRUE if should be run otherwise FALSE
def execute?(target)
        return true if self.if_clause.nil? && self.unless_clause.nil?
        if self.unless_clause
          if self.unless_clause.is_a?(Symbol)          
            return false if target.send(self.unless_clause)
          elsif self.unless_clause.respond_to?(:call)
            return false if self.unless_clause.call(target)
          end
        end
        if self.if_clause
          if self.if_clause.is_a?(Symbol)
            return target.send(self.if_clause)
          elsif self.if_clause.respond_to?(:call)
            return self.if_clause.call(target)
          end
        end
        return true
      end
def execute? ( target ) return true if self . if_clause . nil? && self . unless_clause . nil? if self . unless_clause if self . unless_clause . is_a? ( Symbol ) return false if target . send ( self . unless_clause ) elsif self . unless_clause . respond_to? ( :call ) return false if self . unless_clause . call ( target ) end end if self . if_clause if self . if_clause . is_a? ( Symbol ) return target . send ( self . if_clause ) elsif self . if_clause . respond_to? ( :call ) return self . if_clause . call ( target ) end end return true end
Determine if this validator should be run against the target
 Parameters
target<Object>:: the resource that we check against
Determine if this validator should be run against the target Parameters target<Object > :: the resource that we check against
target