Method: OpenC3::Structure#delete_item
- Defined in:
- lib/openc3/packets/structure.rb
#delete_item(name) ⇒ Object
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/openc3/packets/structure.rb', line 362 def delete_item(name) item = @items[name.upcase] raise ArgumentError, "Unknown item: #{name}" unless item # Find the item to delete in the sorted_items array item_index = nil @sorted_items.each_with_index do |sorted_item, index| if sorted_item.name == item.name item_index = index break end end @sorted_items.delete_at(item_index) @items.delete(name.upcase) end |