mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Replace map.flatten with flat_map in railties
This commit is contained in:
parent
3413b88a3d
commit
cff340f1ed
4 changed files with 4 additions and 4 deletions
|
@ -11,7 +11,7 @@ else
|
||||||
end
|
end
|
||||||
if File.exist?(railsrc)
|
if File.exist?(railsrc)
|
||||||
extra_args_string = File.read(railsrc)
|
extra_args_string = File.read(railsrc)
|
||||||
extra_args = extra_args_string.split(/\n+/).map {|l| l.split}.flatten
|
extra_args = extra_args_string.split(/\n+/).flat_map {|l| l.split}
|
||||||
puts "Using #{extra_args.join(" ")} from #{railsrc}"
|
puts "Using #{extra_args.join(" ")} from #{railsrc}"
|
||||||
ARGV.insert(1, *extra_args)
|
ARGV.insert(1, *extra_args)
|
||||||
end
|
end
|
||||||
|
|
|
@ -188,7 +188,7 @@ module Rails
|
||||||
# generate(:authenticated, "user session")
|
# generate(:authenticated, "user session")
|
||||||
def generate(what, *args)
|
def generate(what, *args)
|
||||||
log :generate, what
|
log :generate, what
|
||||||
argument = args.map {|arg| arg.to_s }.flatten.join(" ")
|
argument = args.flat_map {|arg| arg.to_s }.join(" ")
|
||||||
|
|
||||||
in_root { run_ruby_script("bin/rails generate #{what} #{argument}", verbose: false) }
|
in_root { run_ruby_script("bin/rails generate #{what} #{argument}", verbose: false) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -101,7 +101,7 @@ module Rails
|
||||||
def filter_by(&block)
|
def filter_by(&block)
|
||||||
all_paths.find_all(&block).flat_map { |path|
|
all_paths.find_all(&block).flat_map { |path|
|
||||||
paths = path.existent
|
paths = path.existent
|
||||||
paths - path.children.map { |p| yield(p) ? [] : p.existent }.flatten
|
paths - path.children.flat_map { |p| yield(p) ? [] : p.existent }
|
||||||
}.uniq
|
}.uniq
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -115,7 +115,7 @@ class SourceAnnotationExtractor
|
||||||
# Prints the mapping from filenames to annotations in +results+ ordered by filename.
|
# Prints the mapping from filenames to annotations in +results+ ordered by filename.
|
||||||
# The +options+ hash is passed to each annotation's +to_s+.
|
# The +options+ hash is passed to each annotation's +to_s+.
|
||||||
def display(results, options={})
|
def display(results, options={})
|
||||||
options[:indent] = results.map { |f, a| a.map(&:line) }.flatten.max.to_s.size
|
options[:indent] = results.flat_map { |f, a| a.map(&:line) }.max.to_s.size
|
||||||
results.keys.sort.each do |file|
|
results.keys.sort.each do |file|
|
||||||
puts "#{file}:"
|
puts "#{file}:"
|
||||||
results[file].each do |note|
|
results[file].each do |note|
|
||||||
|
|
Loading…
Reference in a new issue