Class: CmsTag::Helper

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

Constant Summary

Constants included from CmsTag

TOKENIZER_REGEX

Instance Attribute Summary collapse

Attributes included from CmsTag

#params, #parent, #record_id

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#labelObject

Returns the value of attribute label.



3
4
5
# File 'lib/comfortable_mexican_sofa/cms_tag/helper.rb', line 3

def label
  @label
end

Class Method Details

.regex_tag_signature(label = nil) ⇒ Object



7
8
9
10
# File 'lib/comfortable_mexican_sofa/cms_tag/helper.rb', line 7

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

Instance Method Details

#contentObject



16
17
18
# File 'lib/comfortable_mexican_sofa/cms_tag/helper.rb', line 16

def content
  "<%= #{label}(#{params.split(':').collect{|p| "'#{p}'"}.join(', ')}) %>"
end

#regex_tag_signatureObject



12
13
14
# File 'lib/comfortable_mexican_sofa/cms_tag/helper.rb', line 12

def regex_tag_signature
  self.class.regex_tag_signature(label)
end