Class: HQMF1::Value
- Inherits:
-
Object
- Object
- HQMF1::Value
- Includes:
- Utilities
- Defined in:
- lib/hqmf-parser/1.0/range.rb
Overview
Represents a bound within a HQMF pauseQuantity, has a value, a unit and an inclusive/exclusive indicator
Instance Method Summary collapse
- #inclusive? ⇒ Boolean
-
#initialize(entry, inclusive = nil) ⇒ Value
constructor
A new instance of Value.
- #to_json ⇒ Object
- #unit ⇒ Object
- #value ⇒ Object
Methods included from Utilities
#attr_val, #check_nil_conjunction_on_child, #clean_json, #clean_json_recursive
Methods included from HQMF::Conversion::Utilities
#build_hash, #check_equality, #json_array, #openstruct_to_json
Constructor Details
#initialize(entry, inclusive = nil) ⇒ Value
Returns a new instance of Value.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hqmf-parser/1.0/range.rb', line 7 def initialize(entry, inclusive=nil) @entry = entry if (inclusive.nil?) case attr_val('./@inclusive') when 'true' @inclusive = true else @inclusive = false end else @inclusive = inclusive end end |
Instance Method Details
#inclusive? ⇒ Boolean
31 32 33 |
# File 'lib/hqmf-parser/1.0/range.rb', line 31 def inclusive? @inclusive end |
#to_json ⇒ Object
35 36 37 |
# File 'lib/hqmf-parser/1.0/range.rb', line 35 def to_json build_hash(self, [:value,:unit,:inclusive?]) end |
#unit ⇒ Object
27 28 29 |
# File 'lib/hqmf-parser/1.0/range.rb', line 27 def unit attr_val('./@unit') end |
#value ⇒ Object
23 24 25 |
# File 'lib/hqmf-parser/1.0/range.rb', line 23 def value attr_val('./@value') end |