faststep 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/faststep.rb CHANGED
@@ -5,6 +5,7 @@ module Faststep
5
5
  DESCENDING = -1
6
6
  autoload :Db, "faststep/db"
7
7
  autoload :Connection, "faststep/connection"
8
+ autoload :Collection, "faststep/collection"
8
9
  autoload :Cursor, "faststep/cursor"
9
10
  end
10
11
 
@@ -0,0 +1,11 @@
1
+ module Faststep
2
+ class Collection
3
+ def index_information
4
+ info = {}
5
+ @db["system.indexes"].find({:ns => ns}).each do |index|
6
+ info[index['name']] = index
7
+ end
8
+ info
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Faststep
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -178,3 +178,15 @@ describe Faststep::Collection, "#remove" do
178
178
  db["something"].remove({}, { :safe => true })["n"].should == 6
179
179
  end
180
180
  end
181
+
182
+ describe Faststep::Collection, "indexes" do
183
+ let(:collection) { $faststep_test_db["something"] }
184
+
185
+ it "creates indexes" do
186
+ collection.create_index(:foo => 1)
187
+ collection.index_information.should == {
188
+ "_id_" => { "name" => "_id_", "ns" => collection.ns, "key" => { "_id" => 1 }, "v" => 0 },
189
+ "_foo" => { "name" => "_foo", "ns" => collection.ns, "key" => { "foo" => 1 }, "v" => 0 }
190
+ }
191
+ end
192
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: faststep
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.5
5
+ version: 0.0.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Josh Clayton
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-23 00:00:00 -04:00
13
+ date: 2011-04-24 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -106,6 +106,7 @@ files:
106
106
  - ext/faststep/utilities.h
107
107
  - faststep.gemspec
108
108
  - lib/faststep.rb
109
+ - lib/faststep/collection.rb
109
110
  - lib/faststep/connection.rb
110
111
  - lib/faststep/cursor.rb
111
112
  - lib/faststep/db.rb