mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Remove usage of memoizable from ActionPack.
This commit is contained in:
@@ -3,9 +3,10 @@ require 'active_support/memoizable'
|
||||
module ActionDispatch
|
||||
module Http
|
||||
class Headers < ::Hash
|
||||
extend ActiveSupport::Memoizable
|
||||
@@env_cache = Hash.new { |h,k| h[k] = "HTTP_#{k.upcase.gsub(/-/, '_')}" }
|
||||
|
||||
def initialize(*args)
|
||||
|
||||
if args.size == 1 && args[0].is_a?(Hash)
|
||||
super()
|
||||
update(args[0])
|
||||
@@ -25,9 +26,8 @@ module ActionDispatch
|
||||
private
|
||||
# Converts a HTTP header name to an environment variable name.
|
||||
def env_name(header_name)
|
||||
"HTTP_#{header_name.upcase.gsub(/-/, '_')}"
|
||||
@@env_cache[header_name]
|
||||
end
|
||||
memoize :env_name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -621,7 +621,6 @@ module ActionView
|
||||
end
|
||||
|
||||
class DateTimeSelector #:nodoc:
|
||||
extend ActiveSupport::Memoizable
|
||||
include ActionView::Helpers::TagHelper
|
||||
|
||||
DEFAULT_PREFIX = 'date'.freeze
|
||||
@@ -786,11 +785,12 @@ module ActionView
|
||||
# Returns translated month names, but also ensures that a custom month
|
||||
# name array has a leading nil element.
|
||||
def month_names
|
||||
month_names = @options[:use_month_names] || translated_month_names
|
||||
month_names.unshift(nil) if month_names.size < 13
|
||||
month_names
|
||||
@month_names ||= begin
|
||||
month_names = @options[:use_month_names] || translated_month_names
|
||||
month_names.unshift(nil) if month_names.size < 13
|
||||
month_names
|
||||
end
|
||||
end
|
||||
memoize :month_names
|
||||
|
||||
# Returns translated month names.
|
||||
# => [nil, "January", "February", "March",
|
||||
@@ -825,9 +825,8 @@ module ActionView
|
||||
end
|
||||
|
||||
def date_order
|
||||
@options[:order] || translated_date_order
|
||||
@date_order ||= @options[:order] || translated_date_order
|
||||
end
|
||||
memoize :date_order
|
||||
|
||||
def translated_date_order
|
||||
I18n.translate(:'date.order', :locale => @options[:locale]) || []
|
||||
|
||||
Reference in New Issue
Block a user