Changeset 210
- Timestamp:
- Aug 17, 2009, 9:54:25 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
r209 r210 150 150 return false 151 151 end 152 153 def row_with_key(keys) 154 unless has_row_with_key?(keys) 155 raise ArgumentError, 'no row for key' 156 end 157 keys.each do |key| 158 @rows.each do |row| 159 return row if row.items[0].name.value == key 160 end 161 end 162 end 152 163 end 153 164 end # of ItemStructure -
ruby/branches/0.5/spec/lib/open_ehr/rm/data_structures/item_structure/item_table_spec.rb
r209 r210 105 105 @item_table.has_row_with_key?(Set['two','five']).should be_false 106 106 end 107 108 it 'should be a first row that has one' do 109 @item_table.row_with_key(Set['one', 'two']).items[0].name.value.should =='one' 110 end 111 112 it 'should raise argument error if row has no key' do 113 lambda { 114 @item_table.row_with_key(Set['two','five'])}.should raise_error(ArgumentError) 115 end 107 116 end
Note:
See TracChangeset
for help on using the changeset viewer.