Class: QStat::ServerInfo::Rule

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-qstat.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRule

Returns a new instance of Rule.



89
90
# File 'lib/ruby-qstat.rb', line 89

def initialize
end

Instance Attribute Details

#botsObject

Returns the value of attribute bots.



81
82
83
# File 'lib/ruby-qstat.rb', line 81

def bots
  @bots
end

#dedicatedObject

Returns the value of attribute dedicated.



82
83
84
# File 'lib/ruby-qstat.rb', line 82

def dedicated
  @dedicated
end

#game_portObject

Returns the value of attribute game_port.



86
87
88
# File 'lib/ruby-qstat.rb', line 86

def game_port
  @game_port
end

#game_tagObject

Returns the value of attribute game_tag.



87
88
89
# File 'lib/ruby-qstat.rb', line 87

def game_tag
  @game_tag
end

#gamedirObject

Returns the value of attribute gamedir.



79
80
81
# File 'lib/ruby-qstat.rb', line 79

def gamedir
  @gamedir
end

#gamenameObject

Returns the value of attribute gamename.



80
81
82
# File 'lib/ruby-qstat.rb', line 80

def gamename
  @gamename
end

#protocolObject

Returns the value of attribute protocol.



78
79
80
# File 'lib/ruby-qstat.rb', line 78

def protocol
  @protocol
end

#secureObject

Returns the value of attribute secure.



84
85
86
# File 'lib/ruby-qstat.rb', line 84

def secure
  @secure
end

#sv_osObject

Returns the value of attribute sv_os.



83
84
85
# File 'lib/ruby-qstat.rb', line 83

def sv_os
  @sv_os
end

#versionObject

Returns the value of attribute version.



85
86
87
# File 'lib/ruby-qstat.rb', line 85

def version
  @version
end

Class Method Details

.create_from_xml(doc) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/ruby-qstat.rb', line 92

def self.create_from_xml(doc)
  rule = Rule.new
  rule.protocol = doc.search("rule[name=protocol]").text
  rule.gamedir = doc.search("rule[name=gamedir]").text
  rule.gamename = doc.search("rule[name=gamename]").text
  rule.bots = doc.search("rule[name=bots]").text
  rule.dedicated = doc.search("rule[name=dedicated]").text
  rule.sv_os = doc.search("rule[name=sv_os]").text
  rule.secure = doc.search("rule[name=secure]").text
  rule.version = doc.search("rule[name=version]").text
  rule.game_port = doc.search("rule[name=game_port]").text
  rule.game_tag = doc.search("rule[name=game_tag]").text
  rule
end

Instance Method Details

#game_tagsObject



107
108
109
110
111
112
113
# File 'lib/ruby-qstat.rb', line 107

def game_tags
  if @game_tag =~ /^.*\n@(.*)$/
    $1.split(",")
  else
    []
  end
end