mongo_doc 0.6.12 → 0.6.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongo_doc (0.6.11)
4
+ mongo_doc (0.6.12)
5
5
  activemodel (>= 3.0.0.beta.4)
6
6
  activesupport (>= 3.0.0.beta.4)
7
7
  bson (>= 1.0.0)
data/README.textile CHANGED
@@ -1,6 +1,6 @@
1
1
  h1. MongoDoc
2
2
 
3
- Version: Hurricane (0.6.12) 2010/07/23
3
+ Version: Hurricane (0.6.13) 2010/07/25
4
4
 
5
5
  h2. Notes
6
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.12
1
+ 0.6.13
@@ -44,13 +44,12 @@ module MongoDoc
44
44
  :where, :to => :criteria
45
45
 
46
46
  class CriteriaWrapper < Mongoid::Criteria
47
- %w(all and any_in cache enslave excludes extras fuse in limit not_in offset only order_by skip where).each do |method|
47
+ %w(all and any_in cache enslave excludes extras fuse id in limit not_in offset only order_by skip where).each do |method|
48
48
  class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
49
49
  def #{method}_with_wrapping(*args, &block) # def and(*args, &block)
50
50
  new_criteria = CriteriaWrapper.new(klass) # new_criteria = CriteriaWrapper.new(klass)
51
51
  new_criteria.merge(self) # new_criteria.merge(criteria)
52
52
  new_criteria.#{method}_without_wrapping(*args, &block) # new_criteria.and_without_wrapping(*args, &block)
53
- new_criteria # new_criteria
54
53
  end # end
55
54
 
56
55
  alias_method_chain :#{method}, :wrapping
data/lib/mongo_doc.rb CHANGED
@@ -3,7 +3,7 @@ require 'active_support'
3
3
  require 'active_support/core_ext'
4
4
 
5
5
  module MongoDoc
6
- VERSION = '0.6.12'
6
+ VERSION = '0.6.13'
7
7
  end
8
8
 
9
9
  require 'mongo_doc/connection'
@@ -76,8 +76,12 @@ module Mongoid #:nodoc:
76
76
  # Returns: <tt>self</tt>
77
77
  def id(*args)
78
78
  ids = strings_to_object_ids(args.flatten)
79
- (ids.size > 1) ? self.in(:_id => ids) : (@selector[:_id] = ids.first)
80
- self
79
+ if ids.size > 1
80
+ self.in(:_id => ids)
81
+ else
82
+ @selector[:_id] = ids.first
83
+ self
84
+ end
81
85
  end
82
86
 
83
87
  # Adds a criterion to the +Criteria+ that specifies the maximum number of
data/mongo_doc.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mongo_doc}
8
- s.version = "0.6.12"
8
+ s.version = "0.6.13"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Les Hill"]
12
- s.date = %q{2010-07-23}
12
+ s.date = %q{2010-07-25}
13
13
  s.description = %q{ODM for MongoDB}
14
14
  s.email = %q{leshill@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -25,7 +25,7 @@ describe MongoDoc::Criteria do
25
25
  wrapper.klass.should == CriteriaTest
26
26
  end
27
27
 
28
- %w(all and any_in cache enslave excludes fuse in limit offset only order_by skip where).each do |wrapping_method|
28
+ %w(all and any_in cache enslave excludes fuse id in limit offset only order_by skip where).each do |wrapping_method|
29
29
  it "#{wrapping_method} returns a new CriteriaWrapper" do
30
30
  wrapper.send(wrapping_method).object_id.should_not == wrapper.object_id
31
31
  end
@@ -39,6 +39,13 @@ describe MongoDoc::Criteria do
39
39
  wrapper.not_in({}).object_id.should_not == wrapper.object_id
40
40
  end
41
41
 
42
+ it "id with mutliple ids returns a new CriteriaWrapper with the id selector set" do
43
+ id1 = BSON::ObjectID.new
44
+ id2 = BSON::ObjectID.new
45
+ returned = wrapper.id(id1, id2)
46
+ returned.object_id.should_not == wrapper.object_id
47
+ returned.selector[:_id].should == {'$in' => [id1, id2]}
48
+ end
42
49
  end
43
50
 
44
51
  context "criteria delegates" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_doc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 12
10
- version: 0.6.12
9
+ - 13
10
+ version: 0.6.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Les Hill
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-23 00:00:00 -04:00
18
+ date: 2010-07-25 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency