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, #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.



38
39
40
41
42
43
44
# File 'lib/hqmf-parser/1.0/range.rb', line 38

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

Instance Attribute Details

#highObject (readonly)

Returns the value of attribute high.



36
37
38
# File 'lib/hqmf-parser/1.0/range.rb', line 36

def high
  @high
end

#lowObject (readonly)

Returns the value of attribute low.



36
37
38
# File 'lib/hqmf-parser/1.0/range.rb', line 36

def low
  @low
end

Instance Method Details

#to_jsonObject



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

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