Class: Timmy::Runner
- Inherits:
-
Object
- Object
- Timmy::Runner
- Defined in:
- lib/timmy/runner.rb
Class Method Summary collapse
Instance Method Summary collapse
- #consume_stdin ⇒ Object
-
#initialize(replay_speed:) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(replay_speed:) ⇒ Runner
Returns a new instance of Runner.
20 21 22 23 |
# File 'lib/timmy/runner.rb', line 20 def initialize(replay_speed:) @replay_speed = replay_speed @last_replay_time = 0 end |
Class Method Details
.run ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/timmy/runner.rb', line 8 def run ConfigLoader.load = OptionParser.parse replay_speed = [:replay_speed] || @replay_speed Logger.set_precision([:precision]) if .key?(:precision) Logger.set_profile([:profile]) if .key?(:profile) self.new(replay_speed: replay_speed).consume_stdin end |
.set_replay_speed(speed) ⇒ Object
4 5 6 |
# File 'lib/timmy/runner.rb', line 4 def set_replay_speed(speed) @replay_speed = speed end |
Instance Method Details
#consume_stdin ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/timmy/runner.rb', line 25 def consume_stdin around_run_lines do STDIN.each_line do |line| next if init_replay_mode(line) if @replay_mode replay_line(line) else run_line(line.rstrip) end end Logger.put_eof unless @replay_mode end end |