Class: Dbdoc::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/dbdoc/config.rb

Overview

Dbdoc::Config class knows how to load the default config from the dbdoc gem folder. Later, if needed, this class could be used to merge user-defined config with the default one.

Instance Method Summary collapse

Constructor Details

#initialize(local_path: Dir.pwd) ⇒ Config

Returns a new instance of Config.



11
12
13
# File 'lib/dbdoc/config.rb', line 11

def initialize(local_path: Dir.pwd)
  @local_path = local_path
end

Instance Method Details

#loadObject



15
16
17
18
19
20
21
22
23
# File 'lib/dbdoc/config.rb', line 15

def load
  local_config_file = File.join(@local_path, "config.yml")

  if File.exist?(local_config_file)
    YAML.load(File.read(local_config_file))
  else
    {}
  end
end