diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-12-05 21:33:26 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-12-05 21:33:26 +0100 |
commit | 754a3641f5bab6a2dbe3e4e42e7903090714b1ae (patch) | |
tree | d40b5a718dd6becea10cde8fafe377f0e4b3b797 /railties/lib | |
parent | eb4deb9dc6493de5b7d452a0500707dd8ce69200 (diff) | |
download | rails-754a3641f5bab6a2dbe3e4e42e7903090714b1ae.tar.gz rails-754a3641f5bab6a2dbe3e4e42e7903090714b1ae.tar.bz2 rails-754a3641f5bab6a2dbe3e4e42e7903090714b1ae.zip |
Spruce up `command_for`.
* Ditch the instance methods local variable.
* Prefer Ruby's default nil return, and remove else branch.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/commands/command.rb | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/railties/lib/rails/commands/command.rb b/railties/lib/rails/commands/command.rb index 0d4d44ff89..37d61a8bea 100644 --- a/railties/lib/rails/commands/command.rb +++ b/railties/lib/rails/commands/command.rb @@ -63,14 +63,11 @@ module Rails def command_for(command_name) klass = @@commands.find do |command| - command_instance_methods = command.public_instance_methods - command_instance_methods.include?(command_name) + command.public_instance_methods.include?(command_name) end if klass klass.new(@argv) - else - nil end end end |