Module: ConfigSL::DSL
- Included in:
- Config
- Defined in:
- lib/configsl/dsl.rb
Overview
DSL (Domain Specific Language) for defining configuration options.
This module provides the base functionality for building configuration classes. It should be included before any other modules that provide additional functionality, such as formatting or validation.
The class that includes this module will need to set the values for the options before they can be used. The easiest way to do this is to call ‘set_value` with each option and its value in the constructor.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
Include the class methods when the module is included.
Instance Method Summary collapse
-
#options ⇒ Hash
Returns the options hash for the class of the current instance.
-
#values ⇒ Array<Hash>
Returns the values of all the options.
Class Method Details
.included(base) ⇒ Object
Include the class methods when the module is included.
24 25 26 |
# File 'lib/configsl/dsl.rb', line 24 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#options ⇒ Hash
Returns the options hash for the class of the current instance.
31 32 33 |
# File 'lib/configsl/dsl.rb', line 31 def self.class. end |
#values ⇒ Array<Hash>
Returns the values of all the options.
38 39 40 |
# File 'lib/configsl/dsl.rb', line 38 def values .each_key.to_h { |name| [name, get_value(name)] } end |