Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 684 Bytes

Style-ArrayJoin.md

File metadata and controls

26 lines (17 loc) · 684 Bytes

Pattern: Use of Array#*

Issue: -

Description

This rule checks for uses of fairly cryptic Array#* to be replaced with Array#join.

Not all cases can reliably checked, due to Ruby's dynamic types, so it considers only cases when the first argument is an array literal or the second is a string literal.

Examples

# bad
%w[one two three] * ', '
# => 'one, two, three'

# good
%w[one two three].join(', ')
# => 'one, two, three'

Further Reading