Module: Taxonomite::Configurable
- Included in:
- Configuration
- Defined in:
- lib/taxonomite/taxonomite_configuration.rb
Overview
Allows the class to be configured on its very own, such that it creates its own @configuration class object. Thus if ClassB inherited from ClassA and ClassA extends Configurable, then both could have their own configuration options? Any class that extends this must declare a create_configuration class method.
Class Attribute Summary collapse
-
.configuration ⇒ Object
writeonly
Sets the attribute configuration.
Instance Method Summary collapse
Class Attribute Details
.configuration=(value) ⇒ Object (writeonly)
Sets the attribute configuration
15 16 17 |
# File 'lib/taxonomite/taxonomite_configuration.rb', line 15 def configuration=(value) @configuration = value end |
Instance Method Details
#config ⇒ Object
18 19 20 |
# File 'lib/taxonomite/taxonomite_configuration.rb', line 18 def config @configuration ||= create_configuration end |
#configure {|config| ... } ⇒ Object
22 23 24 |
# File 'lib/taxonomite/taxonomite_configuration.rb', line 22 def configure yield(config) end |
#reset ⇒ Object
26 27 28 |
# File 'lib/taxonomite/taxonomite_configuration.rb', line 26 def reset @configuration = create_configuration end |