Sha256: b7d6f9fbeae629e4334d70e79f6abd8a842681310833f47fd335607b01a1e839

Contents?: true

Size: 598 Bytes

Versions: 2

Compression:

Stored size: 598 Bytes

Contents

require 'sinatra'
require './lib/vrowser'

def get_active_servers
  Vrowser.load_file("/home/kimoto/config.yml") do |vrowser|
    greped = vrowser.active_servers.select(:name, :host, :ping, :num_players, :type, :map, :players)
    ordered = greped.order(:host)
    return ordered.map(&:values)
  end
end

def get_active_servers_nary
  get_active_servers.map(&:values)
end

get '/api/connected/json' do
  content_type :json
  return get_active_servers.to_json
end

get '/api/updated/json' do
  content_type :json
  return get_active_servers_nary.to_json
end

get '/' do
  redirect "index.html"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vrowser-0.1.5 app.rb
vrowser-0.1.4 app.rb