Module: ComfortableMexicanSofa::Tag::ClassMethods
- Defined in:
- lib/comfortable_mexican_sofa/tag.rb
Instance Method Summary collapse
-
#initialize_tag(page, tag_signature) ⇒ Object
Initializing tag object for a particular Tag type First capture group in the regex is the tag label.
-
#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}.
Instance Method Details
#initialize_tag(page, tag_signature) ⇒ Object
Initializing tag object for a particular Tag type First capture group in the regex is the tag label
28 29 30 31 32 33 34 35 36 |
# File 'lib/comfortable_mexican_sofa/tag.rb', line 28 def initialize_tag(page, tag_signature) if match = tag_signature.match(regex_tag_signature) tag = self.new tag.page = page tag.label = match[1] tag.params = match[2] tag 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}}
22 23 24 |
# File 'lib/comfortable_mexican_sofa/tag.rb', line 22 def regex_tag_signature(label = nil) nil end |