Class: Webgen::PathHandler::MetaInfo

Inherits:
Object
  • Object
show all
Includes:
Base, PageUtils
Defined in:
lib/webgen/path_handler/meta_info.rb

Overview

Handles meta information paths which provide meta information for other paths.

Constant Summary

Constants included from Base

Base::DEST_PATH_PARENT_SEGMENTS, Base::DEST_PATH_SEGMENTS

Instance Method Summary collapse

Methods included from PageUtils

#create_node, #parse_meta_info!

Methods included from Base

#parse_meta_info!

Constructor Details

#initialize(website) ⇒ MetaInfo

Upon creation the path handler registers itself as listener for the :apply_meta_info_to_path and :after_node_created hooks so that it can apply the meta information.



20
21
22
23
24
25
26
27
28
# File 'lib/webgen/path_handler/meta_info.rb', line 20

def initialize(website)
  super
  @website.blackboard.add_listener(:apply_meta_info_to_path, 'path_handler.meta_info',
                                   &method(:apply_meta_info_to_path))
  @website.blackboard.add_listener(:after_node_created, 'path_handler.meta_info',
                                   :before => 'item_tracker.node_meta_info', &method(:after_node_created))
  @paths = []
  @alcns = []
end

Instance Method Details

#create_nodes(path, blocks) ⇒ Object

Create a meta info node from path.



31
32
33
34
35
36
37
38
# File 'lib/webgen/path_handler/meta_info.rb', line 31

def create_nodes(path, blocks)
  @paths += add_data(path, blocks['paths'], 'paths')
  entries = add_data(path, blocks['alcn'], 'alcn')
  @alcns += entries
  update_existing_nodes(entries)

  nil
end