jashmenn-method_cache 0.8.0.0 → 0.8.1.0

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/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 8
4
- :patch: 0
4
+ :patch: 1
5
5
  :build: 0
@@ -130,7 +130,7 @@ module MethodCache
130
130
  @key = ['m', version, arg_string].compact.join('|')
131
131
  @key = "m|#{Digest::SHA1.hexdigest(@key)}" if @key.length > 250
132
132
  end
133
- pp @key
133
+ puts "cache key: #{@key}" if Eigenjoy::MethodCache.verbose?
134
134
  @key
135
135
  end
136
136
 
data/lib/method_cache.rb CHANGED
@@ -79,6 +79,10 @@ module MethodCache
79
79
  @default_cache ||= {}
80
80
  end
81
81
 
82
+ def self.default_cache=(new_cache)
83
+ @default_cache = new_cache
84
+ end
85
+
82
86
  def get_ancestors
83
87
  ancestors = if self.respond_to?(:ancestors)
84
88
  self.ancestors
@@ -136,6 +140,19 @@ module MethodCache
136
140
  @disabled
137
141
  end
138
142
 
143
+ def self.verbose(&block)
144
+ @verbose, old = true, @verbose
145
+ yield
146
+ ensure
147
+ @verbose = old
148
+ end
149
+
150
+ def self.verbose=(v)
151
+ @verbose = v
152
+ end
153
+
154
+ def self.verbose?; @verbose; end
155
+
139
156
  module InvalidationMethods
140
157
  def invalidate_cached_method(method_name, *args, &block)
141
158
  cached_method(method_name, args).invalidate(&block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jashmenn-method_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.0
4
+ version: 0.8.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: