Method: Dao::Db#delete

Defined in:
lib/dao/db.rb

#delete(collection, id = :all) ⇒ Object Also known as: destroy



149
150
151
152
153
154
155
156
157
158
159
# File 'lib/dao/db.rb', line 149

def delete(collection, id = :all)
  ystore.transaction do |y|
    collection = (y[collection.to_s] ||= {})
    if id.nil? or id == :all
      collection.clear()
    else
      deleted = collection.delete(String(id))
      data_for(deleted) if deleted
    end
  end
end