Class: Regenerate::PathAndParents

Inherits:
Object
  • Object
show all
Defined in:
lib/regenerate/site-regenerator.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ PathAndParents

Returns a new instance of PathAndParents.



8
9
10
# File 'lib/regenerate/site-regenerator.rb', line 8

def initialize(path)
  @path = path
end

Instance Method Details

#eachObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/regenerate/site-regenerator.rb', line 12

def each
  currentPath = @path
  topLevel = false
  while !topLevel do
    yield currentPath
    parentPath = File.dirname(currentPath)
    topLevel = parentPath == currentPath
    currentPath = parentPath
  end
end