Class: Spina::RichTextPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/spina/rich_text_presenter.rb

Constant Summary collapse

EMBED_CONTENT_TYPE =
"application/vnd+spina.embed+html"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view_context, html) ⇒ RichTextPresenter

Returns a new instance of RichTextPresenter.



7
8
9
10
# File 'app/presenters/spina/rich_text_presenter.rb', line 7

def initialize(view_context, html)
  @view_context = view_context || Spina::Current.page&.view_context
  @html = html
end

Instance Attribute Details

#htmlObject (readonly)

Returns the value of attribute html.



3
4
5
# File 'app/presenters/spina/rich_text_presenter.rb', line 3

def html
  @html
end

#view_contextObject (readonly)

Returns the value of attribute view_context.



3
4
5
# File 'app/presenters/spina/rich_text_presenter.rb', line 3

def view_context
  @view_context
end

Instance Method Details

#to_sObject



12
13
14
# File 'app/presenters/spina/rich_text_presenter.rb', line 12

def to_s
  ActiveSupport::SafeBuffer.new(render_embeds(html))
end