Checks for while and until statements that would fit on one line if written as a modifier while/until. The maximum line length is configurable.
# File lib/rubocop/cop/style/while_until_modifier.rb, line 11 def investigate(processed_source) return unless processed_source.ast on_node([:while, :until], processed_source.ast) do |node| # discard modifier while/until next unless node.loc.end if check(node, processed_source.comments) add_offense(node, :keyword, message(node.loc.keyword.source)) end end end
Generated with the Darkfish Rdoc Generator 2.