Skip to content

Commit

Permalink
Earning some more bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
judofyr committed Oct 30, 2008
1 parent 205983a commit 5359649
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/camping-unabridged.rb
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def mab(l=nil,&b)
#
# See also: #r404, #r500 and #r501
def r(s, b, h = {})
Hash===b && (b, h = h, b)
b, h = h, b if Hash === b
@status = s
@headers.merge!(h)
@body = b
Expand Down Expand Up @@ -551,8 +551,7 @@ class << self
# module Blog::Views; ... end
#
def goes(m)
eval S.gsub(/Camping/,m=m.to_s), t=TOPLEVEL_BINDING
Apps << eval(m,t)
Apps << eval(S.gsub(/Camping/,m.to_s), TOPLEVEL_BINDING)
end
# Ruby web servers use this method to enter the Camping realm. The e
Expand Down Expand Up @@ -634,5 +633,6 @@ def Y;self;end
end
autoload :Mab, 'camping/mab'
C
end
6 changes: 3 additions & 3 deletions lib/camping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def method_missing m,*a;m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m.to_s]:super end
def render v,*a,&b;mab(/^_/!~v.to_s){send(v,*a,&b)} end
def mab l=nil,&b;m=Mab.new({},self);s=m.capture(&b)
s=m.capture{layout{s}} if l && m.respond_to?(:layout);s end
def r s,b,h={};(Hash===b&&(b,h=h,b));@status=s;
def r s,b,h={};b,h=h,b if Hash===b;@status=s;
@headers.merge!(h);@body=b;end;def redirect *a;r 302,'','Location'=>URL(*a).
to_s;end;def r404 p=env.PATH;r 404,P%"#{p} not found"end;def r500 k,m,x
r 500,P%"#{k}.#{m}"+"<h3>#{x.class} #{x.message}: <ul>#{x.
Expand Down Expand Up @@ -44,11 +44,11 @@ def M;def M;end;constants.map{|c|k=const_get(c)
k.meta_def(:urls){["/#{c.scan(/.[^A-Z]*/).map(&N.method(:[]))*'/'}"]
}if !k.respond_to?:urls}end end;class I<R()
end; end;X=Controllers;class<<self;def goes m
eval S.gsub(/Camping/,m=m.to_s),t=TOPLEVEL_BINDING;Apps<<eval(m,t) end;def call(
Apps<<eval(S.gsub(/Camping/,m.to_s),TOPLEVEL_BINDING) end;def call(
e)X.M;e=H[e.to_hash];k,m,*a=X.D e.PATH_INFO,(e.REQUEST_METHOD||'get').downcase
e.REQUEST_METHOD=m;k.new(e).service(*a).to_a;end
def method_missing m,c,*a;X.M;h=Hash===a[-1]?H[a.pop]:{};e=
H[h[:env]||{}].merge!({'rack.input'=>StringIO.new,'REQUEST_METHOD'=>m.to_s})
k=X.const_get(c).new(H[e]);k.send("input=",h[:input])if h[:input]
k.service(*a);end;end;module Views;include X,Helpers end;module Models
autoload:Base,'camping/ar';def Y;self;end end;autoload:Mab,'camping/mab'end
autoload:Base,'camping/ar';def Y;self;end end;autoload:Mab,'camping/mab';C end

2 comments on commit 5359649

@Bluebie
Copy link

@Bluebie Bluebie commented on 5359649 Nov 4, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we’d decided using Mash would be funky? But your gems don’t seem to include it. Whats the dealio? Are we now anti-mash?

@judofyr
Copy link
Owner Author

@judofyr judofyr commented on 5359649 Nov 4, 2008

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh, I was just tossing ideas around. I had it on a branch, but I think I removed it a while ago. H does a good job already, and there’s no point of adding a new dependency :-)

Please sign in to comment.