Sha256: 27f2990ff8a045bb03976c9f949a1e92ccc857cd34749ed33ea95c8560ba8df6
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
module Geocoder class Configuration def self.options_and_defaults [ # geocoding service timeout (secs) [:timeout, 3], # name of geocoding service (symbol) [:lookup, :google], # ISO-639 language code [:language, :en], # use HTTPS for lookup requests? (if supported) [:use_https, false], # HTTP proxy server (user:pass@host:port) [:http_proxy, nil], # HTTPS proxy server (user:pass@host:port) [:https_proxy, nil], # API key for geocoding service [:api_key, nil], # cache object (must respond to #[], #[]=, and #keys) [:cache, nil], # prefix (string) to use for all cache keys [:cache_prefix, "geocoder:"], # exceptions that should not be rescued by default # (if you want to implement custom error handling); # supports SocketError and TimeoutError [:always_raise, []] ] end # define getters and setters for all configuration settings self.options_and_defaults.each do |o,d| eval("def self.#{o}; @@#{o}; end") eval("def self.#{o}=(obj); @@#{o} = obj; end") end ## # Set all values to default. # def self.set_defaults self.options_and_defaults.each do |o,d| self.send("#{o}=", d) end end end end Geocoder::Configuration.set_defaults
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geocoder-1.0.2 | lib/geocoder/configuration.rb |
geocoder-1.0.1 | lib/geocoder/configuration.rb |