Class: Liquid::Template
- Inherits:
-
Object
- Object
- Liquid::Template
- Defined in:
- lib/dm_core/liquid_extensions.rb
Class Method Summary collapse
-
.register_tag(name, klass) ⇒ Object
——————————————————————————.
-
.register_tag_namespace(name, klass, namespace = 'system_tags') ⇒ Object
Store tags in a namespace, usually a theme name.
-
.tags ⇒ Object
return the list of tags that are available.
-
.tags_namespaced(namespace) ⇒ Object
——————————————————————————.
Class Method Details
.register_tag(name, klass) ⇒ Object
10 11 12 |
# File 'lib/dm_core/liquid_extensions.rb', line 10 def register_tag(name, klass) register_tag_namespace(name, klass) end |
.register_tag_namespace(name, klass, namespace = 'system_tags') ⇒ Object
Store tags in a namespace, usually a theme name. This is so we can register many different tags for each theme and keep them seperate.
17 18 19 |
# File 'lib/dm_core/liquid_extensions.rb', line 17 def register_tag_namespace(name, klass, namespace = 'system_tags') (namespace)[name.to_s] = klass end |
.tags ⇒ Object
return the list of tags that are available. Tags available at any instance is the global tags, the current theme’s tags, and the parent theme’s tags.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/dm_core/liquid_extensions.rb', line 24 def if Account.current.nil? ('system_tags').merge(@tags) else t = ('system_tags').merge(@tags).merge((Account.current.current_theme)) #--- if parent theme, reverse_merge tags - they should not override current theme tags t.reverse_merge!((Account.current.parent_theme)) if Account.current.parent_theme return t end end |
.tags_namespaced(namespace) ⇒ Object
37 38 39 40 |
# File 'lib/dm_core/liquid_extensions.rb', line 37 def (namespace) @tags_namespaced ||= {} @tags_namespaced[namespace] ||= {} end |