Class: Coco::Content

Inherits:
ViewComponent::Base
  • Object
show all
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

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

#callObject



8
9
10
# File 'app/components/coco/utilities/content/content.rb', line 8

def call
  content.presence&.html_safe || @body&.html_safe
end