Class: Ambo::Loader

Inherits:
Object
  • Object
show all
Includes:
Loggable
Defined in:
lib/ambo/loader.rb

Overview

Parses and loads into bot via the Context class. This class then calls Ambo::Loaded#wait_until_exit! and blocks until the program is shutdown

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Loader


9
10
11
12
# File 'lib/ambo/loader.rb', line 9

def initialize(path)
  @path = path
  @runner = Runner.new
end

Instance Method Details

#load!Object


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ambo/loader.rb', line 14

def load!
  info_log "Started with pid #{Process.pid}"

  each_file do |file|
    eval_context file

    debug_log "Loaded #{file}"
  end

  info_log 'Starting bot runner'

  @runner.wait_until_exit!

  info_log 'Goodbye!'
end