lib/whyvalidationssuckin96/attribute_based_validation.rb
# Performs the validation, returning true or false if the validation passes or fails,
# or nil if the validation will not run.
# @return [true, false, nil]
#
# @todo - this method is uuuuuuuugly
Performs the validation, returning true or false if the validation passes or fails,
or nil if the validation will not run.
Performs the validation returning true or false if the validation passes or fails or nil if the validation will not run .
def validates?
      if options[:array]
        return @passed = nil if skip_on_empty?
        return @passed = false if !skip_on_empty? && Array(validatable.send(options[:attribute])).empty?
        reset
        @pos = 0
        statuses = []
        while validating?
          status = super
          @pos += 1
          statuses << status
        end
        @passed = statuses.all?
      else
        super
      end
    end
def validates? if options [ :array ] return @passed = nil if skip_on_empty? return @passed = false if ! skip_on_empty? && Array ( validatable . send ( options [ :attribute ] ) ) . empty? reset @pos = 0 statuses = [ ] while validating? status = super @pos += 1 statuses << status end @passed = statuses . all? else super end end
Performs the validation, returning true or false if the validation passes or fails,
or nil if the validation will not run.
Performs the validation returning true or false if the validation passes or fails or nil if the validation will not run .
None
true, false, nil
todo
this method is uuuuuuuugly
this method is uuuuuuuugly