Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

since we can now use local variables we can initialize them and avoid…

… 3 $ in exchange for a ,q

Signed-off-by: Konstantin Haase <konstantin.mailinglists@googlemail.com>
  • Loading branch information...
commit cead411c57f198bdc8187f95764a391a0b09d200 1 parent 74ae058
gabriele renzi riffraff authored committed

Showing 1 changed file with 3 additions and 3 deletions. Show diff stats Hide diff stats

  1. +3 3 almost_sinatra.rb
6 almost_sinatra.rb
... ... @@ -1,9 +1,9 @@
1 1 %w.rack tilt backports INT TERM..map{|l|trap(l){$r.stop}rescue require l}
2   -$n=Sinatra=Module.new{extend Rack;a,D,S,$p,Application=Builder.new,Object.method(:define_method),/@@ *([^\n]+)\n(((?!@@)[^\n]*\n)*)/m,4567,a
  2 +$n=Sinatra=Module.new{extend Rack;a,D,S,$p,q,Application=Builder.new,Object.method(:define_method),/@@ *([^\n]+)\n(((?!@@)[^\n]*\n)*)/m,4567,a
3 3 %w[get post put delete].map{|m|D.(m){|u,&b|a.map(u){run->(e){[200,{"Content-Type"=>"text/html"},[a.instance_eval(&b)]]}}}}
4 4 Tilt.mappings.map{|k,v|D.(k){|n,*o|$t||=(h={};File.read(caller[0][/^[^:]+/]).scan(S){|a,b|h[a]=b};h);v.new(*o){n.to_s==n ?n:$t[n.to_s]}.render(a,o[0].try(:[],:locals)||{})}}
5 5 %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}}
6   -%w[params session].map{|m|D.(m){$q.send m}};a.use Session::Cookie;a.use Lock
7   -D.(:before){|&b|a.use Rack::Config,&b};before{|e|$q=Request.new e;$q.params.dup.map{|k,v|params[k.to_sym]=v}}
  6 +%w[params session].map{|m|D.(m){q.send m}};a.use Session::Cookie;a.use Lock
  7 +D.(:before){|&b|a.use Rack::Config,&b};before{|e|q=Request.new e;q.params.dup.map{|k,v|params[k.to_sym]=v}}
8 8 }
9 9 puts "== almost #$n/No Version has taken the stage on #$p for development with backup from Webrick"

0 comments on commit cead411

Please sign in to comment.
Something went wrong with that request. Please try again.