Class: Zgomot::Boot

Inherits:
Object show all
Defined in:
lib/zgomot/boot.rb

Class Method Summary collapse

Class Method Details

.bootObject



7
8
9
10
11
12
13
14
15
# File 'lib/zgomot/boot.rb', line 7

def boot
  Zgomot.logger = Logger.new(STDOUT)
  Zgomot.logger.level = Logger::WARN
  call_if_implemented(:call_before_start)
  Zgomot.logger.info "ZGOMOT BEGINNING"
  Zgomot.logger.info "APPLICATION PATH: #{Zgomot.app_path}"
  Zgomot.logger.info "CONFIGURATION FILE: #{Zgomot.config_file}"
  Zgomot.logger.info "CONFIGURATION: #{Zgomot.config.inspect}"
end

.call_if_implemented(method, *args) ⇒ Object



16
17
18
# File 'lib/zgomot/boot.rb', line 16

def call_if_implemented(method, *args)
  send(method, *args) if respond_to?(method)
end

.callbacks(*args) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/zgomot/boot.rb', line 19

def callbacks(*args)
  args.each do |meth|
    instance_eval <<-do_eval
      def #{meth}(&blk)
        define_meta_class_method(:call_#{meth}, &blk)
      end
    do_eval
  end
end