Class: Mack::BootLoader

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/mack/initialization/boot_loader.rb

Defined Under Namespace

Classes: Loader

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBootLoader

Returns a new instance of BootLoader.



16
17
18
# File 'lib/mack/initialization/boot_loader.rb', line 16

def initialize
  self.sequences = {}
end

Instance Attribute Details

#sequencesObject

Returns the value of attribute sequences.



14
15
16
# File 'lib/mack/initialization/boot_loader.rb', line 14

def sequences
  @sequences
end

Class Method Details

.run(*args) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/mack/initialization/boot_loader.rb', line 24

def self.run(*args)
  args.each do |a|
    begin
      Mack::BootLoader.instance.sequences[a.to_sym].run
    rescue Exception => e
      raise e
    end
  end
end

.run!(*args) ⇒ Object



34
35
36
37
38
# File 'lib/mack/initialization/boot_loader.rb', line 34

def self.run!(*args)
  args.each do |a|
    Mack::BootLoader.instance.sequences[a.to_sym].run!
  end
end

Instance Method Details

#add(name, *dependencies, &block) ⇒ Object



20
21
22
# File 'lib/mack/initialization/boot_loader.rb', line 20

def add(name, *dependencies, &block)
  self.sequences[name.to_sym] = Mack::BootLoader::Loader.new(name.to_sym, *dependencies, &block)
end