Class: RMuh::ServerStats::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rmuh/serverstats/base.rb

Overview

TODO: Documentation

Constant Summary collapse

DEFAULT_PORT =
2_302

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Base

Returns a new instance of Base.



14
15
16
17
18
19
# File 'lib/rmuh/serverstats/base.rb', line 14

def initialize(opts = {})
  fail ArgumentError, 'arg 1 must be a Hash' unless opts.is_a?(Hash)
  self.class.validate_opts(opts)
  opts_to_instance(opts)
  @gsq = GamespyQuery::Socket.new("#{@host}:#{@port}")
end

Instance Method Details

#statsObject



21
22
23
# File 'lib/rmuh/serverstats/base.rb', line 21

def stats
  remote_stats
end

#update_cacheObject



25
26
27
# File 'lib/rmuh/serverstats/base.rb', line 25

def update_cache
  @serverstats = sync if @cache
end