Sha256: 597300ea08c670b4811973d2661ae5e732b16b2ec935a6932460027944c54f53

Contents?: true

Size: 376 Bytes

Versions: 10

Compression:

Stored size: 376 Bytes

Contents

require 'hermod/validators/base'

module Hermod
  module Validators
    # Checks a decimal value has no decimal componant, i.e. it's just a decimal
    # representation of an integer
    class WholeUnits < Base

      private

      def test
        value.blank? || value == value.to_i
      end

      def message
        "must be in whole units"
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hermod-2.5.0 lib/hermod/validators/whole_units.rb
hermod-2.4.1 lib/hermod/validators/whole_units.rb
hermod-2.4.0 lib/hermod/validators/whole_units.rb
hermod-2.2.0 lib/hermod/validators/whole_units.rb
hermod-2.1.0 lib/hermod/validators/whole_units.rb
hermod-1.2.9 lib/hermod/validators/whole_units.rb
hermod-1.2.8 lib/hermod/validators/whole_units.rb
hermod-1.2.7 lib/hermod/validators/whole_units.rb
hermod-1.2.6 lib/hermod/validators/whole_units.rb
hermod-1.2.5 lib/hermod/validators/whole_units.rb