class RuboCop::Cop::Lint::RegexpAsCondition
This cop checks for regexp literals used as `match-current-line`. If a regexp literal is in condition, the regexp matches `$_` implicitly.
@example
# bad if /foo/ do_something end # good if /foo/ =~ $_ do_something end
Constants
- MSG
Public Instance Methods
on_match_current_line(node)
click to toggle source
# File lib/rubocop/cop/lint/regexp_as_condition.rb, line 23 def on_match_current_line(node) add_offense(node) end