Class: Konfig::DirectoryProvider

Inherits:
ConfigProvider show all
Defined in:
lib/konfig/directory_provider.rb

Instance Attribute Summary

Attributes inherited from ConfigProvider

#mode, #workdir

Instance Method Summary collapse

Constructor Details

#initialize(workdir:) ⇒ DirectoryProvider

Returns a new instance of DirectoryProvider.



6
7
8
9
10
11
# File 'lib/konfig/directory_provider.rb', line 6

def initialize(workdir:)
  super(mode: :yaml, workdir: workdir)
  @files = Dir.children(@workdir)
  # exclude any directories there
  @files = @files.delete_if { |x| File.directory?(File.join(@workdir, x)) }
end

Instance Method Details

#loadObject



13
14
15
16
# File 'lib/konfig/directory_provider.rb', line 13

def load
  Konfig.configuration.logger.info "Loading files from #{@workdir}"
  build_object_from_list(@files)
end