mongo_doc 0.6.8 → 0.6.9
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 +1 -1
- data/VERSION +1 -1
- data/lib/mongo_doc/attributes.rb +6 -8
- data/lib/mongo_doc.rb +1 -1
- data/mongo_doc.gemspec +2 -2
- data/spec/attributes_spec.rb +13 -1
- metadata +4 -4
data/README.textile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.9
|
data/lib/mongo_doc/attributes.rb
CHANGED
@@ -66,14 +66,12 @@ module MongoDoc
|
|
66
66
|
end
|
67
67
|
|
68
68
|
if type and type.respond_to?(:cast_from_string)
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end # end
|
76
|
-
RUBY
|
69
|
+
define_method "#{name}_with_type=" do |value|
|
70
|
+
if value.kind_of?(String)
|
71
|
+
value = type.cast_from_string(value)
|
72
|
+
end
|
73
|
+
self.send("#{name}_without_type=", value)
|
74
|
+
end
|
77
75
|
alias_method_chain "#{name}=", :type
|
78
76
|
end
|
79
77
|
end
|
data/lib/mongo_doc.rb
CHANGED
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.
|
8
|
+
s.version = "0.6.9"
|
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-
|
12
|
+
s.date = %q{2010-07-12}
|
13
13
|
s.description = %q{ODM for MongoDB}
|
14
14
|
s.email = %q{leshill@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/attributes_spec.rb
CHANGED
@@ -111,11 +111,23 @@ describe "MongoDoc::Attributes" do
|
|
111
111
|
object.birthdate = date.to_s
|
112
112
|
end
|
113
113
|
|
114
|
-
it "sets the value to the result of the
|
114
|
+
it "sets the value to the result of the cast" do
|
115
115
|
object.birthdate = date.to_s
|
116
116
|
object.birthdate.should == date
|
117
117
|
end
|
118
118
|
end
|
119
|
+
|
120
|
+
context "when a namespace collision exists" do
|
121
|
+
class TestType
|
122
|
+
attr_accessor :bson_id, :type => ::BSON::ObjectID
|
123
|
+
end
|
124
|
+
|
125
|
+
let(:bson_id) { ::BSON::ObjectID.new }
|
126
|
+
it "sets the value to the result of the cast" do
|
127
|
+
object.bson_id = bson_id.to_s
|
128
|
+
object.bson_id.should == bson_id
|
129
|
+
end
|
130
|
+
end
|
119
131
|
end
|
120
132
|
|
121
133
|
describe "used with inheritance" 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:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 9
|
10
|
+
version: 0.6.9
|
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-
|
18
|
+
date: 2010-07-12 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|