Module: Dpl::ConfigFile::ClassMethods

Defined in:
lib/dpl/helper/config_file.rb

Overview

should this sit in Cl?

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#config_filesObject (readonly)

Returns the value of attribute config_files.



11
12
13
# File 'lib/dpl/helper/config_file.rb', line 11

def config_files
  @config_files
end

Instance Method Details

#config(*paths) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dpl/helper/config_file.rb', line 13

def config(*paths)
  if paths.any?
    @config_files = paths
  elsif config_files
    paths = config_files.dup
    opts = paths.last.is_a?(Hash) ? paths.pop : {}
    conf = ConfigFiles.new(paths, opts).config
    known = self.opts.map(&:name).map(&:to_sym)
    conf.select { |key, _| known.include?(key) }
  else
    {}
  end
end