Class: HQMF2::SubsetOperator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#attr_val, attr_val, #to_xml

Methods included from HQMF::Conversion::Utilities

#build_hash, #check_equality, #json_array, #openstruct_to_json

Constructor Details

#initialize(entry) ⇒ SubsetOperator

Returns a new instance of SubsetOperator.



170
171
172
173
174
175
176
177
# File 'lib/hqmf-parser/2.0/types.rb', line 170

def initialize(entry)
  @entry = entry
  @type = attr_val('./cda:subsetCode/@code')
  value_def = @entry.at_xpath('./*/cda:repeatNumber', HQMF2::Document::NAMESPACES)
  if value_def
    @value = HQMF2::Range.new(value_def, 'IVL_INT')
  end
end

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



168
169
170
# File 'lib/hqmf-parser/2.0/types.rb', line 168

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



168
169
170
# File 'lib/hqmf-parser/2.0/types.rb', line 168

def value
  @value
end

Instance Method Details

#to_modelObject



179
180
181
182
# File 'lib/hqmf-parser/2.0/types.rb', line 179

def to_model
  vm = value ? value.to_model : nil
  HQMF::SubsetOperator.new(type, vm)
end