diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/benchmarking.rb | 7 | ||||
-rw-r--r-- | actionpack/lib/action_controller/components.rb | 11 | ||||
-rw-r--r-- | actionpack/lib/action_controller/filters.rb | 11 | ||||
-rw-r--r-- | actionpack/lib/action_controller/flash.rb | 7 | ||||
-rw-r--r-- | actionpack/lib/action_controller/helpers.rb | 3 | ||||
-rw-r--r-- | actionpack/lib/action_controller/integration.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_controller/layout.rb | 5 | ||||
-rw-r--r-- | actionpack/lib/action_controller/rescue.rb | 3 | ||||
-rw-r--r-- | actionpack/lib/action_controller/session_management.rb | 9 | ||||
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 3 |
11 files changed, 23 insertions, 43 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 865aec8672..1d28af1c3d 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.] + * Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.] * Use #flush between switching from #write to #syswrite. Closes #4907. [Blair Zajac <blair@orcaware.com>] diff --git a/actionpack/lib/action_controller/benchmarking.rb b/actionpack/lib/action_controller/benchmarking.rb index a30212c8bd..8b548f9d25 100644 --- a/actionpack/lib/action_controller/benchmarking.rb +++ b/actionpack/lib/action_controller/benchmarking.rb @@ -8,11 +8,8 @@ module ActionController #:nodoc: base.extend(ClassMethods) base.class_eval do - alias_method :perform_action_without_benchmark, :perform_action - alias_method :perform_action, :perform_action_with_benchmark - - alias_method :render_without_benchmark, :render - alias_method :render, :render_with_benchmark + alias_method_chain :perform_action, :benchmark + alias_method_chain :render, :benchmark end end diff --git a/actionpack/lib/action_controller/components.rb b/actionpack/lib/action_controller/components.rb index 75005daaec..c746928697 100644 --- a/actionpack/lib/action_controller/components.rb +++ b/actionpack/lib/action_controller/components.rb @@ -50,14 +50,9 @@ module ActionController #:nodoc: base.send :attr_accessor, :parent_controller base.class_eval do - alias_method :process_cleanup_without_components, :process_cleanup - alias_method :process_cleanup, :process_cleanup_with_components - - alias_method :set_session_options_without_components, :set_session_options - alias_method :set_session_options, :set_session_options_with_components - - alias_method :flash_without_components, :flash - alias_method :flash, :flash_with_components + alias_method_chain :process_cleanup, :components + alias_method_chain :set_session_options, :components + alias_method_chain :flash, :components alias_method :component_request?, :parent_controller end diff --git a/actionpack/lib/action_controller/filters.rb b/actionpack/lib/action_controller/filters.rb index 01a4b9fba1..624124ac01 100644 --- a/actionpack/lib/action_controller/filters.rb +++ b/actionpack/lib/action_controller/filters.rb @@ -350,14 +350,9 @@ module ActionController #:nodoc: module InstanceMethods # :nodoc: def self.included(base) base.class_eval do - alias_method :perform_action_without_filters, :perform_action - alias_method :perform_action, :perform_action_with_filters - - alias_method :process_without_filters, :process - alias_method :process, :process_with_filters - - alias_method :process_cleanup_without_filters, :process_cleanup - alias_method :process_cleanup, :process_cleanup_with_filters + alias_method_chain :perform_action, :filters + alias_method_chain :process, :filters + alias_method_chain :process_cleanup, :filters end end diff --git a/actionpack/lib/action_controller/flash.rb b/actionpack/lib/action_controller/flash.rb index 8877c33741..61ac33f399 100644 --- a/actionpack/lib/action_controller/flash.rb +++ b/actionpack/lib/action_controller/flash.rb @@ -28,11 +28,8 @@ module ActionController #:nodoc: base.send :include, InstanceMethods base.class_eval do - alias_method :assign_shortcuts_without_flash, :assign_shortcuts - alias_method :assign_shortcuts, :assign_shortcuts_with_flash - - alias_method :process_cleanup_without_flash, :process_cleanup - alias_method :process_cleanup, :process_cleanup_with_flash + alias_method_chain :assign_shortcuts, :flash + alias_method_chain :process_cleanup, :flash end end diff --git a/actionpack/lib/action_controller/helpers.rb b/actionpack/lib/action_controller/helpers.rb index cdfcfd7e91..8aeef52868 100644 --- a/actionpack/lib/action_controller/helpers.rb +++ b/actionpack/lib/action_controller/helpers.rb @@ -12,8 +12,7 @@ module ActionController #:nodoc: base.class_eval do # Wrap inherited to create a new master helper module for subclasses. class << self - alias_method :inherited_without_helper, :inherited - alias_method :inherited, :inherited_with_helper + alias_method_chain :inherited, :helper end end end diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index 74817c4b4c..56ac4b74fe 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -317,9 +317,8 @@ module ActionController def self.included(base) base.extend(ClassMethods) base.class_eval do - class <<self - alias_method :new_without_capture, :new - alias_method :new, :new_with_capture + class << self + alias_method_chain :new, :capture end end end diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb index 4e9e42d468..f27e42ea17 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -3,12 +3,13 @@ module ActionController #:nodoc: def self.included(base) base.extend(ClassMethods) base.class_eval do + # NOTE: Can't use alias_method_chain here because +render_without_layout+ is already + # defined as a publicly exposed method alias_method :render_with_no_layout, :render alias_method :render, :render_with_a_layout class << self - alias_method :inherited_without_layout, :inherited - alias_method :inherited, :inherited_with_layout + alias_method_chain :inherited, :layout end end end diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb index 9f0cd47092..9b57d35587 100644 --- a/actionpack/lib/action_controller/rescue.rb +++ b/actionpack/lib/action_controller/rescue.rb @@ -9,8 +9,7 @@ module ActionController #:nodoc: def self.included(base) #:nodoc: base.extend(ClassMethods) base.class_eval do - alias_method :perform_action_without_rescue, :perform_action - alias_method :perform_action, :perform_action_with_rescue + alias_method_chain :perform_action, :rescue end end diff --git a/actionpack/lib/action_controller/session_management.rb b/actionpack/lib/action_controller/session_management.rb index 408ef2790e..d953b5b766 100644 --- a/actionpack/lib/action_controller/session_management.rb +++ b/actionpack/lib/action_controller/session_management.rb @@ -8,12 +8,9 @@ module ActionController #:nodoc: module SessionManagement #:nodoc: def self.included(base) base.extend(ClassMethods) - - base.send :alias_method, :process_without_session_management_support, :process - base.send :alias_method, :process, :process_with_session_management_support - - base.send :alias_method, :process_cleanup_without_session_management_support, :process_cleanup - base.send :alias_method, :process_cleanup, :process_cleanup_with_session_management_support + + base.send :alias_method_chain, :process, :session_management_support + base.send :alias_method_chain, :process_cleanup, :session_management_support end module ClassMethods diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index 096ccf76d2..b35439249d 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -18,8 +18,7 @@ module ActionController #:nodoc: end end - alias_method :process_without_test, :process - alias_method :process, :process_with_test + alias_method_chain :process, :test end class TestRequest < AbstractRequest #:nodoc: |