diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-03-10 17:48:54 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2012-03-14 12:46:24 -0300 |
commit | 858a30e5716de6201087f2798f6d733cfb9b2fd7 (patch) | |
tree | 49a1a025cb6f95cdf1424dbc2852221265e4662e /railties/lib | |
parent | 219ff436399c3d28bb09ea841fecfdcfe6606257 (diff) | |
download | rails-858a30e5716de6201087f2798f6d733cfb9b2fd7.tar.gz rails-858a30e5716de6201087f2798f6d733cfb9b2fd7.tar.bz2 rails-858a30e5716de6201087f2798f6d733cfb9b2fd7.zip |
Refactor http_only, remove reader method
[Carlos Antonio da Silva & Santiago Pastorino]
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/configuration.rb | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index 46b363c70e..bce696c8f9 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -6,6 +6,20 @@ require 'rails/rack' 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 Rails # 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 @@ module Rails 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 @@ module Rails @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 @@ module Rails end end end + end end |