1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Simplify RailsGuides::Generator#select_only a bit

The main goal is to improve readability, but as a side effect this commit makes the method a bit faster.
This commit is contained in:
Viktar Basharymau 2015-11-22 18:37:30 +03:00
parent 4547e894e9
commit 35442422fa

View file

@ -162,7 +162,7 @@ module RailsGuides
def select_only(guides)
prefixes = ENV['ONLY'].split(",").map(&:strip)
guides.select do |guide|
prefixes.any? { |p| guide.start_with?(p) || guide.start_with?("kindle") }
guide.start_with?('kindle'.freeze, *prefixes)
end
end