Module: ConfigEnv

Defined in:
lib/config_env.rb,
lib/config_env/version.rb,
lib/config_env/rake_tasks.rb

Defined Under Namespace

Modules: Tasks Classes: EnvWrap

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.clearObject



27
28
29
# File 'lib/config_env.rb', line 27

def self.clear
  vars_hash.clear
end

.environmentObject



31
32
33
# File 'lib/config_env.rb', line 31

def self.environment
  ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'
end

.init(path_to_config) ⇒ Object



9
10
11
12
# File 'lib/config_env.rb', line 9

def self.init(path_to_config)
  @path = path_to_config
  Kernel.load(path) if File.exists?(path)
end

.pathObject



14
15
16
# File 'lib/config_env.rb', line 14

def self.path
  @path
end

.path_to_config(new_path) ⇒ Object

DEPRECATED. Use ‘init`



5
6
7
# File 'lib/config_env.rb', line 5

def self.path_to_config(new_path)
  init(new_path)
end

.vars(environment = nil) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/config_env.rb', line 18

def self.vars(environment = nil)
  environment = (environment || self.environment).to_s

  vars = (vars_hash[environment] || {}).clone
  vars.merge!(vars_hash["any"] || {})

  vars
end