cachetastic 2.1.2 → 2.1.3

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.
@@ -143,7 +143,7 @@ Example:
143
143
  39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_class</span>
144
144
  40: <span class="ruby-identifier">n</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>
145
145
  41: <span class="ruby-identifier">n</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;Class&quot;</span>
146
- 42: <span class="ruby-comment cmt"># puts &quot;n: #{n}&quot;</span>
146
+ 42: <span class="ruby-identifier">n</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-value str">'::'</span>, <span class="ruby-value str">'_'</span>)
147
147
  43: <span class="ruby-identifier">c_name</span> = <span class="ruby-node">&quot;Cachetastic::Cacheable::#{n}Cache&quot;</span>
148
148
  44: <span class="ruby-keyword kw">begin</span>
149
149
  45: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">c_name</span>.<span class="ruby-identifier">constantize</span>
data/doc/created.rid CHANGED
@@ -1 +1 @@
1
- Fri, 16 Jan 2009 18:05:14 -0500
1
+ Mon, 19 Jan 2009 16:39:02 -0500
@@ -56,7 +56,7 @@
56
56
  </tr>
57
57
  <tr class="top-aligned-row">
58
58
  <td><strong>Last Update:</strong></td>
59
- <td>Fri Jan 02 16:27:11 -0500 2009</td>
59
+ <td>Mon Jan 19 16:37:58 -0500 2009</td>
60
60
  </tr>
61
61
  </table>
62
62
  </div>
@@ -39,7 +39,7 @@ module Cachetastic
39
39
  def cache_class
40
40
  n = self.class.name
41
41
  n = self.name if n == "Class"
42
- # puts "n: #{n}"
42
+ n.gsub!('::', '_')
43
43
  c_name = "Cachetastic::Cacheable::#{n}Cache"
44
44
  begin
45
45
  return c_name.constantize
@@ -17,12 +17,24 @@ class Person
17
17
 
18
18
  end
19
19
 
20
+ module Me
21
+ class You
22
+ include Cachetastic::Cacheable
23
+ end
24
+ end
25
+
20
26
  class Unknown
21
27
  include Cachetastic::Cacheable
22
28
  end
23
29
 
24
30
  class CacheableTest < Test::Unit::TestCase
25
31
 
32
+ def test_cache_classes_work_with_modules
33
+ assert !Cachetastic::Cacheable.const_defined?("Me_YouCache")
34
+ assert Me::You.cache_class == Cachetastic::Cacheable::Me_YouCache
35
+ assert Cachetastic::Cacheable.const_defined?("Me_YouCache")
36
+ end
37
+
26
38
  def test_cache_classes_are_auto_genned
27
39
  assert !Cachetastic::Cacheable.const_defined?("PersonCache")
28
40
  assert Person.cache_class == Cachetastic::Cacheable::PersonCache
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cachetastic
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - markbates
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-16 00:00:00 -05:00
12
+ date: 2009-01-19 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency