Skip to content


Subversion checkout URL

You can clone with
Download ZIP


second round #6

wants to merge 19 commits into from

3 participants


No description provided.


this causes an "can't modify hash while iterating" exception on the latest 1.9


does using R for $r work? I believed constants are looked up lexically at parse time so the trap block would fail

works fine :]


@riffraff: They are looked up lexically, but not at parse time. (Also, except if you use ActiveSupport autoloading, they are also looked up in the inheritance chain.)

@janlelis: Sorry, but 13 lines is a no go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 5 deletions.
  1. +9 −5 almost_sinatra.rb
14 almost_sinatra.rb
@@ -1,9 +1,13 @@
-%w.rack tilt backports INT{|l|trap(l){$r.stop}rescue require l}
-${extend Rack;a,D,S,$p,q,,Object.method(:define_method),/@@ *([^\n]+)\n(((?!@@)[^\n]*\n)*)/m,4567,a
+%w.rack tilt backports INT{|l|trap(l){R.stop}rescue require l}
+${extend Rack;;D,P,q=Object.method(:define_method),4567
%w[get post put delete].map{|m|D.(m){|u,&b|{run->(e){[200,{"Content-Type"=>"text/html"},[a.instance_eval(&b)]]}}}}{|k,v|D.(k){|n,*o|$t||=(h={};[0][/^[^:]+/]).scan(S){|a,b|h[a]=b};h);*o){n.to_s==n ?n:$t[n.to_s]}.render(a,o[0].try(:[],:locals)||{})}}
-%w[set enable disable configure helpers use register].map{|m|D.(m){|*_,&b|b.try :[]}};END{Handler.get("webrick").run(a,Port:$p){|s|$r=s}}{|k,v|D.(k){|n,*o|$t||=(h={};[0][/^[^:]+/]).scan(/@@ *([^
+%w[set enable disable configure helpers use register].map{|m|D.(m){|*,&b|b.try :[]}};END{Handler.get(W).run(a,Port:P){|s|R=s}}
%w[params session].map{|m|D.(m){q.send m}};a.use Session::Cookie;a.use Lock
D.(:before){|&b|a.use Rack::Config,&b};before{|e| e;{|k,v|params[k.to_sym]=v}}
-puts "== almost #$n/No Version has taken the stage on #$p for development with backup from Webrick"
+puts"== almost #$n/No Version has taken the stage on #{P} for development with backup from "+W="WEBrick"
Something went wrong with that request. Please try again.