module RuboCop::Cop::Metrics::Utils::IteratingBlock
def block_method_name(node)
Returns the name of the method called with a block
def block_method_name(node) case node.type when :block node.method_name when :block_pass node.parent.method_name end end
def iterating_block?(node)
Returns nil if node is neither a block node or a block-pass node.
def iterating_block?(node) name = block_method_name(node) name && iterating_method?(name) end
def iterating_method?(name)
def iterating_method?(name) KNOWN_ITERATING_METHODS.include? name end