Class: Genit::ClassTag

Inherits:
Tag
  • Object
show all
Defined in:
lib/genit/tags/class_tag.rb

Overview

A Genit general tag.

Instance Method Summary collapse

Methods inherited from Tag

#replace_tag_into_template!

Constructor Details

#initialize(working_dir, template, filename, tag) ⇒ ClassTag

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



14
15
16
# File 'lib/genit/tags/class_tag.rb', line 14

def initialize working_dir, template, filename, tag
  super working_dir, template, filename, tag
end

Instance Method Details

#processObject

Public: Replace something in the template.

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



21
22
23
24
25
26
27
28
29
30
# File 'lib/genit/tags/class_tag.rb', line 21

def process
  case @tag['class']
    when 'pages' then ClassPagesTag.new(@working_dir, @template, @filename, @tag).process
    when 'menu' then ClassMenuTag.new(@working_dir, @template, @filename, @tag).process
    when 'fragment' then ClassFragmentTag.new(@working_dir, @template, @filename, @tag).process
    when 'news' then ClassNewsTag.new(@working_dir, @template, @filename, @tag).process
    else
      error "Unknown tag #{@tag}"
  end
end