Class: Thredded::ViewHooks::Renderer
- Inherits:
-
Object
- Object
- Thredded::ViewHooks::Renderer
- Defined in:
- lib/thredded/view_hooks/renderer.rb
Instance Method Summary collapse
-
#initialize(view_context, config) ⇒ Renderer
constructor
A new instance of Renderer.
- #render(**args, &original_content) ⇒ String
Constructor Details
#initialize(view_context, config) ⇒ Renderer
Returns a new instance of Renderer.
7 8 9 10 |
# File 'lib/thredded/view_hooks/renderer.rb', line 7 def initialize(view_context, config) @view_context = view_context @config = config end |
Instance Method Details
#render(**args, &original_content) ⇒ String
13 14 15 16 17 18 19 |
# File 'lib/thredded/view_hooks/renderer.rb', line 13 def render(**args, &original_content) @view_context.safe_join [ *@config.before, *(@config.replace.presence || [original_content]), *@config.after, ].map { |proc| render_proc(**args, &proc) }, '' end |