lib/rubocop/cop/mixin/trailing_comma.rb
def multiline?(node)
        # No need to process anything if the whole node is not multiline
        # Without the 2nd check, Foo.new({}) is considered multiline, which
        # it should not be. Essentially, if there are no elements, the
        # expression can not be multiline.
        return false unless node.multiline?

        items = elements(node).map(&:source_range)
        return false if items.empty?

        return false if single_argument_not_multiline?(items, node)

        items << node.loc.begin << node.loc.end
        (items.map(&:first_line) + items.map(&:last_line)).uniq.size > 1
      end
# Returns true if the round/square/curly brackets of the given node are
# on different lines, each item within is on its own line, and the
# closing bracket is on its own line.
Returns true if the round/square/curly brackets of the given node are
on different lines, each item within is on its own line, and the
closing bracket is on its own line.
Returns true if the round / square / curly brackets of the given node are on different lines each item within is on its own line and the closing bracket is on its own line .
def multiline?(node)
        return false unless node.multiline?
        items = elements(node).map(&:source_range)
        return false if items.empty?
        return false if single_argument_not_multiline?(items, node)
        items << node.loc.begin << node.loc.end
        (items.map(&:first_line) + items.map(&:last_line)).uniq.size > 1
      end
def multiline? ( node ) return false unless node . multiline? items = elements ( node ) . map ( & :source_range ) return false if items . empty? return false if single_argument_not_multiline? ( items , node ) items << node . loc . begin << node . loc . end ( items . map ( & :first_line ) + items . map ( & :last_line ) ) . uniq . size > 1 end
Returns true if the round/square/curly brackets of the given node are
on different lines, each item within is on its own line, and the
closing bracket is on its own line.
Returns true if the round / square / curly brackets of the given node are on different lines each item within is on its own line and the closing bracket is on its own line .
# No need to process anything if the whole node is not multiline # Without the 2nd check, Foo.new({}) is considered multiline, which # it should not be. Essentially, if there are no elements, the # expression can not be multiline.
node