Sha256: 979b2ffc1fb854d8923bf41b7510f90c3a09b7396ca93d6e97189bc956549d06

Contents?: true

Size: 310 Bytes

Versions: 2

Compression:

Stored size: 310 Bytes

Contents

module SimpleValidate
  class ValidatesNumericalityOf < ValidatesBase
    def initialize(attribute, options)
      super(attribute, options[:message] ||
        'must be a number', options[:if] || proc { true })
    end

    def valid?(instance)
      instance.send(attribute).is_a?(Numeric)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_validate-1.2.2 lib/simple_validate/validates_numericality_of.rb
simple_validate-1.1.2 lib/simple_validate/validates_numericality_of.rb