key_value 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +5 -0
- data/VERSION +1 -1
- data/key_value.gemspec +1 -1
- data/lib/key_value.rb +2 -0
- metadata +3 -3
data/Readme.md
CHANGED
@@ -24,8 +24,13 @@ Migration
|
|
24
24
|
|
25
25
|
Usage
|
26
26
|
=====
|
27
|
+
KeyValue['xxx'] = {:baz=>'foo'})
|
27
28
|
KeyValue.set('xxx', {:baz=>'foo'})
|
29
|
+
|
30
|
+
KeyValue['xxx'] -> {:baz=>'foo'}
|
28
31
|
KeyValue.get('xxx') -> {:baz=>'foo'}
|
32
|
+
|
33
|
+
KeyValue['xxx'] = nil
|
29
34
|
KeyValue.del('xxx')
|
30
35
|
|
31
36
|
Authors
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/key_value.gemspec
CHANGED
data/lib/key_value.rb
CHANGED
@@ -9,6 +9,7 @@ class KeyValue < ActiveRecord::Base
|
|
9
9
|
def self.get(key)
|
10
10
|
KeyValue.find_by_key(key).try(:value)
|
11
11
|
end
|
12
|
+
alias_method :get, :[]
|
12
13
|
|
13
14
|
def self.set(key, value)
|
14
15
|
if value
|
@@ -19,6 +20,7 @@ class KeyValue < ActiveRecord::Base
|
|
19
20
|
KeyValue.delete_all(:key => key)
|
20
21
|
end
|
21
22
|
end
|
23
|
+
alias_method :set, :[]=
|
22
24
|
|
23
25
|
def self.del(key)
|
24
26
|
set(key, nil)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: key_value
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Roman Heinrich
|