lib/boom/list.rb in boom-0.0.4 vs lib/boom/list.rb in boom-0.0.5
- old
+ new
@@ -59,9 +59,20 @@
previous = storage.lists.size
storage.lists = storage.lists.reject { |list| list.name == name }
previous != storage.lists.size
end
+ # Public: deletes an Item by name.
+ #
+ # name - String name of the item to delete
+ #
+ # Returns whether an item was removed.
+ def delete_item(name)
+ previous = items.size
+ items.reject! { |item| item.name == name}
+ previous != items.size
+ end
+
# Public: a Hash representation of this List.
#
# Returns a Hash of its own data and its child Items.
def to_hash
{ name => items.collect(&:to_hash) }