Module: GisScraper
- Defined in:
- lib/gis_scraper.rb,
lib/gis_scraper/version.rb
Overview
stackoverflow.com/questions/6233124/where-to-place-access-config-file-in-gem
Constant Summary collapse
- VERSION =
'0.0.0'
Class Method Summary collapse
Class Method Details
.config ⇒ Object
37 38 39 |
# File 'lib/gis_scraper.rb', line 37 def self.config @config end |
.configure(opts = {}) ⇒ Object
19 20 21 |
# File 'lib/gis_scraper.rb', line 19 def self.configure(opts = {}) opts.each { |k, v| @config[k.to_sym] = v if @valid_keys.include? k.to_sym } end |
.configure_with(path_to_yaml_file) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gis_scraper.rb', line 23 def self.configure_with(path_to_yaml_file) begin config = YAML.safe_load_file path_to_yaml_file rescue Errno::ENOENT puts "YAML configuration file couldn't be found. Using defaults" return rescue Psych::SyntaxError puts 'YAML configuration file contains invalid syntax. Using defaults' return end configure(config) end |