Class: RconCs::Responses::QueryResponse
- Inherits:
-
Object
- Object
- RconCs::Responses::QueryResponse
- 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
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#raw_body ⇒ Object
readonly
Returns the value of attribute raw_body.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(body) ⇒ QueryResponse
constructor
A new instance of QueryResponse.
- #to_s ⇒ Object
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
#body ⇒ Object (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_body ⇒ Object (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 |
#type ⇒ Object (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_s ⇒ Object
21 22 23 |
# File 'lib/rcon_cs/responses/query_response.rb', line 21 def to_s "Type: #{@type}, Body: #{@body}" end |