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 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.0
1
+ 0.1.1
data/key_value.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{key_value}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Roman Heinrich", "Michael Grosser"]
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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roman Heinrich