Class: Genit::HereTag

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

Overview

A Genit tag that represents a variable. For example, in the template you have: <genit var=“page_title”/>, and in the page you have: <genit var=“page_title”>My Title</genit>.

Instance Method Summary collapse

Methods inherited from Tag

#replace_tag_into_template!

Constructor Details

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

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



16
17
18
# File 'lib/genit/tags/here_tag.rb', line 16

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

Instance Method Details

#processObject

Public: Replace a variable in the template. The variable content is found in the tag in the page.

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



24
25
26
27
# File 'lib/genit/tags/here_tag.rb', line 24

def process
  replace_tag_into_template! get_css_rule, get_variable_value
  @template
end