Class: NntpScrape::Config

Inherits:
Hashie::Trash
  • Object
show all
Defined in:
lib/nntp_scrape/config.rb

Class Method Summary collapse

Class Method Details

.load(config_path) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/nntp_scrape/config.rb', line 12

def self.load(config_path)
  return [nil, :path_doesnt_exist] unless File.exist?(config_path)
  
  yaml =  YAML.load_file(config_path)
  [new(yaml), true]
rescue Psych::SyntaxError
  [nil, :invalid_yaml]
rescue ArgumentError => e
  [nil, e]
end