Skip to content

Commit

Permalink
Camping.use now also accepts a block
Browse files Browse the repository at this point in the history
  • Loading branch information
judofyr committed Nov 30, 2009
1 parent f76f858 commit 3be2a50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/camping-unabridged.rb
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,8 @@ def method_missing(m, c, *a)
# use Rack::MethodOverride
# use Rack::Session::Memcache, :key => "session"
# end
def use(*a)
m = a.shift.new(method(:call), *a)
def use(*a, &b)
m = a.shift.new(method(:call), *a, &b)
meta_def(:call) { |e| m.call(e) }
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 @@ -46,6 +46,6 @@ def M;def M;end;constants.map{|c|k=const_get(c)
def method_missing m,c,*a;X.M;h=Hash===a[-1]?a.pop: {}
e=H[Rack::MockRequest.env_for('',h[:env]||{})]
k=X.const_get(c).new(e,m.to_s);k.send("input=",h[:input])if h[:input]
k.service(*a);end;def use*a;m=a.shift.new(method(:call),*a);meta_def(:call){|e|
k.service(*a);end;def use*a,&b;m=a.shift.new(method(:call),*a,&b);meta_def(:call){|e|
m.call(e)}end end;module Views;include X,Helpers end;module Models
autoload:Base,'camping/ar';def Y;self;end end;autoload:Mab,'camping/mab';C end

0 comments on commit 3be2a50

Please sign in to comment.