Class: Openphar::Models::Limit

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/openphar/models/limit.rb

Overview

Represents a quantitative limit for a test specification

Instance Method Summary collapse

Instance Method Details

#maximum?Boolean

Returns true if this is a maximum limit

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


24
25
26
# File 'lib/openphar/models/limit.rb', line 24

def range?
  !lower_limit.nil? && !upper_limit.nil?
end

#to_sObject

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