提交 4751a699 编写于 作者: S Santiago Pastorino

AbstractController.action_methods should return a Set

上级 b0a93d65
require 'erubis' require 'erubis'
require 'set'
require 'active_support/configurable' require 'active_support/configurable'
require 'active_support/descendants_tracker' require 'active_support/descendants_tracker'
require 'active_support/core_ext/module/anonymous' require 'active_support/core_ext/module/anonymous'
...@@ -59,7 +60,7 @@ def hidden_actions ...@@ -59,7 +60,7 @@ def hidden_actions
# itself. Finally, #hidden_actions are removed. # itself. Finally, #hidden_actions are removed.
# #
# ==== Returns # ==== Returns
# * <tt>array</tt> - A list of all methods that should be considered actions. # * <tt>set</tt> - A set of all methods that should be considered actions.
def action_methods def action_methods
@action_methods ||= begin @action_methods ||= begin
# All public instance methods of this class, including ancestors # All public instance methods of this class, including ancestors
...@@ -72,7 +73,7 @@ def action_methods ...@@ -72,7 +73,7 @@ def action_methods
hidden_actions.to_a hidden_actions.to_a
# Clear out AS callback method pollution # Clear out AS callback method pollution
methods.reject { |method| method =~ /_one_time_conditions/ } Set.new(methods.reject { |method| method =~ /_one_time_conditions/ })
end end
end end
......
...@@ -254,7 +254,7 @@ def index ...@@ -254,7 +254,7 @@ def index
class TestActionMethodsReloading < ActiveSupport::TestCase class TestActionMethodsReloading < ActiveSupport::TestCase
test "action_methods should be reloaded after defining a new method" do test "action_methods should be reloaded after defining a new method" do
assert_equal ["index"], Me6.action_methods assert_equal Set.new(["index"]), Me6.action_methods
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册