Skip to content

Commit

Permalink
Replace map.flatten with flat_map in railties
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Mar 4, 2014
1 parent 3413b88 commit cff340f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion railties/lib/rails/commands/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
end
if File.exist?(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}"
ARGV.insert(1, *extra_args)
end
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/generators/actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def initializer(filename, data=nil, &block)
# generate(:authenticated, "user session")
def generate(what, *args)
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) }
end
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/paths.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def load_paths
def filter_by(&block)
all_paths.find_all(&block).flat_map { |path|
paths = path.existent
paths - path.children.map { |p| yield(p) ? [] : p.existent }.flatten
paths - path.children.flat_map { |p| yield(p) ? [] : p.existent }
}.uniq
end
end
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/source_annotation_extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def extract_annotations_from(file, pattern)
# Prints the mapping from filenames to annotations in +results+ ordered by filename.
# The +options+ hash is passed to each annotation's +to_s+.
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|
puts "#{file}:"
results[file].each do |note|
Expand Down

0 comments on commit cff340f

Please sign in to comment.