Class: RconCs::Responses::QueryResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/rcon_cs/responses/query_response.rb

Overview

Query response class, provides methods to parse the response from a Source server.

Constant Summary collapse

RESPONSE_TYPES =
{
  "41" => :challenge,
  "44" => :players,
  "45" => :rules,
  "49" => :info
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ QueryResponse

Returns a new instance of QueryResponse.



16
17
18
19
# File 'lib/rcon_cs/responses/query_response.rb', line 16

def initialize(body)
  @raw_body = body
  parse body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



14
15
16
# File 'lib/rcon_cs/responses/query_response.rb', line 14

def body
  @body
end

#raw_bodyObject (readonly)

Returns the value of attribute raw_body.



14
15
16
# File 'lib/rcon_cs/responses/query_response.rb', line 14

def raw_body
  @raw_body
end

#typeObject (readonly)

Returns the value of attribute type.



14
15
16
# File 'lib/rcon_cs/responses/query_response.rb', line 14

def type
  @type
end

Instance Method Details

#to_sObject



21
22
23
# File 'lib/rcon_cs/responses/query_response.rb', line 21

def to_s
  "Type: #{@type}, Body: #{@body}"
end