Class: Snapcrawl::Config

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

Class Method Summary collapse

Class Method Details

.load(file = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/snapcrawl/config.rb', line 7

def load(file = nil)
  reset!
  push defaults

  return unless file

  file = "#{file}.yml" unless /\.ya?ml$/.match?(file)

  # FIXME: Cannot use logger here due to the "chicken and egg" with
  #        Config. The $logger is available, but it was not yet fully
  #        configured with log_level etc.
  if File.exist? file
    # $logger.debug "loading config file g`#{file}`"
    push file
  else
    # $logger.debug "creating config file g`#{file}`"
    create_config file
  end
end