Sha256: fc75f567f583b7d76084041dd7b46125fb7dbed8e301968a87ba5a286dc6d7a8
Contents?: true
Size: 458 Bytes
Versions: 12
Compression:
Stored size: 458 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Style # Checks for uses of if/then/else/end on a single line. class OneLineConditional < Cop include IfThenElse def offending_line(node) node.loc.expression.line unless node.loc.expression.source =~ /\n/ end def error_message 'Favor the ternary operator (?:) over if/then/else/end constructs.' end end end end end
Version data entries
12 entries across 12 versions & 2 rubygems