Class: Slim::EmbeddedEngine Private
- Defined in:
- lib/slim/embedded_engine.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.
Temple filter which processes embedded engines
Direct Known Subclasses
Defined Under Namespace
Classes: ERBEngine, InterpolateTiltEngine, PrecompiledTiltEngine, RubyEngine, SassEngine, StaticTiltEngine, TagEngine, TiltEngine
Class Attribute Summary collapse
- .engines ⇒ Object readonly private
Class Method Summary collapse
-
.register(name, klass, *option_filter) ⇒ Object
private
Register embedded engine.
Instance Method Summary collapse
Methods inherited from Filter
#on_slim_attrs, #on_slim_condcomment, #on_slim_control, #on_slim_output, #on_slim_tag
Class Attribute Details
.engines ⇒ Object (readonly)
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.
67 68 69 |
# File 'lib/slim/embedded_engine.rb', line 67 def engines @engines end |
Class Method Details
.register(name, klass, *option_filter) ⇒ 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.
Register embedded engine
75 76 77 78 |
# File 'lib/slim/embedded_engine.rb', line 75 def register(name, klass, *option_filter) = Hash === option_filter.last ? option_filter.pop : nil @engines[name.to_s] = [klass, option_filter, ] end |
Instance Method Details
#on_slim_embedded(name, body) ⇒ 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.
81 82 83 84 85 86 87 88 |
# File 'lib/slim/embedded_engine.rb', line 81 def (name, body) name = name.to_s raise "Embedded engine #{name} is disabled" if ([:enable_engines] && ![:enable_engines].include?(name)) || ([:disable_engines] && [:disable_engines].include?(name)) engine, option_filter, = self.class.engines[name] || raise("Embedded engine #{name} not found") = Hash[*option_filter.select {|k| .include?(k) }.map {|k| [k, [k]] }.flatten] engine.new(Temple::ImmutableHash.new(, )).(name, body) end |