Class: ComfortableMexicanSofa::Tag::Helper
Constant Summary
collapse
- BLACKLIST =
%w(eval class_eval instance_eval render)
TOKENIZER_REGEX
Instance Attribute Summary
#identifier, #page, #params, #parent
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.regex_tag_signature(identifier = nil) ⇒ Object
6
7
8
9
|
# File 'lib/comfortable_mexican_sofa/tags/helper.rb', line 6
def self.regex_tag_signature(identifier = nil)
identifier ||= /[\w\-]+/
/\{\{\s*cms:helper:(#{identifier}):?(.*?)\s*\}\}/
end
|
Instance Method Details
#content ⇒ Object
11
12
13
|
# File 'lib/comfortable_mexican_sofa/tags/helper.rb', line 11
def content
"<%= #{identifier}(#{params.collect{|p| "'#{p}'"}.join(', ')}) %>"
end
|
#render ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/comfortable_mexican_sofa/tags/helper.rb', line 15
def render
whitelist = ComfortableMexicanSofa.config.allowed_helpers
if whitelist.is_a?(Array)
content if whitelist.map!(&:to_s).member?(identifier)
else
content unless BLACKLIST.member?(identifier)
end
end
|