ninjudd-active_document 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 0
3
- :patch: 4
3
+ :patch: 5
4
4
  :major: 0
@@ -6,8 +6,7 @@ end
6
6
 
7
7
  require 'bdb'
8
8
  require 'tuple'
9
- require 'active_support/inflector'
10
- require 'active_support/core_ext/hash/indifferent_access.rb'
9
+ require 'active_support'
11
10
  require 'active_document/database'
12
11
  require 'active_document/environment'
13
12
  require 'active_document/base'
@@ -23,6 +23,7 @@ class ActiveDocument::Base
23
23
  end
24
24
 
25
25
  def self.transaction(&block)
26
+ open_database
26
27
  environment.transaction(&block)
27
28
  end
28
29
 
@@ -36,7 +36,7 @@ class ActiveDocument::Database
36
36
  if opts[:partial] and not key.kind_of?(Range)
37
37
  first = [*key]
38
38
  last = first + [true]
39
- key = first..last
39
+ key = first..last
40
40
  end
41
41
 
42
42
  if key == :all
@@ -65,13 +65,14 @@ class ActiveDocument::Database
65
65
  cond = key.exclude_end? ? lambda {|k| k < last} : lambda {|k| k <= last}
66
66
 
67
67
  if opts[:reverse]
68
+ iter = lambda {cursor.get(nil, nil, Bdb::DB_PREV | flags)} # Move backward.
69
+
68
70
  # Position the cursor at the end of the range.
69
- k,v = cursor.get(last, nil, Bdb::DB_SET_RANGE | flags)
71
+ k,v = cursor.get(last, nil, Bdb::DB_SET_RANGE | flags) || cursor.get(nil, nil, Bdb::DB_LAST | flags)
70
72
  while k and not cond.call(k)
71
73
  k,v = iter.call
72
74
  end
73
75
 
74
- iter = lambda {cursor.get(nil, nil, Bdb::DB_PREV | flags)} # Move backward.
75
76
  cond = lambda {|k| k >= first} # Change the condition to stop when we move past the start.
76
77
  else
77
78
  k,v = cursor.get(first, nil, Bdb::DB_SET_RANGE | flags) # Start at the beginning of the range.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ninjudd-active_document
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Balthrop
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-25 00:00:00 -07:00
12
+ date: 2009-08-26 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -33,6 +33,7 @@ files:
33
33
  - test/test_helper.rb
34
34
  has_rdoc: true
35
35
  homepage: http://github.com/ninjudd/active_document
36
+ licenses:
36
37
  post_install_message:
37
38
  rdoc_options:
38
39
  - --inline-source
@@ -54,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
55
  requirements: []
55
56
 
56
57
  rubyforge_project:
57
- rubygems_version: 1.2.0
58
+ rubygems_version: 1.3.5
58
59
  signing_key:
59
60
  specification_version: 2
60
61
  summary: TODO