提交 858a30e5 编写于 作者: C Carlos Antonio da Silva 提交者: Santiago Pastorino

Refactor http_only, remove reader method

[Carlos Antonio da Silva & Santiago Pastorino]
上级 219ff436
......@@ -6,6 +6,20 @@
module Rails
module Configuration
module HttpOnly #:nodoc:
def initialize
@http_only = false
end
def http_only!
@http_only = true
end
def http_only?
@http_only
end
end
# MiddlewareStackProxy is a proxy for the Rails middleware stack that allows
# you to configure middlewares in your application. It works basically as a
# command recorder, saving each command to be applied after initialization
......@@ -44,16 +58,11 @@ module Configuration
# Cookies, Session and Flash, BestStandardsSupport, and MethodOverride. You
# can always add any of them later manually if you want.
class MiddlewareStackProxy
attr_reader :http_only
alias :http_only? :http_only
include HttpOnly
def initialize
super
@operations = []
@http_only = false
end
def http_only!
@http_only = true
end
def insert_before(*args, &block)
......@@ -90,17 +99,16 @@ class Generators #:nodoc:
attr_accessor :aliases, :options, :templates, :fallbacks, :colorize_logging
attr_reader :hidden_namespaces
attr_reader :http_only
alias :http_only? :http_only
include HttpOnly
def initialize
super
@aliases = Hash.new { |h,k| h[k] = {} }
@options = Hash.new { |h,k| h[k] = {} }
@fallbacks = {}
@templates = []
@colorize_logging = true
@hidden_namespaces = []
@http_only = false
end
def initialize_copy(source)
......@@ -114,10 +122,6 @@ def hide_namespace(namespace)
@hidden_namespaces << namespace
end
def http_only!
@http_only = true
end
def method_missing(method, *args)
method = method.to_s.sub(/=$/, '').to_sym
......@@ -138,5 +142,6 @@ def method_missing(method, *args)
end
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册