Class: Webgen::Tag::Metainfo

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/webgen/tag/metainfo.rb

Overview

Provides easy access to the meta information of a node.

Instance Method Summary collapse

Methods included from Base

#create_tag_params, #param, #set_params

Methods included from WebsiteAccess

included, website

Methods included from Loggable

#log, #puts

Instance Method Details

#call(tag, body, context) ⇒ Object

Return the meta information key specified in tag of the content node.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/webgen/tag/metainfo.rb', line 11

def call(tag, body, context)
  output = ''
  if tag == 'lang'
    output = context.content_node.lang
  elsif context.content_node[tag]
    output = context.content_node[tag].to_s
  else
    log(:warn) { "No value for meta info key '#{tag}' in <#{context.ref_node.absolute_lcn}> found in <#{context.content_node.absolute_lcn}>" }
  end
  output
end