Module: RuboCop::Cop::EndlessMethodRewriter
- Included in:
- Style::AmbiguousEndlessMethodDefinition, Style::EndlessMethod
- Defined in:
- lib/rubocop/cop/mixin/endless_method_rewriter.rb
Overview
Common functionality for rewriting endless methods to normal method definitions
Instance Method Summary collapse
Instance Method Details
#correct_to_multiline(corrector, node) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/rubocop/cop/mixin/endless_method_rewriter.rb', line 7 def correct_to_multiline(corrector, node) replacement = <<~RUBY.strip def #{node.method_name}#{arguments(node)} #{node.body.source} end RUBY corrector.replace(node, replacement) end |