diff options
author | Chris Price <chris@puppetlabs.com> | 2012-07-28 21:59:54 -0700 |
---|---|---|
committer | Chris Price <chris@puppetlabs.com> | 2012-07-28 21:59:54 -0700 |
commit | 9c76b6af1200c71e7ae72e0e2f349919a3081738 (patch) | |
tree | e3dc5ca1824f1fcf74c08e78d649eed394408a78 /lib/puppet/util/external_iterator.rb | |
parent | 91273a5a2b0c88e7129908406fd0933a0d88ef11 (diff) | |
download | puppet-inifile-9c76b6af1200c71e7ae72e0e2f349919a3081738.tar.gz puppet-inifile-9c76b6af1200c71e7ae72e0e2f349919a3081738.tar.bz2 |
First (basic) working version of ini_setting provider
Diffstat (limited to 'lib/puppet/util/external_iterator.rb')
-rw-r--r-- | lib/puppet/util/external_iterator.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/puppet/util/external_iterator.rb b/lib/puppet/util/external_iterator.rb new file mode 100644 index 0000000..67b3375 --- /dev/null +++ b/lib/puppet/util/external_iterator.rb @@ -0,0 +1,24 @@ +module Puppet +module Util + class ExternalIterator + def initialize(coll) + @coll = coll + @cur_index = 0 + end + + def next + @cur_index = @cur_index + 1 + item_at(@cur_index) + end + + def peek + item_at(@cur_index + 1) + end + + private + def item_at(index) + [@coll[index], index] + end + end +end +end |