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', force_inclusive = false) ⇒ 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', force_inclusive = false) ⇒ Value
Returns a new instance of Value.
23 24 25 26 27 28 29 |
# File 'lib/hqmf-parser/2.0/types.rb', line 23 def initialize(entry, default_type='PQ', force_inclusive=false) @entry = entry @type = attr_val('./@xsi:type') || default_type @unit = attr_val('./@unit') @value = attr_val('./@value') @force_inclusive = force_inclusive 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
35 36 37 38 39 40 41 42 |
# File 'lib/hqmf-parser/2.0/types.rb', line 35 def derived? case attr_val('./@nullFlavor') when 'DER' true else false end end |
#expression ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/hqmf-parser/2.0/types.rb', line 44 def expression if !derived? nil else attr_val('./cda:expression/@value') end end |
#inclusive? ⇒ Boolean
31 32 33 |
# File 'lib/hqmf-parser/2.0/types.rb', line 31 def inclusive? attr_val("../@#{@entry.name}Closed") == 'true' || @force_inclusive end |