From 5217482dee51be5456c22ba079b4a8894547b3a2 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 28 Jun 2018 00:05:37 -0700 Subject: Use loop with break See https://github.com/rubocop-hq/ruby-style-guide/commit/df933c0f9b3a805c00e5ef81889992b1aec787a7 --- lib/puppet/provider/augeas/augeas.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/puppet/provider') diff --git a/lib/puppet/provider/augeas/augeas.rb b/lib/puppet/provider/augeas/augeas.rb index c27aa81..17879d3 100644 --- a/lib/puppet/provider/augeas/augeas.rb +++ b/lib/puppet/provider/augeas/augeas.rb @@ -94,7 +94,7 @@ Puppet::Type.type(:augeas).provide(:augeas) do nbracket = 0 inSingleTick = false inDoubleTick = false - begin + loop do sc.skip(%r{([^\]\[\s\\'"]|\\.)+}) ch = sc.getch nbracket += 1 if ch == '[' @@ -102,7 +102,8 @@ Puppet::Type.type(:augeas).provide(:augeas) do inSingleTick = !inSingleTick if ch == "'" inDoubleTick = !inDoubleTick if ch == '"' fail(_('unmatched [')) if nbracket < 0 - end until ((nbracket == 0 && !inSingleTick && !inDoubleTick && (ch =~ %r{\s})) || sc.eos?) + break if (nbracket == 0 && !inSingleTick && !inDoubleTick && (ch =~ %r{\s})) || sc.eos? + end len = sc.pos - start len -= 1 unless sc.eos? p = sc.string[start, len] -- cgit v1.2.3