Class: Txbr::ContentTag

Inherits:
Object
  • Object
show all
Defined in:
lib/txbr/content_tag.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(liquid_template, liquid_tag) ⇒ ContentTag

Returns a new instance of ContentTag.



5
6
7
8
# File 'lib/txbr/content_tag.rb', line 5

def initialize(liquid_template, liquid_tag)
  @liquid_template = liquid_template
  @liquid_tag = liquid_tag
end

Instance Attribute Details

#liquid_tagObject (readonly)

Returns the value of attribute liquid_tag.



3
4
5
# File 'lib/txbr/content_tag.rb', line 3

def liquid_tag
  @liquid_tag
end

#liquid_templateObject (readonly)

Returns the value of attribute liquid_template.



3
4
5
# File 'lib/txbr/content_tag.rb', line 3

def liquid_template
  @liquid_template
end

Instance Method Details

#metadataObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/txbr/content_tag.rb', line 10

def 
   ||= begin
    # Render the template to implicitly populate the metadata hash inside
    # the liquid tag object. We do this because we encourage templates to
    # set local variables for the project and resource slugs. It's less
    # error-prone to let Liquid do the template evaluation instead of
    # grepping through the nodelist looking for assignment statements.
    liquid_template.render
    liquid_tag.
  end
end

#strings_manifestObject



22
23
24
25
26
# File 'lib/txbr/content_tag.rb', line 22

def strings_manifest
  @strings_manifest ||= StringsManifest.new.tap do |manifest|
    extract_strings_from(liquid_template.root, manifest)
  end
end