class ActionText::Attachables::RemoteImage
Attributes
Public Class Methods
Source
# File lib/action_text/attachables/remote_image.rb, line 9 def from_node(node) if node["url"] && content_type_is_image?(node["content-type"]) new(attributes_from_node(node)) end end
Source
# File lib/action_text/attachables/remote_image.rb, line 30 def initialize(attributes = {}) @url = attributes[:url] @content_type = attributes[:content_type] @width = attributes[:width] @height = attributes[:height] end
Private Class Methods
Source
# File lib/action_text/attachables/remote_image.rb, line 20 def attributes_from_node(node) { url: node["url"], content_type: node["content-type"], width: node["width"], height: node["height"] } end
Source
# File lib/action_text/attachables/remote_image.rb, line 16 def content_type_is_image?(content_type) content_type.to_s.match?(/^image(\/.+|$)/) end
Public Instance Methods
Source
# File lib/action_text/attachables/remote_image.rb, line 37 def attachable_plain_text_representation(caption) "[#{caption || "Image"}]" end
Source
# File lib/action_text/attachables/remote_image.rb, line 41 def to_partial_path "action_text/attachables/remote_image" end