Class: HQMF2::Range
- Inherits:
-
Object
- Object
- HQMF2::Range
- Includes:
- Utilities
- Defined in:
- lib/hqmf-parser/2.0/types.rb
Overview
Represents a HQMF physical quantity which can have low and high bounds
Direct Known Subclasses
Instance Attribute Summary collapse
-
#high ⇒ Object
Returns the value of attribute high.
-
#low ⇒ Object
Returns the value of attribute low.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(entry, type = nil) ⇒ Range
constructor
A new instance of Range.
- #to_model ⇒ Object
- #type ⇒ Object
Methods included from Utilities
Methods included from HQMF::Conversion::Utilities
#build_hash, #check_equality, #json_array, #openstruct_to_json
Constructor Details
#initialize(entry, type = nil) ⇒ Range
Returns a new instance of Range.
66 67 68 69 70 71 72 73 74 |
# File 'lib/hqmf-parser/2.0/types.rb', line 66 def initialize(entry, type=nil) @type = type @entry = entry if @entry @low = optional_value('./cda:low', default_bounds_type) @high = optional_value('./cda:high', default_bounds_type) @width = optional_value('./cda:width', 'PQ') end end |
Instance Attribute Details
#high ⇒ Object
Returns the value of attribute high.
64 65 66 |
# File 'lib/hqmf-parser/2.0/types.rb', line 64 def high @high end |
#low ⇒ Object
Returns the value of attribute low.
64 65 66 |
# File 'lib/hqmf-parser/2.0/types.rb', line 64 def low @low end |
#width ⇒ Object
Returns the value of attribute width.
64 65 66 |
# File 'lib/hqmf-parser/2.0/types.rb', line 64 def width @width end |
Instance Method Details
#to_model ⇒ Object
80 81 82 83 84 85 |
# File 'lib/hqmf-parser/2.0/types.rb', line 80 def to_model lm = low ? low.to_model : nil hm = high ? high.to_model : nil wm = width ? width.to_model : nil HQMF::Range.new(type, lm, hm, wm) end |
#type ⇒ Object
76 77 78 |
# File 'lib/hqmf-parser/2.0/types.rb', line 76 def type @type || attr_val('./@xsi:type') end |