looksy 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/looksy/cacheable.rb +19 -20
- data/lib/looksy/version.rb +1 -1
- data/spec/support/record.rb +0 -2
- metadata +3 -3
data/lib/looksy/cacheable.rb
CHANGED
@@ -2,32 +2,25 @@ module Looksy
|
|
2
2
|
module Cacheable
|
3
3
|
def self.included(base)
|
4
4
|
base.extend(ClassMethods)
|
5
|
-
|
6
|
-
def self.cache_key
|
7
|
-
@cache_key ||= [self.name.downcase, 'all'].join('/')
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.cache_key=(key)
|
11
|
-
@cache_key = key
|
12
|
-
end
|
5
|
+
end
|
13
6
|
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
module ClassMethods
|
8
|
+
def cache_key
|
9
|
+
@cache_key ||= [self.name.downcase, 'all'].join('/')
|
10
|
+
end
|
17
11
|
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
def cache_key=(key)
|
13
|
+
@cache_key = key
|
14
|
+
end
|
21
15
|
|
22
|
-
|
16
|
+
def cache_options
|
17
|
+
@cache_options ||= {}
|
18
|
+
end
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
end
|
20
|
+
def cache_options=(options = {})
|
21
|
+
@cache_options = options
|
27
22
|
end
|
28
|
-
end
|
29
23
|
|
30
|
-
module ClassMethods
|
31
24
|
def fetch_all
|
32
25
|
lookup.all
|
33
26
|
end
|
@@ -44,6 +37,12 @@ module Looksy
|
|
44
37
|
super
|
45
38
|
end
|
46
39
|
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def lookup
|
44
|
+
@lookup ||= Looksy::Lookup.new(self, defined?(Rails) ? Rails.cache : Looksy::NullCache.new)
|
45
|
+
end
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
data/lib/looksy/version.rb
CHANGED
data/spec/support/record.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: looksy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
17
|
-
requirement: &
|
17
|
+
requirement: &9388700 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,7 +22,7 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *9388700
|
26
26
|
description: Add a caching layer to your ActiveRecord models that represent look up
|
27
27
|
tables
|
28
28
|
email:
|