redis-model 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/redis/model.rb +7 -3
- data/redis-model.gemspec +4 -8
- data/spec/redis/model_spec.rb +12 -0
- metadata +6 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/redis/model.rb
CHANGED
@@ -54,9 +54,13 @@ class Redis::Model
|
|
54
54
|
end
|
55
55
|
|
56
56
|
# Issues delete commands for all defined fields
|
57
|
-
def delete
|
58
|
-
|
59
|
-
redis.delete field_key(
|
57
|
+
def delete(name = nil)
|
58
|
+
if name
|
59
|
+
redis.delete field_key(name.to_s)
|
60
|
+
else
|
61
|
+
self.class.fields.each do |field|
|
62
|
+
redis.delete field_key(field[:name])
|
63
|
+
end
|
60
64
|
end
|
61
65
|
end
|
62
66
|
|
data/redis-model.gemspec
CHANGED
@@ -1,15 +1,12 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
1
|
# -*- encoding: utf-8 -*-
|
5
2
|
|
6
3
|
Gem::Specification.new do |s|
|
7
4
|
s.name = %q{redis-model}
|
8
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.3"
|
9
6
|
|
10
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
8
|
s.authors = ["Vladimir Kolesnikov"]
|
12
|
-
s.date = %q{2009-10-
|
9
|
+
s.date = %q{2009-10-21}
|
13
10
|
s.description = %q{Minimal model support for redis-rb. Directly maps ruby properties to model_name:id:field_name keys in redis. Scalar, list and set properties are supported.}
|
14
11
|
s.email = %q{voloko@gmail.com}
|
15
12
|
s.extra_rdoc_files = [
|
@@ -27,11 +24,10 @@ Gem::Specification.new do |s|
|
|
27
24
|
"spec/redis/model_spec.rb",
|
28
25
|
"spec/spec_helper.rb"
|
29
26
|
]
|
30
|
-
s.has_rdoc = true
|
31
27
|
s.homepage = %q{http://github.com/voloko/redis-model}
|
32
28
|
s.rdoc_options = ["--charset=UTF-8"]
|
33
29
|
s.require_paths = ["lib"]
|
34
|
-
s.rubygems_version = %q{1.3.
|
30
|
+
s.rubygems_version = %q{1.3.5}
|
35
31
|
s.summary = %q{Minimal models for Redis}
|
36
32
|
s.test_files = [
|
37
33
|
"spec/redis/model_spec.rb",
|
@@ -41,7 +37,7 @@ Gem::Specification.new do |s|
|
|
41
37
|
|
42
38
|
if s.respond_to? :specification_version then
|
43
39
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
|
-
s.specification_version =
|
40
|
+
s.specification_version = 3
|
45
41
|
|
46
42
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
47
43
|
s.add_runtime_dependency(%q<redis>, [">= 0.0.1"])
|
data/spec/redis/model_spec.rb
CHANGED
@@ -184,5 +184,17 @@ describe Redis::Model do
|
|
184
184
|
@redisMock.should_receive(:sadd).with('test_commands:1:sloppy', 'bar')
|
185
185
|
@x.sloppy << 'bar'
|
186
186
|
end
|
187
|
+
|
188
|
+
it "should delete separate fields" do
|
189
|
+
@redisMock.should_receive(:delete).with('test_commands:1:foo')
|
190
|
+
@x.delete :foo
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should delete all field" do
|
194
|
+
@redisMock.should_receive(:delete).with('test_commands:1:foo')
|
195
|
+
@redisMock.should_receive(:delete).with('test_commands:1:bar')
|
196
|
+
@redisMock.should_receive(:delete).with('test_commands:1:sloppy')
|
197
|
+
@x.delete
|
198
|
+
end
|
187
199
|
end
|
188
200
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladimir Kolesnikov
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-10-
|
12
|
+
date: 2009-10-21 00:00:00 +04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -53,6 +53,8 @@ files:
|
|
53
53
|
- spec/spec_helper.rb
|
54
54
|
has_rdoc: true
|
55
55
|
homepage: http://github.com/voloko/redis-model
|
56
|
+
licenses: []
|
57
|
+
|
56
58
|
post_install_message:
|
57
59
|
rdoc_options:
|
58
60
|
- --charset=UTF-8
|
@@ -73,9 +75,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
75
|
requirements: []
|
74
76
|
|
75
77
|
rubyforge_project:
|
76
|
-
rubygems_version: 1.3.
|
78
|
+
rubygems_version: 1.3.5
|
77
79
|
signing_key:
|
78
|
-
specification_version:
|
80
|
+
specification_version: 3
|
79
81
|
summary: Minimal models for Redis
|
80
82
|
test_files:
|
81
83
|
- spec/redis/model_spec.rb
|