mongodb 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -8,9 +8,4 @@ project(
8
8
 
9
9
  author: "Alexey Petrushin",
10
10
  homepage: "http://alexeypetrushin.github.com/mongodb"
11
- )
12
-
13
- desc "Generate documentation"
14
- task :docs do
15
- %x(cd docs && rocco -o site *.rb)
16
- end
11
+ )
data/lib/mongo/driver.rb CHANGED
@@ -18,8 +18,9 @@ Mongo.class_eval do
18
18
  def defaults; @defaults ||= {} end
19
19
  attr_writer :defaults
20
20
 
21
- # Override this method to provide Your own custom database initialization.
21
+ # Override this method to provide Your own custom database initialization logic.
22
22
  def db name
23
+ name = name.to_s
23
24
  @databases ||= {}
24
25
  @databases[name] ||= begin
25
26
  connection = Mongo::Connection.new
@@ -1,7 +1,7 @@
1
1
  require 'set'
2
2
  require 'date'
3
3
 
4
- module Mongo::CollectionExt
4
+ module Mongo::CollectionExt
5
5
  #
6
6
  # CRUD
7
7
  #
@@ -1,4 +1,6 @@
1
1
  module Mongo::ConnectionExt
2
+ attr_writer :logger
3
+
2
4
  protected
3
5
  def method_missing db_name
4
6
  self.db db_name.to_s
@@ -1,4 +1,15 @@
1
1
  module Mongo::DBExt
2
+ def drop
3
+ connection.drop_database name
4
+ end
5
+
6
+ def clear
7
+ collection_names.each do |name|
8
+ next if name =~ /^system\./
9
+ mongo.db.collection(name).drop
10
+ end
11
+ end
12
+
2
13
  protected
3
14
  def method_missing collection_name
4
15
  self.collection collection_name
@@ -13,13 +13,6 @@ rspec do
13
13
  $mongo || raise('Mongo not defined (use :with_mongo helper)!')
14
14
  end
15
15
 
16
- def clear_mongo name = MONGO_TEST_DATABASE_NAME
17
- mongo.db.collection_names.each do |name|
18
- next if name =~ /^system\./
19
- mongo.db.collection(name).drop
20
- end
21
- end
22
-
23
16
  class << self
24
17
  def with_mongo
25
18
  before :all do
@@ -33,7 +26,7 @@ rspec do
33
26
  after(:all){$mongo = nil}
34
27
 
35
28
  before do
36
- clear_mongo
29
+ mongo.db.clear
37
30
  end
38
31
  end
39
32
  end
@@ -3,6 +3,7 @@ module Mongo::Object
3
3
 
4
4
  def valid? options = {}
5
5
  options = ::Mongo::Object.parse_options options
6
+ errors.clear
6
7
  begin
7
8
  return false if options[:callbacks] and !::Mongo::Object.run_before_callbacks(self, :validate)
8
9
 
data/readme.md CHANGED
@@ -34,7 +34,7 @@ connection = Mongo::Connection.new
34
34
  db = connection.default_test
35
35
  db.drop
36
36
 
37
- # Collection shortcuts, access collection directly by typing it's name,
37
+ # Collection shortcuts, access collection directly by typing its name,
38
38
  # instead of `db.collection('some_collection')`.
39
39
  db.some_collection
40
40
 
@@ -140,7 +140,7 @@ class Unit
140
140
 
141
141
  attr_reader :name, :stats
142
142
 
143
- # We need to also the initializer to be used without arguments.
143
+ # We need the initializer to be used also without arguments.
144
144
  def initialize name = nil, stats = nil
145
145
  @name, @stats = name, stats
146
146
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongodb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
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: 2011-09-13 00:00:00.000000000Z
12
+ date: 2011-09-15 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: