Hi, How can I access the Rack request object in a controller? I need to know the HTTP_REFERRER, but I can''t find it in env. (I''m sure I need glasses, or have to sleep more...) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120406/49057cbe/attachment.html>
It should be in @env: @env[''HTTP_REFERER''] (Note that it''s misspelled in the spec) // Magnus Holm On Friday 6. April 2012 at 15:01, Nokan Emiro wrote:> Hi, > > How can I access the Rack request object in a controller? I need > to know the HTTP_REFERRER, but I can''t find it in env. (I''m > sure I need glasses, or have to sleep more...) > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org (mailto:Camping-list at rubyforge.org) > http://rubyforge.org/mailman/listinfo/camping-list
I''m sorry bothering you, it was there in env, env[''HTTP_REFERER'']. (But it still would be useful sometimes to access the Rack''s Request object...) On Fri, Apr 6, 2012 at 3:01 PM, Nokan Emiro <uzleepito at gmail.com> wrote:> Hi, > > How can I access the Rack request object in a controller? I need > to know the HTTP_REFERRER, but I can''t find it in env. (I''m > sure I need glasses, or have to sleep more...) > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120406/cecda2c1/attachment.html>
Try @request. // Magnus Holm On Friday 6. April 2012 at 16:27, Nokan Emiro wrote:> I''m sorry bothering you, it was there in env, env[''HTTP_REFERER'']. > > (But it still would be useful sometimes to access the Rack''s Request object...) > > > > On Fri, Apr 6, 2012 at 3:01 PM, Nokan Emiro <uzleepito at gmail.com (mailto:uzleepito at gmail.com)> wrote: > > Hi, > > > > How can I access the Rack request object in a controller? I need > > to know the HTTP_REFERRER, but I can''t find it in env. (I''m > > sure I need glasses, or have to sleep more...) > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org (mailto:Camping-list at rubyforge.org) > http://rubyforge.org/mailman/listinfo/camping-list
Why does it work without the @ for me? On Fri, Apr 6, 2012 at 4:26 PM, Magnus Holm <judofyr at gmail.com> wrote:> It should be in @env: > > @env[''HTTP_REFERER''] > > (Note that it''s misspelled in the spec) > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120407/e46d21d0/attachment.html>
Starship Enterprise, Stardate #{Time.now.to_f}. Captain''s Log. network.http.sendrefererheader was set to 0 in my Firefox for unknown reasons. Probably Mr Spock, the Chief of security did this. I make this log entry for those who don''t want to spend hours in a spacedock repairing a working application. Signing out... On Sat, Apr 7, 2012 at 6:06 PM, Nokan Emiro <uzleepito at gmail.com> wrote:> Why does it work without the @ for me? > > > On Fri, Apr 6, 2012 at 4:26 PM, Magnus Holm <judofyr at gmail.com> wrote: > >> It should be in @env: >> >> @env[''HTTP_REFERER''] >> >> (Note that it''s misspelled in the spec) >> >>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120408/df74faf3/attachment.html>
Haha! How did you get Spock on board... :-) I must admit I''m a little confused about the sytnax for environmental variables, because as well as @env[HTTP_REFERER] this also works: ENV[''SCRIPT_NAME''] For a test I just used it like this: ENV[''SCRIPT_NAME''].scan(/\w+\.\w+$/) to get the Camping file''s name (with whatever file extension rb, rbx, cgi) instead of using __FILE__ I think I''ll throw together a quick Camping app that ''nicely'' prints all available environment variables (as they''ll vary for each setup)... DaveE> Starship Enterprise, Stardate #{Time.now.to_f}. Captain''s Log. > network.http.sendrefererheader was set to 0 in my Firefox for > unknown reasons. > Probably Mr Spock, the Chief of security did this. > I make this log entry for those who don''t want to spend hours in a > spacedock repairing a working application. > Signing out... > > > On Sat, Apr 7, 2012 at 6:06 PM, Nokan Emiro <uzleepito at gmail.com> > wrote: > Why does it work without the @ for me? > > > On Fri, Apr 6, 2012 at 4:26 PM, Magnus Holm <judofyr at gmail.com> wrote: > It should be in @env: > > @env[''HTTP_REFERER''] > > (Note that it''s misspelled in the spec) > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120414/c2cf0990/attachment.html>
About environment variables - I''ve just used this in my Camping helpers to print them all out, but the Rack variables seem to have multiple values or values with no name: def envars(theenv) if theenv == "ENV" ul do theenv.each_pair do |name,value| li { name + " " + value } end end else ul do theenv.each do |name| li { name } end end end end called with: envars(ENV) envars(@env) Can some one enlighten me about how Rack env vars are stored, and how to get a nice printout? DaveE> Haha! How did you get Spock on board... :-) > > I must admit I''m a little confused about the sytnax for > environmental variables, because as well as > @env[HTTP_REFERER] > this also works: > ENV[''SCRIPT_NAME''] > > For a test I just used it like this: > ENV[''SCRIPT_NAME''].scan(/\w+\.\w+$/) > to get the Camping file''s name (with whatever file extension rb, > rbx, cgi) instead of using __FILE__ > > I think I''ll throw together a quick Camping app that ''nicely'' prints > all available environment variables (as they''ll vary for each > setup)... > > DaveE > >> Starship Enterprise, Stardate #{Time.now.to_f}. Captain''s Log. >> network.http.sendrefererheader was set to 0 in my Firefox for >> unknown reasons. >> Probably Mr Spock, the Chief of security did this. >> I make this log entry for those who don''t want to spend hours in a >> spacedock repairing a working application. >> Signing out... >> >> >> On Sat, Apr 7, 2012 at 6:06 PM, Nokan Emiro <uzleepito at gmail.com> >> wrote: >> Why does it work without the @ for me? >> >> >> On Fri, Apr 6, 2012 at 4:26 PM, Magnus Holm <judofyr at gmail.com> >> wrote: >> It should be in @env: >> >> @env[''HTTP_REFERER''] >> >> (Note that it''s misspelled in the spec)
how Rack env vars are stored, and how to get a nice printout? i defined #to_html on everything. on Array thats map(&:html).join '', '' on Hash it prints a <table>, Object is html_escape(to_s) Rack just iterates thru env in an ERB template: <h3 id="env-info">Rack ENV</h3> <table class="req"> <thead> <tr> <th>Variable</th> <th>Value</th> </tr> </thead> <tbody> <% env.sort_by { |k, v| k.to_s }.each { |key, val| %> <tr> <td><%=h key %></td> <td class="code"><div><%=h val %></div></td> </tr> <% } %> </tbody> </table> i wonder how small camping could become if it was a rubyish exoskeleton for plugging together Rack tidbits. 1K?
On Sat, Apr 14, 2012 at 10:38, Dave Everitt <deveritt at innotts.co.uk> wrote:> Haha! How did you get Spock on board... :-) > > I must admit I''m a little confused about the sytnax for environmental > variables, because as well as > ? @env[HTTP_REFERER] > this also works: > ? ENV[''SCRIPT_NAME''] > > For a test I just used it like this: > ? ENV[''SCRIPT_NAME''].scan(/\w+\.\w+$/) > to get the Camping file''s name?(with whatever file extension rb, rbx, > cgi)?instead of using __FILE__The only reason ENV[''HTTP_REFERER''] works for you is that you deploy on (Fast)CGI. You should only depend on @env if you want your app to be compatible with other servers.
Understood about compatible - this is David''s Camping server, and I''m experimenting with QUERY_STRING in the URL and various other env vars - DaveE> On Sat, Apr 14, 2012 at 10:38, Dave Everitt <deveritt at innotts.co.uk> > wrote: >> Haha! How did you get Spock on board... :-) >> >> I must admit I''m a little confused about the sytnax for environmental >> variables, because as well as >> @env[HTTP_REFERER] >> this also works: >> ENV[''SCRIPT_NAME''] >> >> For a test I just used it like this: >> ENV[''SCRIPT_NAME''].scan(/\w+\.\w+$/) >> to get the Camping file''s name (with whatever file extension rb, rbx, >> cgi) instead of using __FILE__ > > The only reason ENV[''HTTP_REFERER''] works for you is that you deploy > on (Fast)CGI. You should only depend on @env if you want your app to > be compatible with other servers. > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list
Ah well the is not on fcgi but passenger :) I would say that most of the serious ruby/rails hosting now offer passenger as an option so shouldn''t limit your application portability. On Sun, Apr 15, 2012 at 11:41 PM, Dave Everitt <deveritt at innotts.co.uk>wrote:> Understood about compatible - this is David''s Camping server, and I''m > experimenting with QUERY_STRING in the URL and various other env vars - > DaveE > > > On Sat, Apr 14, 2012 at 10:38, Dave Everitt <deveritt at innotts.co.uk> >> wrote: >> >>> Haha! How did you get Spock on board... :-) >>> >>> I must admit I''m a little confused about the sytnax for environmental >>> variables, because as well as >>> @env[HTTP_REFERER] >>> this also works: >>> ENV[''SCRIPT_NAME''] >>> >>> For a test I just used it like this: >>> ENV[''SCRIPT_NAME''].scan(/\w+\.**\w+$/) >>> to get the Camping file''s name (with whatever file extension rb, rbx, >>> cgi) instead of using __FILE__ >>> >> >> The only reason ENV[''HTTP_REFERER''] works for you is that you deploy >> on (Fast)CGI. You should only depend on @env if you want your app to >> be compatible with other servers. >> ______________________________**_________________ >> Camping-list mailing list >> Camping-list at rubyforge.org >> http://rubyforge.org/mailman/**listinfo/camping-list<http://rubyforge.org/mailman/listinfo/camping-list> >> > > ______________________________**_________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/**listinfo/camping-list<http://rubyforge.org/mailman/listinfo/camping-list> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120416/8c9b6196/attachment.html>
O_o I think the extra character is worth it. ? Jenna On Monday, 16 April 2012 at 9:40 AM, david costa wrote:> Ah well the is not on fcgi but passenger :) > I would say that most of the serious ruby/rails hosting now offer passenger as an option so shouldn''t limit your application portability. > > On Sun, Apr 15, 2012 at 11:41 PM, Dave Everitt <deveritt at innotts.co.uk (mailto:deveritt at innotts.co.uk)> wrote: > > Understood about compatible - this is David''s Camping server, and I''m experimenting with QUERY_STRING in the URL and various other env vars - DaveE > > > > > > > On Sat, Apr 14, 2012 at 10:38, Dave Everitt <deveritt at innotts.co.uk (mailto:deveritt at innotts.co.uk)> wrote: > > > > Haha! How did you get Spock on board... :-) > > > > > > > > I must admit I''m a little confused about the sytnax for environmental > > > > variables, because as well as > > > > @env[HTTP_REFERER] > > > > this also works: > > > > ENV[''SCRIPT_NAME''] > > > > > > > > For a test I just used it like this: > > > > ENV[''SCRIPT_NAME''].scan(/\w+\.\w+$/) > > > > to get the Camping file''s name (with whatever file extension rb, rbx, > > > > cgi) instead of using __FILE__ > > > > > > The only reason ENV[''HTTP_REFERER''] works for you is that you deploy > > > on (Fast)CGI. You should only depend on @env if you want your app to > > > be compatible with other servers. > > > _______________________________________________ > > > Camping-list mailing list > > > Camping-list at rubyforge.org (mailto:Camping-list at rubyforge.org) > > > http://rubyforge.org/mailman/listinfo/camping-list > > > > _______________________________________________ > > Camping-list mailing list > > Camping-list at rubyforge.org (mailto:Camping-list at rubyforge.org) > > http://rubyforge.org/mailman/listinfo/camping-list > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org (mailto:Camping-list at rubyforge.org) > http://rubyforge.org/mailman/listinfo/camping-list > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120416/54b08889/attachment.html>
sure I was just explaining that was not fcgi :) BTW I am making some good progress with the on the fly deployment. I have found an apparently good security solution to allow users to deploy their app without major problems and at the same time not compromise other users/the server. More testing this week. On Mon, Apr 16, 2012 at 2:13 AM, Jenna Fox <a at creativepony.com> wrote:> O_o > > I think the extra character is worth it. > > ? > Jenna > > On Monday, 16 April 2012 at 9:40 AM, david costa wrote: > > Ah well the is not on fcgi but passenger :) > I would say that most of the serious ruby/rails hosting now offer > passenger as an option so shouldn''t limit your application portability. > > On Sun, Apr 15, 2012 at 11:41 PM, Dave Everitt <deveritt at innotts.co.uk>wrote: > > Understood about compatible - this is David''s Camping server, and I''m > experimenting with QUERY_STRING in the URL and various other env vars - > DaveE > > > On Sat, Apr 14, 2012 at 10:38, Dave Everitt <deveritt at innotts.co.uk> > wrote: > > Haha! How did you get Spock on board... :-) > > I must admit I''m a little confused about the sytnax for environmental > variables, because as well as > @env[HTTP_REFERER] > this also works: > ENV[''SCRIPT_NAME''] > > For a test I just used it like this: > ENV[''SCRIPT_NAME''].scan(/\w+\.**\w+$/) > to get the Camping file''s name (with whatever file extension rb, rbx, > cgi) instead of using __FILE__ > > > The only reason ENV[''HTTP_REFERER''] works for you is that you deploy > on (Fast)CGI. You should only depend on @env if you want your app to > be compatible with other servers. > ______________________________**_________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/**listinfo/camping-list<http://rubyforge.org/mailman/listinfo/camping-list> > > > ______________________________**_________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/**listinfo/camping-list<http://rubyforge.org/mailman/listinfo/camping-list> > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list > > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120416/f7e4ecb0/attachment.html>
Actually env[] works with mongrel also, not just fcgi or passenger. (No, it''s not a typo: env, and not ENV. But I''m sure ENV works too.) On Sun, Apr 15, 2012 at 12:37 PM, Magnus Holm <judofyr at gmail.com> wrote:> > > The only reason ENV[''HTTP_REFERER''] works for you is that you deploy > on (Fast)CGI. You should only depend on @env if you want your app to > be compatible with other servers. > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120416/7cde2ea1/attachment.html>
On Mon, Apr 16, 2012 at 13:45, Nokan Emiro <uzleepito at gmail.com> wrote:> Actually env[] works with mongrel also, not just fcgi or passenger. > (No, it''s not a typo: env, and not ENV. But I''m sure ENV works too.)Yes, env inside Camping is the same @env (it''s just an attr_accessor). Same for @body, @request, @method, @status etc: https://github.com/camping/camping/blob/75f1144b7c9f53948d887d331a4f583a3b86a74f/lib/camping-unabridged.rb#L257
> > > Actually env[] works with mongrel also, not just fcgi or passenger. > > (No, it''s not a typo: env, and not ENV. But I''m sure ENV works too.) > > Yes, env inside Camping is the same @env (it''s just an attr_accessor). > Same for @body, @request, @method, @status etc: > > https://github.com/camping/camping/blob/75f1144b7c9f53948d887d331a4f583a3b86a74f/lib/camping-unabridged.rb#L257Hmmm, maybe I should read through this commented version of source code. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120416/83edea92/attachment.html>
Everything I actually learned about Camping was by reading the source code as it is quite a feat of engineering. And I learned a ton about metaprogramming too. So it can be quite interesting. :-) On 4/16/2012 12:41 PM, Nokan Emiro wrote:> > > Actually env[] works with mongrel also, not just fcgi or passenger. > > (No, it''s not a typo: env, and not ENV. But I''m sure ENV works too.) > > Yes, env inside Camping is the same @env (it''s just an attr_accessor). > Same for @body, @request, @method, @status etc: > https://github.com/camping/camping/blob/75f1144b7c9f53948d887d331a4f583a3b86a74f/lib/camping-unabridged.rb#L257 > > > Hmmm, maybe I should read through this commented version of source code. > > > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120416/8b2b1995/attachment.html>
I''m totally convinced... so I''m going to download the whole source before the guys start to rewrite it as a "modern framework"... :) But to be frank, this, for instance, is not so great to read: https://github.com/camping/camping/blob/master/lib/camping.rb I mean I''m big http://catseye.tc/ fan, but when I''m working on a site, it''s not a big flash to try to find out something from that ~ camping.min.rb u. On Mon, Apr 16, 2012 at 10:23 PM, Philippe Monnet <ruby at monnet-usa.com>wrote:> Everything I actually learned about Camping was by reading the source > code as it is quite a feat of engineering. > And I learned a ton about metaprogramming too. So it can be quite > interesting. :-) > > > On 4/16/2012 12:41 PM, Nokan Emiro wrote: > > > Actually env[] works with mongrel also, not just fcgi or passenger. >> > (No, it''s not a typo: env, and not ENV. But I''m sure ENV works too.) >> >> Yes, env inside Camping is the same @env (it''s just an attr_accessor). >> Same for @body, @request, @method, @status etc: >> >> https://github.com/camping/camping/blob/75f1144b7c9f53948d887d331a4f583a3b86a74f/lib/camping-unabridged.rb#L257 > > > Hmmm, maybe I should read through this commented version of source code. > > > > > _______________________________________________ > Camping-list mailing listCamping-list at rubyforge.orghttp://rubyforge.org/mailman/listinfo/camping-list > > > > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120416/bfd14b72/attachment.html>
W dniu 16 kwietnia 2012 22:45 u?ytkownik Nokan Emiro <uzleepito at gmail.com> napisa?:> I''m totally convinced... ?so I''m going to download the whole source > before the?guys start to rewrite it as a "modern framework"... :) > > But to be frank, this, for instance, is not so great to read: > https://github.com/camping/camping/blob/master/lib/camping.rb > > I mean I''m big?http://catseye.tc/?fan, but when I''m working on a site, > it''s?not a big flash to try to find out something from that ~ camping.min.rbYou do realize that there exists an annotated version of source, with comments, proper indentation and (whoa!) some whitespace? https://github.com/camping/camping/blob/master/lib/camping-unabridged.rb -- Matma Rex
I think Nokan has a good point there: it is not easy for people new to Camping to know about the trick to compile/process/compact the source code. So an idea for the "new" version could be to leave the source as is (unabridged). Plus this makes debugging easier. :-) On 4/16/2012 2:59 PM, Bartosz Dziewo?ski wrote:> W dniu 16 kwietnia 2012 22:45 u?ytkownik Nokan Emiro > <uzleepito at gmail.com> napisa?: >> I''m totally convinced... so I''m going to download the whole source >> before the guys start to rewrite it as a "modern framework"... :) >> >> But to be frank, this, for instance, is not so great to read: >> https://github.com/camping/camping/blob/master/lib/camping.rb >> >> I mean I''m big http://catseye.tc/ fan, but when I''m working on a site, >> it''s not a big flash to try to find out something from that ~ camping.min.rb > You do realize that there exists an annotated version of source, with > comments, proper indentation and (whoa!) some whitespace? > https://github.com/camping/camping/blob/master/lib/camping-unabridged.rb > > -- Matma Rex > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120416/f182e999/attachment-0001.html>
2012/4/16 Bartosz Dziewo?ski <matma.rex at gmail.com>> You do realize that there exists an annotated version of source, with > comments, proper indentation and (whoa!) some whitespace? > https://github.com/camping/camping/blob/master/lib/camping-unabridged.rb > >No, actually I did know that there''s an indented version, but the nice comments are new to me. It''s a whole book! ...but it isn''t <= 4k... ;-) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120416/880ee250/attachment.html>
Well the point of the original camping was *not* to be easy to read nor to have camping used in the next big commercial project. The annotated version gives you pretty much all you want if you want to read it :) On Mon, Apr 16, 2012 at 10:59 PM, Bartosz Dziewo?ski <matma.rex at gmail.com>wrote:> W dniu 16 kwietnia 2012 22:45 u?ytkownik Nokan Emiro > <uzleepito at gmail.com> napisa?: > > I''m totally convinced... so I''m going to download the whole source > > before the guys start to rewrite it as a "modern framework"... :) > > > > But to be frank, this, for instance, is not so great to read: > > https://github.com/camping/camping/blob/master/lib/camping.rb > > > > I mean I''m big http://catseye.tc/ fan, but when I''m working on a site, > > it''s not a big flash to try to find out something from that ~ > camping.min.rb > > You do realize that there exists an annotated version of source, with > comments, proper indentation and (whoa!) some whitespace? > https://github.com/camping/camping/blob/master/lib/camping-unabridged.rb > > -- Matma Rex > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/camping-list/attachments/20120416/7ae1e54a/attachment.html>
Just to be clear (obviously env vars are going to differ according to setup, but): when env is used inside Camping, it''s equivalent to @env and get Rack env vars when ENV is used, it will get any other environment variables, not just from Passenger etc. but also any set by the system. With a view to making a little app/snippet to show all available env vars I''ve been looking at them on David''s Camping server (they only appear with the query string at the end of the URL): http://dave.camping.sh/sites?vars But the Rack vars don''t seem to format nicely with key value pairs (breaks when I try): env.each_pair do |name,value| so I just made a line for each with env.each do |name| - source here: https://github.com/DaveEveritt/Camping-links/blob/master/www/camplinks.rb DaveE> On Mon, Apr 16, 2012 at 13:45, Nokan Emiro <uzleepito at gmail.com> > wrote: >> Actually env[] works with mongrel also, not just fcgi or passenger. >> (No, it''s not a typo: env, and not ENV. But I''m sure ENV works too.) > > Yes, env inside Camping is the same @env (it''s just an attr_accessor). > Same for @body, @request, @method, @status etc: > https://github.com/camping/camping/blob/75f1144b7c9f53948d887d331a4f583a3b86a74f/lib/camping-unabridged.rb > #L257 > _______________________________________________ > Camping-list mailing list > Camping-list at rubyforge.org > http://rubyforge.org/mailman/listinfo/camping-list
Hi cdr - thanks for this, but I''ve not been able to do key value on the Rack envs as some seem to have a different format - see the other post I added to this thread - DaveE> how Rack env vars are stored, and how > to get a nice printout? > > i defined #to_html on everything. on Array thats > > map(&:html).join '', '' > > on Hash it prints a <table>, Object is html_escape(to_s) > > > Rack just iterates thru env in an ERB template: > > <h3 id="env-info">Rack ENV</h3> > <table class="req"> > <thead> > <tr> > <th>Variable</th> > <th>Value</th> > </tr> > </thead> > <tbody> > <% env.sort_by { |k, v| k.to_s }.each { |key, val| %> > <tr> > <td><%=h key %></td> > <td class="code"><div><%=h val %></div></td> > </tr> > <% } %> > </tbody> > </table>