Sha256: 982fb5b8f4b0a460817c552930bc287682499f0be6b77add51ce002a9ca69971

Contents?: true

Size: 544 Bytes

Versions: 14

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 = 1

      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

14 entries across 14 versions & 1 rubygems

Version Path
renalware-core-2.0.62 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.61 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.60 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.58 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.57 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.56 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.55 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.54 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.53 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.52 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.51 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.50 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.48 app/validators/renalware/patients/weight_validator.rb
renalware-core-2.0.47 app/validators/renalware/patients/weight_validator.rb