Module: ShareWith::LinkFactory

Included in:
Service
Defined in:
lib/share_with/link_factory.rb

Overview

Methods to create the HTML code to represent the sharing links.

Instance Method Summary collapse

Instance Method Details

#render(tpl_name) ⇒ Object

Raises:



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/share_with/link_factory.rb', line 8

def render(tpl_name)
  raise InvalidTemplate, tpl_name unless templates.key? tpl_name.to_sym

  template = templates[tpl_name.to_sym]

  merge_template!(template[:inherit_from], tpl_name) if template.key? :inherit_from

  includes&.each do |k, _v|
    i = includes[k]
    i[:cache] = traverse_node(i[:content]) unless i.key? :cache
  end

  traverse_node(template[:content])
end