Class: Openphar::Models::Limit
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- Openphar::Models::Limit
- Defined in:
- lib/openphar/models/limit.rb
Overview
Represents a quantitative limit for a test specification
Instance Method Summary collapse
-
#maximum? ⇒ Boolean
Returns true if this is a maximum limit.
-
#minimum? ⇒ Boolean
Returns true if this is a minimum limit.
-
#range? ⇒ Boolean
Returns true if this is a range limit.
-
#to_s ⇒ Object
Returns a human-readable representation.
Instance Method Details
#maximum? ⇒ Boolean
Returns true if this is a maximum limit
35 36 37 38 |
# File 'lib/openphar/models/limit.rb', line 35 def maximum? limit_type == 'LimitType-Maximum' || limit_type == 'LimitType-NotMoreThan' end |
#minimum? ⇒ Boolean
Returns true if this is a minimum limit
29 30 31 32 |
# File 'lib/openphar/models/limit.rb', line 29 def minimum? limit_type == 'LimitType-Minimum' || limit_type == 'LimitType-NotLessThan' end |
#range? ⇒ Boolean
Returns true if this is a range limit
24 25 26 |
# File 'lib/openphar/models/limit.rb', line 24 def range? !lower_limit.nil? && !upper_limit.nil? end |
#to_s ⇒ Object
Returns a human-readable representation
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/openphar/models/limit.rb', line 41 def to_s if range? "#{lower_limit} - #{upper_limit} #{limit_unit}" elsif minimum? "Not less than #{limit_value} #{limit_unit}" elsif maximum? "Not more than #{limit_value} #{limit_unit}" else "#{limit_value} #{limit_unit}" end end |