Class: Decidim::ContentRenderers::BaseRenderer Abstract
- Inherits:
-
Object
- Object
- Decidim::ContentRenderers::BaseRenderer
- Includes:
- Decidim::ContentProcessor::Common
- Defined in:
- lib/decidim/content_renderers/base_renderer.rb
Overview
This class is abstract.
Subclass and override #render to implement a content renderer
Abstract base class for content renderers, so they have the same contract
Direct Known Subclasses
HashtagRenderer, LinkRenderer, ResourceRenderer, UserRenderer
Instance Attribute Summary collapse
-
#content ⇒ String
readonly
The content to be formatted.
Instance Method Summary collapse
-
#initialize(content) ⇒ BaseRenderer
constructor
Gets initialized with the ‘content` to format.
-
#render(_options = nil) ⇒ String
abstract
Format the content and return it ready to display.
Methods included from Decidim::ContentProcessor::Common
#html_content?, #html_fragment
Constructor Details
#initialize(content) ⇒ BaseRenderer
Gets initialized with the ‘content` to format
21 22 23 |
# File 'lib/decidim/content_renderers/base_renderer.rb', line 21 def initialize(content) @content = content || "" end |
Instance Attribute Details
#content ⇒ String (readonly)
Returns the content to be formatted.
16 17 18 |
# File 'lib/decidim/content_renderers/base_renderer.rb', line 16 def content @content end |
Instance Method Details
#render(_options = nil) ⇒ String
This method is abstract.
Subclass is expected to implement it
Format the content and return it ready to display
34 35 36 |
# File 'lib/decidim/content_renderers/base_renderer.rb', line 34 def render( = nil) content end |