aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorAkira Matsuda <ronnie@dio.jp>2017-01-13 15:09:56 +0900
committerAkira Matsuda <ronnie@dio.jp>2017-01-13 15:13:47 +0900
commit9360b6be63b7a452535699bcf6ae853df7f5eea7 (patch)
treed1ad1280439883cf0fb328efe45e09dfa581182f /activesupport/lib/active_support
parentbe5ddc250874e6c7f4d22e34791f5187448ebb0e (diff)
downloadrails-9360b6be63b7a452535699bcf6ae853df7f5eea7.tar.gz
rails-9360b6be63b7a452535699bcf6ae853df7f5eea7.tar.bz2
rails-9360b6be63b7a452535699bcf6ae853df7f5eea7.zip
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
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/execution_wrapper.rb4
1 files changed, 2 insertions, 2 deletions
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)