Remove global access to the rack env and response
This commit is contained in:
parent
16ca3d5c17
commit
fdd52cd640
|
@ -180,14 +180,6 @@ module Middleman
|
|||
delegate :use, :to => :"self.class"
|
||||
delegate :map, :to => :"self.class"
|
||||
|
||||
# Rack env
|
||||
def env
|
||||
Thread.current[:env]
|
||||
end
|
||||
def env=(value)
|
||||
Thread.current[:env] = value
|
||||
end
|
||||
|
||||
# Rack request
|
||||
# @return [Rack::Request]
|
||||
def req
|
||||
|
@ -197,15 +189,6 @@ module Middleman
|
|||
Thread.current[:req] = value
|
||||
end
|
||||
|
||||
# Rack response
|
||||
# @return [Rack::Response]
|
||||
def res
|
||||
Thread.current[:res]
|
||||
end
|
||||
def res=(value)
|
||||
Thread.current[:res] = value
|
||||
end
|
||||
|
||||
def call(env)
|
||||
dup.call!(env)
|
||||
end
|
||||
|
@ -214,10 +197,9 @@ module Middleman
|
|||
#
|
||||
# @param env Rack environment
|
||||
def call!(env)
|
||||
self.env = env
|
||||
# Store environment, request and response for later
|
||||
self.req = req = ::Rack::Request.new(env)
|
||||
self.res = res = ::Rack::Response.new
|
||||
res = ::Rack::Response.new
|
||||
|
||||
logger.debug "== Request: #{env["PATH_INFO"]}"
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ module Middleman
|
|||
app.data.store("page", md[:page])
|
||||
end
|
||||
|
||||
blocks = md[:blocks].dup rescue []
|
||||
blocks = Array(md[:blocks]).dup
|
||||
blocks << block if block_given?
|
||||
|
||||
app.current_path ||= self.destination_path
|
||||
|
|
Loading…
Reference in a new issue