Created
November 20, 2009 14:27
-
-
Save mkristian/239534 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if RUBY_PLATFORM =~ /java/ | |
module DataMapper | |
module Validate | |
class NumericValidator | |
def validate_with_comparison(value, cmp, expected, error_message_name, errors, negated = false) | |
return if expected.nil? | |
if cmp == :=~ | |
return value =~ expected | |
end | |
comparison = value.send(cmp, expected) | |
return if negated ? !comparison : comparison | |
errors << ValidationErrors.default_error_message(error_message_name, field_name, expected) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment