Class: Dotenvious::Loaders::YamlFile

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ YamlFile

Returns a new instance of YamlFile.



10
11
12
# File 'lib/dotenvious/loaders/yaml_file.rb', line 10

def initialize(filename)
  @filename = filename
end

Class Method Details

.load_from(filename) ⇒ Object



6
7
8
# File 'lib/dotenvious/loaders/yaml_file.rb', line 6

def self.load_from(filename)
  new(filename).load
end

Instance Method Details

#loadObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/dotenvious/loaders/yaml_file.rb', line 14

def load
  if file_missing?
    puts "This repo does not have an #{filename} file"
    return {}
  end
  Hash.new.tap do |environment|
    environment_variables.each do |(k, v)|
      environment[k] = v.to_s
    end
  end
end