Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 40 lines (30 sloc) 0.79 kb
3bb9b3e0 »
2013-01-11 Added instrumentation example for active support notifications.
1 require File.expand_path('../example_setup', __FILE__)
2
3 require 'securerandom'
4 require 'active_support/notifications'
5
6 class FlipperSubscriber
7 def call(*args)
8 event = ActiveSupport::Notifications::Event.new(*args)
9 puts event.inspect
10 end
11
12 ActiveSupport::Notifications.subscribe(/flipper/, new)
13 end
14
15 require 'flipper'
16 require 'flipper/adapters/memory'
17
18 # pick an adapter
19 adapter = Flipper::Adapters::Memory.new
20
21 # get a handy dsl instance
afb43ce2 »
2013-01-22 Correct spelling of instrumenters.
22 flipper = Flipper.new(adapter, :instrumenter => ActiveSupport::Notifications)
3bb9b3e0 »
2013-01-11 Added instrumentation example for active support notifications.
23
24 # grab a feature
25 search = flipper[:search]
26
27 perform = lambda do
28 # check if that feature is enabled
29 if search.enabled?
30 puts 'Search away!'
31 else
32 puts 'No search for you!'
33 end
34 end
35
36 perform.call
37 puts 'Enabling Search...'
38 search.enable
39 perform.call
Something went wrong with that request. Please try again.