key_value 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/Rakefile +9 -1
- data/VERSION +1 -1
- data/key_value.gemspec +6 -4
- data/lib/key_value.rb +4 -1
- data/spec/ar2/Gemfile +12 -0
- data/spec/ar2/Gemfile.lock +36 -0
- data/spec/key_value_spec.rb +15 -1
- metadata +9 -7
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.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.4.
|
8
|
+
s.version = "0.4.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"]
|
@@ -20,6 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
"key_value.gemspec",
|
21
21
|
"lib/key_value.rb",
|
22
22
|
"spec/Readme.md",
|
23
|
+
"spec/ar2/Gemfile",
|
24
|
+
"spec/ar2/Gemfile.lock",
|
23
25
|
"spec/key_value_spec.rb",
|
24
26
|
"spec/spec_helper.rb"
|
25
27
|
]
|
@@ -32,12 +34,12 @@ Gem::Specification.new do |s|
|
|
32
34
|
s.specification_version = 3
|
33
35
|
|
34
36
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
35
|
-
s.add_runtime_dependency(%q<activerecord>, ["
|
37
|
+
s.add_runtime_dependency(%q<activerecord>, ["~> 3"])
|
36
38
|
else
|
37
|
-
s.add_dependency(%q<activerecord>, ["
|
39
|
+
s.add_dependency(%q<activerecord>, ["~> 3"])
|
38
40
|
end
|
39
41
|
else
|
40
|
-
s.add_dependency(%q<activerecord>, ["
|
42
|
+
s.add_dependency(%q<activerecord>, ["~> 3"])
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
data/lib/key_value.rb
CHANGED
@@ -8,7 +8,6 @@ class KeyValue < ActiveRecord::Base
|
|
8
8
|
VERSION = File.read( File.join(File.dirname(__FILE__),'..','VERSION') ).strip
|
9
9
|
|
10
10
|
set_primary_key :key
|
11
|
-
serialize :value
|
12
11
|
|
13
12
|
cattr_accessor :handler_socket
|
14
13
|
|
@@ -18,6 +17,10 @@ class KeyValue < ActiveRecord::Base
|
|
18
17
|
write_attribute :value, x
|
19
18
|
end
|
20
19
|
|
20
|
+
def value
|
21
|
+
YAML.load(read_attribute :value)
|
22
|
+
end
|
23
|
+
|
21
24
|
def self.get(key)
|
22
25
|
if handler_socket
|
23
26
|
open_key_index
|
data/spec/ar2/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source :rubygems
|
2
|
+
|
3
|
+
gem 'activerecord', '~>2'
|
4
|
+
|
5
|
+
group :dev do # not development <-> would add unneeded development dependencies in gemspec
|
6
|
+
gem 'sqlite3'
|
7
|
+
gem 'mysql2', '~>0.2.0'
|
8
|
+
gem 'handlersocket'
|
9
|
+
gem 'rake'
|
10
|
+
gem 'rspec', '~>2'
|
11
|
+
gem 'jeweler'
|
12
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activerecord (2.3.11)
|
5
|
+
activesupport (= 2.3.11)
|
6
|
+
activesupport (2.3.11)
|
7
|
+
diff-lcs (1.1.2)
|
8
|
+
git (1.2.5)
|
9
|
+
handlersocket (0.0.2)
|
10
|
+
jeweler (1.6.0)
|
11
|
+
bundler (~> 1.0.0)
|
12
|
+
git (>= 1.2.5)
|
13
|
+
rake
|
14
|
+
mysql2 (0.2.7)
|
15
|
+
rake (0.8.7)
|
16
|
+
rspec (2.6.0)
|
17
|
+
rspec-core (~> 2.6.0)
|
18
|
+
rspec-expectations (~> 2.6.0)
|
19
|
+
rspec-mocks (~> 2.6.0)
|
20
|
+
rspec-core (2.6.0)
|
21
|
+
rspec-expectations (2.6.0)
|
22
|
+
diff-lcs (~> 1.1.2)
|
23
|
+
rspec-mocks (2.6.0)
|
24
|
+
sqlite3 (1.3.3)
|
25
|
+
|
26
|
+
PLATFORMS
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
activerecord (~> 2)
|
31
|
+
handlersocket
|
32
|
+
jeweler
|
33
|
+
mysql2 (~> 0.2.0)
|
34
|
+
rake
|
35
|
+
rspec (~> 2)
|
36
|
+
sqlite3
|
data/spec/key_value_spec.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path('
|
1
|
+
require File.expand_path('../spec_helper', __FILE__)
|
2
2
|
|
3
3
|
describe KeyValue do
|
4
4
|
before do
|
@@ -23,6 +23,20 @@ describe KeyValue do
|
|
23
23
|
KeyValue.get('xxx').should == 1
|
24
24
|
end
|
25
25
|
|
26
|
+
it "can set & get all kinds of objects" do
|
27
|
+
KeyValue.set('xxx', '1')
|
28
|
+
KeyValue.get('xxx').should == '1'
|
29
|
+
KeyValue.delete_all
|
30
|
+
KeyValue.set('xxx', [1])
|
31
|
+
KeyValue.get('xxx').should == [1]
|
32
|
+
KeyValue.delete_all
|
33
|
+
KeyValue.set('xxx', {:x => 1})
|
34
|
+
KeyValue.get('xxx').should == {:x => 1}
|
35
|
+
KeyValue.delete_all
|
36
|
+
KeyValue.set('xxx', :x)
|
37
|
+
KeyValue.get('xxx').should == :x
|
38
|
+
end
|
39
|
+
|
26
40
|
it "can set & get false" do
|
27
41
|
KeyValue.set('xxx', false)
|
28
42
|
KeyValue.get('xxx').should == false
|
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: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Roman Heinrich
|
@@ -23,12 +23,12 @@ dependencies:
|
|
23
23
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
28
|
+
hash: 5
|
29
29
|
segments:
|
30
|
-
-
|
31
|
-
version: "
|
30
|
+
- 3
|
31
|
+
version: "3"
|
32
32
|
requirement: *id001
|
33
33
|
prerelease: false
|
34
34
|
type: :runtime
|
@@ -50,6 +50,8 @@ files:
|
|
50
50
|
- key_value.gemspec
|
51
51
|
- lib/key_value.rb
|
52
52
|
- spec/Readme.md
|
53
|
+
- spec/ar2/Gemfile
|
54
|
+
- spec/ar2/Gemfile.lock
|
53
55
|
- spec/key_value_spec.rb
|
54
56
|
- spec/spec_helper.rb
|
55
57
|
has_rdoc: true
|