Class: Decidim::ContentRenderers::BaseRenderer Abstract
- Inherits:
-
Object
- Object
- Decidim::ContentRenderers::BaseRenderer
- 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, UserGroupRenderer, 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.
Constructor Details
#initialize(content) ⇒ BaseRenderer
Gets initialized with the ‘content` to format
19 20 21 |
# File 'lib/decidim/content_renderers/base_renderer.rb', line 19 def initialize(content) @content = content || "" end |
Instance Attribute Details
#content ⇒ String (readonly)
Returns the content to be formatted.
14 15 16 |
# File 'lib/decidim/content_renderers/base_renderer.rb', line 14 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
32 33 34 |
# File 'lib/decidim/content_renderers/base_renderer.rb', line 32 def render( = nil) content end |