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

Instance Method Summary collapse

Class Attribute Details

.configuration=(value) ⇒ Object (writeonly)

Sets the attribute configuration

Parameters:

  • value

    the value to set the attribute configuration to.



15
16
17
# File 'lib/taxonomite/taxonomite_configuration.rb', line 15

def configuration=(value)
  @configuration = value
end

Instance Method Details

#configObject



18
19
20
# File 'lib/taxonomite/taxonomite_configuration.rb', line 18

def config
  @configuration ||= create_configuration
end

#configure {|config| ... } ⇒ Object

Yields:



22
23
24
# File 'lib/taxonomite/taxonomite_configuration.rb', line 22

def configure
  yield(config)
end

#resetObject



26
27
28
# File 'lib/taxonomite/taxonomite_configuration.rb', line 26

def reset
  @configuration = create_configuration
end