Class: Konfig::ConfigProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/konfig/config_provider.rb

Direct Known Subclasses

DirectoryProvider, YamlProvider

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mode:, workdir:) ⇒ ConfigProvider

Returns a new instance of ConfigProvider.

Raises:

  • (ArgumentError)


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

def initialize(mode:, workdir:)
  raise ArgumentError unless workdir
  raise ArgumentError unless [:yaml, :directory].include? mode
  raise FileNotFound, "directory #{workdir} not found" unless Dir.exist? workdir

  @mode = mode
  @workdir = workdir
end

Instance Attribute Details

#modeObject (readonly)

Returns the value of attribute mode.



3
4
5
# File 'lib/konfig/config_provider.rb', line 3

def mode
  @mode
end

#workdirObject (readonly)

Returns the value of attribute workdir.



4
5
6
# File 'lib/konfig/config_provider.rb', line 4

def workdir
  @workdir
end