Skip to content

Commit

Permalink
Using @env instead of @request whenever it's possible. Earning some b…
Browse files Browse the repository at this point in the history
…ytes.
  • Loading branch information
judofyr committed Oct 27, 2008
1 parent 6acd337 commit c380870
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/camping-unabridged.rb
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def initialize(env) #:nodoc:
Rack::Request.new(env), Rack::Response.new, env
@root, @input, @cookies,
@headers, @status =
@request.script_name.sub(/\/$/,''),
@env.SCRIPT_NAME.sub(/\/$/,''),
H[@request.params], H[@request.cookies],
@response.headers, @response.status

Expand All @@ -434,7 +434,7 @@ def initialize(env) #:nodoc:
# See http://code.whytheluckystiff.net/camping/wiki/BeforeAndAfterOverrides for more
# on before and after overrides with Camping.
def service(*a)
r = catch(:halt){send(@request.request_method.downcase, *a)}
r = catch(:halt){send(@env.REQUEST_METHOD.downcase, *a)}
@body ||= r
self
end
Expand Down
4 changes: 2 additions & 2 deletions lib/camping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def r s,b,h={};(Hash===b&&(b,h=h,b));@status=s;
@response.to_a;end;def initialize(env)
@request,@response,@env=Rack::Request.new(env),Rack::Response.new,env
@root,@input,@cookies,@headers,@status=
@request.script_name.sub(/\/$/,''),H[@request.params],
@env.SCRIPT_NAME.sub(/\/$/,''),H[@request.params],
H[@request.cookies],@response.headers,@response.status
@input.each{|k,v|if k[-2..-1]=="[]";@input[k[0..-3]]=
@input.delete(k)elsif k=~/(.*)\[([^\]]+)\]$/
(@input[$1]||=H[])[$2]=@input.delete(k)end};end;def service *a
r=catch(:halt){send(@request.request_method.downcase,*a)};@body||=r
r=catch(:halt){send(@env.REQUEST_METHOD.downcase,*a)};@body||=r
self;end;end;module Controllers;@r=[];class<<self;def r;@r end;def R *u;r=@r
Class.new{meta_def(:urls){u};meta_def(:inherited){|x|r<<x}}end
def D p,m;p='/'if !p||!p[0]
Expand Down

0 comments on commit c380870

Please sign in to comment.