Class: Rubocop::Cop::OneLineConditional
- Includes:
- IfThenElse
- Defined in:
- lib/rubocop/cop/if_then_else.rb
Instance Attribute Summary
Attributes inherited from Cop
#debug, #disabled_lines, #offences
Instance Method Summary collapse
Methods included from IfThenElse
Methods inherited from Cop
#add_offence, cop_name, #has_report?, inherited, #initialize, #inspect, #name, #on_comment
Constructor Details
This class inherits a constructor from Rubocop::Cop::Cop
Instance Method Details
#error_message ⇒ Object
60 61 62 |
# File 'lib/rubocop/cop/if_then_else.rb', line 60 def 'Favor the ternary operator (?:) over if/then/else/end constructs.' end |
#offending_line(node) ⇒ Object
56 57 58 |
# File 'lib/rubocop/cop/if_then_else.rb', line 56 def offending_line(node) node.loc.expression.line unless node.loc.expression.source =~ /\n/ end |