Skip to content

Files

Latest commit

 

History

History
25 lines (17 loc) · 445 Bytes

Performance-TimesMap.md

File metadata and controls

25 lines (17 loc) · 445 Bytes

Pattern: Use of .times.map

Issue: -

Description

This rule checks for .times.map calls. In most cases such calls can be replaced with an explicit array creation.

Examples

# bad
9.times.map do |i|
  i.to_s
end

# good
Array.new(9) do |i|
  i.to_s
end

Further Reading