lib/rubocop/cop/style/infinite_loop.rb in rubocop-1.12.1 vs lib/rubocop/cop/style/infinite_loop.rb in rubocop-1.13.0
- old
+ new
@@ -60,13 +60,11 @@
assigned_inside_loop?(var, range) &&
!assigned_before_loop?(var, range) &&
referenced_after_loop?(var, range)
end
- add_offense(node.loc.keyword) do |corrector|
- autocorrect(corrector, node)
- end
+ add_offense(node.loc.keyword) { |corrector| autocorrect(corrector, node) }
end
def autocorrect(corrector, node)
if node.while_post_type? || node.until_post_type?
replace_begin_end_with_modifier(corrector, node)
@@ -105,11 +103,10 @@
if node.single_line?
"loop { #{body.source} }"
else
indentation = body.source_range.source_line[LEADING_SPACE]
- ['loop do', body.source.gsub(/^/, configured_indent),
- 'end'].join("\n#{indentation}")
+ ['loop do', body.source.gsub(/^/, configured_indent), 'end'].join("\n#{indentation}")
end
end
def non_modifier_range(node)
start_range = node.loc.keyword.begin