From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.204.72.79 with SMTP id l15cs28014bkj; Fri, 5 Jun 2009 07:02:18 -0700 (PDT) Received: by 10.100.232.16 with SMTP id e16mr3944277anh.70.1244210537676; Fri, 05 Jun 2009 07:02:17 -0700 (PDT) Return-Path: Received: from mail-gx0-f184.google.com (mail-gx0-f184.google.com [209.85.217.184]) by mx.google.com with ESMTP id b7si39617601ana.17.2009.06.05.07.02.15; Fri, 05 Jun 2009 07:02:16 -0700 (PDT) Received-SPF: pass (google.com: domain of grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com designates 209.85.217.184 as permitted sender) client-ip=209.85.217.184; Authentication-Results: mx.google.com; spf=pass (google.com: domain of grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com designates 209.85.217.184 as permitted sender) smtp.mail=grbounce-ceibQwUAAAB4YPBqaDIjI2bFOCxyyh3G=chneukirchen=gmail.com@googlegroups.com; dkim=pass (test mode) header.i=@googlegroups.com Received: by mail-gx0-f184.google.com with SMTP id 4so2946197gxk.2 for ; Fri, 05 Jun 2009 07:02:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:received:x-sender:x-apparently-to :mime-version:received:date:x-ip:user-agent:x-http-useragent :message-id:subject:from:to:content-type:content-transfer-encoding :reply-to:sender:precedence:x-google-loop:mailing-list:list-id :list-post:list-help:list-unsubscribe:x-beenthere-env:x-beenthere; bh=P5/E0GvATFK4rOD3tACyhx/9usNfabTLwAkFvb+DTS8=; b=BJUbHcjeQUFBySbFwcWkQZMgqRUn3ujkPwq6nZAhAnPt7EV4aQKGacW2XP7yJqP8FT quD7F6VbmNuC55M8Nrbz+a45IOmBxfYSuo+ZfYvaK99EvxCja3uk1D3gFE9Om6OxtRFv QHkFDR6OeRO7SUKTnc7SOCDOmxNauAUriRB5s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-sender:x-apparently-to:mime-version:date:x-ip:user-agent :x-http-useragent:message-id:subject:from:to:content-type :content-transfer-encoding:reply-to:sender:precedence:x-google-loop :mailing-list:list-id:list-post:list-help:list-unsubscribe :x-beenthere-env:x-beenthere; b=N/kbAonyOzJy8Fv8vh7BNXMSl9fydsIanOdDFhwfGk/BzwwwWnGZso1Or0EyqS0h82 pKiyJCnpdVaaf3BStOYdxgTrtzCrmmqkRWYkJnJANQmBRod0/lEa8Wkf5GzgmBhn0cZ6 MRZx5Aby0L7Eu7tCS4Pf7Vgpi9g1zFmxJbZ2U= Received: by 10.100.248.16 with SMTP id v16mr263699anh.0.1244210535771; Fri, 05 Jun 2009 07:02:15 -0700 (PDT) Received: by 10.107.131.11 with SMTP id i11gr1414prn.0; Fri, 05 Jun 2009 07:02:10 -0700 (PDT) X-Sender: garysweaver@gmail.com X-Apparently-To: rack-devel@googlegroups.com MIME-Version: 1.0 Received: by 10.100.131.13 with SMTP id e13mr260689and.6.1244210529464; Fri, 05 Jun 2009 07:02:09 -0700 (PDT) Date: Fri, 5 Jun 2009 07:02:09 -0700 (PDT) X-IP: 152.3.127.57 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.0.10) Gecko/2009042315 Firefox/3.0.10,gzip(gfe),gzip(gfe) Message-ID: Subject: dynamic map url to class using rack? From: gsw To: Rack Development Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Reply-To: rack-devel@googlegroups.com Sender: rack-devel@googlegroups.com Precedence: bulk X-Google-Loop: groups Mailing-List: list rack-devel@googlegroups.com; contact rack-devel+owner@googlegroups.com List-Id: List-Post: List-Help: List-Unsubscribe: , X-BeenThere-Env: rack-devel@googlegroups.com X-BeenThere: rack-devel@googlegroups.com Hey, I have a serious newb question, so hopefully it isn't too nuts. I'd like to be able to do something like this dynamically: map "/(service)/(version)/*" do run (module corresponding to service)::(module corresponding to version)::Controller end I don't think this is currently possible, but maybe I'm wrong. Might it be possible in the future with rack, or would that be a bad idea? I know that currently I could do it non-dynamically like: map "/actual_service_name" do map "/actual_version_name" do run ActualServiceName::ActualVersionName::Controller end map "/another_actual_version_name" do run ActualServiceName::AnotherActualVersionName::Controller end end map "/another_actual_service_name" do map "/actual_version_name" do run AnotherActualServiceName::ActualVersionName::Controller end map "/another_actual_version_name" do run AnotherActualServiceName::AnotherActualVersionName::Controller end end The goal is have Sinatra controller classes that extend Sinatra::Base in directories like: /lib/service_name/version_name/controller.rb /lib/service_name/another_version_name/controller.rb /lib/another_service_name/version_name/controller.rb /lib/another_service_name/another_version_name/controller.rb Thanks in advance! Gary