summaryrefslogtreecommitdiff
path: root/it_pipe.class
diff options
context:
space:
mode:
Diffstat (limited to 'it_pipe.class')
-rw-r--r--it_pipe.class12
1 files changed, 6 insertions, 6 deletions
diff --git a/it_pipe.class b/it_pipe.class
index cd1b54f..e23f7e8 100644
--- a/it_pipe.class
+++ b/it_pipe.class
@@ -6,6 +6,7 @@ class it_pipe implements Iterator
var $lines; # all lines currently in pipe
var $_valid;
+ var $_position;
/**
* Creates a pipe object from input. Named arguments:
@@ -50,28 +51,27 @@ function __toString()
#
function rewind()
{
- reset($this->lines);
- $this->next();
+ $this->_position = 0;
}
function next()
{
- $this->_valid = each($this->lines);
+ $this->_position++;
}
function valid()
{
- return $this->_valid;
+ return isset($this->lines[$this->_position]);
}
function current()
{
- return $this->_valid[1];
+ return $this->lines[$this->_position];
}
function key()
{
- return $this->_valid[0];
+ return $this->_position;
}