Class: ComplexConfig::Config

Inherits:
Struct
  • Object
show all
Defined in:
lib/complex_config/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

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_dirObject

Returns the value of attribute config_dir

Returns:

  • (Object)

    the current value of config_dir



2
3
4
# File 'lib/complex_config/config.rb', line 2

def config_dir
  @config_dir
end

#deep_freezeObject

Returns the value of attribute deep_freeze

Returns:

  • (Object)

    the current value of deep_freeze



2
3
4
# File 'lib/complex_config/config.rb', line 2

def deep_freeze
  @deep_freeze
end

#envObject

Returns the value of attribute env

Returns:

  • (Object)

    the current value of env



2
3
4
# File 'lib/complex_config/config.rb', line 2

def env
  @env
end

#pluginsObject

Returns the value of attribute plugins

Returns:

  • (Object)

    the current value of 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