Class: Jekyll::Share::Group
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::Share::Group
- Includes:
- Helper
- Defined in:
- lib/jekyll/share/tags.rb
Overview
Group of services.
Instance Method Summary collapse
-
#initialize(tag_name, text, tokens) ⇒ Group
constructor
A new instance of Group.
- #render(context) ⇒ Object
Methods included from Helper
#extract_page_data, #extract_preview_data, #preview?
Constructor Details
#initialize(tag_name, text, tokens) ⇒ Group
Returns a new instance of Group.
65 66 67 68 69 |
# File 'lib/jekyll/share/tags.rb', line 65 def initialize(tag_name, text, tokens) super @@share_groups ||= {} @text = text end |
Instance Method Details
#render(context) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/jekyll/share/tags.rb', line 71 def render(context) @params = init_params(@text, context) if @@share_groups.key? @name @@share_groups[@name].reset_all! else @@share_groups[@name] = ShareWith::Collection.new extend_with: @extend_with, services: @services, paths: Config.paths end @params = if preview?(context) @params.merge extract_preview_data(context) else @params.merge extract_page_data(context) end @params.each do |key, value| @@share_groups[@name].set_conditional_param(key, value) end res = [@wrappers["group_start"].to_s] @@share_groups[@name].render_all(@template).each do |_k, v| res << "#{@wrappers["service_start"]}#{v}#{@wrappers["service_end"]}" end res << @wrappers["group_end"].to_s res.join("\n") end |