Class: Brief::Configuration
- Inherits:
-
Object
- Object
- Brief::Configuration
show all
- Includes:
- Singleton
- Defined in:
- lib/brief/configuration.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
27
28
29
30
31
32
33
34
35
|
# File 'lib/brief/configuration.rb', line 27
def method_missing(meth, *args, &block)
if current.respond_to?(meth) && current.key?(meth)
current.send(meth, *args, &block)
else
super if ENV['BRIEF_DEBUG_MODE']
nil
end
end
|
Class Method Details
.method_missing(meth, *args, &block) ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/brief/configuration.rb', line 7
def self.method_missing(meth, *args, &block)
if instance.respond_to?(meth)
instance.send(meth, *args, &block)
else
super
end
end
|
Instance Method Details
#current ⇒ Object
15
16
17
18
19
20
|
# File 'lib/brief/configuration.rb', line 15
def current
@current ||= {
docs_path: 'docs',
models_path: 'models'
}.to_mash
end
|
#set(attribute, value = nil) ⇒ Object
22
23
24
25
|
# File 'lib/brief/configuration.rb', line 22
def set(attribute, value = nil)
current[attribute] = value
self
end
|