Module: RubyFlipper

Defined in:
lib/ruby_flipper.rb,
lib/ruby_flipper/dsl.rb,
lib/ruby_flipper/feature.rb,
lib/ruby_flipper/railtie.rb,
lib/ruby_flipper/object_mixin.rb,
lib/ruby_flipper/condition_context.rb

Defined Under Namespace

Modules: ObjectMixin Classes: ConditionContext, Dsl, Feature, NotDefinedError, Railtie

Class Method Summary collapse

Class Method Details

.configObject



12
13
14
# File 'lib/ruby_flipper.rb', line 12

def self.config
  @@config ||= {}
end

.config=(config) ⇒ Object



16
17
18
# File 'lib/ruby_flipper.rb', line 16

def self.config=(config)
  @@config = config
end

.load(file = nil) ⇒ Object

Raises:

  • (ArgumentError)


20
21
22
23
24
# File 'lib/ruby_flipper.rb', line 20

def self.load(file = nil)
  file ||= config[:feature_file]
  raise ArgumentError, 'you have to either specify or configure a feature definition file in RubyFlipper::config[:feature_file]' if file.nil?
  Dsl.new.instance_eval(IO.read file) if File.exist?(file)
end

.resetObject



26
27
28
29
# File 'lib/ruby_flipper.rb', line 26

def self.reset
  @@config = nil
  Feature.reset
end

.silence_warningsObject



31
32
33
34
35
36
37
# File 'lib/ruby_flipper.rb', line 31

def self.silence_warnings
  warn_level = $VERBOSE
  $VERBOSE = nil
  yield
ensure
  $VERBOSE = warn_level
end