Class: HQMF1::Comparison
- Inherits:
-
Object
- Object
- HQMF1::Comparison
- Includes:
- Utilities
- Defined in:
- lib/hqmf-parser/1.0/comparison.rb
Instance Attribute Summary collapse
-
#data_criteria_id ⇒ Object
readonly
Returns the value of attribute data_criteria_id.
-
#restrictions ⇒ Object
readonly
Returns the value of attribute restrictions.
-
#subset ⇒ Object
readonly
Returns the value of attribute subset.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(data_criteria_id, entry, parent, doc) ⇒ Comparison
constructor
A new instance of Comparison.
- #to_json ⇒ Object
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(data_criteria_id, entry, parent, doc) ⇒ Comparison
Returns a new instance of Comparison.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/hqmf-parser/1.0/comparison.rb', line 8 def initialize(data_criteria_id, entry, parent, doc) @doc = doc @data_criteria_id = data_criteria_id @entry = entry title_def = @entry.at_xpath('./*/cda:title') if title_def @title = title_def.inner_text end @restrictions = [] restriction_def = @entry.at_xpath('./*/cda:sourceOf') if restriction_def @entry.xpath('./*/cda:sourceOf').each do |restriction| @restrictions << Restriction.new(restriction, self, @doc) end end end |
Instance Attribute Details
#data_criteria_id ⇒ Object (readonly)
Returns the value of attribute data_criteria_id.
6 7 8 |
# File 'lib/hqmf-parser/1.0/comparison.rb', line 6 def data_criteria_id @data_criteria_id end |
#restrictions ⇒ Object (readonly)
Returns the value of attribute restrictions.
6 7 8 |
# File 'lib/hqmf-parser/1.0/comparison.rb', line 6 def restrictions @restrictions end |
#subset ⇒ Object (readonly)
Returns the value of attribute subset.
6 7 8 |
# File 'lib/hqmf-parser/1.0/comparison.rb', line 6 def subset @subset end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/hqmf-parser/1.0/comparison.rb', line 6 def title @title end |
Instance Method Details
#to_json ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/hqmf-parser/1.0/comparison.rb', line 25 def to_json json = build_hash(self, [:data_criteria_id,:title,:subset]) json[:restrictions] = json_array(@restrictions) json end |