Class: Genit::Tag
- Inherits:
-
Object
- Object
- Genit::Tag
- Defined in:
- lib/genit/tags/tag.rb
Overview
Base class for all Tags.
Direct Known Subclasses
ClassFragmentTag, ClassMenuTag, ClassNewsTag, ClassPagesTag, ClassTag, HereTag
Instance Method Summary collapse
-
#initialize(working_dir, template, filename, tag) ⇒ Tag
constructor
Public: Constructor.
-
#replace_tag_into_template!(css_rule, string) ⇒ Object
Public: Replace a tag by a string content into the template.
Constructor Details
#initialize(working_dir, template, filename, tag) ⇒ Tag
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 17 18 19 |
# File 'lib/genit/tags/tag.rb', line 14 def initialize working_dir, template, filename, tag @working_dir = working_dir @filename = filename @template = template @tag = tag end |
Instance Method Details
#replace_tag_into_template!(css_rule, string) ⇒ Object
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
29 30 31 32 |
# File 'lib/genit/tags/tag.rb', line 29 def replace_tag_into_template! css_rule, string builder = Builder.new(@template) @template = builder.replace(css_rule, string) end |