Sha256: 3c4ff43c01edc619c123a0d4b104dbe45aa06a639bd37c5534ca7604b3b52924
Contents?: true
Size: 833 Bytes
Versions: 11
Compression:
Stored size: 833 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking instance methods and singleton methods. module OnMethodDef def on_def(node) method_name, args, body = *node on_method_def(node, method_name, args, body) end def on_defs(node) _scope, method_name, args, body = *node on_method_def(node, method_name, args, body) end private # Returns true for constructs such as # private def my_method # which are allowed in Ruby 2.1 and later. def modifier_and_def_on_same_line?(send_node) send_node.receiver.nil? && send_node.method_name != :def && send_node.method_args.size == 1 && [:def, :defs].include?(send_node.method_args.first.type) end end end end
Version data entries
11 entries across 11 versions & 2 rubygems