Module: Dirble::Configurable
- Included in:
- Dirble
- Defined in:
- lib/dirble/configurable.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#connection ⇒ Object
Returns the value of attribute connection.
Instance Method Summary collapse
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/dirble/configurable.rb', line 3 def api_key @api_key end |
#connection ⇒ Object
Returns the value of attribute connection.
3 4 5 |
# File 'lib/dirble/configurable.rb', line 3 def connection @connection end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
5 6 7 8 9 |
# File 'lib/dirble/configurable.rb', line 5 def configure yield self prepare_connection self end |
#prepare_connection ⇒ Object
11 12 13 14 |
# File 'lib/dirble/configurable.rb', line 11 def prepare_connection raise ArgumentError, 'You have to set api key in configure' unless self.api_key self.connection = Dirble::Connection.new end |
#reset! ⇒ Object
16 17 18 |
# File 'lib/dirble/configurable.rb', line 16 def reset! self.api_key = nil end |