Module: Checkup::Config
- Defined in:
- lib/checkup/config.rb
Constant Summary collapse
- DEFAULT_ROOT_PATH =
'~/.checkup'
Class Attribute Summary collapse
-
.root_path ⇒ Object
Returns the value of attribute root_path.
Class Method Summary collapse
- .add_dsl_constants! ⇒ Object
- .create_modules(scope, names) ⇒ Object
- .get_or_create_empty_module(scope, const) ⇒ Object
Class Attribute Details
.root_path ⇒ Object
Returns the value of attribute root_path.
6 7 8 |
# File 'lib/checkup/config.rb', line 6 def root_path @root_path end |
Class Method Details
.add_dsl_constants! ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/checkup/config.rb', line 9 def add_dsl_constants! create_modules( self, [ # Services ['Http'], # Notifiers ['Mail'] ] ) end |
.create_modules(scope, names) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/checkup/config.rb', line 21 def create_modules(scope, names) names.flatten.each do |name| if name.is_a?(Hash) name.each do |key, val| create_modules(get_or_create_empty_module(scope, key), [val]) end else get_or_create_empty_module(scope, name) end end end |
.get_or_create_empty_module(scope, const) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/checkup/config.rb', line 33 def get_or_create_empty_module(scope, const) if scope.const_defined?(const) scope.const_get(const) else scope.const_set(const, Module.new) end end |