diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-10-14 19:53:52 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-10-14 19:53:52 -0500 |
commit | bc1a18d7bd8898fea6d41d59f4016b4be51e371b (patch) | |
tree | aee98e7bb2469bd6a5df4d33146288e9698562ac | |
parent | 8cbf825425dc8ad3770881ea4e100b9023c69ce2 (diff) | |
download | rails-bc1a18d7bd8898fea6d41d59f4016b4be51e371b.tar.gz rails-bc1a18d7bd8898fea6d41d59f4016b4be51e371b.tar.bz2 rails-bc1a18d7bd8898fea6d41d59f4016b4be51e371b.zip |
Punt on ConcurrentHash [#3322 state:resolved]
-rw-r--r-- | actionpack/lib/action_controller/legacy/layout.rb | 10 | ||||
-rw-r--r-- | activesupport/lib/active_support/autoload.rb | 1 | ||||
-rw-r--r-- | activesupport/lib/active_support/concurrent_hash.rb | 27 |
3 files changed, 5 insertions, 33 deletions
diff --git a/actionpack/lib/action_controller/legacy/layout.rb b/actionpack/lib/action_controller/legacy/layout.rb index 53762158fc..4e3b67de20 100644 --- a/actionpack/lib/action_controller/legacy/layout.rb +++ b/actionpack/lib/action_controller/legacy/layout.rb @@ -184,7 +184,7 @@ module ActionController #:nodoc: def default_layout(*args) memoized_default_layout(*args) - @_memoized_default_layout ||= ::ActiveSupport::ConcurrentHash.new + @_memoized_default_layout ||= {} @_memoized_default_layout[args] ||= memoized_default_layout(*args) end @@ -195,7 +195,7 @@ module ActionController #:nodoc: end def find_layout(*args) - @_memoized_find_layout ||= ::ActiveSupport::ConcurrentHash.new + @_memoized_find_layout ||= {} @_memoized_find_layout[args] ||= memoized_find_layout(*args) end @@ -221,10 +221,10 @@ module ActionController #:nodoc: write_inheritable_hash(:layout_conditions, conditions) end end - + def active_layout(name) name = self.class.default_layout(formats) if name == true - + layout_name = case name when Symbol then __send__(name) when Proc then name.call(self) @@ -246,7 +246,7 @@ module ActionController #:nodoc: if only = conditions[:only] return only.include?(action_name) elsif except = conditions[:except] - return !except.include?(action_name) + return !except.include?(action_name) end end true diff --git a/activesupport/lib/active_support/autoload.rb b/activesupport/lib/active_support/autoload.rb index 2b5ebcf390..da12ecceca 100644 --- a/activesupport/lib/active_support/autoload.rb +++ b/activesupport/lib/active_support/autoload.rb @@ -6,7 +6,6 @@ module ActiveSupport autoload :Cache, 'active_support/cache' autoload :Callbacks, 'active_support/callbacks' autoload :Concern, 'active_support/concern' - autoload :ConcurrentHash, 'active_support/concurrent_hash' autoload :Configurable, 'active_support/configurable' autoload :DependencyModule, 'active_support/dependency_module' autoload :DeprecatedCallbacks, 'active_support/deprecated_callbacks' diff --git a/activesupport/lib/active_support/concurrent_hash.rb b/activesupport/lib/active_support/concurrent_hash.rb deleted file mode 100644 index 40224765a7..0000000000 --- a/activesupport/lib/active_support/concurrent_hash.rb +++ /dev/null @@ -1,27 +0,0 @@ -module ActiveSupport - class ConcurrentHash - def initialize(hash = {}) - @backup_cache = hash.dup - @frozen_cache = hash.dup.freeze - @mutex = Mutex.new - end - - def []=(k,v) - @mutex.synchronize { @backup_cache[k] = v } - @frozen_cache = @backup_cache.dup.freeze - v - end - - def [](k) - if @frozen_cache.key?(k) - @frozen_cache[k] - else - @mutex.synchronize { @backup_cache[k] } - end - end - - def empty? - @backup_cache.empty? - end - end -end |