Method: Geoloqi::Config#initialize

Defined in:
lib/geoloqi/config.rb

#initialize(opts = {}) ⇒ Config

Instantiate a new Geoloqi::Config object.

Examples:

# Dynamically create a Geoloqi::Config object
geoloqi_config = Geoloqi::Config.new :use_hashie_mash => true, :throw_exceptions => false

# Use geoloqi_config to create new session
geoloqi_session = Geoloqi::Session.new :access_token => 'YOUR ACCESS TOKEN', :config => geoloqi_config

Parameters:

  • opts (defaults to: {})

    A hash of the config settings.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/geoloqi/config.rb', line 80

def initialize(opts={})
  self.use_hashie_mash ||= false
  self.throw_exceptions ||= true
  self.symbolize_names ||= true
  self.use_dynamic_exceptions ||= false

  opts.each {|k,v| send("#{k}=", v)}

  begin
    require 'hashie' if self.use_hashie_mash && !defined?(Hashie::Mash)
  rescue LoadError
    raise Error, "You've requested Hashie::Mash, but the gem is not available. Don't set use_hashie_mash in your config, or install the hashie gem"
  end
end