Class Index [+]

Quicksearch

Webgen::SourceHandler::Base::OutputPathHelpers

This module is used for defining all methods that can be used for creating output paths.

All public methods of this module are considered to be output path creation methods and must have the following parameters:

parent

the parent node

path

the path for which the output name should be created

use_lang_part

controls whether the output path name has to include the language part

Public Instance Methods

standard_output_path(parent, path, use_lang_part, style = path.meta_info['output_path_style']) click to toggle source

Default method for creating an output path for parent and source path.

The automatically set parameter style (which uses the meta information output_path_style from the path’s meta information hash) defines how the output name should be built (more information about this in the user documentation).

     # File lib/webgen/sourcehandler/base.rb, line 145
145:       def standard_output_path(parent, path, use_lang_part, style = path.meta_info['output_path_style'])
146:         result = style.collect do |part|
147:           case part
148:           when String  then part
149:           when :lang   then use_lang_part ? path.meta_info['lang'] : ''
150:           when :ext    then path.ext.empty? ? '' : '.' + path.ext
151:           when :parent then temp = parent; temp = temp.parent while temp.is_fragment?; temp.path
152:           when :year, :month, :day
153:             ctime = path.meta_info['created_at']
154:             if !ctime.kind_of?(Time)
155:               raise Webgen::NodeCreationError.new("Invalid meta info 'created_at', needed because of used output path style",
156:                                                   self.class.name, path)
157:             end
158:             ctime.send(part).to_s.rjust(2, '0')
159:           when Symbol  then path.send(part)
160:           when Array   then part.include?(:lang) && !use_lang_part ? '' : standard_output_path(parent, path, use_lang_part, part)
161:           else ''
162:           end
163:         end
164:         result.join('')
165:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.