- Timestamp:
- Aug 17, 2009, 11:24:39 PM (15 years ago)
- Location:
- ruby/branches/0.5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ruby/branches/0.5/lib/open_ehr/rm/data_structures/item_structure.rb
r211 r212 165 165 return @rows[i-1].items[j-1] 166 166 end 167 168 def element_at_named_cell(row_key, column_key) 169 i,j=0,0 170 @rows[0].items.each do |c| 171 break if c.name.value == column_key 172 i+=1 173 end 174 @rows.each do |row| 175 break if row.name.value == row_key 176 j+=1 177 end 178 return element_at_cell_ij(i,j) 179 end 180 181 def as_hierarchy 182 return @rows[0] 183 end 167 184 end 168 185 end # of ItemStructure -
ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/item_table_spec.rb
r211 r212 122 122 @item_table.element_at_cell_ij(2,3).name.value.should_not == 'five' 123 123 end 124 125 it 'should be two element at named cell by row column' do 126 @item_table.element_at_named_cell('cluster', 'two').name.value == 'two' 127 end 128 129 it 'should be first row as hierachy' do 130 @item_table.as_hierarchy.name.value.should == 'cluster' 131 end 124 132 end
Note:
See TracChangeset
for help on using the changeset viewer.