Class: TriggerSwitchD::ConfigFactory::ProperEnvironmentFile
- Inherits:
-
Object
- Object
- TriggerSwitchD::ConfigFactory::ProperEnvironmentFile
- Defined in:
- lib/trigger_switch_d/config.rb
Overview
Verifies proper path to environment.rb
Instance Method Summary collapse
-
#initialize ⇒ ProperEnvironmentFile
constructor
A new instance of ProperEnvironmentFile.
- #path ⇒ Object
Constructor Details
#initialize ⇒ ProperEnvironmentFile
Returns a new instance of ProperEnvironmentFile.
23 24 25 26 27 |
# File 'lib/trigger_switch_d/config.rb', line 23 def initialize @paths_to_look = %w{~/.trigger_switch_d/config/ /etc/trigger_switch_d/config/ config/} @paths_to_look[0].gsub!("~",File.("~")) @env_name = "environment.rb" end |
Instance Method Details
#path ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/trigger_switch_d/config.rb', line 29 def path env_path = @paths_to_look.find do |path| File.exist?("#{path}#{@env_name}") end return offer_to_create if env_path == nil "#{env_path}#{@env_name}" end |