class Genit::Tag

Base class for all Tags.

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.rb, line 13
def initialize working_dir, template, filename, tag
  @working_dir = working_dir
  @filename = filename
  @template = template
  @tag = tag
end

Public Instance Methods

replace_tag_into_template!(css_rule, string) click to toggle source

Public: Replace a tag by a string content into the template. This method not only returns the modified template, it also really replace the template in place.

css_rule - The String css rule to identify the tag to replace. string - The String replacement.

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

# File lib/genit/tags/tag.rb, line 28
def replace_tag_into_template! css_rule, string
  builder = Builder.new(@template)
  @template = builder.replace(css_rule, string)
end