Class: Sinclair::Config
- Extended by:
- ConfigClass
- Defined in:
- lib/sinclair/config.rb,
lib/sinclair/config/methods_builder.rb
Overview
Base class for configuration when using Configurable
The methods will be added later by ConfigFactory
The instance variables will be set by ConfigBuilder
Defined Under Namespace
Classes: MethodsBuilder
Instance Method Summary collapse
-
#as_options(options_hash = {}) ⇒ Sinclair::Option
Returns options with configurated values.
-
#to_hash ⇒ Hash
Return all the current configurations in a hash.
Methods included from ConfigClass
add_configs, config_attributes, options_class
Instance Method Details
#as_options(options_hash = {}) ⇒ Sinclair::Option
Returns options with configurated values
The returned options will use the values defined in the config merged with the extra attributes
83 84 85 |
# File 'lib/sinclair/config.rb', line 83 def ( = {}) self.class..new(to_hash.merge()) end |
#to_hash ⇒ Hash
Return all the current configurations in a hash
35 36 37 38 39 |
# File 'lib/sinclair/config.rb', line 35 def to_hash self.class.config_attributes.each_with_object({}) do |attribute, hash| hash[attribute.to_s] = public_send(attribute) end end |