Class: Limitedrun::Themekit::Renderer
- Inherits:
-
Struct
- Object
- Struct
- Limitedrun::Themekit::Renderer
- Defined in:
- lib/limitedrun-themekit/renderer.rb
Instance Attribute Summary collapse
-
#request_path ⇒ Object
Returns the value of attribute request_path.
-
#theme_path ⇒ Object
Returns the value of attribute theme_path.
Instance Method Summary collapse
Instance Attribute Details
#request_path ⇒ Object
Returns the value of attribute request_path
13 14 15 |
# File 'lib/limitedrun-themekit/renderer.rb', line 13 def request_path @request_path end |
#theme_path ⇒ Object
Returns the value of attribute theme_path
13 14 15 |
# File 'lib/limitedrun-themekit/renderer.rb', line 13 def theme_path @theme_path end |
Instance Method Details
#render(template, template_assigns = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/limitedrun-themekit/renderer.rb', line 14 def render(template, template_assigns = nil) assigns = global_assigns if template_assigns template_assigns.each_key do |k| unless template_assigns[k].is_a?(Hashie::Mash) template_assigns[k] = Hashie::Mash.new(instance_eval &template_assigns[k]) end end assigns.merge!(template_assigns.stringify_keys) end layout = parse_template File.join(Limitedrun::Themekit::Config.layouts_dir, 'default.html') template = parse_template File.join(Limitedrun::Themekit::Config.templates_dir, template) layout.render(assigns.merge('content' => template.render(assigns))) end |
#render_string(string) ⇒ Object
33 34 35 |
# File 'lib/limitedrun-themekit/renderer.rb', line 33 def render_string(string) Liquid::Template.parse(string).render('config' => theme_config) end |