Class: RedisDashboard::Application

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/redis_dashboard/application.rb

Instance Method Summary collapse

Instance Method Details

#clientObject



55
56
57
58
59
60
61
62
# File 'lib/redis_dashboard/application.rb', line 55

def client
  return @client if @client
  if url = RedisDashboard.urls.find { |url| URI(url).host == params[:server] }
    @client ||= RedisDashboard::Client.new(url)
  else
    raise Sinatra::NotFound
  end
end

#clientsObject



64
65
66
67
68
# File 'lib/redis_dashboard/application.rb', line 64

def clients
  @clients ||= RedisDashboard.urls.map do |url|
    RedisDashboard::Client.new(url)
  end
end

#close_clientsObject



70
71
72
73
# File 'lib/redis_dashboard/application.rb', line 70

def close_clients
  @client.close if @client
  @clients.each { |client| client.close } if @clients
end