Class: QStat::Response
- Inherits:
-
Object
- Object
- QStat::Response
- Defined in:
- lib/ruby-qstat.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#gamename ⇒ Object
Returns the value of attribute gamename.
-
#gametype ⇒ Object
Returns the value of attribute gametype.
-
#xml ⇒ Object
Returns the value of attribute xml.
Instance Method Summary collapse
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
25 26 27 |
# File 'lib/ruby-qstat.rb', line 25 def address @address end |
#doc ⇒ Object
Returns the value of attribute doc.
27 28 29 |
# File 'lib/ruby-qstat.rb', line 27 def doc @doc end |
#gamename ⇒ Object
Returns the value of attribute gamename.
29 30 31 |
# File 'lib/ruby-qstat.rb', line 29 def gamename @gamename end |
#gametype ⇒ Object
Returns the value of attribute gametype.
28 29 30 |
# File 'lib/ruby-qstat.rb', line 28 def gametype @gametype end |
#xml ⇒ Object
Returns the value of attribute xml.
26 27 28 |
# File 'lib/ruby-qstat.rb', line 26 def xml @xml end |
Instance Method Details
#status_code ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/ruby-qstat.rb', line 31 def status_code server = @doc.search("/qstat/server[1]").first if server.attributes["type"].value.upcase == @gametype.upcase if server.attributes["address"].value == @address return server.attributes["status"].value end end nil end |
#to_ror ⇒ Object
54 55 56 |
# File 'lib/ruby-qstat.rb', line 54 def to_ror Hash.from_xml(@doc.to_s) end |
#to_s ⇒ Object
50 51 52 |
# File 'lib/ruby-qstat.rb', line 50 def to_s @xml end |
#valid? ⇒ Boolean
41 42 43 44 45 46 47 48 |
# File 'lib/ruby-qstat.rb', line 41 def valid? case status_code when "UP" true else false end end |