Skip to content
Browse files

Rename memoized decorator to memoizable which is more accurate.

  • Loading branch information...
1 parent aca0769 commit ad693bc2a3d960439bb7bdf108afece732bcbb59 @jnunemaker committed Feb 15, 2013
Showing with 5 additions and 3 deletions.
  1. +3 −1 lib/flipper/adapters/memoized.rb
  2. +1 −1 lib/flipper/dsl.rb
  3. +1 −1 spec/flipper/adapters/memoized_spec.rb
View
4 lib/flipper/adapters/memoized.rb
@@ -2,7 +2,7 @@
module Flipper
module Adapters
- class Memoized < Decorator
+ class Memoizable < Decorator
FeaturesKey = :flipper_features
# Private: The cache of memoized adapter operations and results.
@@ -50,6 +50,7 @@ def disable(feature, gate, thing)
result
end
+ # Public
def features
if memoizing?
@cache.fetch(FeaturesKey) {
@@ -60,6 +61,7 @@ def features
end
end
+ # Public
def add(feature)
result = super
@cache.delete(FeaturesKey) if memoizing?
View
2 lib/flipper/dsl.rb
@@ -21,7 +21,7 @@ def initialize(adapter, options = {})
instrumented = Flipper::Adapters::Instrumented.new(adapter, {
:instrumenter => @instrumenter,
})
- memoized = Flipper::Adapters::Memoized.new(instrumented)
+ memoized = Flipper::Adapters::Memoizable.new(instrumented)
@adapter = memoized
@memoized_features = {}
View
2 spec/flipper/adapters/memoized_spec.rb
@@ -3,7 +3,7 @@
require 'flipper/adapters/memory'
require 'flipper/spec/shared_adapter_specs'
-describe Flipper::Adapters::Memoized do
+describe Flipper::Adapters::Memoizable do
let(:features_key) { described_class::FeaturesKey }
let(:cache) { {} }

0 comments on commit ad693bc

Please sign in to comment.
Something went wrong with that request. Please try again.