Methods
- caption
- fragment_by_canonicalizing_attachments
- from_attachable
- from_attachables
- from_attributes
- from_node
- full_attributes
- inspect
- new
- to_html
- to_plain_text
- to_s
- with_full_attributes
Constants
ATTRIBUTES | = | %w( sgid content-type url href filename filesize width height previewable presentation caption ) |
SELECTOR | = | TAG_NAME |
TAG_NAME | = | "action-text-attachment" |
Attributes
[R] | attachable | |
[R] | node |
Class Public methods
fragment_by_canonicalizing_attachments(content)
Source:
# File actiontext/lib/action_text/attachment.rb, line 12
def fragment_by_canonicalizing_attachments(content)
fragment_by_minifying_attachments(fragment_by_converting_trix_attachments(content))
end
from_attachable(attachable, attributes = {})
Source:
# File actiontext/lib/action_text/attachment.rb, line 24
def from_attachable(attachable, attributes = {})
if node = node_from_attributes(attachable.to_rich_text_attributes(attributes))
new(node, attachable)
end
end
from_attachables(attachables)
Source:
# File actiontext/lib/action_text/attachment.rb, line 20
def from_attachables(attachables)
Array(attachables).map { |attachable| from_attachable(attachable) }.compact
end
from_attributes(attributes, attachable = nil)
Source:
# File actiontext/lib/action_text/attachment.rb, line 30
def from_attributes(attributes, attachable = nil)
if node = node_from_attributes(attributes)
from_node(node, attachable)
end
end
from_node(node, attachable = nil)
Source:
# File actiontext/lib/action_text/attachment.rb, line 16
def from_node(node, attachable = nil)
new(node, attachable || ActionText::Attachable.from_node(node))
end
new(node, attachable)
Source:
# File actiontext/lib/action_text/attachment.rb, line 53
def initialize(node, attachable)
@node = node
@attachable = attachable
end
Instance Public methods
caption()
Source:
# File actiontext/lib/action_text/attachment.rb, line 58
def caption
node_attributes["caption"].presence
end
full_attributes()
Source:
# File actiontext/lib/action_text/attachment.rb, line 62
def full_attributes
node_attributes.merge(attachable_attributes).merge(sgid_attributes)
end
inspect()
Source:
# File actiontext/lib/action_text/attachment.rb, line 86
def inspect
"#<#{self.class.name} attachable=#{attachable.inspect}>"
end
to_html()
Source:
# File actiontext/lib/action_text/attachment.rb, line 78
def to_html
HtmlConversion.node_to_html(node)
end