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, RubyEngine, TagEngine, TiltEngine
Class Method Summary collapse
- .[](name) ⇒ Object private
- .register(name, klass, options = {}) ⇒ Object private
Instance Method Summary collapse
- #collect_text(body) ⇒ Object private
- #on_slim_embedded(name, *body) ⇒ Object private
Methods inherited from Filter
#on_slim_attrs, #on_slim_comment, #on_slim_control, #on_slim_output, #on_slim_tag, #tmp_var
Class Method Details
.[](name) ⇒ 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.
11 12 13 14 15 |
# File 'lib/slim/embedded_engine.rb', line 11 def self.[](name) engine = @engines[name.to_s] raise "Invalid embedded engine #{name}" if !engine engine.dup end |
.register(name, klass, options = {}) ⇒ 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.
7 8 9 |
# File 'lib/slim/embedded_engine.rb', line 7 def self.register(name, klass, = {}) @engines[name.to_s] = klass.new() end |
Instance Method Details
#collect_text(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.
24 25 26 27 28 29 |
# File 'lib/slim/embedded_engine.rb', line 24 def collect_text(body) body.inject('') do |text, exp| text << exp[2] if exp[0] == :slim && exp[1] == :text text end end |
#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.
17 18 19 20 21 22 |
# File 'lib/slim/embedded_engine.rb', line 17 def (name, *body) engine = EmbeddedEngine[name] raise "Embedded engine #{name} is disabled" if ([:enable_engines] && ![:enable_engines].include?(name)) || ([:disable_engines] && [:disable_engines].include?(name)) engine.(name, *body) end |