class Docwatch::Connection

Public Class Methods

handle(*opts) click to toggle source
# File lib/docwatch/connection.rb, line 9
def self.handle(*opts)
    new(*opts).handle
end
new(renderer, watcher, session) click to toggle source
# File lib/docwatch/connection.rb, line 3
def initialize(renderer, watcher, session)
    @renderer = renderer
    @watcher = watcher
    @session = session
end

Public Instance Methods

handle() click to toggle source
# File lib/docwatch/connection.rb, line 13
def handle
    case @session.path
        when '/'
            @session.respond_with_html @renderer.to_html
        when '/wait'
            @watcher.wait
            @session.respond_with_text 'OK'
        else
            @session.respond_with_404
    end
end