Class: Slim::Embedded::TagEngine Private

Inherits:
Engine
  • Object
show all
Defined in:
lib/slim/embedded.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Tag wrapper engine Generates a html tag and wraps another engine (specified via :engine option)

Direct Known Subclasses

JavaScriptEngine

Instance Method Summary collapse

Methods inherited from Filter

#on_slim_control, #on_slim_output, #on_slim_text

Instance Method Details

#on_slim_embedded(engine, body, attrs) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/slim/embedded.rb', line 189

def on_slim_embedded(engine, body, attrs)

  unless options[:attributes].empty?
    options[:attributes].map do|k, v|
      attrs << [:html, :attr, k, [:static, v]]
    end
  end

  if options[:engine]
    opts = {}.update(options)
    opts.delete(:engine)
    opts.delete(:tag)
    opts.delete(:attributes)
    @engine ||= options[:engine].new(opts)
    body = @engine.on_slim_embedded(engine, body, attrs)
  end

  [:html, :tag, options[:tag], attrs, body]
end