Report abuse

# run this with :
#  rackup hello.ru

app1 = Proc.new {|env|
  [200, {'Content-Type'=>'text/html', 'hello world!']
}

class GoodBye

  def initialize(app)
    @app = app
  end

  def call(env)
    if env['PATH_INFO'] =~ %r{/goodbye}
      [200, {'Content-Type'=>'text/html'}, 'goodbye world!']
    else
      @app.call(env)
    end
  end

end

use Goodbye
run app1