Class: Webgen::SourceHandler::Directory

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/webgen/sourcehandler/directory.rb

Overview

Handles directory source paths.

Instance Method Summary collapse

Methods included from Base

#node_exists?, #output_path, #page_from_path

Methods included from Base::OutputPathHelpers

#standard_output_path

Methods included from Loggable

#log, #puts

Instance Method Details

#content(node) ⇒ Object

Return an empty string to signal that the directory should be written to the output.



25
26
27
# File 'lib/webgen/sourcehandler/directory.rb', line 25

def content(node)
  ''
end

#create_node(parent, path) ⇒ Object

Creation of directory nodes is special because once they are created, they are only deleted when the source path gets deleted. Otherwise, only the meta information of the node gets updated.



13
14
15
16
17
18
19
20
21
22
# File 'lib/webgen/sourcehandler/directory.rb', line 13

def create_node(parent, path)
  if node = node_exists?(parent, path)
    node.meta_info.clear
    node.meta_info.update(path.meta_info)
    node.dirty = true
    node
  else
    super(parent, path)
  end
end