Class: Cosmos::ScriptRunnerConfig
- Defined in:
- lib/cosmos/tools/script_runner/script_runner_config.rb
Overview
This class reads the Script Runner configuration file
Instance Method Summary collapse
-
#initialize(filename) ⇒ ScriptRunnerConfig
constructor
Processes the config file.
Constructor Details
#initialize(filename) ⇒ ScriptRunnerConfig
Processes the config file
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cosmos/tools/script_runner/script_runner_config.rb', line 18 def initialize(filename) parser = ConfigParser.new parser.parse_file(filename) do |keyword, params| case keyword when 'LINE_DELAY' parser.verify_num_parameters(1, 1, "#{keyword} <Delay in Seconds>") ScriptRunnerFrame.line_delay = params[0].to_f when 'MONITOR_LIMITS' parser.verify_num_parameters(0, 0, keyword) ScriptRunnerFrame.monitor_limits = true when 'PAUSE_ON_RED' parser.verify_num_parameters(0, 0, keyword) ScriptRunnerFrame.monitor_limits = true ScriptRunnerFrame.pause_on_red = true else # blank config.lines will have a nil keyword and should not raise an exception raise parser.error("Unknown keyword '#{keyword}'") if keyword end end end |