Module: CmsTag::ClassMethods

Defined in:
lib/LucyCMS/cms_tag.rb

Instance Method Summary collapse

Instance Method Details

#initialize_tag(cms_page, tag_signature) ⇒ Object

Initializing tag object for a particular Tag type First capture group in the regex is the tag label



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/LucyCMS/cms_tag.rb', line 27

def initialize_tag(cms_page, tag_signature)
  if match = tag_signature.match(regex_tag_signature)
    if self.respond_to?(:initialize_or_find)
      self.initialize_or_find(cms_page, match[1])
    else
      tag = self.new
      tag.label   = match[1]
      tag.params  = match[2]
      tag
    end
  end
end

#regex_tag_signature(label = nil) ⇒ Object

Regex that is used to match tags in the content Example:

/\{\{\s*?cms:page:(\w+)\}\}/

will match tags like these:

{{cms:page:my_label}}


21
22
23
# File 'lib/LucyCMS/cms_tag.rb', line 21

def regex_tag_signature(label = nil)
  nil
end