Parent

Methods

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Style::ArrayJoin

This cop checks for uses of "*" as a substitute for join.

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

Constants

MSG

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/style/array_join.rb, line 13
def on_send(node)
  receiver_node, method_name, *arg_nodes = *node
  return unless receiver_node && receiver_node.type == :array &&
    method_name == :* && arg_nodes[0].type == :str

  add_offense(node, :selector)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.