Skip to content

Commit

Permalink
Removing @env - use @headers and @request instead
Browse files Browse the repository at this point in the history
  • Loading branch information
judofyr committed May 21, 2008
1 parent 04eeaf4 commit b09de27
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/camping-unabridged.rb
Expand Up @@ -113,7 +113,6 @@ module Camping
# to get the value for the <tt>page</tt> query variable.
#
# 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 < Hash
# Gets or sets keys in the hash.
#
Expand Down Expand Up @@ -280,8 +279,7 @@ def URL c='/',*a
# end
#
module Base
attr_accessor :input, :cookies, :env, :headers, :body, :status, :root
Z = "\r\n"
attr_accessor :input, :cookies, :headers, :body, :status, :root

# Display a view, calling it by its method name +m+. If a <tt>layout</tt>
# method is found in Camping::Views, it will be used to wrap the HTML.
Expand All @@ -302,7 +300,7 @@ def render(m); end; undef_method :render
#
# module Camping::Controllers
# class Info
# def get; code @env.inspect end
# def get; code @headers.inspect end
# end
# end
#
Expand Down Expand Up @@ -401,7 +399,7 @@ def r501(m=@method)
# def get(id)
# Post.find(id)
# rescue
# r *Blog.get(:NotFound, @env.REQUEST_URI)
# r *Blog.get(:NotFound, @headers.REQUEST_URI)
# end
# end
#
Expand All @@ -410,8 +408,6 @@ def to_a
end

def initialize(env) #:nodoc:
@env = env

@request = Rack::Request.new(env)
@root = @request.script_name.sub(/\/$/,'')
@input = H[@request.params]
Expand Down Expand Up @@ -604,7 +600,7 @@ def call(env)
# #=> #<Blog::Controllers::Login @user=... >
#
# Blog.get(:Info, :env => {'HTTP_HOST' => 'wagon'})
# #=> #<Blog::Controllers::Info @env={'HTTP_HOST'=>'wagon'} ...>
# #=> #<Blog::Controllers::Info @headers={'HTTP_HOST'=>'wagon'} ...>
#
def method_missing(m, c, *a)
X.M
Expand Down

0 comments on commit b09de27

Please sign in to comment.