Class: MemoryDb::Base
- Inherits:
-
Object
- Object
- MemoryDb::Base
- Defined in:
- lib/memorydb/base.rb
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#filter ⇒ Object
12 13 14 |
# File 'lib/memorydb/base.rb', line 12 def filter @filter_factory ||= FilterFactory.new end |
#find ⇒ Object
8 9 10 |
# File 'lib/memorydb/base.rb', line 8 def find cursor end |
#remove!(model = nil) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/memorydb/base.rb', line 24 def remove!(model=nil) if model remove_by_id!(model.send(primary_key)) else cursor.remove! end end |
#remove_by_id!(id) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/memorydb/base.rb', line 16 def remove_by_id!(id) if model = find_by_id(id) remove_model!(model) else raise ArgumentError.new("Could not remove record with id: #{id} because it does not exist") end end |