Class: RCON::Query
- Inherits:
-
Object
- Object
- RCON::Query
- Defined in:
- lib/rcon/rcon.rb
Instance Method Summary collapse
-
#cvar(cvar_name) ⇒ Object
Convenience method to scrape input from cvar output and return that data.
Instance Method Details
#cvar(cvar_name) ⇒ Object
Convenience method to scrape input from cvar output and return that data. Returns integers as a numeric type if possible.
ex: rcon.cvar(“mp_friendlyfire”) => 1
NOTE: This file has not been updated since previous version. Please be aware there may be outstanding Ruby2 bugs
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rcon/rcon.rb', line 13 def cvar(cvar_name) response = command(cvar_name) match = /^.+?\s(?:is|=)\s"([^"]+)".*$/.match response match = match[1] if /\D/.match match return match else return match.to_i end end |