Module: Impartial::Configuration
- Included in:
- Impartial
- Defined in:
- lib/impartial/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :paths ].freeze
- DEFAULT_PATHS =
Look for impartial templates in this location
['./impartials']
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
15 16 17 |
# File 'lib/impartial/configuration.rb', line 15 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
20 21 22 |
# File 'lib/impartial/configuration.rb', line 20 def configure yield self end |
#options ⇒ Object
Create a hash of options and their values
25 26 27 28 29 |
# File 'lib/impartial/configuration.rb', line 25 def = {} VALID_OPTIONS_KEYS.each{|k| [k] = send(k)} end |
#reset ⇒ Object
Reset all configuration options to defaults
32 33 34 35 |
# File 'lib/impartial/configuration.rb', line 32 def reset self.paths = DEFAULT_PATHS self end |