persistent_hash 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/persistent_hash/hash.rb +10 -8
- data/lib/persistent_hash/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06b320eea13bba423859587cff01a544d305ec19
|
4
|
+
data.tar.gz: 2c5a643b36f877b1aaa3ad210fee8c011a73f750
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71cfed0122f4b6599e573004a3aa69fb167af398f75ce5f710dbe6ad96d2cd54f33f348de365397d533dc2da2183ddced1fa11665fb38743310bdbdf98d0f123
|
7
|
+
data.tar.gz: ad6f5667e8316b8d24ad130e8d5ba0010f927dce8b9c707fd98511fded7c5f3d9acf3443f70625ee110c0febfb4b247e797fd253a81880a963d5161210ae6cae
|
@@ -5,16 +5,18 @@ module PersistentHash
|
|
5
5
|
|
6
6
|
# save a value in the hash
|
7
7
|
def self.[]=(key_name, value)
|
8
|
-
|
8
|
+
transaction do
|
9
|
+
where(key_name: key_name).delete_all
|
9
10
|
|
10
|
-
|
11
|
-
|
11
|
+
if ! value.nil?
|
12
|
+
formatted = PersistentHash::Formatter.format(value)
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
create!(
|
15
|
+
key_name: key_name,
|
16
|
+
readable_value: formatted,
|
17
|
+
marshalled: Base64.encode64(Marshal.dump(value))
|
18
|
+
)
|
19
|
+
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: persistent_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dean
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|