Skip to content

Commit

Permalink
Remove usage of memoizable from ActionPack.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jun 16, 2011
1 parent 8775ffa commit f2c0fb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions actionpack/lib/action_dispatch/http/headers.rb
Expand Up @@ -3,9 +3,10 @@
module ActionDispatch module ActionDispatch
module Http module Http
class Headers < ::Hash class Headers < ::Hash
extend ActiveSupport::Memoizable @@env_cache = Hash.new { |h,k| h[k] = "HTTP_#{k.upcase.gsub(/-/, '_')}" }


def initialize(*args) def initialize(*args)

if args.size == 1 && args[0].is_a?(Hash) if args.size == 1 && args[0].is_a?(Hash)
super() super()
update(args[0]) update(args[0])
Expand All @@ -25,9 +26,8 @@ def [](header_name)
private private
# Converts a HTTP header name to an environment variable name. # Converts a HTTP header name to an environment variable name.
def env_name(header_name) def env_name(header_name)
"HTTP_#{header_name.upcase.gsub(/-/, '_')}" @@env_cache[header_name]
end end
memoize :env_name
end end
end end
end end
13 changes: 6 additions & 7 deletions actionpack/lib/action_view/helpers/date_helper.rb
Expand Up @@ -621,7 +621,6 @@ def time_tag(date_or_time, *args)
end end


class DateTimeSelector #:nodoc: class DateTimeSelector #:nodoc:
extend ActiveSupport::Memoizable
include ActionView::Helpers::TagHelper include ActionView::Helpers::TagHelper


DEFAULT_PREFIX = 'date'.freeze DEFAULT_PREFIX = 'date'.freeze
Expand Down Expand Up @@ -786,11 +785,12 @@ def select_year
# Returns translated month names, but also ensures that a custom month # Returns translated month names, but also ensures that a custom month
# name array has a leading nil element. # name array has a leading nil element.
def month_names def month_names
month_names = @options[:use_month_names] || translated_month_names @month_names ||= begin
month_names.unshift(nil) if month_names.size < 13 month_names = @options[:use_month_names] || translated_month_names
month_names month_names.unshift(nil) if month_names.size < 13
month_names
end
end end
memoize :month_names


# Returns translated month names. # Returns translated month names.
# => [nil, "January", "February", "March", # => [nil, "January", "February", "March",
Expand Down Expand Up @@ -825,9 +825,8 @@ def month_name(number)
end end


def date_order def date_order
@options[:order] || translated_date_order @date_order ||= @options[:order] || translated_date_order
end end
memoize :date_order


def translated_date_order def translated_date_order
I18n.translate(:'date.order', :locale => @options[:locale]) || [] I18n.translate(:'date.order', :locale => @options[:locale]) || []
Expand Down

0 comments on commit f2c0fb3

Please sign in to comment.