Method: ActionText::Content#attachables

Defined in:
actiontext/lib/action_text/content.rb

#attachablesObject

Extracts ActionText::Attachable objects from the HTML fragment:

attachable = ActiveStorage::Blob.first
html = %Q(<action-text-attachment sgid="#{attachable.attachable_sgid}" caption="Captioned"></action-text-attachment>)
content = ActionText::Content.new(html)
content.attachables # => [attachable]


87
88
89
90
91
# File 'actiontext/lib/action_text/content.rb', line 87

def attachables
  @attachables ||= attachment_nodes.map do |node|
    ActionText::Attachable.from_node(node)
  end
end