mongo_doc 0.6.29 → 0.6.30
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/README.textile +11 -11
- data/lib/mongo_doc/associations.rb +3 -3
- data/lib/mongo_doc/attributes.rb +11 -3
- data/lib/mongo_doc/references_many.rb +2 -2
- data/lib/mongo_doc/timestamps.rb +1 -1
- data/lib/mongo_doc/version.rb +1 -1
- metadata +13 -2
data/README.textile
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
h1. MongoDoc
|
2
2
|
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.30 2011/06/18
|
4
4
|
|
5
|
-
|
6
|
-
MongoMapper and (heavily) Mongoid since 2009. By Summer 2010, I had come to the
|
7
|
-
conclusion that something more 'native' was the right way to go, and I began
|
8
|
-
to use more and more features of MongoDB directly in my code. After more than
|
9
|
-
six months, I am convinced that 'native' is the right approach.
|
5
|
+
MongoDoc is not actively supported for anything but my own apps.
|
10
6
|
|
11
|
-
I
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
I use MongoDoc in production on my own apps, and have been using MongoMapper
|
8
|
+
(lightly) and Mongoid (heavily) since 2009. By June 2010, I had come to the
|
9
|
+
conclusion that something more 'native' was the right way to go, and I began to
|
10
|
+
use more and more features of MongoDB directly in my code irrespective of which
|
11
|
+
ODM I was using (Mongoid, MongoDoc, or MongoMapper). After more than six
|
12
|
+
months, I am convinced that 'native' is the right approach.
|
13
|
+
|
14
|
+
Instead I am no longer actively mainting MongoDoc. If I emailed you in the
|
15
|
+
summer of 2010 saying MongoDoc was going 'native', apologies.
|
16
16
|
|
17
17
|
If you want a full-featured ODM for Ruby, take a look at
|
18
18
|
"mongoid":https://github.com/mongoid/mongoid .
|
@@ -13,7 +13,7 @@ module MongoDoc
|
|
13
13
|
end
|
14
14
|
|
15
15
|
args.each do |name|
|
16
|
-
|
16
|
+
_add_association(name)
|
17
17
|
|
18
18
|
attr_reader name
|
19
19
|
|
@@ -41,7 +41,7 @@ module MongoDoc
|
|
41
41
|
end
|
42
42
|
|
43
43
|
args.each do |name|
|
44
|
-
|
44
|
+
_add_association(name)
|
45
45
|
|
46
46
|
define_method("#{name}") do
|
47
47
|
association = instance_variable_get("@#{name}")
|
@@ -75,7 +75,7 @@ module MongoDoc
|
|
75
75
|
end
|
76
76
|
|
77
77
|
args.each do |name|
|
78
|
-
|
78
|
+
_add_association(name)
|
79
79
|
|
80
80
|
define_method("#{name}") do
|
81
81
|
association = instance_variable_get("@#{name}")
|
data/lib/mongo_doc/attributes.rb
CHANGED
@@ -2,9 +2,9 @@ module MongoDoc
|
|
2
2
|
module Attributes
|
3
3
|
def self.included(klass)
|
4
4
|
klass.class_eval do
|
5
|
-
|
5
|
+
class_attribute :_keys
|
6
6
|
self._keys = []
|
7
|
-
|
7
|
+
class_attribute :_associations
|
8
8
|
self._associations = []
|
9
9
|
|
10
10
|
attr_accessor :_id
|
@@ -35,6 +35,14 @@ module MongoDoc
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
def _add_key(key)
|
39
|
+
self._keys += [key] unless _keys.include?(key)
|
40
|
+
end
|
41
|
+
|
42
|
+
def _add_association(association)
|
43
|
+
self._associations += [association] unless _associations.include?(association)
|
44
|
+
end
|
45
|
+
|
38
46
|
def _attributes
|
39
47
|
_keys + _associations
|
40
48
|
end
|
@@ -45,7 +53,7 @@ module MongoDoc
|
|
45
53
|
default = opts.delete(:default)
|
46
54
|
type = opts.delete(:type)
|
47
55
|
args.each do |name|
|
48
|
-
|
56
|
+
_add_key(name)
|
49
57
|
attr_writer name
|
50
58
|
|
51
59
|
unless default.nil?
|
@@ -82,7 +82,7 @@ module MongoDoc
|
|
82
82
|
def references_many_by_dbref(objects_name)
|
83
83
|
refs_name = "#{objects_name.singularize}_refs"
|
84
84
|
|
85
|
-
|
85
|
+
_add_key(refs_name)
|
86
86
|
|
87
87
|
module_eval(<<-RUBY, __FILE__, __LINE__)
|
88
88
|
def #{objects_name}=(objects) # def addresses=(objects)
|
@@ -108,7 +108,7 @@ module MongoDoc
|
|
108
108
|
def references_many_by_id(klass, objects_name)
|
109
109
|
ids_name = "#{objects_name.singularize}_ids"
|
110
110
|
|
111
|
-
|
111
|
+
_add_key(ids_name)
|
112
112
|
|
113
113
|
module_eval(<<-RUBY, __FILE__, __LINE__)
|
114
114
|
def #{objects_name}=(objects) # def addresses=(objects)
|
data/lib/mongo_doc/timestamps.rb
CHANGED
@@ -10,7 +10,7 @@ module MongoDoc
|
|
10
10
|
# +updated_at+:: set on every save
|
11
11
|
def timestamps!
|
12
12
|
[:created_at, :updated_at].each do |name|
|
13
|
-
|
13
|
+
_add_key(name)
|
14
14
|
attr_reader name
|
15
15
|
class_eval(<<-RUBY, __FILE__, __LINE__)
|
16
16
|
def #{name}=(value) # def created_at=(value)
|
data/lib/mongo_doc/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mongo_doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.30
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Les Hill
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-06-18 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -90,6 +90,17 @@ dependencies:
|
|
90
90
|
version: 2.5.0
|
91
91
|
type: :development
|
92
92
|
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: ruby-debug19
|
95
|
+
prerelease: false
|
96
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.11.6
|
102
|
+
type: :development
|
103
|
+
version_requirements: *id008
|
93
104
|
description: ODM for MongoDB
|
94
105
|
email: leshill@gmail.com
|
95
106
|
executables: []
|