redis-objects-rmap 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/README.md +9 -0
- data/lib/redis/objects/rmap.rb +4 -0
- data/lib/redis/objects/rmap/version.rb +1 -1
- data/spec/lib/redis/objects/rmap_spec.rb +10 -0
- metadata +6 -5
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Adds Redis-cached hash containing correspondence between row id and selected field to ActiveRecord models.
|
4
4
|
|
5
|
+
![Travis CI](https://secure.travis-ci.org/inossidabile/redis-objects-rmap.png)
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
@@ -47,6 +49,13 @@ class Foo < ActiveRecord::Base
|
|
47
49
|
end
|
48
50
|
```
|
49
51
|
|
52
|
+
```ruby
|
53
|
+
class Foo < ActiveRecord::Base
|
54
|
+
include Redis::Objects::RMap
|
55
|
+
has_rmap({:title => lambda{|x| x.camelize}}, :my_id)
|
56
|
+
end
|
57
|
+
```
|
58
|
+
|
50
59
|
## Contributing
|
51
60
|
|
52
61
|
1. Fork it
|
data/lib/redis/objects/rmap.rb
CHANGED
@@ -55,6 +55,16 @@ describe Redis::Objects::RMap do
|
|
55
55
|
|
56
56
|
Foo.rmap_options[:title_proc].call(:test).should == 'test'
|
57
57
|
end
|
58
|
+
|
59
|
+
it "undestands complex declaration" do
|
60
|
+
class Foo < ActiveRecord::Base
|
61
|
+
include Redis::Objects::RMap
|
62
|
+
has_rmap 'foo' => lambda{|x| x.to_s}, :id => lambda{|x| x.to_s}
|
63
|
+
end
|
64
|
+
|
65
|
+
Foo.rmap_options[:title_proc].call(:test).should == 'test'
|
66
|
+
Foo.rmap_options[:id_proc].call(:test).should == 'test'
|
67
|
+
end
|
58
68
|
end
|
59
69
|
|
60
70
|
describe "Cache" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-objects-rmap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-01-11 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &70221063705240 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70221063705240
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: redis-objects
|
27
|
-
requirement: &
|
27
|
+
requirement: &70221063704600 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70221063704600
|
36
36
|
description: Adds fast-map to a AR model
|
37
37
|
email:
|
38
38
|
- boris@roundlake.ru
|
@@ -41,6 +41,7 @@ extensions: []
|
|
41
41
|
extra_rdoc_files: []
|
42
42
|
files:
|
43
43
|
- .gitignore
|
44
|
+
- .travis.yml
|
44
45
|
- Gemfile
|
45
46
|
- LICENSE.txt
|
46
47
|
- README.md
|