Parent

Methods

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Style::WordArray

This cop checks for array literals made up of word-like strings, that are not using the %w() syntax.

Constants

MSG

Public Instance Methods

on_array(node) click to toggle source
# File lib/rubocop/cop/style/word_array.rb, line 16
def on_array(node)
  array_elems = node.children
  return unless array_of?(:str, node) &&
    !complex_content?(array_elems) &&
    array_elems.size > min_size && !comments_in_array?(node)

  add_offense(node, :expression) { self.max = array_elems.size }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.