Class: Rubycon::RconExecutor
- Inherits:
-
Object
- Object
- Rubycon::RconExecutor
- Defined in:
- lib/rubycon/rcon_executor.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(server_info, command) ⇒ RconExecutor
constructor
A new instance of RconExecutor.
Constructor Details
#initialize(server_info, command) ⇒ RconExecutor
Returns a new instance of RconExecutor.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rubycon/rcon_executor.rb', line 4 def initialize(server_info, command) begin @commands = [] @server_info = server_info @session = SourceServer.new @server_info.address, @server_info.port @session.rcon_auth(@server_info.rcon) @response = rcon_exec command rescue RCONNoAuthError @response = 'Could not authenticate with gameserver. Wrong rcon password?' rescue Errno::ECONNREFUSED @response = 'Connection refused. Wrong host?' rescue SteamCondenser::TimeoutError @response = 'Connection timed out while sending command!' rescue Exception => e @response = "#{e.}" end end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/rubycon/rcon_executor.rb', line 3 def response @response end |