Module: Saphyr::Asserts::NumericAssert Private
- Included in:
- Fields::FieldBase
- Defined in:
- lib/saphyr/asserts/numeric_assert.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #assert_numeric_gt(opt_value, value, errors, error_code = Fields::FieldBase::ERR_GT) ⇒ Object private
- #assert_numeric_gte(opt_value, value, errors, error_code = Fields::FieldBase::ERR_GTE) ⇒ Object private
- #assert_numeric_lt(opt_value, value, errors, error_code = Fields::FieldBase::ERR_LT) ⇒ Object private
- #assert_numeric_lte(opt_value, value, errors, error_code = Fields::FieldBase::ERR_LTE) ⇒ Object private
Instance Method Details
#assert_numeric_gt(opt_value, value, errors, error_code = Fields::FieldBase::ERR_GT) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/saphyr/asserts/numeric_assert.rb', line 5 def assert_numeric_gt opt_value, value, errors, error_code=Fields::FieldBase::ERR_GT return nil if opt_value.nil? if value <= opt_value errors << { type: err(error_code), data: { _val: value, gt: opt_value, } } return false end true end |
#assert_numeric_gte(opt_value, value, errors, error_code = Fields::FieldBase::ERR_GTE) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/saphyr/asserts/numeric_assert.rb', line 20 def assert_numeric_gte opt_value, value, errors, error_code=Fields::FieldBase::ERR_GTE return nil if opt_value.nil? if value < opt_value errors << { type: err(error_code), data: { _val: value, gte: opt_value, } } return false end true end |
#assert_numeric_lt(opt_value, value, errors, error_code = Fields::FieldBase::ERR_LT) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/saphyr/asserts/numeric_assert.rb', line 35 def assert_numeric_lt opt_value, value, errors, error_code=Fields::FieldBase::ERR_LT return nil if opt_value.nil? if value >= opt_value errors << { type: err(error_code), data: { _val: value, lt: opt_value, } } return false end true end |
#assert_numeric_lte(opt_value, value, errors, error_code = Fields::FieldBase::ERR_LTE) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/saphyr/asserts/numeric_assert.rb', line 50 def assert_numeric_lte opt_value, value, errors, error_code=Fields::FieldBase::ERR_LTE return nil if opt_value.nil? if value > opt_value errors << { type: err(error_code), data: { _val: value, lte: opt_value, } } return false end true end |