Class: Quill::Configuration
- Inherits:
-
Object
- Object
- Quill::Configuration
show all
- Defined in:
- lib/quill/configuration.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}, defaults = {}) ⇒ Configuration
Returns a new instance of Configuration.
4
5
6
7
8
9
10
11
|
# File 'lib/quill/configuration.rb', line 4
def initialize options = {}, defaults = {}
options.assert_valid_keys(*@@keys)
@config = {}
@@keys.each do |key|
@config[key] = options[key] || @@env["#{@@namespace.to_s.upcase}_#{key.to_s.upcase}"] || defaults[key]
end
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
13
14
15
16
|
# File 'lib/quill/configuration.rb', line 13
def method_missing method
super unless @@keys.include? method
@config[method]
end
|
Class Method Details
.env(env) ⇒ Object
27
28
29
|
# File 'lib/quill/configuration.rb', line 27
def env env
@@env = env
end
|
.keys(*args) ⇒ Object
19
20
21
|
# File 'lib/quill/configuration.rb', line 19
def keys *args
@@keys = args
end
|
.namespace(namespace) ⇒ Object
23
24
25
|
# File 'lib/quill/configuration.rb', line 23
def namespace namespace
@@namespace = namespace
end
|