diff options
author | Chris Price <chris@pupppetlabs.com> | 2012-08-17 04:48:28 -0700 |
---|---|---|
committer | Chris Price <chris@pupppetlabs.com> | 2012-08-17 04:48:28 -0700 |
commit | c57dab4903a6a23fb14dc79c76efea989e694460 (patch) | |
tree | 6f8ef871f02465d21b231e931eba03739422d277 /lib/puppet/util/external_iterator.rb | |
parent | 4f0e7264e3c3089e489d05bbb4371c449b0ed78d (diff) | |
download | puppet-inifile-c57dab4903a6a23fb14dc79c76efea989e694460.tar.gz puppet-inifile-c57dab4903a6a23fb14dc79c76efea989e694460.tar.bz2 |
Add support for "global" section at beginning of file
This commit does the following:
* Fixes a bug in ExternalIterator
* Adds support for a "global" section before the first named
section at the beginning of the INI file
* Improves test coverage
Diffstat (limited to 'lib/puppet/util/external_iterator.rb')
-rw-r--r-- | lib/puppet/util/external_iterator.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/puppet/util/external_iterator.rb b/lib/puppet/util/external_iterator.rb index 67b3375..45c0fa4 100644 --- a/lib/puppet/util/external_iterator.rb +++ b/lib/puppet/util/external_iterator.rb @@ -3,7 +3,7 @@ module Util class ExternalIterator def initialize(coll) @coll = coll - @cur_index = 0 + @cur_index = -1 end def next @@ -17,7 +17,11 @@ module Util private def item_at(index) - [@coll[index], index] + if @coll.length > index + [@coll[index], index] + else + [nil, nil] + end end end end |