Permalink
Browse files

Correct spelling of instrumenters.

  • Loading branch information...
1 parent aa8956b commit afb43ce2f5fe5068ea36a82f0d4e783150127898 @jnunemaker committed Jan 22, 2013
@@ -19,7 +19,7 @@ def call(*args)
adapter = Flipper::Adapters::Memory.new
# get a handy dsl instance
-flipper = Flipper.new(adapter, :instrumentor => ActiveSupport::Notifications)
+flipper = Flipper.new(adapter, :instrumenter => ActiveSupport::Notifications)
# grab a feature
search = flipper[:search]
View
@@ -1,4 +1,4 @@
-require 'flipper/instrumentors/noop'
+require 'flipper/instrumenters/noop'
module Flipper
# Internal: Adapter wrapper that wraps vanilla adapter instances. Adds things
@@ -57,7 +57,7 @@ def self.wrap(object, options = {})
attr_reader :local_cache
# Private: What is used to instrument all the things.
- attr_reader :instrumentor
+ attr_reader :instrumenter
# Internal: Initializes a new adapter instance.
#
@@ -68,13 +68,13 @@ def self.wrap(object, options = {})
# :local_cache - Where to store the local cache data (default: {}).
# Must respond to fetch(key, block), delete(key)
# and clear.
- # :instrumentor - What to use to instrument all the things.
+ # :instrumenter - What to use to instrument all the things.
#
def initialize(adapter, options = {})
@adapter = adapter
@name = adapter.class.name.split('::').last.downcase
@local_cache = options[:local_cache] || {}
- @instrumentor = options.fetch(:instrumentor, Flipper::Instrumentors::Noop)
+ @instrumenter = options.fetch(:instrumenter, Flipper::Instrumenters::Noop)
end
# Public: Turns local caching on/off.
@@ -157,7 +157,7 @@ def perform_read(operation, key)
name = instrumentation_name(operation)
payload = {:key => key}
- @instrumentor.instrument(name, payload) {
+ @instrumenter.instrument(name, payload) {
@adapter.send(operation, key)
}
end
@@ -167,7 +167,7 @@ def perform_update(operation, key, value)
name = instrumentation_name(operation)
payload = {:key => key, :value => value}
- result = @instrumentor.instrument(name, payload) {
+ result = @instrumenter.instrument(name, payload) {
@adapter.send(operation, key, value)
}
@@ -182,7 +182,7 @@ def perform_delete(operation, key)
name = instrumentation_name(operation)
payload = {:key => key}
- result = @instrumentor.instrument(name, payload) {
+ result = @instrumenter.instrument(name, payload) {
@adapter.send(operation, key)
}
View
@@ -1,22 +1,22 @@
require 'flipper/adapter'
-require 'flipper/instrumentors/noop'
+require 'flipper/instrumenters/noop'
module Flipper
class DSL
# Private
attr_reader :adapter
# Private: What is being used to instrument all the things.
- attr_reader :instrumentor
+ attr_reader :instrumenter
# Public: Returns a new instance of the DSL.
#
# adapter - The adapter that this DSL instance should use.
# options - The Hash of options.
- # :instrumentor - What should be used to instrument all the things.
+ # :instrumenter - What should be used to instrument all the things.
def initialize(adapter, options = {})
- @instrumentor = options.fetch(:instrumentor, Flipper::Instrumentors::Noop)
- @adapter = Adapter.wrap(adapter, :instrumentor => @instrumentor)
+ @instrumenter = options.fetch(:instrumenter, Flipper::Instrumenters::Noop)
+ @adapter = Adapter.wrap(adapter, :instrumenter => @instrumenter)
@memoized_features = {}
end
@@ -67,7 +67,7 @@ def disable(name, *args)
# Returns an instance of Flipper::Feature.
def feature(name)
@memoized_features[name.to_sym] ||= Feature.new(name, @adapter, {
- :instrumentor => instrumentor,
+ :instrumenter => instrumenter,
})
end
View
@@ -3,7 +3,7 @@
require 'flipper/type'
require 'flipper/toggle'
require 'flipper/gate'
-require 'flipper/instrumentors/noop'
+require 'flipper/instrumenters/noop'
module Flipper
class Feature
@@ -14,20 +14,20 @@ class Feature
attr_reader :adapter
# Private: What is being used to instrument all the things.
- attr_reader :instrumentor
+ attr_reader :instrumenter
# Internal: Initializes a new feature instance.
#
# name - The Symbol or String name of the feature.
# adapter - The adapter that will be used to store details about this feature.
#
# options - The Hash of options.
- # :instrumentor - What to use to instrument all the things.
+ # :instrumenter - What to use to instrument all the things.
#
def initialize(name, adapter, options = {})
@name = name
- @instrumentor = options.fetch(:instrumentor, Flipper::Instrumentors::Noop)
- @adapter = Adapter.wrap(adapter, :instrumentor => @instrumentor)
+ @instrumenter = options.fetch(:instrumenter, Flipper::Instrumenters::Noop)
+ @adapter = Adapter.wrap(adapter, :instrumenter => @instrumenter)
end
# Public: Enable this feature for something.
@@ -142,7 +142,7 @@ def instrument(action, thing, gate = nil)
:thing => thing,
}
payload[:gate] = gate if gate
- @instrumentor.instrument(instrument_name, payload) { yield }
+ @instrumenter.instrument(instrument_name, payload) { yield }
end
def instrumentation_name(action)
View
@@ -1,6 +1,6 @@
require 'forwardable'
require 'flipper/key'
-require 'flipper/instrumentors/noop'
+require 'flipper/instrumenters/noop'
module Flipper
class Gate
@@ -10,13 +10,13 @@ class Gate
attr_reader :feature
# Private: What is used to instrument all the things.
- attr_reader :instrumentor
+ attr_reader :instrumenter
def_delegator :@feature, :adapter
def initialize(feature, options = {})
@feature = feature
- @instrumentor = options.fetch(:instrumentor, Flipper::Instrumentors::Noop)
+ @instrumenter = options.fetch(:instrumenter, Flipper::Instrumenters::Noop)
end
# Public: The name of the gate. Implemented in subclass.
@@ -97,7 +97,7 @@ def instrument(action, thing)
payload = {
:thing => thing,
}
- @instrumentor.instrument(name, payload) { yield }
+ @instrumenter.instrument(name, payload) { yield }
end
def instrument_name(action)
@@ -1,5 +1,5 @@
module Flipper
- module Instrumentors
+ module Instrumenters
# Instrumentor that is useful for tests as it stores each of the events that
# are instrumented.
class Memory
@@ -1,5 +1,5 @@
module Flipper
- module Instrumentors
+ module Instrumenters
class Noop
def self.instrument(name, payload = {})
yield
@@ -1,7 +1,7 @@
require 'helper'
require 'flipper/adapter'
require 'flipper/adapters/memory'
-require 'flipper/instrumentors/memory'
+require 'flipper/instrumenters/memory'
describe Flipper::Adapter do
let(:local_cache) { {} }
@@ -40,10 +40,10 @@
end
context "with adapter instance and options" do
- let(:instrumentor) { double('Instrumentor') }
+ let(:instrumenter) { double('Instrumentor') }
before do
- @result = described_class.wrap(adapter, :instrumentor => instrumentor)
+ @result = described_class.wrap(adapter, :instrumenter => instrumenter)
end
it "returns Flipper::Adapter instance" do
@@ -55,7 +55,7 @@
end
it "passes options to initialization" do
- @result.instrumentor.should be(instrumentor)
+ @result.instrumenter.should be(instrumenter)
end
end
end
@@ -66,15 +66,15 @@
instance.adapter.should be(adapter)
end
- it "defaults instrumentor" do
+ it "defaults instrumenter" do
instance = described_class.new(adapter)
- instance.instrumentor.should be(Flipper::Instrumentors::Noop)
+ instance.instrumenter.should be(Flipper::Instrumenters::Noop)
end
- it "allows overriding instrumentor" do
- instrumentor = double('Instrumentor', :instrument => nil)
- instance = described_class.new(adapter, :instrumentor => instrumentor)
- instance.instrumentor.should be(instrumentor)
+ it "allows overriding instrumenter" do
+ instrumenter = double('Instrumentor', :instrument => nil)
+ instance = described_class.new(adapter, :instrumenter => instrumenter)
+ instance.instrumenter.should be(instrumenter)
end
end
@@ -369,16 +369,16 @@
end
describe "instrumentation" do
- let(:instrumentor) { Flipper::Instrumentors::Memory.new }
+ let(:instrumenter) { Flipper::Instrumenters::Memory.new }
subject {
- described_class.new(adapter, :instrumentor => instrumentor)
+ described_class.new(adapter, :instrumenter => instrumenter)
}
it "is recorded for read" do
subject.read('foo')
- event = instrumentor.events.last
+ event = instrumenter.events.last
event.should_not be_nil
event.name.should eq('read.memory.adapter.flipper')
event.payload.should eq({:key => 'foo'})
@@ -387,7 +387,7 @@
it "is recorded for write" do
subject.write('foo', 'bar')
- event = instrumentor.events.last
+ event = instrumenter.events.last
event.should_not be_nil
event.name.should eq('write.memory.adapter.flipper')
event.payload.should eq({:key => 'foo', :value => 'bar'})
@@ -396,7 +396,7 @@
it "is recorded for delete" do
subject.delete('foo')
- event = instrumentor.events.last
+ event = instrumenter.events.last
event.should_not be_nil
event.name.should eq('delete.memory.adapter.flipper')
event.payload.should eq({:key => 'foo'})
@@ -405,7 +405,7 @@
it "is recorded for set_members" do
subject.set_members('foo')
- event = instrumentor.events.last
+ event = instrumenter.events.last
event.should_not be_nil
event.name.should eq('set_members.memory.adapter.flipper')
event.payload.should eq({:key => 'foo'})
@@ -414,7 +414,7 @@
it "is recorded for set_add" do
subject.set_add('foo', 'bar')
- event = instrumentor.events.last
+ event = instrumenter.events.last
event.should_not be_nil
event.name.should eq('set_add.memory.adapter.flipper')
event.payload.should eq({:key => 'foo', :value => 'bar'})
@@ -423,7 +423,7 @@
it "is recorded for set_delete" do
subject.set_delete('foo', 'bar')
- event = instrumentor.events.last
+ event = instrumenter.events.last
event.should_not be_nil
event.name.should eq('set_delete.memory.adapter.flipper')
event.payload.should eq({:key => 'foo', :value => 'bar'})
View
@@ -17,22 +17,22 @@
dsl.adapter.adapter.should eq(adapter)
end
- it "defaults instrumentor to noop" do
+ it "defaults instrumenter to noop" do
dsl = described_class.new(adapter)
- dsl.instrumentor.should be(Flipper::Instrumentors::Noop)
+ dsl.instrumenter.should be(Flipper::Instrumenters::Noop)
end
- context "with overriden instrumentor" do
- let(:instrumentor) { double('Instrumentor', :instrument => nil) }
+ context "with overriden instrumenter" do
+ let(:instrumenter) { double('Instrumentor', :instrument => nil) }
- it "overrides default instrumentor" do
- dsl = described_class.new(adapter, :instrumentor => instrumentor)
- dsl.instrumentor.should be(instrumentor)
+ it "overrides default instrumenter" do
+ dsl = described_class.new(adapter, :instrumenter => instrumenter)
+ dsl.instrumenter.should be(instrumenter)
end
- it "passes overridden instrumentor to adapter wrapping" do
- dsl = described_class.new(adapter, :instrumentor => instrumentor)
- dsl.adapter.instrumentor.should be(instrumentor)
+ it "passes overridden instrumenter to adapter wrapping" do
+ dsl = described_class.new(adapter, :instrumenter => instrumenter)
+ dsl.adapter.instrumenter.should be(instrumenter)
end
end
end
@@ -83,17 +83,17 @@
describe "#feature" do
it_should_behave_like "a DSL feature" do
- let(:instrumentor) { double('Instrumentor', :instrument => nil) }
+ let(:instrumenter) { double('Instrumentor', :instrument => nil) }
let(:feature) { dsl.feature(:stats) }
- let(:dsl) { Flipper::DSL.new(adapter, :instrumentor => instrumentor) }
+ let(:dsl) { Flipper::DSL.new(adapter, :instrumenter => instrumenter) }
end
end
describe "#[]" do
it_should_behave_like "a DSL feature" do
- let(:instrumentor) { double('Instrumentor', :instrument => nil) }
+ let(:instrumenter) { double('Instrumentor', :instrument => nil) }
let(:feature) { dsl[:stats] }
- let(:dsl) { Flipper::DSL.new(adapter, :instrumentor => instrumentor) }
+ let(:dsl) { Flipper::DSL.new(adapter, :instrumenter => instrumenter) }
end
end
Oops, something went wrong.

0 comments on commit afb43ce

Please sign in to comment.