class RuboCop::Cop::Layout::DotPosition
def proper_dot_position?(node)
def proper_dot_position?(node) selector_range = selector_range(node) return true if same_line?(selector_range, end_range(node.receiver)) selector_line = selector_range.line receiver_line = receiver_end_line(node.receiver) dot_line = node.loc.dot.line # don't register an offense if there is a line comment between the # dot and the selector otherwise, we might break the code while # "correcting" it (even if there is just an extra blank line, treat # it the same) # Also, in the case of a heredoc, the receiver will end after the dot, # because the heredoc body is on subsequent lines, so use the highest # line to compare to. return true if line_between?(selector_line, [receiver_line, dot_line].max) correct_dot_position_style?(dot_line, selector_line) end