class RuboCop::Cop::Style::StringChars


string.chars
# good
string.split(”)
string.split(//)
# bad
@example
define a ‘split` method that takes exactly the same arguments.
This cop is marked as unsafe. But probably it’s quite unlikely that some other class would
Checks for uses of ‘String#split` with empty string or regexp literal argument.

def on_send(node)

def on_send(node)
  return unless node.arguments.one? && BAD_ARGUMENTS.include?(node.first_argument.source)
  range = node.loc.selector.begin.join(node.loc.end)
  add_offense(range, message: format(MSG, current: range.source)) do |corrector|
    corrector.replace(range, 'chars')
  end
end