diff options
author | José Valim <jose.valim@gmail.com> | 2011-06-16 08:01:35 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-06-16 08:01:35 -0300 |
commit | f2c0fb32c0dce7f8da0ce446e2d2f0cba5fd44b3 (patch) | |
tree | 8ef6575204ce1e314fa16a5eeb9f9c91667e5f30 | |
parent | 8775ffa37231d381cba34f0ecacb8a7bbcf0573f (diff) | |
download | rails-f2c0fb32c0dce7f8da0ce446e2d2f0cba5fd44b3.tar.gz rails-f2c0fb32c0dce7f8da0ce446e2d2f0cba5fd44b3.tar.bz2 rails-f2c0fb32c0dce7f8da0ce446e2d2f0cba5fd44b3.zip |
Remove usage of memoizable from ActionPack.
-rw-r--r-- | actionpack/lib/action_dispatch/http/headers.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/date_helper.rb | 13 |
2 files changed, 9 insertions, 10 deletions
diff --git a/actionpack/lib/action_dispatch/http/headers.rb b/actionpack/lib/action_dispatch/http/headers.rb index 1e43104f0a..505d5560b1 100644 --- a/actionpack/lib/action_dispatch/http/headers.rb +++ b/actionpack/lib/action_dispatch/http/headers.rb @@ -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 diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 56e3af683b..6a724749f4 100644 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -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]) || [] |