Module: DisplayWords::Configuration
- Included in:
- DisplayWords
- Defined in:
- lib/display_words/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[:username, :password, :domain, :format]
- VALID_FORMATS =
[:json]
- DEFAULT_DOMAIN =
'http://hb.sand-08.adnxs.net/'- DEFAULT_FORMAT =
'json'
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
12 13 14 15 |
# File 'lib/display_words/configuration.rb', line 12 def self.extended(base) base.reset self end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block
18 19 20 |
# File 'lib/display_words/configuration.rb', line 18 def configure yield self end |
#options ⇒ Object
Create a hash of options and their values
23 24 25 26 27 |
# File 'lib/display_words/configuration.rb', line 23 def = {} VALID_OPTIONS_KEYS.each{|k| [k] = send(k) } end |
#reset ⇒ Object
Reset all configuration options to defaults
30 31 32 33 34 |
# File 'lib/display_words/configuration.rb', line 30 def reset self.domain = DEFAULT_DOMAIN self.format = DEFAULT_FORMAT self end |