Class: HQMF2::TypedReference
- Inherits:
-
Object
- Object
- HQMF2::TypedReference
- Includes:
- Utilities
- Defined in:
- lib/hqmf-parser/2.0/types.rb
Overview
Represents a HQMF reference to a data criteria that has a given type
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#mood ⇒ Object
Returns the value of attribute mood.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(entry, type = nil, verbose = false) ⇒ TypedReference
constructor
Create a new HQMF::Reference.
-
#reference ⇒ Object
Generate the reference for the typed reference to use.
-
#to_model ⇒ Object
Generates this classes hqmf-model equivalent.
Methods included from Utilities
#attr_val, attr_val, #strip_tokens, #to_xml
Methods included from HQMF::Conversion::Utilities
#build_hash, #check_equality, #json_array, #openstruct_to_json
Constructor Details
#initialize(entry, type = nil, verbose = false) ⇒ TypedReference
Create a new HQMF::Reference
376 377 378 379 380 381 382 |
# File 'lib/hqmf-parser/2.0/types.rb', line 376 def initialize(entry, type = nil, verbose = false) @entry = entry @type = type || attr_val('./@classCode') @mood = attr_val('./@moodCode') @entry = entry.elements.first unless entry.at_xpath('./@extension') @verbose = verbose end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
372 373 374 |
# File 'lib/hqmf-parser/2.0/types.rb', line 372 def id @id end |
#mood ⇒ Object
Returns the value of attribute mood.
372 373 374 |
# File 'lib/hqmf-parser/2.0/types.rb', line 372 def mood @mood end |
#type ⇒ Object
Returns the value of attribute type.
372 373 374 |
# File 'lib/hqmf-parser/2.0/types.rb', line 372 def type @type end |
Instance Method Details
#reference ⇒ Object
Generate the reference for the typed reference to use
385 386 387 388 |
# File 'lib/hqmf-parser/2.0/types.rb', line 385 def reference value = "#{attr_val('./@extension')}_#{attr_val('./@root')}" strip_tokens(value) end |
#to_model ⇒ Object
Generates this classes hqmf-model equivalent
391 392 393 |
# File 'lib/hqmf-parser/2.0/types.rb', line 391 def to_model HQMF::TypedReference.new(reference, @type, @mood) end |