Class: ComplexConfig::Proxy
- Inherits:
-
BasicObject
- Defined in:
- lib/complex_config/proxy.rb
Instance Method Summary
collapse
Constructor Details
#initialize(env = nil) ⇒ Proxy
Returns a new instance of Proxy.
3
4
5
|
# File 'lib/complex_config/proxy.rb', line 3
def initialize(env = nil)
@env = env
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/complex_config/proxy.rb', line 20
def method_missing(name, *args)
config = ::ComplexConfig::Provider[name]
env, = args
if env
config[env]
elsif @env
config[@env]
else
config
end
end
|
Instance Method Details
#inspect ⇒ Object
11
12
13
|
# File 'lib/complex_config/proxy.rb', line 11
def inspect
"#<#{to_s}>"
end
|
#reload ⇒ Object
15
16
17
18
|
# File 'lib/complex_config/proxy.rb', line 15
def reload
::ComplexConfig::Provider.flush_cache
self
end
|
#to_s ⇒ Object
7
8
9
|
# File 'lib/complex_config/proxy.rb', line 7
def to_s
'ComplexConfig::Proxy'
end
|