Class: ActionText::Attachables::ContentAttachment

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/action_text/attachables/content_attachment.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contentObject

Returns the value of attribute content.



15
16
17
# File 'lib/action_text/attachables/content_attachment.rb', line 15

def content
  @content
end

#content_typeObject

Returns the value of attribute content_type.



15
16
17
# File 'lib/action_text/attachables/content_attachment.rb', line 15

def content_type
  @content_type
end

Class Method Details

.from_node(node) ⇒ Object



10
11
12
13
# File 'lib/action_text/attachables/content_attachment.rb', line 10

def self.from_node(node)
  attachment = new(content_type: node["content-type"], content: node["content"])
  attachment if attachment.valid?
end

Instance Method Details

#attachable_plain_text_representation(caption) ⇒ Object



20
21
22
# File 'lib/action_text/attachables/content_attachment.rb', line 20

def attachable_plain_text_representation(caption)
  content_instance.fragment.source
end

#to_htmlObject



24
25
26
# File 'lib/action_text/attachables/content_attachment.rb', line 24

def to_html
  @to_html ||= content_instance.render(content_instance)
end

#to_partial_pathObject



32
33
34
# File 'lib/action_text/attachables/content_attachment.rb', line 32

def to_partial_path
  "action_text/attachables/content_attachment"
end

#to_sObject



28
29
30
# File 'lib/action_text/attachables/content_attachment.rb', line 28

def to_s
  to_html
end