diff --git a/exe/client b/exe/client index 7447a8e..42941d0 100755 --- a/exe/client +++ b/exe/client @@ -1,6 +1,8 @@ #!/usr/bin/env ruby # frozen_string_literal: true +require 'bundler/setup' + lib = File.expand_path('../lib', __dir__).freeze $LOAD_PATH.unshift lib unless $LOAD_PATH.include? lib diff --git a/lib/main.rb b/lib/main.rb index 8c854b1..4597db4 100644 --- a/lib/main.rb +++ b/lib/main.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'tox' + require 'thread' require 'faker' @@ -24,19 +26,19 @@ private def call before_loop - loop do - before_iteration - sleep - after_iteration - end + before_iteration + @tox_client.run after_loop end - def sleep - super 0.01 - end - def before_loop + @tox_client = Tox::Client.new + + @tox_client.on_iteration do + after_iteration + before_iteration + end + @screen = Screen.new Style.default = Style.new end