Sha256: c5a9b66fdad66519c141373fd5217cb084dc231f5af95ecdb2c922dcddeac3c2

Contents?: true

Size: 887 Bytes

Versions: 8

Compression:

Stored size: 887 Bytes

Contents

module Geoloqi
  class Config
    attr_accessor :client_id, :client_secret, :redirect_uri, :adapter, :enable_logging, :use_hashie_mash, :throw_exceptions
    def initialize(opts={})
      self.enable_logging ||= false
      self.use_hashie_mash ||= false
      self.throw_exceptions ||= true
      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
      raise ArgumentError, 'enable_logging must be boolean' unless [true, false].include? self.enable_logging
    end

    def client_id?
      !client_id.nil? && !client_id.empty?
    end

    def client_secret?
      !client_secret.nil? && !client_secret.empty?
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
geoloqi-0.9.23 lib/geoloqi/config.rb
geoloqi-0.9.22 lib/geoloqi/config.rb
geoloqi-0.9.21 lib/geoloqi/config.rb
geoloqi-0.9.19 lib/geoloqi/config.rb
geoloqi-0.9.18 lib/geoloqi/config.rb
geoloqi-0.9.17 lib/geoloqi/config.rb
geoloqi-0.9.16 lib/geoloqi/config.rb
geoloqi-0.9.15 lib/geoloqi/config.rb