Class: Rubocop::Cop::IfUnlessModifier
- Includes:
- FavorModifier
- Defined in:
- lib/rubocop/cop/favor_modifier.rb
Instance Attribute Summary
Attributes inherited from Cop
Instance Method Summary collapse
Methods included from FavorModifier
Methods inherited from Cop
#add_offence, #has_report?, inherited, #initialize
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#error_message ⇒ Object
60 61 62 63 |
# File 'lib/rubocop/cop/favor_modifier.rb', line 60 def 'Favor modifier if/unless usage when you have a single-line body. ' + 'Another good alternative is the usage of control flow and/or.' end |
#inspect(file, source, tokens, sexp) ⇒ Object
65 66 67 |
# File 'lib/rubocop/cop/favor_modifier.rb', line 65 def inspect(file, source, tokens, sexp) [:if, :unless].each { |kind| check(kind, tokens, sexp) } end |