class ActionText::AttachmentGallery

Constants

ATTACHMENT_SELECTOR
SELECTOR
TAG_NAME

Attributes

node[R]

Public Class Methods

fragment_by_canonicalizing_attachment_galleries(content) click to toggle source
# File lib/action_text/attachment_gallery.rb, line 7
def fragment_by_canonicalizing_attachment_galleries(content)
  fragment_by_replacing_attachment_gallery_nodes(content) do |node|
    "<#{TAG_NAME}>#{node.inner_html}</#{TAG_NAME}>"
  end
end
from_node(node) click to toggle source
# File lib/action_text/attachment_gallery.rb, line 33
def from_node(node)
  new(node)
end
new(node) click to toggle source
# File lib/action_text/attachment_gallery.rb, line 40
def initialize(node)
  @node = node
end

Public Instance Methods

attachments() click to toggle source
# File lib/action_text/attachment_gallery.rb, line 44
def attachments
  @attachments ||= node.css(ATTACHMENT_SELECTOR).map do |node|
    ActionText::Attachment.from_node(node).with_full_attributes
  end
end
inspect() click to toggle source
# File lib/action_text/attachment_gallery.rb, line 54
def inspect
  "#<#{self.class.name} size=#{size.inspect}>"
end
size() click to toggle source
# File lib/action_text/attachment_gallery.rb, line 50
def size
  attachments.size
end