class ActionMosaico::Attachables::ContentAttachment

Attributes

name[RW]

Public Class Methods

from_node(node) click to toggle source
# File lib/action_mosaico/attachables/content_attachment.rb, line 8
def self.from_node(node)
  if node['content-type'] && matches = node['content-type'].match(/vnd\.rubyonrails\.(.+)\.html/)
    attachment = new(name: matches[1])
    attachment if attachment.valid?
  end
end

Public Instance Methods

attachable_plain_text_representation(_caption) click to toggle source
# File lib/action_mosaico/attachables/content_attachment.rb, line 19
def attachable_plain_text_representation(_caption)
  case name
  when 'horizontal-rule'
    ' ┄ '
  else
    ' '
  end
end
to_mosaico_content_attachment_partial_path() click to toggle source
# File lib/action_mosaico/attachables/content_attachment.rb, line 32
def to_mosaico_content_attachment_partial_path
  "action_mosaico/attachables/content_attachments/#{name.underscore}"
end
to_partial_path() click to toggle source
# File lib/action_mosaico/attachables/content_attachment.rb, line 28
def to_partial_path
  'action_mosaico/attachables/content_attachment'
end