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/open_ehr/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, #path_exists?, #path_of_item, #path_unique?
Constructor Details
#initialize(args = {}) ⇒ ItemList
Returns a new instance of ItemList.
40 41 42 43 |
# File 'lib/open_ehr/rm/data_structures/item_structure.rb', line 40 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/open_ehr/rm/data_structures/item_structure.rb', line 38 def items @items end |
Instance Method Details
#as_hierarchy ⇒ Object
69 70 71 72 73 |
# File 'lib/open_ehr/rm/data_structures/item_structure.rb', line 69 def as_hierarchy return Cluster.new(:name => @name, :archetype_node_id => @archetype_node_id, :items => @items) end |
#item_count ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/open_ehr/rm/data_structures/item_structure.rb', line 45 def item_count unless @items.nil? return @items.size else return 0 end end |
#ith_item(i) ⇒ Object
64 65 66 67 |
# File 'lib/open_ehr/rm/data_structures/item_structure.rb', line 64 def ith_item(i) raise ArgumentError, 'index invalid' if i <= 0 return @items[i - 1] end |
#named_item(a_name) ⇒ Object
57 58 59 60 61 62 |
# File 'lib/open_ehr/rm/data_structures/item_structure.rb', line 57 def named_item(a_name) @items.each do |item| return item if item.name.value == a_name end return nil end |
#names ⇒ Object
53 54 55 |
# File 'lib/open_ehr/rm/data_structures/item_structure.rb', line 53 def names return @items.collect{|item| item.name} end |