Class: Markup::RenderingService
- Inherits:
-
Object
- Object
- Markup::RenderingService
- Defined in:
- app/services/markup/rendering_service.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(text, file_name: nil, context: {}, postprocess_context: {}) ⇒ RenderingService
constructor
A new instance of RenderingService.
Constructor Details
#initialize(text, file_name: nil, context: {}, postprocess_context: {}) ⇒ RenderingService
Returns a new instance of RenderingService.
5 6 7 8 9 10 |
# File 'app/services/markup/rendering_service.rb', line 5 def initialize(text, file_name: nil, context: {}, postprocess_context: {}) @text = text @file_name = file_name @context = context @postprocess_context = postprocess_context end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/markup/rendering_service.rb', line 12 def execute return '' unless text.present? return context.delete(:rendered) if context.has_key?(:rendered) html = markup_unsafe return '' unless html.present? postprocess_context ? postprocess(html) : html end |