Class: ComfyPress::Tag::Helper
- Inherits:
-
Object
- Object
- ComfyPress::Tag::Helper
show all
- Includes:
- ComfyPress::Tag
- Defined in:
- lib/comfypress/tags/helper.rb
Constant Summary
collapse
- BLACKLIST =
%w(eval class_eval instance_eval render)
IDENTIFIER_REGEX, TOKENIZER_REGEX
Instance Attribute Summary
#identifier, #namespace, #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/comfypress/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/comfypress/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/comfypress/tags/helper.rb', line 15
def render
whitelist = ComfyPress.config.allowed_helpers
if whitelist.is_a?(Array)
content if whitelist.map!(&:to_s).member?(identifier)
else
content unless BLACKLIST.member?(identifier)
end
end
|