aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorHolger Frohloff <holger@5minutenpause.com>2015-02-02 20:25:32 +0100
committerHolger Frohloff <holger@5minutenpause.com>2015-02-03 09:58:23 +0100
commit3e036f90c233fbbdc1e2cf15885afab611e90537 (patch)
treedee61a57a0cce4769e1ff1d930af6e6e3a69a21a /railties
parent054e2a3d4220fcdf91170b5b45f16da36e35c5ce (diff)
downloadrails-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.
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators.rb4
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.