Module: OpenKVK::Configuration
- Included in:
- OpenKVK
- Defined in:
- lib/openkvk/configuration.rb
Overview
Defines constants and methods related to configuration
Constant Summary collapse
- VALID_OPTIONS_KEYS =
An array of valid keys in the options hash when configuring an API
[:host].freeze
- DEFAULT_HOST =
By default, set openkvk.nl as the server
"openkvk.nl".freeze
Class Method Summary collapse
-
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block.
-
#options ⇒ Object
Create a hash of options and their values.
-
#reset ⇒ Object
Reset all configuration options to defaults.
Class Method Details
.extended(base) ⇒ Object
When this module is extended, set all configuration options to their default values
14 15 16 |
# File 'lib/openkvk/configuration.rb', line 14 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block
19 20 21 |
# File 'lib/openkvk/configuration.rb', line 19 def configure yield self end |
#options ⇒ Object
Create a hash of options and their values
24 25 26 27 28 |
# File 'lib/openkvk/configuration.rb', line 24 def VALID_OPTIONS_KEYS.inject({}) do |option, key| option.merge!(key => send(key)) end end |
#reset ⇒ Object
Reset all configuration options to defaults
31 32 33 34 |
# File 'lib/openkvk/configuration.rb', line 31 def reset self.host = DEFAULT_HOST self end |