Sha256: b4013463eb538040036e9137685dcf1fe83b8a8d9dbca9fbd1ef881d5f88f502
Contents?: true
Size: 918 Bytes
Versions: 16
Compression:
Stored size: 918 Bytes
Contents
# frozen_string_literal: true module ActionText module Attachables class ContentAttachment # :nodoc: include ActiveModel::Model def self.from_node(node) attachment = new(content_type: node["content-type"], content: node["content"]) attachment if attachment.valid? end attr_accessor :content_type, :content validates_format_of :content_type, with: /html/ validates_presence_of :content def attachable_plain_text_representation(caption) content_instance.fragment.source end def to_html @to_html ||= content_instance.render(content_instance) end def to_s to_html end def to_partial_path "action_text/attachables/content_attachment" end private def content_instance @content_instance ||= ActionText::Content.new(content) end end end end
Version data entries
16 entries across 16 versions & 3 rubygems