Method: CascadingConfiguration::Core::Module::ExtendedConfigurations.parse_extension_modules

Defined in:
lib/cascading_configuration/core/module/extended_configurations.rb

.parse_extension_modules(instance_controller, encapsulation, *names_modules) ⇒ Object

self.parse_extension_modules #



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/cascading_configuration/core/module/extended_configurations.rb', line 8

def self.parse_extension_modules( instance_controller, encapsulation, *names_modules )
  
  # We can have configuration names or modules - we need to separate them.
  names = [ ]
  modules = [ ]

  names_modules.each do |this_name_or_module|

    case this_name_or_module
      
      when ::Class

        raise ArgumentError, 'Module expected (received Class).'
      
      when ::Module

        modules.push( this_name_or_module )

      else
      
        names.push( this_name_or_module )
      
    end
    
  end
  
  names_modules_hash = { }
  
  # if we have a block to define extensions to the compositing object:
    
  names.each do |this_name|
    names_modules_hash[ this_name ] = modules
  end
  
  return names_modules_hash
  
end