Module: Dolphin

Defined in:
lib/dolphin.rb,
lib/dolphin/dsl.rb,
lib/dolphin/helper.rb,
lib/dolphin/experiment.rb,
lib/dolphin/feature_store.rb,
lib/dolphin/flipper_store.rb

Defined Under Namespace

Modules: Helper Classes: DSL, Experiment, FeatureStore, FlipperStore, MissingFlipperError

Class Method Summary collapse

Class Method Details

.clearObject


52
53
54
55
56
# File 'lib/dolphin.rb', line 52

def self.clear
  @flippers = nil
  @feature_store = nil
  @flipper_store = nil
end

.configure(&block) ⇒ Object


11
12
13
# File 'lib/dolphin.rb', line 11

def self.configure(&block)
  FlipperStore::DSL.new(flipper_store, &block)
end

.experiment(name, logger = nil, &block) ⇒ Object


23
24
25
26
# File 'lib/dolphin.rb', line 23

def self.experiment(name, logger=nil, &block)
  experiment = Dolphin::Experiment.new(name, logger, &block)
  experiment.run
end

.feature_available?(name) ⇒ Boolean


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/dolphin.rb', line 36

def self.feature_available?(name)
  if feature_store
    if flipper_name = feature_store[name]
      if flipper = flipper_store[flipper_name]
        instance_eval(&flipper)
      else
        false
      end
    else
      false
    end
  else
    raise "Dolphin has not been initialized with a features file"
  end
end

.feature_storeObject


19
20
21
# File 'lib/dolphin.rb', line 19

def self.feature_store
  @feature_store
end

.flipper_storeObject


15
16
17
# File 'lib/dolphin.rb', line 15

def self.flipper_store
  @flipper_store ||= FlipperStore.new
end

.init(feature_file) ⇒ Object


28
29
30
# File 'lib/dolphin.rb', line 28

def self.init(feature_file)
  @feature_store = FeatureStore.new(feature_file)
end

.init_with_store(feature_store) ⇒ Object


32
33
34
# File 'lib/dolphin.rb', line 32

def self.init_with_store(feature_store)
  @feature_store = feature_store
end