Class: Hako::EnvProviders::File

Inherits:
Hako::EnvProvider show all
Defined in:
lib/hako/env_providers/file.rb

Instance Method Summary collapse

Constructor Details

#initialize(root_path, options) ⇒ File

Returns a new instance of File.



7
8
9
10
11
12
# File 'lib/hako/env_providers/file.rb', line 7

def initialize(root_path, options)
  unless options['path']
    validation_error!('path must be set')
  end
  @path = root_path.join(options['path'])
end

Instance Method Details

#ask(variables) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/hako/env_providers/file.rb', line 14

def ask(variables)
  env = {}
  read_from_file do |key, val|
    if variables.include?(key)
      env[key] = val
    end
  end
  env
end