Class: RCon::Query
- Inherits:
-
Object
- Object
- RCon::Query
- Defined in:
- lib/rcon.rb
Overview
placeholder so ruby doesn’t bitch
Defined Under Namespace
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
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/rcon.rb', line 71 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 |