Module: Confg
- Defined in:
- lib/confg.rb,
lib/confg/version.rb,
lib/confg/erb_context.rb,
lib/confg/configuration.rb
Defined Under Namespace
Classes: Configuration, ErbContext
Constant Summary
collapse
- VERSION =
"1.0.3"
Class Method Summary
collapse
Class Method Details
20
21
22
23
24
|
# File 'lib/confg.rb', line 20
def configure(raise_on_missed_key = false)
@configuration ||= ::Confg::Configuration.new(raise_on_missed_key)
yield @configuration if block_given?
@configuration
end
|
.erb_function(function_name, &block) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/confg.rb', line 13
def erb_function(function_name, &block)
::Confg::ErbContext.class_eval do
define_method(function_name, &block)
end
self
end
|
.get(path) ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/confg.rb', line 35
def get(path)
thing = self
path.split('.').each do |piece|
thing = thing.try(piece)
end
thing
end
|
.method_missing(method_name, *args, &block) ⇒ Object
27
28
29
|
# File 'lib/confg.rb', line 27
def method_missing(method_name, *args, &block)
config.send(method_name, *args, &block)
end
|
.respond_to_missing?(*args) ⇒ Boolean
31
32
33
|
# File 'lib/confg.rb', line 31
def respond_to_missing?(*args)
true
end
|
.root ⇒ Object
9
10
11
|
# File 'lib/confg.rb', line 9
def root
@root ||= Pathname.new(calc_root_string).expand_path
end
|