Sha256: 43b0c531f30ae0cfdc22ea5ea2b8b86cd9427b19e47947ffbe105632a00760b4
Contents?: true
Size: 981 Bytes
Versions: 4
Compression:
Stored size: 981 Bytes
Contents
require 'yaml' require 'mechanize' require 'parallel' require 'pg' require 'gis_scraper/version' require 'gis_scraper/feature_scraper' require 'gis_scraper/layer' # stackoverflow.com/questions/6233124/where-to-place-access-config-file-in-gem module GisScraper @config = {threads: 8, output_path: '~/Desktop', host: 'localhost', port: 5432, dbname: 'postgres', user: 'postgres', password: nil, srs: nil} @valid_keys = @config.keys def self.configure(opts = {}) opts.each { |k,v| @config[k.to_sym] = v if @valid_keys.include? k.to_sym } end def self.configure_with(path_to_yaml_file) begin config = YAML::load(IO.read(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 def self.config @config end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gis_scraper-0.1.6.pre | lib/gis_scraper.rb |
gis_scraper-0.1.5.pre | lib/gis_scraper.rb |
gis_scraper-0.1.4.pre | lib/gis_scraper.rb |
gis_scraper-0.1.3.pre | lib/gis_scraper.rb |