aboutsummaryrefslogtreecommitdiff
path: root/lib/puppet
diff options
context:
space:
mode:
authorJosh Cooper <josh@puppet.com>2018-06-28 00:05:37 -0700
committerJosh Cooper <josh@puppet.com>2018-06-28 00:05:37 -0700
commit5217482dee51be5456c22ba079b4a8894547b3a2 (patch)
tree965b6dcfcadfb14a2019a355560f262b9bd8fa0f /lib/puppet
parent74b01806ce0d003c00fe665d671d4b282af33424 (diff)
downloadpuppet-augeas_core-5217482dee51be5456c22ba079b4a8894547b3a2.tar.gz
puppet-augeas_core-5217482dee51be5456c22ba079b4a8894547b3a2.tar.bz2
Use loop with break
See https://github.com/rubocop-hq/ruby-style-guide/commit/df933c0f9b3a805c00e5ef81889992b1aec787a7
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/provider/augeas/augeas.rb5
1 files changed, 3 insertions, 2 deletions
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]