lowered shortcircuit to the base valid? so it works for everyone

This commit is contained in:
Gant
2014-08-21 14:29:45 -05:00
parent 24b6a19a4e
commit 7273fda935

View File

@@ -105,6 +105,11 @@ module RubyMotionQuery
end
def valid?(data, options={})
# shortcircuit if debugging
return true if RubyMotionQuery::RMQ.debugging?
# shortcircuit for optionals
return true if (options[:allow_blank] && (data.nil? || data.empty?))
@options = options.merge(@options)
@valid_status = @rule.call(data, @options)
end
@@ -182,11 +187,6 @@ module RubyMotionQuery
#
# @return [Boolean]
def valid?(value, rule, options={})
# shortcircuit if debugging
return true if RubyMotionQuery::RMQ.debugging?
# shortcircuit for optionals
return true if (options[:allow_blank] && (value.nil? || value.empty?))
Validation.new(rule).valid?(value, options)
end