提交 7b2ec381 编写于 作者: K Krekoten' Marjan 提交者: José Valim

Change def to attr_reader + alias

Signed-off-by: NJosé Valim <jose.valim@gmail.com>
上级 0d5d70f1
......@@ -39,7 +39,8 @@ def fresh?(response)
end
module Response
attr_reader :cache_control
attr_reader :cache_control, :etag
alias :etag? :etag
def initialize(*)
status, header, body = super
......@@ -69,14 +70,6 @@ def last_modified=(utc_time)
headers['Last-Modified'] = utc_time.httpdate
end
def etag
@etag
end
def etag?
@etag
end
def etag=(etag)
key = ActiveSupport::Cache.expand_cache_key(etag)
@etag = self["ETag"] = %("#{Digest::MD5.hexdigest(key)}")
......@@ -99,7 +92,7 @@ def set_conditional_cache_control!
if control.empty?
headers["Cache-Control"] = DEFAULT_CACHE_CONTROL
elsif @cache_control[:no_cache]
elsif control[:no_cache]
headers["Cache-Control"] = "no-cache"
else
extras = control[:extras]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册