Sha256: 0e2163e6cbef3d867a119319c338e890108c27bfc8aaaa03b1a83a233940c449

Contents?: true

Size: 618 Bytes

Versions: 10

Compression:

Stored size: 618 Bytes

Contents

module Shoulda
  module Matchers
    module ActiveModel
      module NumericalityMatchers
        # @private
        class OddNumberMatcher < NumericTypeMatcher
          NON_ODD_NUMBER_VALUE  = 2

          def initialize(attribute, options = {})
            @attribute = attribute
            @disallow_value_matcher = DisallowValueMatcher.new(NON_ODD_NUMBER_VALUE).
                for(@attribute).
                with_message(:odd)
          end

          def allowed_type
            'odd numbers'
          end

          def diff_to_compare
            2
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/shoulda-matchers-2.8.0/lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb
shoulda-matchers-3.0.0.rc1 lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb
shoulda-matchers-2.8.0 lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb
shoulda-matchers-2.8.0.rc2 lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb
shoulda-matchers-2.8.0.rc1 lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb
shoulda-matchers-2.7.0 lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb
shoulda-matchers-2.6.2 lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb
mcmire-shoulda-matchers-2.6.2.docs.1 lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb
mcmire-shoulda-matchers-2.6.1.docs.1 lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb
mcmire-shoulda-matchers-2.5.0 lib/shoulda/matchers/active_model/numericality_matchers/odd_number_matcher.rb