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.



9
10
11
# File 'lib/dpl/helper/config_file.rb', line 9

def config_files
  @config_files
end

Instance Method Details

#config(*paths) ⇒ Object



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

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