Class: HQMF1::Range

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/hqmf-parser/1.0/range.rb

Overview

Represents a HQMF pauseQuantity which can have low and high bounds

Instance Attribute Summary collapse

Instance Method Summary collapse

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) ⇒ Range

Returns a new instance of Range.



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/hqmf-parser/1.0/range.rb', line 45

def initialize(entry)
  @entry = entry
  if @entry
    @low = optional_value('./cda:low')
    @high = optional_value('./cda:high')
    if (@low == nil && @high == nil)
      @low = optional_value('.',true)
      @high = optional_value('.',true)
    end
  end
end

Instance Attribute Details

#highObject (readonly)

Returns the value of attribute high.



43
44
45
# File 'lib/hqmf-parser/1.0/range.rb', line 43

def high
  @high
end

#lowObject (readonly)

Returns the value of attribute low.



43
44
45
# File 'lib/hqmf-parser/1.0/range.rb', line 43

def low
  @low
end

Instance Method Details

#to_jsonObject



57
58
59
60
61
62
# File 'lib/hqmf-parser/1.0/range.rb', line 57

def to_json
  json = {}
  json[:low] = self.low.to_json if self.low
  json[:high] = self.high.to_json if self.high
  json
end