Class: ActionText::Attachables::ContentAttachment
- Inherits:
-
Object
- Object
- ActionText::Attachables::ContentAttachment
- Includes:
- ActiveModel::Model
- Defined in:
- lib/action_text/attachables/content_attachment.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#content_type ⇒ Object
Returns the value of attribute content_type.
Class Method Summary collapse
Instance Method Summary collapse
- #attachable_plain_text_representation(caption) ⇒ Object
- #to_html ⇒ Object
- #to_partial_path ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
13 14 15 |
# File 'lib/action_text/attachables/content_attachment.rb', line 13 def content @content end |
#content_type ⇒ Object
Returns the value of attribute content_type.
13 14 15 |
# File 'lib/action_text/attachables/content_attachment.rb', line 13 def content_type @content_type end |
Class Method Details
.from_node(node) ⇒ Object
8 9 10 11 |
# File 'lib/action_text/attachables/content_attachment.rb', line 8 def self.from_node(node) = new(content_type: node["content-type"], content: node["content"]) if .valid? end |
Instance Method Details
#attachable_plain_text_representation(caption) ⇒ Object
18 19 20 |
# File 'lib/action_text/attachables/content_attachment.rb', line 18 def attachable_plain_text_representation() content_instance.fragment.source end |
#to_html ⇒ Object
22 23 24 |
# File 'lib/action_text/attachables/content_attachment.rb', line 22 def to_html @to_html ||= content_instance.render(content_instance) end |
#to_partial_path ⇒ Object
30 31 32 |
# File 'lib/action_text/attachables/content_attachment.rb', line 30 def to_partial_path "action_text/attachables/content_attachment" end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/action_text/attachables/content_attachment.rb', line 26 def to_s to_html end |