Class: Cloudshaper::StackModules

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudshaper/stack_modules.rb

Overview

Stack module factory, register a module and provide clones of it

Defined Under Namespace

Classes: ModuleAlreadyRegistered, ModuleNotFound

Class Method Summary collapse

Class Method Details

.get(stack_module_name) ⇒ Object



17
18
19
20
# File 'lib/cloudshaper/stack_modules.rb', line 17

def get(stack_module_name)
  fail ModuleNotFound, "#{stack_module_name} module module not found" unless @stack_modules.key?(stack_module_name.downcase)
  @stack_modules[stack_module_name.downcase].clone
end

.has?(stack_module_name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/cloudshaper/stack_modules.rb', line 13

def has?(stack_module_name)
  @stack_modules.key?(stack_module_name.downcase)
end

.register(name, stack_module) ⇒ Object



8
9
10
11
# File 'lib/cloudshaper/stack_modules.rb', line 8

def register(name, stack_module)
  fail ModuleAlreadyRegistered, "#{name} is already a registered stack_module" if @stack_modules.key?(name.downcase)
  @stack_modules[name.downcase] = stack_module
end

.reset!Object



22
23
24
# File 'lib/cloudshaper/stack_modules.rb', line 22

def reset!
  @stack_modules = {}
end