nutella_lib 0.4.24 → 0.4.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a87eae6c33b4dbed562ddcf6faa2d5caf4e6f55
4
- data.tar.gz: fcf2660f146de22ee786c43a102ffdef7e33a170
3
+ metadata.gz: c8350b0d60a7ecfa57ae8f2c794a4d9f1e52461e
4
+ data.tar.gz: e88f23e2a3a4cb9af2e5e3b2e4e583370cfbbdf0
5
5
  SHA512:
6
- metadata.gz: b1cf06099f12b1334a4dc68b869453e4d9d0221a92f385922e2ed5921368ea4b6a346e2829119d081e2ff7029cc47d81b089ebebc389843a085efca5a406d931
7
- data.tar.gz: 37217d05a6ba9186e5811118f36d547194dd56224e6ad022dfca59f4ff59b3375f59bae9674a676fc8abaffee9502fca7fdbcaccd0e2f0adde3af17e4d010088
6
+ metadata.gz: 5ae8e248442adf73196a6c70cef6621a7e6affd28717786e7f9cfec32d6daa89db945ca613b0e177ee1f36304e2ac10136f694266da52f4b0b4d5d879cdbce06
7
+ data.tar.gz: 6c801b3f4804aac7f64cf7437283fddb147325a1559877a683c36197f0aff67335b3bb69112d7620d86581ab4402c233cd661134004c443a6c39698574e4c74d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.24
1
+ 0.4.25
@@ -127,14 +127,17 @@ class MongoPersistedHash
127
127
  @r = @collection.find({_id: @doc_id}).limit(1).first
128
128
  }
129
129
  end
130
- @r.nil? ? {'_id' => @doc_id} : @r
130
+ if(@r.nil?)
131
+ @r = {'_id' => @doc_id};
132
+ end
133
+ @r
131
134
  end
132
135
 
133
136
 
134
137
  def store_hash(hash)
135
138
  @s.synchronize {
136
139
  @r = hash
137
- if(@auto_save)
140
+ if(@auto_save and !@r.empty?)
138
141
  @collection.find({'_id' => @doc_id}).find_one_and_replace(@r, :upsert => :true)
139
142
  end
140
143
  }
@@ -142,7 +145,9 @@ class MongoPersistedHash
142
145
 
143
146
  def save
144
147
  @s.synchronize {
145
- @collection.find({'_id' => @doc_id}).find_one_and_replace(@r, :upsert => :true)
148
+ if(defined? @r and !@r.empty?)
149
+ @collection.find({'_id' => @doc_id}).find_one_and_replace(@r, :upsert => :true)
150
+ end
146
151
  }
147
152
  end
148
153
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutella_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.24
4
+ version: 0.4.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Gnoli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-02 00:00:00.000000000 Z
11
+ date: 2015-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mqtt