Skip to content

Commit

Permalink
Gained 7 octets :)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas Pfenniger committed Sep 23, 2007
1 parent c1a3de1 commit 596f092
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/camping-unabridged.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ def URL c='/',*a
# end
#
module Base
include Helpers
attr_accessor :input, :cookies, :env, :headers, :body, :status, :root
Z = "\r\n"

Expand Down Expand Up @@ -536,7 +535,7 @@ def M #:nodoc:
end
constants.map { |c|
k=const_get(c)
k.send :include,C,Base,Models
k.send :include,C,Base,Helpers,Models
r[0,0]=k if !r.include?k
k.meta_def(:urls){["/#{c.downcase}"]}if !k.respond_to?:urls
}
Expand Down
4 changes: 2 additions & 2 deletions lib/camping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Camping;Apps=[];C=self;S=IO.read(__FILE__).sub(/S=I.+$/,'')
escape z}*"="}*"&": "")end;def URL c='/',*a;c=R(c,*a)if c.respond_to?:urls
c=self/c;c="//"+@env.HTTP_HOST+c if c[/^\//];URI(c)end;def/p;p[/^\//]?@root+p :
p end;def errors_for o;ul.errors{o.errors.each_full{|x|li x}}if o.errors.any?end
end;module Base;include Helpers;attr_accessor:input,:cookies,:env,:headers,:body,
end;module Base;attr_accessor:input,:cookies,:env,:headers,:body,
:status,:root;def method_missing*a,&b;a.shift if a[0]==:render;m=Mab.new({},self)
s=m.capture{send(*a,&b)};s=m.capture{send(:layout){s}} if /^_/!~a[0].to_s and m.
respond_to?:layout;s end;def r s,b,h={};@status=s;@headers.merge!h;@body=b end
Expand All @@ -29,7 +29,7 @@ def redirect*a;r 302,'','Location'=>URL(*a)end;Z="\r\n";def to_a;[@status,@body,
"Status: #{@status}#{Z+@headers.map{|k,v|[*v].map{|x|[k,v]*": "}}*Z+Z*2}#{@body}"
end;end;X=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 M;def M
end;constants.map{|c|k=const_get(c);k.send:include,C,Base,Models;r[0,0]=k if
end;constants.map{|c|k=const_get(c);k.send:include,C,Base,Helpers,Models;r[0,0]=k if
!r.include?k;k.meta_def(:urls){["/#{c.downcase}"]}if !k.respond_to?:urls}end;def
D p;r.map{|k|k.urls.map{|x|return k,$~[1..-1]if p=~/^#{x}\/?$/}};[NotFound,[p]]end
end;class NotFound<R();def get p;r(404,Mab.new{h1 P;h2 p+" not found"})end end
Expand Down

0 comments on commit 596f092

Please sign in to comment.