Sha256: 049c234c42ba423b33695a7db744dbe134dabedf3de99d83ade82456b7af9eec

Contents?: true

Size: 544 Bytes

Versions: 100

Compression:

Stored size: 544 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module Patients
    class WeightValidator < ActiveModel::EachValidator
      include NumericRangeValidations
      include NumericScaleValidations
      MIN_VALUE = 5.0
      MAX_VALUE = 300.0
      MAX_DECIMAL_PLACES = 2

      def validate_each(record, attribute, value)
        return if value.blank?

        validate_number_is_in_range(record, attribute, value, MIN_VALUE, MAX_VALUE)
        validate_numeric_scale(record, attribute, value, MAX_DECIMAL_PLACES)
      end
    end
  end
end

Version data entries

100 entries across 100 versions & 1 rubygems

Version Path
renalware-core-2.0.147 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.146 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.145 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.144 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.143 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.142 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.141 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.140 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.139 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.138 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.137 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.136 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.135 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.134 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.133 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.132 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.131 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.130 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.129 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.128 app/validators/renalware/patients/weight_validator.rb