module FeatureCop::Whitelist::ClassMethods

Public Instance Methods

whitelist() click to toggle source
# File lib/feature_cop/whitelist.rb, line 21
def whitelist
  @whitelist ||= {}
end
whitelist=(whitelist) click to toggle source
# File lib/feature_cop/whitelist.rb, line 25
def whitelist=(whitelist)
  if whitelist.is_a?(Array)
    @whitelist = { "default" => whitelist }
    return
  end
  @whitelist = whitelist
end
whitelist_from_yaml(file = "feature_cop_whitelist.yml") click to toggle source
# File lib/feature_cop/whitelist.rb, line 10
def whitelist_from_yaml(file = "feature_cop_whitelist.yml")
  if ::File.exist?(file)
    absolute_path = file
  elsif defined?(Rails)
    absolute_path = ::File.join(Rails.root, "config", file)
  end

  raise "#{file} not found!" unless ::File.exist?(absolute_path)
  self.whitelist = ::YAML.load_file(absolute_path)[env]
end
whitelist_only(feature, identifier, options = {}) click to toggle source
# File lib/feature_cop/whitelist.rb, line 33
def whitelist_only(feature, identifier, options = {})
  whitelisted?(feature, identifier, options)
end
whitelisted?(feature, identifier, options = {}) click to toggle source
# File lib/feature_cop/whitelist.rb, line 37
def whitelisted?(feature, identifier, options = {})
  feature = "default" if whitelist[feature].nil?
  return false if whitelist[feature].nil?
  whitelist[feature].include?(identifier)
end