Class: Nanoc::Filters::ERB Private
- Inherits:
-
Nanoc::Filter
- Object
- Nanoc::Filters::ERB
- Defined in:
- lib/nanoc/filters/erb.rb
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.
Class Attribute Summary collapse
- ._erb_cache ⇒ Object private
Instance Method Summary collapse
-
#run(content, params = {}) ⇒ String
private
Runs the content through [ERB](ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html).
Class Attribute Details
._erb_cache ⇒ 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 |
# File 'lib/nanoc/filters/erb.rb', line 11 def _erb_cache @_erb_cache end |
Instance Method Details
#run(content, params = {}) ⇒ String
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.
Runs the content through [ERB](ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html).
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/nanoc/filters/erb.rb', line 23 def run(content, params = {}) # Add locals assigns.merge!(params[:locals] || {}) # Create context context = ::Nanoc::Core::Context.new(assigns) # Get binding proc = assigns[:content] ? -> { assigns[:content] } : nil assigns_binding = context.get_binding(&proc) # Get result trim_mode = params[:trim_mode] erb_for(content, trim_mode:).result(assigns_binding) end |