class RuboCop::Cop::Style::ModuleFunction

This cops checks for use of `extend self` in a module.

@example

module Test
  extend self

  ...

end

Constants

MSG
TARGET_NODE

Public Instance Methods

on_module(node) click to toggle source
# File lib/rubocop/cop/style/module_function.rb, line 20
def on_module(node)
  _name, body = *node
  return unless body && body.type == :begin

  body.children.each do |body_node|
    add_offense(body_node, :expression) if body_node == TARGET_NODE
  end
end