lib/basket/backend_adapter/memory_backend.rb in basket-0.0.6 vs lib/basket/backend_adapter/memory_backend.rb in basket-0.0.7
- old
+ new
@@ -20,9 +20,20 @@
def read(queue)
@data[queue]
end
+ def search(queue, &block)
+ @data[queue].select { |element| block.call(element.data) }
+ end
+
+ def remove(queue, id)
+ index_of_element_to_delete = @data[queue].index { |element| element.id == id }
+ @data[queue].delete_at(index_of_element_to_delete)
+ rescue
+ nil
+ end
+
def clear(queue)
@data[queue] = []
end
end
end