Do not detach in sample code

the sample code should be batteries included ready to go
putting the detach sample in a ruby file and running it
does not keep running
This commit is contained in:
ChillerDragon 2023-09-17 11:03:40 +02:00
parent 27bfbc22ff
commit a98295bc23
2 changed files with 16 additions and 16 deletions

View file

@ -15,7 +15,7 @@ client.on_input_timing do |context|
puts "time_left: #{context.message.time_left}" puts "time_left: #{context.message.time_left}"
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_maplist_entry_rem"></a> #on_maplist_entry_rem(&block) ### <a name="on_maplist_entry_rem"></a> #on_maplist_entry_rem(&block)
@ -34,7 +34,7 @@ client.on_maplist_entry_rem do |context|
puts context.message.name puts context.message.name
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_maplist_entry_add"></a> #on_maplist_entry_add(&block) ### <a name="on_maplist_entry_add"></a> #on_maplist_entry_add(&block)
@ -53,7 +53,7 @@ client.on_maplist_entry_add do |context|
puts context.message.name puts context.message.name
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_rcon_cmd_rem"></a> #on_rcon_cmd_rem(&block) ### <a name="on_rcon_cmd_rem"></a> #on_rcon_cmd_rem(&block)
@ -70,7 +70,7 @@ client.on_rcon_cmd_rem do |context|
# TODO: generated documentation # TODO: generated documentation
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_rcon_cmd_add"></a> #on_rcon_cmd_add(&block) ### <a name="on_rcon_cmd_add"></a> #on_rcon_cmd_add(&block)
@ -87,7 +87,7 @@ client.on_rcon_cmd_add do |context|
# TODO: generated documentation # TODO: generated documentation
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_auth_off"></a> #on_auth_off(&block) ### <a name="on_auth_off"></a> #on_auth_off(&block)
@ -104,7 +104,7 @@ client.on_auth_off do |context|
# TODO: generated documentation # TODO: generated documentation
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_auth_on"></a> #on_auth_on(&block) ### <a name="on_auth_on"></a> #on_auth_on(&block)
@ -121,7 +121,7 @@ client.on_auth_on do |context|
# TODO: generated documentation # TODO: generated documentation
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_snapshot"></a> #on_snapshot(&block) ### <a name="on_snapshot"></a> #on_snapshot(&block)
@ -138,7 +138,7 @@ client.on_snapshot do |context|
# TODO: generated documentation # TODO: generated documentation
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_rcon_line"></a> #on_rcon_line(&block) ### <a name="on_rcon_line"></a> #on_rcon_line(&block)
@ -155,7 +155,7 @@ client.on_rcon_line do |context|
# TODO: generated documentation # TODO: generated documentation
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_disconnect"></a> #on_disconnect(&block) ### <a name="on_disconnect"></a> #on_disconnect(&block)
@ -172,7 +172,7 @@ client.on_disconnect do |context|
# TODO: generated documentation # TODO: generated documentation
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_connected"></a> #on_connected(&block) ### <a name="on_connected"></a> #on_connected(&block)
@ -189,7 +189,7 @@ client.on_connected do |context|
# TODO: generated documentation # TODO: generated documentation
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_client_info"></a> #on_client_info(&block) ### <a name="on_client_info"></a> #on_client_info(&block)
@ -206,7 +206,7 @@ client.on_client_info do |context|
# TODO: generated documentation # TODO: generated documentation
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_chat"></a> #on_chat(&block) ### <a name="on_chat"></a> #on_chat(&block)
@ -227,7 +227,7 @@ client.on_chat do |context, msg|
puts "[chat] #{msg}" puts "[chat] #{msg}"
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_map_change"></a> #on_map_change(&block) ### <a name="on_map_change"></a> #on_map_change(&block)
@ -248,7 +248,7 @@ client.on_map_change do |context|
context.cancel context.cancel
end end
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
``` ```
### <a name="on_client_drop"></a> #on_client_drop(&block) ### <a name="on_client_drop"></a> #on_client_drop(&block)
@ -321,7 +321,7 @@ Send a chat message. Takes the chat message as String.
```ruby ```ruby
client = TeeworldsClient.new(verbose: true) client = TeeworldsClient.new(verbose: true)
client.connect('localhost', 8303, detach: true) client.connect('localhost', 8303, detach: false)
client.send_chat('hello world!') client.send_chat('hello world!')
``` ```

View file

@ -73,7 +73,7 @@ function add_hook_doc() {
fi fi
local tmpdoc local tmpdoc
local obj_var=client local obj_var=client
local run="client.connect('localhost', 8303, detach: true)" local run="client.connect('localhost', 8303, detach: false)"
if [[ "$ruby_class" =~ Server ]] if [[ "$ruby_class" =~ Server ]]
then then
obj_var=server obj_var=server