Module: Flipper::Utilities::BulkFeatureChecker

Defined in:
lib/flipper/utilities/bulk_feature_checker.rb

Class Method Summary collapse

Class Method Details

.enabled_status(features) ⇒ Object

Accepts an array of feature keys (string or symbol format) and returns a result hash of which keys are enabled or disabled; feature keys are returned in string format



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/flipper/utilities/bulk_feature_checker.rb', line 8

def self.enabled_status(features)
  result = {
    enabled: [],
    disabled: []
  }

  Array(features).map(&:to_s).each do |feature|
    if Flipper.enabled?(feature)
      result[:enabled] << feature
    else
      result[:disabled] << feature
    end
  end

  result
end