class Genit::TagProcessor

Replace a tag in a template.

Public Class Methods

new(working_dir, template, filename, tag) click to toggle source

Public: Constructor.

working_dir - The String working directory, where live the project. template - The Nokogiri::XML::Document into which we process the tag. filename - The String name of the page tag - The tag to process as a Nokogiri::XML::Element

# File lib/genit/tags/tag_processor.rb, line 13
def initialize working_dir, template, filename, tag
  @working_dir = working_dir
  @filename = filename
  @template = template
  if tag.genit_class?
    @tag = ClassTag.new(@working_dir, @template, @filename, tag)
  elsif tag.genit_here?
    @tag = HereTag.new(@working_dir, @template, @filename, tag)
  else
    puts "Genit aborted! Unknown tag: #{tag}"
    exit 1
  end
end

Public Instance Methods

process() click to toggle source

Returns the modified template as a Nokogiri::XML::Document

# File lib/genit/tags/tag_processor.rb, line 28
def process
  @tag.process
end