Archived
1
0
Fork 0

Use Tox::Client#run to event loop

This commit is contained in:
Braiden Vasco 2017-07-25 23:06:37 +00:00
parent b0aae52682
commit 7c07f1ff83
2 changed files with 13 additions and 9 deletions

View file

@ -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

View file

@ -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