Skip to content

Commit

Permalink
Shave off some bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
judofyr committed May 22, 2010
1 parent 60d9a2f commit 1c55f2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/camping-unabridged.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,11 @@ module Base
# instance of Tilt # => Found template in a file
def lookup(n)
T.fetch(n.to_sym) do |k|
t=Views.method_defined?(k) ||
t = Views.method_defined?(k) ||
(f = Dir[[O[:views] || "views", "#{n}.*"]*'/'][0]) &&
Template.new(f, O[f[/\.(\w+)$/, 1].to_sym] || {})
T[k] = t unless O[:dynamic_templates]
t
O[:dynamic_templates] ? t : T[k] = t
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/camping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class H<Hash;def method_missing m,*a;m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m.
module Base;attr_accessor:env,:request,:root,:input,:cookies,:state,:status,
:headers,:body;T={};L=:layout;def lookup n;T.fetch(n.to_sym){|k|t=Views.
method_defined?(k)||(f=Dir[[O[:views]||"views","#{n}.*"]*'/'][0])&&Template.
new(f,O[f[/\.(\w+)$/,1].to_sym]||{});T[k]=t unless O[:dynamic_templates];t} end;def render(v,o={},&b)if t=lookup(v)
new(f,O[f[/\.(\w+)$/,1].to_sym]||{});O[:dynamic_templates]?t:T[k]=t} end;def render(v,o={},&b)if t=lookup(v)
s=(t==!!0)?mab{send v,&b}: t.render(self,o[:locals]||{},&b);s=render(L,o.merge(
L=>!?!)){s}if o[L]!=!?&&&lookup(L);s;else;raise"Can't find template #{v}"end
end;def mab &b;(@mab||=Mab.new({},self)).capture(&b) end;def r s,b,h={};b,h=h,
Expand Down

0 comments on commit 1c55f2e

Please sign in to comment.