RuboCop::Cop
This cop looks for uses of Perl-style regexp match backreferences like $1, $2, etc.
# File lib/rubocop/cop/style/perl_backrefs.rb, line 14 def autocorrect(node) @corrections << lambda do |corrector| backref, = *node corrector.replace(node.loc.expression, "Regexp.last_match[#{backref}]") end end
# File lib/rubocop/cop/style/perl_backrefs.rb, line 10 def on_nth_ref(node) add_offense(node, :expression) end
[Validate]
Generated with the Darkfish Rdoc Generator 2.