Module: RareMap::ConfigLoader

Includes:
Errors
Included in:
Mapper
Defined in:
lib/rare_map/config_loader.rb

Overview

RareMap::ConfigLoader translates a rare_map.yml into DatabaseProfile.

Author:

  • Wei-Ming Wu

Constant Summary collapse

OPTS_KEY =

The key of rare map options inside a config YAML.

'rare_map_opts'

Instance Method Summary collapse

Instance Method Details

#load_config(path = '.', file_name = 'rare_map.yml') ⇒ Array

Translates a rare_map.yaml into an Array of DatabaseProfile.

Parameters:

  • path (String) (defaults to: '.')

    the folder which contains the RareMap config

  • file_name (String) (defaults to: 'rare_map.yml')

    the name of the RareMap config

Returns:

  • (Array)

    an Array of DatabaseProfile

Raises:



19
20
21
22
23
# File 'lib/rare_map/config_loader.rb', line 19

def load_config(path = '.', file_name = 'rare_map.yml')
  raise ConfigNotFoundError unless File.exist? File.join(path, file_name)
  config = YAML.load_file File.join(path, file_name)
  organize_config_properties config['rare_map'] || config || {}
end