class ActionText::Attachables::RemoteImage

def attachable_plain_text_representation(caption)

def attachable_plain_text_representation(caption)
  "[#{caption || "Image"}]"
end

def attributes_from_node(node)

def attributes_from_node(node)
  { url: node["url"],
    content_type: node["content-type"],
    width: node["width"],
    height: node["height"] }
end

def content_type_is_image?(content_type)

def content_type_is_image?(content_type)
  content_type.to_s.match?(/^image(\/.+|$)/)
end

def from_node(node)

def from_node(node)
  if node["url"] && content_type_is_image?(node["content-type"])
    new(attributes_from_node(node))
  end
end

def initialize(attributes = {})

def initialize(attributes = {})
  @url = attributes[:url]
  @content_type = attributes[:content_type]
  @width = attributes[:width]
  @height = attributes[:height]
end

def to_partial_path

def to_partial_path
  "action_text/attachables/remote_image"
end