class Easy::Matchers::Validations::ValidateNumericalityOfMatcher
Public Class Methods
new(attributes)
click to toggle source
Calls superclass method
Easy::Matchers::BaseValidationMatcher::new
# File lib/matchers/validations/numericality_of.rb, line 9 def initialize(attributes) super(attributes, :numericality) end
Public Instance Methods
allow_blank(value = true)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 54 def allow_blank(value = true) options[:allow_blank] = value self end
allow_nil(value = true)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 49 def allow_nil(value = true) options[:allow_nil] = value self end
description()
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 25 def description "require #{ attributes.join(', ') } to be numeric" end
even(value = true)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 99 def even(value = true) options[:even] = value self end
if(symbol_name)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 34 def if(symbol_name) options[:if] = symbol_name self end
is_equal_to(value)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 79 def is_equal_to(value) options[:equal_to] = value self end
is_greater_than(value)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 69 def is_greater_than(value) options[:greater_than] = value self end
is_greater_than_or_equal_to(value)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 74 def is_greater_than_or_equal_to(value) options[:greater_than_or_equal_to] = value self end
is_less_than(value)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 84 def is_less_than(value) options[:less_than] = value self end
is_less_than_or_equal_to(value)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 89 def is_less_than_or_equal_to(value) options[:less_than_or_equal_to] = value self end
is_other_than(value)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 94 def is_other_than(value) options[:other_than] = value self end
matches?(subject)
click to toggle source
Calls superclass method
Easy::Matchers::BaseValidationMatcher#matches?
# File lib/matchers/validations/numericality_of.rb, line 13 def matches?(subject) super(subject) matched_validator = class_name.validators.detect do |validator| validator.kind == type && validator.attributes.sort == attributes.sort && validator.options.sort == options.sort end true if matched_validator end
odd(value = true)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 104 def odd(value = true) options[:odd] = value self end
on(context)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 44 def on(context) options[:on] = context self end
only_integer(value = true)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 64 def only_integer(value = true) options[:only_integer] = value self end
strict(value)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 59 def strict(value) options[:strict] = value self end
unless(symbol_name)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 39 def unless(symbol_name) options[:unless] = symbol_name self end
with_message(message)
click to toggle source
# File lib/matchers/validations/numericality_of.rb, line 29 def with_message(message) options[:message] = message self end