mongo_odm 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +9 -9
- data/Gemfile.lock +33 -36
- data/README.rdoc +19 -2
- data/lib/mongo_odm/criteria.rb +22 -3
- data/lib/mongo_odm/document.rb +12 -17
- data/lib/mongo_odm/document/attribute_methods.rb +6 -6
- data/lib/mongo_odm/document/equality.rb +21 -0
- data/lib/mongo_odm/document/persistence.rb +9 -5
- data/lib/mongo_odm/version.rb +1 -1
- metadata +186 -43
- data/lib/mongo_odm/document/associations.rb +0 -32
- data/lib/mongo_odm/document/associations/has_many.rb +0 -19
- data/lib/mongo_odm/document/associations/has_one.rb +0 -19
data/Gemfile
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# Use `bundle install` in order to install these gems
|
2
2
|
source 'http://rubygems.org'
|
3
3
|
|
4
|
-
gem "activesupport", "~>3.0.
|
5
|
-
gem "activemodel", "~>3.0.
|
6
|
-
gem "mongo", "~>1.0
|
7
|
-
gem "bson_ext", "~>1.0
|
8
|
-
gem "tzinfo", "~>0.3.
|
4
|
+
gem "activesupport", "~>3.0.3"
|
5
|
+
gem "activemodel", "~>3.0.3"
|
6
|
+
gem "mongo", "~>1.2.0"
|
7
|
+
gem "bson_ext", "~>1.2.0"
|
8
|
+
gem "tzinfo", "~>0.3.24"
|
9
9
|
|
10
10
|
group :development do
|
11
|
-
gem 'jeweler', '~>1.
|
12
|
-
gem 'yard', '~>0.
|
13
|
-
gem 'rcov', '~>0.9.
|
14
|
-
gem 'rspec', '
|
11
|
+
gem 'jeweler', '~>1.5.2'
|
12
|
+
gem 'yard', '~>0.6.4'
|
13
|
+
gem 'rcov', '~>0.9.9'
|
14
|
+
gem 'rspec', '2.4.0'
|
15
15
|
gem 'watchr', '~>0.7'
|
16
16
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,51 +1,48 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (3.0.
|
5
|
-
activesupport (= 3.0.
|
4
|
+
activemodel (3.0.3)
|
5
|
+
activesupport (= 3.0.3)
|
6
6
|
builder (~> 2.1.2)
|
7
|
-
i18n (~> 0.4
|
8
|
-
activesupport (3.0.
|
9
|
-
bson (1.0
|
10
|
-
bson_ext (1.0
|
7
|
+
i18n (~> 0.4)
|
8
|
+
activesupport (3.0.3)
|
9
|
+
bson (1.2.0)
|
10
|
+
bson_ext (1.2.0)
|
11
11
|
builder (2.1.2)
|
12
12
|
diff-lcs (1.1.2)
|
13
|
-
gemcutter (0.6.1)
|
14
13
|
git (1.2.5)
|
15
|
-
i18n (0.
|
16
|
-
jeweler (1.
|
17
|
-
|
14
|
+
i18n (0.5.0)
|
15
|
+
jeweler (1.5.2)
|
16
|
+
bundler (~> 1.0.0)
|
18
17
|
git (>= 1.2.5)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
rcov (0.9.
|
24
|
-
rspec (2.
|
25
|
-
rspec-core (
|
26
|
-
rspec-expectations (
|
27
|
-
rspec-mocks (
|
28
|
-
rspec-core (2.
|
29
|
-
rspec-expectations (2.
|
30
|
-
diff-lcs (
|
31
|
-
rspec-mocks (2.
|
32
|
-
|
33
|
-
json_pure (>= 1.1.7)
|
34
|
-
tzinfo (0.3.23)
|
18
|
+
rake
|
19
|
+
mongo (1.2.0)
|
20
|
+
bson (>= 1.2.0)
|
21
|
+
rake (0.8.7)
|
22
|
+
rcov (0.9.9)
|
23
|
+
rspec (2.4.0)
|
24
|
+
rspec-core (~> 2.4.0)
|
25
|
+
rspec-expectations (~> 2.4.0)
|
26
|
+
rspec-mocks (~> 2.4.0)
|
27
|
+
rspec-core (2.4.0)
|
28
|
+
rspec-expectations (2.4.0)
|
29
|
+
diff-lcs (~> 1.1.2)
|
30
|
+
rspec-mocks (2.4.0)
|
31
|
+
tzinfo (0.3.24)
|
35
32
|
watchr (0.7)
|
36
|
-
yard (0.
|
33
|
+
yard (0.6.4)
|
37
34
|
|
38
35
|
PLATFORMS
|
39
36
|
ruby
|
40
37
|
|
41
38
|
DEPENDENCIES
|
42
|
-
activemodel (~> 3.0.
|
43
|
-
activesupport (~> 3.0.
|
44
|
-
bson_ext (~> 1.0
|
45
|
-
jeweler (~> 1.
|
46
|
-
mongo (~> 1.0
|
47
|
-
rcov (~> 0.9.
|
48
|
-
rspec (
|
49
|
-
tzinfo (~> 0.3.
|
39
|
+
activemodel (~> 3.0.3)
|
40
|
+
activesupport (~> 3.0.3)
|
41
|
+
bson_ext (~> 1.2.0)
|
42
|
+
jeweler (~> 1.5.2)
|
43
|
+
mongo (~> 1.2.0)
|
44
|
+
rcov (~> 0.9.9)
|
45
|
+
rspec (= 2.4.0)
|
46
|
+
tzinfo (~> 0.3.24)
|
50
47
|
watchr (~> 0.7)
|
51
|
-
yard (~> 0.
|
48
|
+
yard (~> 0.6.4)
|
data/README.rdoc
CHANGED
@@ -12,12 +12,15 @@ Flexible persistence module for any Ruby class to MongoDB.
|
|
12
12
|
* Automanage type conversions and default values
|
13
13
|
* Keep it as simple as possible
|
14
14
|
|
15
|
-
Other Mongo ODMs don't require to explicitly define the possible schema of a model. I think this is necessary to help with type conversions (instanciate the right class for each attribute, and convert them to a Mongo compatible type when persisted). But it's also possible to fill attributes with valid Mongo values without defining them as fields, and only the attributes whose values are different than the default values are stored as part of the document when saved.
|
16
|
-
|
17
15
|
= Basics
|
18
16
|
|
17
|
+
Other Mongo ODMs don't require to explicitly define the possible schema of a model. I think this is necessary to help with type conversions (instanciate the right class for each attribute, and convert them to a Mongo compatible type when persisted). But it's also possible to fill attributes with valid Mongo values without defining them as fields, and only the attributes whose values are different than the default values are stored as part of the document when saved.
|
18
|
+
|
19
19
|
A piece of code is better than a hundred of words:
|
20
20
|
|
21
|
+
# Establish connection; it uses localhost:27017 and database 'test' if not specified
|
22
|
+
MongoODM.config = {:host => 'localhost', :port => 27017, :database => "my_tests"}
|
23
|
+
|
21
24
|
class Shape
|
22
25
|
include MongoODM::Document
|
23
26
|
field :name
|
@@ -88,6 +91,20 @@ Take a look at the Mongo Ruby driver documentation for the 'find' method to see
|
|
88
91
|
|
89
92
|
http://api.mongodb.org/ruby/1.0.8/Mongo/Collection.html#find-instance_method
|
90
93
|
|
94
|
+
= Collections
|
95
|
+
|
96
|
+
By default, mongo_odm stores data on a collection with the same name than the class, pluralized. In case of class inheritance, it uses the name of the parent class. You can override this behavior by setting a different collection for a class:
|
97
|
+
|
98
|
+
class Shape
|
99
|
+
set_collection 'my_shapes'
|
100
|
+
end
|
101
|
+
|
102
|
+
Alternatively, you can pass a MongoODM::Collection instance to set_collection, to indicate not only a collection name, but also a different connection and/or database:
|
103
|
+
|
104
|
+
class Shape
|
105
|
+
set_collection MongoODM::Collection.new(MongoODM.connection.db('another_database'), 'my_shapes')
|
106
|
+
end
|
107
|
+
|
91
108
|
= Associations
|
92
109
|
|
93
110
|
To embed just one copy of another class, just define the field type of that class. The class just need to respond to the "type_cast" class method and the "to_mongo" instance method. Example:
|
data/lib/mongo_odm/criteria.rb
CHANGED
@@ -2,17 +2,36 @@
|
|
2
2
|
module MongoODM
|
3
3
|
|
4
4
|
class Criteria
|
5
|
+
delegate :inspect, :to_xml, :to_yaml, :length, :collect, :map, :each, :all?, :include?, :to => :to_a
|
6
|
+
|
5
7
|
def initialize(klass, selector = {}, opts = {})
|
6
8
|
@klass, @selector, @opts = klass, selector, opts
|
9
|
+
@loaded = false
|
7
10
|
end
|
8
11
|
|
9
12
|
def find(selector = {}, opts = {})
|
10
13
|
_merge_criteria(selector, opts)
|
11
14
|
end
|
12
15
|
|
13
|
-
def
|
14
|
-
|
15
|
-
|
16
|
+
def loaded?
|
17
|
+
@loaded
|
18
|
+
end
|
19
|
+
|
20
|
+
def ==(other)
|
21
|
+
case other
|
22
|
+
when Criteria
|
23
|
+
other.instance_variable_get("@selector") == @selector &&
|
24
|
+
other.instance_variable_get("@opts") == @opts
|
25
|
+
when Array
|
26
|
+
to_a == other.to_a
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def method_missing(method_name, *args, &block)
|
31
|
+
if Array.method_defined?(method_name)
|
32
|
+
to_a.send(method_name, *args, &block)
|
33
|
+
elsif @klass.methods.include?(method_name)
|
34
|
+
result = @klass.send(method_name, *args, &block)
|
16
35
|
if result.is_a?(Criteria)
|
17
36
|
selector = result.instance_variable_get("@selector")
|
18
37
|
opts = result.instance_variable_get("@opts")
|
data/lib/mongo_odm/document.rb
CHANGED
@@ -7,34 +7,29 @@ module MongoODM
|
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
extend ActiveSupport::Autoload
|
9
9
|
|
10
|
-
#autoload :Associations
|
11
10
|
autoload :AttributeMethods
|
12
11
|
autoload :Callbacks
|
13
12
|
autoload :Fields
|
14
13
|
autoload :Inspect
|
15
14
|
autoload :Persistence
|
16
15
|
autoload :Validations
|
16
|
+
autoload :Equality
|
17
17
|
|
18
18
|
included do
|
19
19
|
include ActiveModel::Conversion
|
20
|
-
include ActiveModel::Serializers::JSON
|
21
|
-
include ActiveModel::Serializers::Xml
|
22
20
|
include ActiveModel::Observing
|
23
21
|
include ActiveModel::Translation
|
24
|
-
|
25
|
-
include
|
26
|
-
include
|
27
|
-
|
28
|
-
|
29
|
-
include
|
30
|
-
include
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
return false unless other.is_a?(MongoODM::Document)
|
36
|
-
attributes == other.attributes
|
37
|
-
end
|
22
|
+
|
23
|
+
include ActiveModel::Serializers::JSON
|
24
|
+
include ActiveModel::Serializers::Xml
|
25
|
+
|
26
|
+
include Document::Persistence
|
27
|
+
include Document::AttributeMethods
|
28
|
+
include Document::Fields
|
29
|
+
include Document::Inspect
|
30
|
+
include Document::Callbacks
|
31
|
+
include Document::Validations
|
32
|
+
include Document::Equality
|
38
33
|
end
|
39
34
|
|
40
35
|
end
|
@@ -17,12 +17,12 @@ module MongoODM
|
|
17
17
|
|
18
18
|
included do
|
19
19
|
include ActiveModel::AttributeMethods
|
20
|
-
include
|
21
|
-
include
|
22
|
-
include
|
23
|
-
include
|
24
|
-
include
|
25
|
-
include
|
20
|
+
include AttributeMethods::Read
|
21
|
+
include AttributeMethods::Write
|
22
|
+
include AttributeMethods::Query
|
23
|
+
include AttributeMethods::Dirty
|
24
|
+
include AttributeMethods::Inspect
|
25
|
+
include AttributeMethods::Localization
|
26
26
|
end
|
27
27
|
|
28
28
|
module InstanceMethods
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
module MongoODM
|
3
|
+
module Document
|
4
|
+
module Equality
|
5
|
+
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
module InstanceMethods
|
9
|
+
def eql?(other)
|
10
|
+
other.is_a?(self.class) && _id == other._id && attributes == other.attributes
|
11
|
+
end
|
12
|
+
alias :== :eql?
|
13
|
+
|
14
|
+
def hash
|
15
|
+
_id.hash
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -16,6 +16,10 @@ module MongoODM
|
|
16
16
|
def new_record?
|
17
17
|
id.nil?
|
18
18
|
end
|
19
|
+
|
20
|
+
def persisted?
|
21
|
+
!new_record?
|
22
|
+
end
|
19
23
|
|
20
24
|
def reload
|
21
25
|
self.load_attributes_or_defaults(self.class.find_one(:_id => id).attributes) unless new_record?
|
@@ -56,6 +60,11 @@ module MongoODM
|
|
56
60
|
end
|
57
61
|
|
58
62
|
module ClassMethods
|
63
|
+
delegate :collection, :db, :hint, :hint=, :pk_factory, :[], :count, :create_index, :distinct,
|
64
|
+
:drop, :drop_index, :drop_indexes, :find_and_modify, :find_one, :group,
|
65
|
+
:index_information, :insert, :<<, :map_reduce, :mapreduce, :options, :remove, :rename,
|
66
|
+
:save, :stats, :update, :to => :collection
|
67
|
+
|
59
68
|
def collection
|
60
69
|
@collection ||= if self.superclass.included_modules.include?(MongoODM::Document)
|
61
70
|
self.superclass.collection
|
@@ -92,11 +101,6 @@ module MongoODM
|
|
92
101
|
new(value)
|
93
102
|
end
|
94
103
|
|
95
|
-
extend Forwardable
|
96
|
-
def_delegators :collection, :db, :hint, :hint=, :pk_factory, :[], :count, :create_index, :distinct,
|
97
|
-
:drop, :drop_index, :drop_indexes, :find_and_modify, :find_one, :group,
|
98
|
-
:index_information, :insert, :<<, :map_reduce, :mapreduce, :options, :remove, :rename,
|
99
|
-
:save, :stats, :update
|
100
104
|
end
|
101
105
|
|
102
106
|
end
|
data/lib/mongo_odm/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 4
|
9
|
+
version: 0.2.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Carlos Paramio
|
@@ -14,11 +14,12 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-01-20 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activesupport
|
22
|
+
prerelease: false
|
22
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
23
24
|
none: false
|
24
25
|
requirements:
|
@@ -27,14 +28,13 @@ dependencies:
|
|
27
28
|
segments:
|
28
29
|
- 3
|
29
30
|
- 0
|
30
|
-
-
|
31
|
-
|
32
|
-
version: 3.0.0.rc2
|
31
|
+
- 3
|
32
|
+
version: 3.0.3
|
33
33
|
type: :runtime
|
34
|
-
prerelease: false
|
35
34
|
version_requirements: *id001
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
36
|
name: activemodel
|
37
|
+
prerelease: false
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
@@ -43,14 +43,13 @@ dependencies:
|
|
43
43
|
segments:
|
44
44
|
- 3
|
45
45
|
- 0
|
46
|
-
-
|
47
|
-
|
48
|
-
version: 3.0.0.rc2
|
46
|
+
- 3
|
47
|
+
version: 3.0.3
|
49
48
|
type: :runtime
|
50
|
-
prerelease: false
|
51
49
|
version_requirements: *id002
|
52
50
|
- !ruby/object:Gem::Dependency
|
53
51
|
name: mongo
|
52
|
+
prerelease: false
|
54
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
54
|
none: false
|
56
55
|
requirements:
|
@@ -58,14 +57,14 @@ dependencies:
|
|
58
57
|
- !ruby/object:Gem::Version
|
59
58
|
segments:
|
60
59
|
- 1
|
60
|
+
- 2
|
61
61
|
- 0
|
62
|
-
|
63
|
-
version: 1.0.8
|
62
|
+
version: 1.2.0
|
64
63
|
type: :runtime
|
65
|
-
prerelease: false
|
66
64
|
version_requirements: *id003
|
67
65
|
- !ruby/object:Gem::Dependency
|
68
66
|
name: bson_ext
|
67
|
+
prerelease: false
|
69
68
|
requirement: &id004 !ruby/object:Gem::Requirement
|
70
69
|
none: false
|
71
70
|
requirements:
|
@@ -73,14 +72,14 @@ dependencies:
|
|
73
72
|
- !ruby/object:Gem::Version
|
74
73
|
segments:
|
75
74
|
- 1
|
75
|
+
- 2
|
76
76
|
- 0
|
77
|
-
|
78
|
-
version: 1.0.5
|
77
|
+
version: 1.2.0
|
79
78
|
type: :runtime
|
80
|
-
prerelease: false
|
81
79
|
version_requirements: *id004
|
82
80
|
- !ruby/object:Gem::Dependency
|
83
81
|
name: tzinfo
|
82
|
+
prerelease: false
|
84
83
|
requirement: &id005 !ruby/object:Gem::Requirement
|
85
84
|
none: false
|
86
85
|
requirements:
|
@@ -89,13 +88,13 @@ dependencies:
|
|
89
88
|
segments:
|
90
89
|
- 0
|
91
90
|
- 3
|
92
|
-
-
|
93
|
-
version: 0.3.
|
91
|
+
- 24
|
92
|
+
version: 0.3.24
|
94
93
|
type: :runtime
|
95
|
-
prerelease: false
|
96
94
|
version_requirements: *id005
|
97
95
|
- !ruby/object:Gem::Dependency
|
98
96
|
name: jeweler
|
97
|
+
prerelease: false
|
99
98
|
requirement: &id006 !ruby/object:Gem::Requirement
|
100
99
|
none: false
|
101
100
|
requirements:
|
@@ -103,14 +102,14 @@ dependencies:
|
|
103
102
|
- !ruby/object:Gem::Version
|
104
103
|
segments:
|
105
104
|
- 1
|
106
|
-
-
|
107
|
-
-
|
108
|
-
version: 1.
|
105
|
+
- 5
|
106
|
+
- 2
|
107
|
+
version: 1.5.2
|
109
108
|
type: :development
|
110
|
-
prerelease: false
|
111
109
|
version_requirements: *id006
|
112
110
|
- !ruby/object:Gem::Dependency
|
113
111
|
name: yard
|
112
|
+
prerelease: false
|
114
113
|
requirement: &id007 !ruby/object:Gem::Requirement
|
115
114
|
none: false
|
116
115
|
requirements:
|
@@ -118,14 +117,14 @@ dependencies:
|
|
118
117
|
- !ruby/object:Gem::Version
|
119
118
|
segments:
|
120
119
|
- 0
|
121
|
-
-
|
122
|
-
-
|
123
|
-
version: 0.
|
120
|
+
- 6
|
121
|
+
- 4
|
122
|
+
version: 0.6.4
|
124
123
|
type: :development
|
125
|
-
prerelease: false
|
126
124
|
version_requirements: *id007
|
127
125
|
- !ruby/object:Gem::Dependency
|
128
126
|
name: rcov
|
127
|
+
prerelease: false
|
129
128
|
requirement: &id008 !ruby/object:Gem::Requirement
|
130
129
|
none: false
|
131
130
|
requirements:
|
@@ -134,30 +133,28 @@ dependencies:
|
|
134
133
|
segments:
|
135
134
|
- 0
|
136
135
|
- 9
|
137
|
-
-
|
138
|
-
version: 0.9.
|
136
|
+
- 9
|
137
|
+
version: 0.9.9
|
139
138
|
type: :development
|
140
|
-
prerelease: false
|
141
139
|
version_requirements: *id008
|
142
140
|
- !ruby/object:Gem::Dependency
|
143
141
|
name: rspec
|
142
|
+
prerelease: false
|
144
143
|
requirement: &id009 !ruby/object:Gem::Requirement
|
145
144
|
none: false
|
146
145
|
requirements:
|
147
|
-
- -
|
146
|
+
- - "="
|
148
147
|
- !ruby/object:Gem::Version
|
149
148
|
segments:
|
150
149
|
- 2
|
150
|
+
- 4
|
151
151
|
- 0
|
152
|
-
|
153
|
-
- beta
|
154
|
-
- 20
|
155
|
-
version: 2.0.0.beta.20
|
152
|
+
version: 2.4.0
|
156
153
|
type: :development
|
157
|
-
prerelease: false
|
158
154
|
version_requirements: *id009
|
159
155
|
- !ruby/object:Gem::Dependency
|
160
156
|
name: watchr
|
157
|
+
prerelease: false
|
161
158
|
requirement: &id010 !ruby/object:Gem::Requirement
|
162
159
|
none: false
|
163
160
|
requirements:
|
@@ -168,8 +165,156 @@ dependencies:
|
|
168
165
|
- 7
|
169
166
|
version: "0.7"
|
170
167
|
type: :development
|
171
|
-
prerelease: false
|
172
168
|
version_requirements: *id010
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: activesupport
|
171
|
+
prerelease: false
|
172
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
173
|
+
none: false
|
174
|
+
requirements:
|
175
|
+
- - ~>
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
segments:
|
178
|
+
- 3
|
179
|
+
- 0
|
180
|
+
- 3
|
181
|
+
version: 3.0.3
|
182
|
+
type: :runtime
|
183
|
+
version_requirements: *id011
|
184
|
+
- !ruby/object:Gem::Dependency
|
185
|
+
name: activemodel
|
186
|
+
prerelease: false
|
187
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
188
|
+
none: false
|
189
|
+
requirements:
|
190
|
+
- - ~>
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
segments:
|
193
|
+
- 3
|
194
|
+
- 0
|
195
|
+
- 3
|
196
|
+
version: 3.0.3
|
197
|
+
type: :runtime
|
198
|
+
version_requirements: *id012
|
199
|
+
- !ruby/object:Gem::Dependency
|
200
|
+
name: mongo
|
201
|
+
prerelease: false
|
202
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
203
|
+
none: false
|
204
|
+
requirements:
|
205
|
+
- - ~>
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
segments:
|
208
|
+
- 1
|
209
|
+
- 2
|
210
|
+
- 0
|
211
|
+
version: 1.2.0
|
212
|
+
type: :runtime
|
213
|
+
version_requirements: *id013
|
214
|
+
- !ruby/object:Gem::Dependency
|
215
|
+
name: bson_ext
|
216
|
+
prerelease: false
|
217
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
218
|
+
none: false
|
219
|
+
requirements:
|
220
|
+
- - ~>
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
segments:
|
223
|
+
- 1
|
224
|
+
- 2
|
225
|
+
- 0
|
226
|
+
version: 1.2.0
|
227
|
+
type: :runtime
|
228
|
+
version_requirements: *id014
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: tzinfo
|
231
|
+
prerelease: false
|
232
|
+
requirement: &id015 !ruby/object:Gem::Requirement
|
233
|
+
none: false
|
234
|
+
requirements:
|
235
|
+
- - ~>
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
segments:
|
238
|
+
- 0
|
239
|
+
- 3
|
240
|
+
- 24
|
241
|
+
version: 0.3.24
|
242
|
+
type: :runtime
|
243
|
+
version_requirements: *id015
|
244
|
+
- !ruby/object:Gem::Dependency
|
245
|
+
name: jeweler
|
246
|
+
prerelease: false
|
247
|
+
requirement: &id016 !ruby/object:Gem::Requirement
|
248
|
+
none: false
|
249
|
+
requirements:
|
250
|
+
- - ~>
|
251
|
+
- !ruby/object:Gem::Version
|
252
|
+
segments:
|
253
|
+
- 1
|
254
|
+
- 5
|
255
|
+
- 2
|
256
|
+
version: 1.5.2
|
257
|
+
type: :development
|
258
|
+
version_requirements: *id016
|
259
|
+
- !ruby/object:Gem::Dependency
|
260
|
+
name: yard
|
261
|
+
prerelease: false
|
262
|
+
requirement: &id017 !ruby/object:Gem::Requirement
|
263
|
+
none: false
|
264
|
+
requirements:
|
265
|
+
- - ~>
|
266
|
+
- !ruby/object:Gem::Version
|
267
|
+
segments:
|
268
|
+
- 0
|
269
|
+
- 6
|
270
|
+
- 4
|
271
|
+
version: 0.6.4
|
272
|
+
type: :development
|
273
|
+
version_requirements: *id017
|
274
|
+
- !ruby/object:Gem::Dependency
|
275
|
+
name: rcov
|
276
|
+
prerelease: false
|
277
|
+
requirement: &id018 !ruby/object:Gem::Requirement
|
278
|
+
none: false
|
279
|
+
requirements:
|
280
|
+
- - ~>
|
281
|
+
- !ruby/object:Gem::Version
|
282
|
+
segments:
|
283
|
+
- 0
|
284
|
+
- 9
|
285
|
+
- 9
|
286
|
+
version: 0.9.9
|
287
|
+
type: :development
|
288
|
+
version_requirements: *id018
|
289
|
+
- !ruby/object:Gem::Dependency
|
290
|
+
name: rspec
|
291
|
+
prerelease: false
|
292
|
+
requirement: &id019 !ruby/object:Gem::Requirement
|
293
|
+
none: false
|
294
|
+
requirements:
|
295
|
+
- - "="
|
296
|
+
- !ruby/object:Gem::Version
|
297
|
+
segments:
|
298
|
+
- 2
|
299
|
+
- 4
|
300
|
+
- 0
|
301
|
+
version: 2.4.0
|
302
|
+
type: :development
|
303
|
+
version_requirements: *id019
|
304
|
+
- !ruby/object:Gem::Dependency
|
305
|
+
name: watchr
|
306
|
+
prerelease: false
|
307
|
+
requirement: &id020 !ruby/object:Gem::Requirement
|
308
|
+
none: false
|
309
|
+
requirements:
|
310
|
+
- - ~>
|
311
|
+
- !ruby/object:Gem::Version
|
312
|
+
segments:
|
313
|
+
- 0
|
314
|
+
- 7
|
315
|
+
version: "0.7"
|
316
|
+
type: :development
|
317
|
+
version_requirements: *id020
|
173
318
|
description: mongo_odm is a flexible persistence module for any Ruby class to MongoDB.
|
174
319
|
email: carlos@evolve.st
|
175
320
|
executables: []
|
@@ -191,9 +336,6 @@ files:
|
|
191
336
|
- lib/mongo_odm/criteria.rb
|
192
337
|
- lib/mongo_odm/cursor.rb
|
193
338
|
- lib/mongo_odm/document.rb
|
194
|
-
- lib/mongo_odm/document/associations.rb
|
195
|
-
- lib/mongo_odm/document/associations/has_many.rb
|
196
|
-
- lib/mongo_odm/document/associations/has_one.rb
|
197
339
|
- lib/mongo_odm/document/attribute_methods.rb
|
198
340
|
- lib/mongo_odm/document/attribute_methods/dirty.rb
|
199
341
|
- lib/mongo_odm/document/attribute_methods/inspect.rb
|
@@ -202,6 +344,7 @@ files:
|
|
202
344
|
- lib/mongo_odm/document/attribute_methods/read.rb
|
203
345
|
- lib/mongo_odm/document/attribute_methods/write.rb
|
204
346
|
- lib/mongo_odm/document/callbacks.rb
|
347
|
+
- lib/mongo_odm/document/equality.rb
|
205
348
|
- lib/mongo_odm/document/fields.rb
|
206
349
|
- lib/mongo_odm/document/inspect.rb
|
207
350
|
- lib/mongo_odm/document/persistence.rb
|
@@ -234,8 +377,8 @@ homepage: http://github.com/carlosparamio/mongo_odm
|
|
234
377
|
licenses: []
|
235
378
|
|
236
379
|
post_install_message:
|
237
|
-
rdoc_options:
|
238
|
-
|
380
|
+
rdoc_options: []
|
381
|
+
|
239
382
|
require_paths:
|
240
383
|
- lib
|
241
384
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module MongoODM
|
4
|
-
module Document
|
5
|
-
module Associations
|
6
|
-
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
extend ActiveSupport::Autoload
|
9
|
-
|
10
|
-
autoload :HasOne
|
11
|
-
autoload :HasMany
|
12
|
-
|
13
|
-
included do
|
14
|
-
class_inheritable_accessor :associations
|
15
|
-
self.associations = {}
|
16
|
-
|
17
|
-
include MongoODM::Document::Associations::HasOne
|
18
|
-
include MongoODM::Document::Associations::HasMany
|
19
|
-
end
|
20
|
-
|
21
|
-
module InstanceMethods
|
22
|
-
def associations
|
23
|
-
self.class.associations
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
module ClassMethods
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|