module Hobby

Constants

VERBS

Public Class Methods

included(app) click to toggle source
# File lib/hobby.rb, line 10
def self.included app
  app.extend Singleton
  app.router = Router.new
  app.request, app.response = Rack::Request, Rack::Response
end

Public Instance Methods

call(env) click to toggle source
# File lib/hobby.rb, line 35
def call env
  dup.handle env
end

Protected Instance Methods

handle(env) click to toggle source
# File lib/hobby.rb, line 40
def handle env
  catch :halt do
    @route = router.route_for (@env = env)
    fill_body
    response.to_a
  end
end

Private Instance Methods

fill_body() click to toggle source
# File lib/hobby.rb, line 49
def fill_body
  body = route ? (instance_exec &route) : not_found
  response.write body
end