Class: Dotenvious::Loaders::Environments

Inherits:
Object
  • Object
show all
Defined in:
lib/dotenvious/loaders/environments.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Environments

Returns a new instance of Environments.



7
8
9
10
# File 'lib/dotenvious/loaders/environments.rb', line 7

def initialize(options = {})
  @example_file = options[:example_file] || DEFAULT_EXAMPLE_ENV_FILE
  @env_file = options[:env_file] || DEFAULT_ENV_FILE
end

Instance Method Details

#load_environmentsObject



12
13
14
15
16
# File 'lib/dotenvious/loaders/environments.rb', line 12

def load_environments
  ENV.merge!(DotenvFile.load_from(env_file))
  environment_loader = example_file.match(/\.ya?ml/) ? YamlFile : DotenvFile
  ENV_EXAMPLE.merge!(environment_loader.load_from(example_file))
end