Class: CommandTimer::Runner
- Inherits:
-
Object
- Object
- CommandTimer::Runner
- Defined in:
- lib/command_timer/runner.rb
Instance Method Summary collapse
-
#initialize(yml, options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #start ⇒ Object
Constructor Details
#initialize(yml, options = {}) ⇒ Runner
Returns a new instance of Runner.
3 4 5 6 7 8 |
# File 'lib/command_timer/runner.rb', line 3 def initialize(yml, = {}) @commands = Parser.parse(yml) echo_commands @count_down = ['count_down'] || 30 @ntp_server = ['ntp_server'] end |
Instance Method Details
#start ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/command_timer/runner.rb', line 10 def start @commands.each_with_index do |command, index| puts "########################################" puts "# Next: Command#{index + 1}" puts "# #{command.description}" if command.description command.echo_command("# ") puts "########################################" if command.burn_time if ['auto', 'Auto'].include?(command.burn_time) command.exec else count_down_and_burn_command(command) end else wait_input_to_continue(command) end end end |