Skip to Content Skip to Search

class ActionText::AttachmentGallery

Inherits From

Attributes

[R] node

Public class methods

Source code GitHub
# File actiontext/lib/action_text/attachment_gallery.rb, line 43
def attachment_selector
  "#{ActionText::Attachment.tag_name}[presentation=gallery]"
end
Source code GitHub
# File actiontext/lib/action_text/attachment_gallery.rb, line 13
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
Source code GitHub
# File actiontext/lib/action_text/attachment_gallery.rb, line 39
def from_node(node)
  new(node)
end
Source code GitHub
# File actiontext/lib/action_text/attachment_gallery.rb, line 54
def initialize(node)
  @node = node
end
Source code GitHub
# File actiontext/lib/action_text/attachment_gallery.rb, line 47
def selector
  "#{TAG_NAME}:has(#{attachment_selector} + #{attachment_selector})"
end

Public instance methods

Source code GitHub
# File actiontext/lib/action_text/attachment_gallery.rb, line 58
def attachments
  @attachments ||= node.css(ActionText::AttachmentGallery.attachment_selector).map do |node|
    ActionText::Attachment.from_node(node).with_full_attributes
  end
end
Source code GitHub
# File actiontext/lib/action_text/attachment_gallery.rb, line 68
def inspect
  "#<#{self.class.name} size=#{size.inspect}>"
end
Source code GitHub
# File actiontext/lib/action_text/attachment_gallery.rb, line 64
def size
  attachments.size
end

Definition files