mongodb 0.0.6 → 0.0.7

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.
Files changed (3) hide show
  1. data/lib/mongo/object/object.rb +10 -8
  2. data/readme.md +3 -1
  3. metadata +1 -1
@@ -7,13 +7,15 @@ module Mongo::Object
7
7
  return false if opts[:callbacks] and !::Mongo::Object.run_before_callbacks(self, :validate)
8
8
 
9
9
  child_opts = opts.merge internal: true
10
- children_valid = child_objects.all?{|group| group.all?{|obj| obj.valid?(child_opts)}}
11
- if children_valid and ::Mongo::Object.run_validations(self) and errors.empty?
12
- ::Mongo::Object.run_after_callbacks(self, :validate) if opts[:callbacks]
13
- true
14
- else
15
- false
16
- end
10
+ result = [
11
+ child_objects.all?{|group| group.all?{|obj| obj.valid?(child_opts)}},
12
+ ::Mongo::Object.run_validations(self),
13
+ errors.empty?
14
+ ].all?
15
+
16
+ ::Mongo::Object.run_after_callbacks(self, :validate) if opts[:callbacks]
17
+
18
+ result
17
19
  ensure
18
20
  clear_child_objects unless opts[:internal]
19
21
  end
@@ -288,7 +290,7 @@ module Mongo::Object
288
290
  raise_error "unknown callback method (#{method})!"
289
291
  end
290
292
 
291
- result &= if type == :after
293
+ if type == :after
292
294
  ::Mongo::Object.run_after_callbacks self, method
293
295
  else
294
296
  true
data/readme.md CHANGED
@@ -3,6 +3,7 @@ Ruby object persistence & driver enhancements for MongoDB.
3
3
  1. Driver enchancements.
4
4
  2. Migrations.
5
5
  3. Persistence for any Ruby object.
6
+ 4. Object Model [mongodb_model][mongodb_model]
6
7
 
7
8
  Lower layers are independent from upper, use only what You need.
8
9
 
@@ -190,4 +191,5 @@ Copyright (c) Alexey Petrushin, http://petrush.in, released under the MIT licens
190
191
 
191
192
  [mongo_mapper_ext]: https://github.com/alexeypetrushin/mongo_mapper_ext
192
193
  [mongoid_misc]: https://github.com/alexeypetrushin/mongoid_misc
193
- [code_stats]: https://github.com/alexeypetrushin/mongodb/raw/master/docs/code_stats.png
194
+ [code_stats]: https://github.com/alexeypetrushin/mongodb/raw/master/docs/code_stats.png
195
+ [mongodb_model]: https://github.com/alexeypetrushin/mongodb_model
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongodb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: