lib/dir_model/import/path.rb in dir_model-0.4.0 vs lib/dir_model/import/path.rb in dir_model-0.5.0
- old
+ new
@@ -4,12 +4,12 @@
attr_reader :path
attr_reader :index
attr_reader :current_path
- def initialize(path)
- @path, @index = path, -1
+ def initialize(dir_path)
+ @path, @index = dir_path, -1
reset!
end
def size
@size ||= ruby_path.size
@@ -41,9 +41,17 @@
return if end?
@index += 1
@current_path = ruby_path[index]
set_end unless current_path
current_path
+ end
+
+ def set_position(index)
+ @index = index
+ end
+
+ def rewind
+ set_position(-1)
end
protected
def ruby_path