flagon 1.0.4 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/flagon/inspector.rb +8 -1
  2. data/lib/flagon.rb +5 -0
  3. metadata +2 -2
@@ -7,7 +7,7 @@ module Flagon
7
7
  end
8
8
 
9
9
  def enabled?(flag_name)
10
- raise FlagMissing, "The flag #{flag_name} is missing" unless exists?(flag_name)
10
+ return false unless exists?(flag_name)
11
11
  get_flag(flag_name)
12
12
  end
13
13
 
@@ -17,6 +17,13 @@ module Flagon
17
17
  end
18
18
  end
19
19
 
20
+ def ensure_flags_exist(*flags)
21
+ missing_flags = flags.select do |flag_name|
22
+ !exists?(flag_name)
23
+ end
24
+ raise FlagMissing, "The following flags are missing: #{missing_flags.join(', ')}" unless missing_flags.empty?
25
+ end
26
+
20
27
  class FlagMissing < Exception
21
28
  end
22
29
 
data/lib/flagon.rb CHANGED
@@ -36,6 +36,11 @@ module Flagon
36
36
  @inspector.when_enabled(flag_name, &block)
37
37
  end
38
38
 
39
+ def ensure_flags_exist(*flags)
40
+ check_initialized
41
+ @inspector.ensure_flags_exist(*flags)
42
+ end
43
+
39
44
  private
40
45
 
41
46
  def check_initialized
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-02-12 00:00:00.000000000 Z
12
+ date: 2015-02-27 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A gem for managing feature flags either with environemnt variables or
15
15
  config files