Class: StatMon::CLI::Execute
- Inherits:
-
Object
- Object
- StatMon::CLI::Execute
- Defined in:
- lib/stat_mon/cli/execute.rb
Instance Method Summary collapse
-
#initialize(params) ⇒ Execute
constructor
A new instance of Execute.
- #load_config(config) ⇒ Object
- #load_stat_file(stat_file) ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(params) ⇒ Execute
Returns a new instance of Execute.
5 6 7 8 |
# File 'lib/stat_mon/cli/execute.rb', line 5 def initialize(params) @params = params start end |
Instance Method Details
#load_config(config) ⇒ Object
17 18 19 20 |
# File 'lib/stat_mon/cli/execute.rb', line 17 def load_config( config ) abort "Unable to find config file" unless File.exist?( config ) load_stat_file( config ) end |
#load_stat_file(stat_file) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/stat_mon/cli/execute.rb', line 23 def load_stat_file( stat_file ) load File.( stat_file ) rescue Exception => e puts "There was an error in #{stat_file}" puts "\t" + e. puts "\t" + e.backtrace.join("\n\y\t") end |
#start ⇒ Object
10 11 12 13 14 15 |
# File 'lib/stat_mon/cli/execute.rb', line 10 def start StatMon.init config = load_config( @params[:config] ) StatMon.start end |