Minimal HWIA removal patch attached. So far, the examples, file upload, sessions, all work under mongrel with the patch applied.
_why, is it something like that that you want ? I'm not even sure if HWIA extension is useful. The method_missing shortcut is even shorter than the one with :symbols. -- Cheers, zimbatm
Index: lib/camping-unabridged.rb =================================================================== --- lib/camping-unabridged.rb (revision 226) +++ lib/camping-unabridged.rb (working copy) @@ -28,8 +28,14 @@ # http://rubyforge.org/projects/mongrel Mongrel comes with examples # in its <tt>examples/camping</tt> directory. # -%w[active_support markaby tempfile uri].map { |l| require l } +%w[markaby tempfile uri].map { |l| require l } +class Object + def meta_def(m,&b) + (class<<self;self;end).send(:define_method, m, &b) + end +end + # == Camping # # The camping module contains three modules for separating your application: @@ -85,8 +91,7 @@ C = self S = IO.read(__FILE__) rescue nil P = "Cam\ping Problem!" - H = HashWithIndifferentAccess - # An object-like Hash, based on ActiveSupport's HashWithIndifferentAccess. + # An object-like Hash. # All Camping query string and cookie variables are loaded as this. # # To access the query string, for instance, use the <tt>@input</tt> variable. @@ -109,7 +114,7 @@ # # Use the <tt>@cookies</tt> variable in the same fashion to access cookie variables. # Also, the <tt>@env</tt> variable is an H containing the HTTP headers and server info. - class H + class H < Hash # Gets or sets keys in the hash. # # @cookies.my_favorite = :macadamian @@ -117,9 +122,9 @@ # => :macadamian # def method_missing(m,*a) - m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m]:super + m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m.to_s]:super end - alias u regular_update + alias u merge! end # Helpers contains methods available in your controllers and views. You may add @@ -369,12 +374,12 @@ when /^Content-D.+?: form-data;/ fh.u H[*$'.scan(/(?:\s(\w+)="([^"]+)")/).flatten] when /^Content-Type: (.+?)(\r$|\Z)/m - fh[:type] = $1 + fh.type = $1 end end - fn=fh[:name] - o=if fh[:filename] - o=fh[:tempfile]=Tempfile.new(:C) + fn=fh.name + o=if fh.filename + o=fh.tempfile=Tempfile.new(:C) o.binmode else fh="" @@ -392,7 +397,7 @@ [EMAIL PROTECTED](s) end C.qsp(fn,'&;',fh,q) if fn - fh[:tempfile].rewind if fh.is_a?H + fh.tempfile.rewind if fh.is_a?H end elsif @method == "post" and e.CONTENT_TYPE == "application/x-www-form-urlencoded" q.u(C.qsp(@in.read)) @@ -673,7 +678,7 @@ # Blog.post(:Login, :input => {'username' => 'admin', 'password' => 'camping'}) # #=> #<Blog::Controllers::Login @user=... > # - # Blog.get(:Info, :env => {:HTTP_HOST => 'wagon'}) + # Blog.get(:Info, :env => {'HTTP_HOST' => 'wagon'}) # #=> #<Blog::Controllers::Info @env={'HTTP_HOST'=>'wagon'} ...> # def method_missing(m, c, *a)
_______________________________________________ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list