class RuboCop::Cop::Style::PerlBackrefs
def preferred_expression_to(node)
-
(String, nil)
-
Parameters:
-
node
(RuboCop::AST::Node
) --
Other tags:
- Private: -
def preferred_expression_to(node) first = node.to_a.first case first when ::Integer "Regexp.last_match(#{first})" when :$&, :$MATCH 'Regexp.last_match(0)' when :$`, :$PREMATCH 'Regexp.last_match.pre_match' when :$', :$POSTMATCH 'Regexp.last_match.post_match' when :$+, :$LAST_PAREN_MATCH 'Regexp.last_match(-1)' end end