emerald_odm 1.3.3 → 1.3.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 206b19f62b40ea1b963823f053a46f8bfeeaed3e18ab9a1938c257e758f3804c
4
- data.tar.gz: 402c5a275a1f7edf3a293e0b0b247f33a39c4068b849188ab23a90a1afa32b2f
3
+ metadata.gz: 5d8fbc1f58f7154bc258f608801426e08c42f682c6b2cb8a77739c31b475158c
4
+ data.tar.gz: 795c8c7ccc359bd99e3eeda78fceb654c95d5841b92c56ba0923c5c31b4ceb27
5
5
  SHA512:
6
- metadata.gz: dc1fef7506971f57b64735babcedf3ffb8cd9eb15e4bf785125dfb4df440b2fc025bad229fe121801b00dcf9f18cab313d52aa614388add4590152eb760808f6
7
- data.tar.gz: 24875e034d9225cce05ca9c5745dc5562379dffe95d7ebf12f884a8c5db898698f5efaa081cf016d7a7773d551285a01af7e910d2c6131da50dfb0b718927798
6
+ metadata.gz: 3ee159cf66d3acda85c941305033d715adc26958093dfce0fc8fa03216e7296557a20e60e3da346d2a0b4237396ee1a089e0d1e22a2d5cae3f3593386ce8703a
7
+ data.tar.gz: bfda155e4712b9be85d39e386fa818c33d4ac58747cae773672f161f385f745749e9f3cf63178cf116ded8dc5bfebf122565cb008a51bdb0a5d6ada47cf31cb5
@@ -1,3 +1,3 @@
1
1
  module EmeraldODM
2
- VERSION = '1.3.3'
2
+ VERSION = '1.3.4'
3
3
  end
data/lib/emerald_odm.rb CHANGED
@@ -29,7 +29,11 @@ module EmeraldODM
29
29
 
30
30
  # @param [Hash, BSON::Document] document The document to be used to initialize the object
31
31
  def initialize(document)
32
- document = BSON::Document.new(document) if document.is_a?(Hash)
32
+ if document.instance_of?(Hash)
33
+ document = BSON::Document.new(document)
34
+ elsif document.nil?
35
+ document = BSON::Document.new
36
+ end
33
37
  self.class.fields.each do |field|
34
38
  document_value = document[field]
35
39
  send("#{field}=", document_value)
@@ -54,6 +58,10 @@ module EmeraldODM
54
58
  _document.nil? || _document.empty?
55
59
  end
56
60
 
61
+ def empty?
62
+ _document.nil? || _document.empty?
63
+ end
64
+
57
65
  def self.array_to_h(array)
58
66
  array.map do |item|
59
67
  if item.is_a?(AttrInitializer)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emerald_odm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - mikael
@@ -144,8 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  requirements: []
147
- rubyforge_project:
148
- rubygems_version: 2.7.7
147
+ rubygems_version: 3.4.1
149
148
  signing_key:
150
149
  specification_version: 4
151
150
  summary: MongoDB ODM