Class: FeatureToggles::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/feature_toggles/loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Loader

Returns a new instance of Loader.



3
4
5
# File 'lib/feature_toggles/loader.rb', line 3

def initialize(env)
  @env = env
end

Instance Method Details

#load(file_name) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/feature_toggles/loader.rb', line 7

def load(file_name)
  @feature_toggle_data ||= begin
    file_path = Rails.root.join("config", file_name)
    toggle_settings = HashWithIndifferentAccess.new(YAML::load(File.open(file_path)))
    toggle_settings[@env]
  end
end