mongo_doc 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -1,6 +1,6 @@
1
1
  h1. MongoDoc
2
2
 
3
- Version: Hurricane (0.6.8) 2010/07/11
3
+ Version: Hurricane (0.6.9) 2010/07/12
4
4
 
5
5
  h2. Notes
6
6
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.8
1
+ 0.6.9
@@ -66,14 +66,12 @@ module MongoDoc
66
66
  end
67
67
 
68
68
  if type and type.respond_to?(:cast_from_string)
69
- module_eval(<<-RUBY, __FILE__, __LINE__)
70
- def #{name}_with_type=(value) # def birth_date_with_type=(value)
71
- if value.kind_of?(String) # if value.kind_of?(String)
72
- value = #{type}.cast_from_string(value) # value = Date.cast_from_string(value)
73
- end # end
74
- self.#{name}_without_type = value # self.birth_date_without_type = value
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
@@ -3,7 +3,7 @@ require 'active_support'
3
3
  require 'active_support/core_ext'
4
4
 
5
5
  module MongoDoc
6
- VERSION = '0.6.8'
6
+ VERSION = '0.6.9'
7
7
  end
8
8
 
9
9
  require 'mongo_doc/connection'
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"
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-11}
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 = [
@@ -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 case" do
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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 8
10
- version: 0.6.8
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-11 00:00:00 -04:00
18
+ date: 2010-07-12 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency