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.
@@ -2,32 +2,25 @@ module Looksy
2
2
  module Cacheable
3
3
  def self.included(base)
4
4
  base.extend(ClassMethods)
5
- base.class_eval do
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
- def self.cache_options
15
- @cache_options ||= {}
16
- end
7
+ module ClassMethods
8
+ def cache_key
9
+ @cache_key ||= [self.name.downcase, 'all'].join('/')
10
+ end
17
11
 
18
- def self.cache_options=(options = {})
19
- @cache_options = options
20
- end
12
+ def cache_key=(key)
13
+ @cache_key = key
14
+ end
21
15
 
22
- private
16
+ def cache_options
17
+ @cache_options ||= {}
18
+ end
23
19
 
24
- def self.lookup
25
- @lookup ||= Looksy::Lookup.new(self, defined?(Rails) ? Rails.cache : Looksy::NullCache.new)
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
@@ -1,3 +1,3 @@
1
1
  module Looksy
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -27,7 +27,6 @@ class Record < Struct.new(:id, :name, :type)
27
27
  end
28
28
  end
29
29
 
30
- =begin
31
30
  class OtherRecord < Struct.new(:id)
32
31
  include Looksy::Cacheable
33
32
 
@@ -49,4 +48,3 @@ class OtherRecord < Struct.new(:id)
49
48
  }
50
49
  end
51
50
  end
52
- =end
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.3
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: &17430820 !ruby/object:Gem::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: *17430820
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: