DbMotion 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,13 +9,18 @@ class Database
9
9
  NSEntityDescription.insertNewObjectForEntityForName(_name, inManagedObjectContext:@context)
10
10
  end
11
11
 
12
- def find_entry(_name)
12
+ # Example: _sort=[NSSortDescriptor.alloc.initWithKey('name', ascending:true)]
13
+ def find_entry(_name, _sort=[])
13
14
  request = NSFetchRequest.alloc.init
14
15
  request.entity = NSEntityDescription.entityForName(_name, inManagedObjectContext:@context)
15
- #request.sortDescriptors = [NSSortDescriptor.alloc.initWithKey('creation_date', ascending:false)]
16
+ request.sortDescriptors = _sort
16
17
  error_ptr = Pointer.new(:object)
17
18
  @context.executeFetchRequest(request, error:error_ptr)
18
19
  end
20
+
21
+ def delete_entry(_obj)
22
+ @context.deleteObject(_obj)
23
+ end
19
24
 
20
25
  def save
21
26
  error_ptr = Pointer.new(:object)
@@ -1,3 +1,3 @@
1
1
  module DbMotion
2
- VERSION = "0.0.5" unless defined?(DbMotion::VERSION)
2
+ VERSION = "0.0.6" unless defined?(DbMotion::VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: DbMotion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-06 00:00:00.000000000 Z
12
+ date: 2013-03-16 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: DbMotion a simple adaption of CoreData.
15
15
  email: