Class: Docks::Renderers::Slim
- Includes:
- Common::Capturable, Common::Helperable
- Defined in:
- lib/docks/renderers/slim_renderer.rb
Instance Method Summary collapse
- #capture(*args) {|args| ... } ⇒ Object
-
#initialize ⇒ Slim
constructor
A new instance of Slim.
- #render(template, locals = {}) ⇒ Object
Methods included from Common::Capturable
#concat, #content_for, #content_for?
Methods included from Common::Helperable
Methods inherited from Base
Constructor Details
#initialize ⇒ Slim
Returns a new instance of Slim.
11 12 13 14 |
# File 'lib/docks/renderers/slim_renderer.rb', line 11 def initialize require "slim" super end |
Instance Method Details
#capture(*args) {|args| ... } ⇒ Object
28 29 30 |
# File 'lib/docks/renderers/slim_renderer.rb', line 28 def capture(*args, &block) yield *args end |
#render(template, locals = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/docks/renderers/slim_renderer.rb', line 16 def render(template, locals = {}) content, layout, locals = normalize_content_and_locals(template, locals) return if content.nil? content = ::Slim::Template.new { content }.render(self, locals) return content if layout.nil? ::Slim::Template.new { layout }.render(self, locals) do |name| name.nil? ? content : @content_blocks[name] end end |