Class: RCon::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/rcon.rb

Overview

placeholder so ruby doesn’t bitch

Direct Known Subclasses

Original, Source

Defined Under Namespace

Classes: Original, Source

Instance Method Summary collapse

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