From 9360b6be63b7a452535699bcf6ae853df7f5eea7 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 13 Jan 2017 15:09:56 +0900 Subject: class Foo < Struct.new(:x) creates an extra unneeded anonymous class because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it --- activesupport/lib/active_support/execution_wrapper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib/active_support') diff --git a/activesupport/lib/active_support/execution_wrapper.rb b/activesupport/lib/active_support/execution_wrapper.rb index 3384d12d5b..ca88e7876b 100644 --- a/activesupport/lib/active_support/execution_wrapper.rb +++ b/activesupport/lib/active_support/execution_wrapper.rb @@ -19,14 +19,14 @@ module ActiveSupport set_callback(:complete, *args, &block) end - class RunHook < Struct.new(:hook) # :nodoc: + RunHook = Struct.new(:hook) do # :nodoc: def before(target) hook_state = target.send(:hook_state) hook_state[hook] = hook.run end end - class CompleteHook < Struct.new(:hook) # :nodoc: + CompleteHook = Struct.new(:hook) do # :nodoc: def before(target) hook_state = target.send(:hook_state) if hook_state.key?(hook) -- cgit v1.2.3