Module: GermDefault
Constant Summary
collapse
- CACHE =
{}
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
64
65
66
67
68
69
70
71
|
# File 'lib/germ/config.rb', line 64
def method_missing sym, *args, &block
begin
cache_load sym
rescue GermConfig::KeyError
super
end
end
|
Instance Method Details
#cache ⇒ Object
50
51
52
|
# File 'lib/germ/config.rb', line 50
def cache
CACHE[self] ||= {}
end
|
#cache_load(key) ⇒ Object
60
61
62
|
# File 'lib/germ/config.rb', line 60
def cache_load key
cache[key] ||= load_key(key)
end
|
#default ⇒ Object
54
55
56
57
|
# File 'lib/germ/config.rb', line 54
def default
cache[:default] ||= load_default
end
|
#has_default(*key_chain) ⇒ Object
46
47
48
|
# File 'lib/germ/config.rb', line 46
def has_default *key_chain
@key_chain = key_chain
end
|