class Vapor::Server

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/vapor.rb, line 10
def initialize(*args)
        super
        @config = STConfig.new
end

Public Instance Methods

add(handle, ip, port=27015) click to toggle source
# File lib/vapor.rb, line 39
def add(handle, ip, port=27015)
        @config.add_server(handle, ip, port)
end
connect(handle) click to toggle source
# File lib/vapor.rb, line 51
def connect(handle)
        s = @config.lookup_server_by_handle(handle)
        uri = "steam://connect/#{s['ip']}:#{s['port']}"
        if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
                system "start #{uri}"
        elsif RbConfig::CONFIG['host_os'] =~ /darwin/
                system "open #{uri}"
        elsif RbConfig::CONFIG['host_os'] =~ /linux|bsd/
                system "xdg-open #{uri}"
        end
end
info(handle=nil) click to toggle source
# File lib/vapor.rb, line 18
def info(handle=nil)
        if (options[:ip])
                parts = options[:ip].strip.split(':')
                ip = parts[0]
                port = parts[1]
        else
                s = @config.lookup_server_by_handle(handle)
                ip = s['ip']
                port = s['port']
        end
        Steam.server_info(ip, port)
end
list() click to toggle source
# File lib/vapor.rb, line 33
def list
        Steam.server_listing(@config.data['servers'])
end
rm(handle) click to toggle source
# File lib/vapor.rb, line 45
def rm(handle)
        @config.rm_server(handle)
end