Class: HQMF2::Value
- Inherits:
-
Object
- Object
- HQMF2::Value
- Includes:
- Utilities
- Defined in:
- lib/hqmf-parser/2.0/types.rb
Overview
Represents a bound within a HQMF pauseQuantity, has a value, a unit and an inclusive/exclusive indicator
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #derived? ⇒ Boolean
- #expression ⇒ Object
- #inclusive? ⇒ Boolean
-
#initialize(entry, default_type = 'PQ') ⇒ Value
constructor
A new instance of Value.
- #to_model ⇒ Object
Methods included from Utilities
Methods included from HQMF::Conversion::Utilities
#build_hash, #check_equality, #json_array, #openstruct_to_json
Constructor Details
#initialize(entry, default_type = 'PQ') ⇒ Value
Returns a new instance of Value.
23 24 25 26 27 28 |
# File 'lib/hqmf-parser/2.0/types.rb', line 23 def initialize(entry, default_type='PQ') @entry = entry @type = attr_val('./@xsi:type') || default_type @unit = attr_val('./@unit') @value = attr_val('./@value') end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
21 22 23 |
# File 'lib/hqmf-parser/2.0/types.rb', line 21 def type @type end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
21 22 23 |
# File 'lib/hqmf-parser/2.0/types.rb', line 21 def unit @unit end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
21 22 23 |
# File 'lib/hqmf-parser/2.0/types.rb', line 21 def value @value end |
Instance Method Details
#derived? ⇒ Boolean
39 40 41 42 43 44 45 46 |
# File 'lib/hqmf-parser/2.0/types.rb', line 39 def derived? case attr_val('./@nullFlavor') when 'DER' true else false end end |
#expression ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/hqmf-parser/2.0/types.rb', line 48 def expression if !derived? nil else attr_val('./cda:expression/@value') end end |
#inclusive? ⇒ Boolean
30 31 32 33 34 35 36 37 |
# File 'lib/hqmf-parser/2.0/types.rb', line 30 def inclusive? case attr_val('./@inclusive') when 'false' false else true end end |