Class: Renalware::Patients::BmStixValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Includes:
NumericRangeValidations, NumericScaleValidations
Defined in:
app/validators/renalware/patients/bm_stix_validator.rb

Constant Summary collapse

MIN_VALUE =
0.5
MAX_VALUE =
50
MAX_DECIMAL_PLACES =
1

Instance Method Summary collapse

Methods included from NumericScaleValidations

#number_exceeds_scale?, #validate_numeric_scale

Methods included from NumericRangeValidations

#validate_number_is_in_range

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



12
13
14
15
16
17
# File 'app/validators/renalware/patients/bm_stix_validator.rb', line 12

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