Sha256: 1175a9df4683335bdc4390853b75cd9d7997ca8a31cfd235365eebb28d3b97b9
Contents?: true
Size: 1.58 KB
Versions: 7
Compression:
Stored size: 1.58 KB
Contents
require 'forwardable' module Shoulda module Matchers module ActiveModel module NumericalityMatchers # @private class NumericTypeMatcher extend Forwardable def_delegators( :disallow_value_matcher, :expects_custom_validation_message?, :expects_strict?, :failure_message, :failure_message_when_negated, :ignore_interference_by_writer, :ignoring_interference_by_writer, :matches?, :does_not_match?, :on, :strict, :with_message, ) def initialize(numeric_type_matcher, attribute) @numeric_type_matcher = numeric_type_matcher @attribute = attribute end def allowed_type_name 'number' end def allowed_type_adjective '' end def diff_to_compare raise NotImplementedError end protected attr_reader :attribute def wrap_disallow_value_matcher(matcher) raise NotImplementedError end def disallowed_value raise NotImplementedError end private def disallow_value_matcher @_disallow_value_matcher ||= begin DisallowValueMatcher.new(disallowed_value).tap do |matcher| matcher.for(attribute) wrap_disallow_value_matcher(matcher) end end end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems