Class: Coco::Content
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Coco::Content
- Defined in:
- app/components/coco/utilities/content/content.rb
Overview
Use ‘Content` as a helper to render content passed to a slot without adding any tags.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(body = nil) ⇒ Content
constructor
A new instance of Content.
Constructor Details
#initialize(body = nil) ⇒ Content
Returns a new instance of Content.
4 5 6 |
# File 'app/components/coco/utilities/content/content.rb', line 4 def initialize(body = nil) @body = body end |
Instance Method Details
#call ⇒ Object
8 9 10 |
# File 'app/components/coco/utilities/content/content.rb', line 8 def call content.presence&.html_safe || @body&.html_safe end |