Class: CmsTag::Snippet

Inherits:
CmsSnippet
  • Object
show all
Includes:
CmsTag
Defined in:
lib/comfortable_mexican_sofa/cms_tag/snippet.rb

Constant Summary

Constants included from CmsTag

TOKENIZER_REGEX

Instance Attribute Summary

Attributes included from CmsTag

#params, #parent, #record_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CmsSnippet

content_for, initialize_or_find, load_for_slug, load_for_slug!, load_from_file

Class Method Details

.regex_tag_signature(label = nil) ⇒ Object



9
10
11
12
# File 'lib/comfortable_mexican_sofa/cms_tag/snippet.rb', line 9

def self.regex_tag_signature(label = nil)
  label ||= /[\w\-]+/
  /\{\{\s*cms:snippet:(#{label})\s*\}\}/
end

Instance Method Details

#contentObject



18
19
20
# File 'lib/comfortable_mexican_sofa/cms_tag/snippet.rb', line 18

def content
  self.read_attribute(:content)
end

#identifierObject



5
6
7
# File 'lib/comfortable_mexican_sofa/cms_tag/snippet.rb', line 5

def identifier
  "#{self.class.name.underscore}_#{self.slug}"
end

#regex_tag_signatureObject



14
15
16
# File 'lib/comfortable_mexican_sofa/cms_tag/snippet.rb', line 14

def regex_tag_signature
  self.class.regex_tag_signature(label)
end