Class: ComplexConfig::Config
- Defined in:
- lib/complex_config/config.rb
Instance Attribute Summary collapse
-
#config_dir ⇒ Object
Returns the value of attribute config_dir.
-
#deep_freeze ⇒ Object
Returns the value of attribute deep_freeze.
-
#env ⇒ Object
Returns the value of attribute env.
-
#plugins ⇒ Object
Returns the value of attribute plugins.
Instance Method Summary collapse
- #add_plugin(code) ⇒ Object
- #configure(provider) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
3 4 5 6 |
# File 'lib/complex_config/config.rb', line 3 def initialize(*) super self.plugins = [] end |
Instance Attribute Details
#config_dir ⇒ Object
Returns the value of attribute config_dir
2 3 4 |
# File 'lib/complex_config/config.rb', line 2 def config_dir @config_dir end |
#deep_freeze ⇒ Object
Returns the value of attribute deep_freeze
2 3 4 |
# File 'lib/complex_config/config.rb', line 2 def deep_freeze @deep_freeze end |
#env ⇒ Object
Returns the value of attribute env
2 3 4 |
# File 'lib/complex_config/config.rb', line 2 def env @env end |
#plugins ⇒ Object
Returns the value of attribute plugins
2 3 4 |
# File 'lib/complex_config/config.rb', line 2 def plugins @plugins end |
Instance Method Details
#add_plugin(code) ⇒ Object
20 21 22 23 |
# File 'lib/complex_config/config.rb', line 20 def add_plugin(code) plugins << code self end |
#configure(provider) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/complex_config/config.rb', line 8 def configure(provider) each_pair do |name, value| value.nil? and next name == :plugins and next provider.__send__("#{name}=", value) end plugins.each do |code| provider.add_plugin(code) end self end |