Sha256: ce58f83699fd701ac6908b7b4b71ea836413dcab3c56204ae9e46d8201aab730
Contents?: true
Size: 637 Bytes
Versions: 1
Compression:
Stored size: 637 Bytes
Contents
module Shoulda module Matchers module ActiveModel module NumericalityMatchers # @private class EvenNumberMatcher < NumericTypeMatcher NON_EVEN_NUMBER_VALUE = 1 def initialize(attribute, options = {}) @attribute = attribute @disallow_value_matcher = DisallowValueMatcher.new(NON_EVEN_NUMBER_VALUE.to_s). for(@attribute). with_message(:even) end def allowed_type 'even numbers' end def diff_to_compare 2 end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoulda-matchers-3.0.0 | lib/shoulda/matchers/active_model/numericality_matchers/even_number_matcher.rb |