Class: Pdfh::SettingsBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/pdfh/utils/settings_builder.rb

Overview

Loads or creates a default settings yaml file

Constant Summary collapse

CONFIG_FILE_LOCATIONS =
[Dir.pwd, File.expand_path("~")].freeze
SUPPORTED_EXTENSIONS =
%w[yml yaml].freeze

Class Method Summary collapse

Class Method Details

.buildPdfh::Settings

Returns:



11
12
13
14
15
16
17
# File 'lib/pdfh/utils/settings_builder.rb', line 11

def build
  config_file = search_config_file
  file_hash = YAML.load_file(config_file, symbolize_names: true)
  Pdfh.debug "Loaded configuration file: #{config_file}"

  Settings.new(file_hash)
end