diff options
author | Holger Frohloff <holger@5minutenpause.com> | 2015-02-02 20:25:32 +0100 |
---|---|---|
committer | Holger Frohloff <holger@5minutenpause.com> | 2015-02-03 09:58:23 +0100 |
commit | 3e036f90c233fbbdc1e2cf15885afab611e90537 (patch) | |
tree | dee61a57a0cce4769e1ff1d930af6e6e3a69a21a | |
parent | 054e2a3d4220fcdf91170b5b45f16da36e35c5ce (diff) | |
download | rails-3e036f90c233fbbdc1e2cf15885afab611e90537.tar.gz rails-3e036f90c233fbbdc1e2cf15885afab611e90537.tar.bz2 rails-3e036f90c233fbbdc1e2cf15885afab611e90537.zip |
Small enhancement for generators
Changes a call to #map and a subsequent call to #flatten to the more idiomatic
version of #flat_map. This commit also removes an unnessecary return statement.
-rw-r--r-- | railties/lib/rails/generators.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index e25c364178..db8b184213 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -156,7 +156,7 @@ module Rails args << "--help" if args.empty? && klass.arguments.any?(&:required?) klass.start(args, config) else - options = sorted_groups.map(&:last).flatten + options = sorted_groups.flat_map(&:last) suggestions = options.sort_by {|suggested| levenshtein_distance(namespace.to_s, suggested) }.first(3) msg = "Could not find generator '#{namespace}'. " msg << "Maybe you meant #{ suggestions.map {|s| "'#{s}'"}.join(" or ") }\n" @@ -286,7 +286,7 @@ module Rails d[m] = x end - return x + x end # Prints a list of generators. |