Class: Geoloqi::Config
- Inherits:
-
Object
- Object
- Geoloqi::Config
- Defined in:
- lib/geoloqi/config.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#enable_logging ⇒ Object
Returns the value of attribute enable_logging.
-
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
-
#throw_exceptions ⇒ Object
Returns the value of attribute throw_exceptions.
-
#use_hashie_mash ⇒ Object
Returns the value of attribute use_hashie_mash.
Instance Method Summary collapse
- #client_id? ⇒ Boolean
- #client_secret? ⇒ Boolean
-
#initialize(opts = {}) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(opts = {}) ⇒ Config
Returns a new instance of Config.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/geoloqi/config.rb', line 4 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 |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
3 4 5 |
# File 'lib/geoloqi/config.rb', line 3 def adapter @adapter end |
#client_id ⇒ Object
Returns the value of attribute client_id.
3 4 5 |
# File 'lib/geoloqi/config.rb', line 3 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
3 4 5 |
# File 'lib/geoloqi/config.rb', line 3 def client_secret @client_secret end |
#enable_logging ⇒ Object
Returns the value of attribute enable_logging.
3 4 5 |
# File 'lib/geoloqi/config.rb', line 3 def enable_logging @enable_logging end |
#redirect_uri ⇒ Object
Returns the value of attribute redirect_uri.
3 4 5 |
# File 'lib/geoloqi/config.rb', line 3 def redirect_uri @redirect_uri end |
#throw_exceptions ⇒ Object
Returns the value of attribute throw_exceptions.
3 4 5 |
# File 'lib/geoloqi/config.rb', line 3 def throw_exceptions @throw_exceptions end |
#use_hashie_mash ⇒ Object
Returns the value of attribute use_hashie_mash.
3 4 5 |
# File 'lib/geoloqi/config.rb', line 3 def use_hashie_mash @use_hashie_mash end |
Instance Method Details
#client_id? ⇒ Boolean
17 18 19 |
# File 'lib/geoloqi/config.rb', line 17 def client_id? !client_id.nil? && !client_id.empty? end |
#client_secret? ⇒ Boolean
21 22 23 |
# File 'lib/geoloqi/config.rb', line 21 def client_secret? !client_secret.nil? && !client_secret.empty? end |