Module: MiniTools::Configuration::ClassMethods
- Defined in:
- lib/mini_tools/configuration.rb
Instance Method Summary collapse
-
#allow(*values) ⇒ Object
Adds values to the allowed list of settings.
-
#config ⇒ Object
Returns the configuration object.
-
#configure {|config| ... } ⇒ Object
Accepts a block of configuration values.
-
#settings ⇒ Object
Returns an array of allowed settings.
Instance Method Details
#allow(*values) ⇒ Object
Adds values to the allowed list of settings. Accepts either a single settings key or array and can be called multiple times.
36 37 38 |
# File 'lib/mini_tools/configuration.rb', line 36 def allow *values @settings = settings.concat(values).uniq end |
#config ⇒ Object
Returns the configuration object
41 42 43 |
# File 'lib/mini_tools/configuration.rb', line 41 def config @config ||= Struct.new(*settings).new end |
#configure {|config| ... } ⇒ Object
Accepts a block of configuration values
46 47 48 |
# File 'lib/mini_tools/configuration.rb', line 46 def configure yield config end |
#settings ⇒ Object
Returns an array of allowed settings
51 52 53 |
# File 'lib/mini_tools/configuration.rb', line 51 def settings @settings ||= [] end |