Parent

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Style::CollectionMethods

This cop checks for uses of unidiomatic method names from the Enumerable module.

The current definition of the check is flawed and should be enhanced by check for by blocks & procs as arguments of the methods.

Constants

MSG

Public Instance Methods

autocorrect(node) click to toggle source
# File lib/rubocop/cop/style/collection_methods.rb, line 27
def autocorrect(node)
  @corrections << lambda do |corrector|
    corrector.replace(node.loc.selector,
                      preferred_method(node.loc.selector.source))
  end
end
on_block(node) click to toggle source
# File lib/rubocop/cop/style/collection_methods.rb, line 14
def on_block(node)
  method, _args, _body = *node

  check_method_node(method)
end
on_send(node) click to toggle source
# File lib/rubocop/cop/style/collection_methods.rb, line 20
def on_send(node)
  _receiver, _method_name, *args = *node
  return unless args.size == 1 && args.first.type == :block_pass

  check_method_node(node)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.