Class: HQMF1::Value

Inherits:
Object
  • Object
show all
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

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

Returns a new instance of Value.



7
8
9
# File 'lib/hqmf-parser/1.0/range.rb', line 7

def initialize(entry)
  @entry = entry
end

Instance Method Details

#inclusive?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
25
26
# File 'lib/hqmf-parser/1.0/range.rb', line 19

def inclusive?
  case attr_val('./@inclusive')
  when 'true'
    true
  else
    false
  end
end

#to_jsonObject



28
29
30
# File 'lib/hqmf-parser/1.0/range.rb', line 28

def to_json
  build_hash(self, [:value,:unit,:inclusive?])
end

#unitObject



15
16
17
# File 'lib/hqmf-parser/1.0/range.rb', line 15

def unit
  attr_val('./@unit')
end

#valueObject



11
12
13
# File 'lib/hqmf-parser/1.0/range.rb', line 11

def value
  attr_val('./@value')
end