Module: Confie

Extended by:
Confie
Included in:
Confie
Defined in:
lib/confie.rb

Constant Summary collapse

@@_files =
[]

Instance Method Summary collapse

Instance Method Details

#extend!(mod, name = 'settings') ⇒ Object



20
21
22
# File 'lib/confie.rb', line 20

def extend!(mod, name = 'settings')
  mod.extend load!.to_module(name)
end

#filesObject



8
9
10
# File 'lib/confie.rb', line 8

def files
  @@_files
end

#files=(files) ⇒ Object



12
13
14
# File 'lib/confie.rb', line 12

def files=(files)
  @@_files = files
end

#load(files) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/confie.rb', line 24

def load(files)
  content = Hashie::Mash.new
  Array(files).flatten.compact.uniq.each do |f|
    next unless File.exists?(f)
    content.deep_merge! Hashie::Mash.load(f)
  end
  content
end

#load!Object



16
17
18
# File 'lib/confie.rb', line 16

def load!
  load files
end