Class: OpenEHR::RM::DataStructures::ItemStructure::ItemList
- Inherits:
-
ItemStructure
- Object
- Common::Archetyped::Pathable
- Common::Archetyped::Locatable
- DataStructure
- ItemStructure
- OpenEHR::RM::DataStructures::ItemStructure::ItemList
- Defined in:
- lib/openehr/rm/data_structures/item_structure.rb
Constant Summary
Constants included from Common::Archetyped::LocaterConstants
Common::Archetyped::LocaterConstants::CONTENT_PATH_SEPARATOR, Common::Archetyped::LocaterConstants::CURRENT_TRANSACTION_ID, Common::Archetyped::LocaterConstants::FRAGMENT_SEPARATOR, Common::Archetyped::LocaterConstants::MULTIPART_ID_DELIMITER, Common::Archetyped::LocaterConstants::ORGANIZER_PATH_SEPARATOR
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
Attributes inherited from Common::Archetyped::Locatable
#archetype_details, #archetype_node_id, #feeder_audit, #links, #name, #uid
Attributes inherited from Common::Archetyped::Pathable
Instance Method Summary collapse
- #as_hierarchy ⇒ Object
-
#initialize(args = {}) ⇒ ItemList
constructor
A new instance of ItemList.
- #item_count ⇒ Object
- #ith_item(i) ⇒ Object
- #named_item(a_name) ⇒ Object
- #names ⇒ Object
Methods inherited from Common::Archetyped::Locatable
Methods inherited from Common::Archetyped::Pathable
#item_at_path, #items_at_path, normalize_path, path_attribute, path_attributes, #path_children, #path_exists?, #path_of_item, #path_unique?, select_by_predicate
Constructor Details
#initialize(args = {}) ⇒ ItemList
Returns a new instance of ItemList.
41 42 43 44 |
# File 'lib/openehr/rm/data_structures/item_structure.rb', line 41 def initialize(args = {}) super(args) self.items = args[:items] end |
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items.
38 39 40 |
# File 'lib/openehr/rm/data_structures/item_structure.rb', line 38 def items @items end |
Instance Method Details
#as_hierarchy ⇒ Object
70 71 72 73 74 |
# File 'lib/openehr/rm/data_structures/item_structure.rb', line 70 def as_hierarchy return Cluster.new(:name => @name, :archetype_node_id => @archetype_node_id, :items => @items) end |
#item_count ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/openehr/rm/data_structures/item_structure.rb', line 46 def item_count unless @items.nil? return @items.size else return 0 end end |
#ith_item(i) ⇒ Object
65 66 67 68 |
# File 'lib/openehr/rm/data_structures/item_structure.rb', line 65 def ith_item(i) raise ArgumentError, 'index invalid' if i <= 0 return @items[i - 1] end |
#named_item(a_name) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/openehr/rm/data_structures/item_structure.rb', line 58 def named_item(a_name) @items.each do |item| return item if item.name.value == a_name end return nil end |
#names ⇒ Object
54 55 56 |
# File 'lib/openehr/rm/data_structures/item_structure.rb', line 54 def names return @items.collect{|item| item.name} end |