Class: Pandemic::ServerSide::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/pandemic/server_side/handler.rb

Instance Method Summary collapse

Instance Method Details

#configObject



4
5
6
# File 'lib/pandemic/server_side/handler.rb', line 4

def config
  Config
end

#filter_alive(servers) ⇒ Object



26
27
28
# File 'lib/pandemic/server_side/handler.rb', line 26

def filter_alive(servers)
  servers.keys.select{|k| servers[k] != :disconnected}
end

#partition(request, servers) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/pandemic/server_side/handler.rb', line 8

def partition(request, servers)
  map = {}
  servers.each do |server, status|
    if status != :disconnected
      map[server] = request.body
    end
  end
  map
end

#process(body) ⇒ Object



22
23
24
# File 'lib/pandemic/server_side/handler.rb', line 22

def process(body)
  body
end

#reduce(request) ⇒ Object



18
19
20
# File 'lib/pandemic/server_side/handler.rb', line 18

def reduce(request)
  request.responses.join("")
end