class ActionMosaico::Attachables::RemoteImage
Attributes
content_type[R]
height[R]
url[R]
width[R]
Public Class Methods
from_node(node)
click to toggle source
# File lib/action_mosaico/attachables/remote_image.rb, line 9 def from_node(node) new(attributes_from_node(node)) if node['url'] && content_type_is_image?(node['content-type']) end
new(attributes = {})
click to toggle source
# File lib/action_mosaico/attachables/remote_image.rb, line 29 def initialize(attributes = {}) @url = attributes[:url] @content_type = attributes[:content_type] @width = attributes[:width] @height = attributes[:height] end
Private Class Methods
attributes_from_node(node)
click to toggle source
# File lib/action_mosaico/attachables/remote_image.rb, line 19 def attributes_from_node(node) { url: node['url'], content_type: node['content-type'], width: node['width'], height: node['height'] } end
content_type_is_image?(content_type)
click to toggle source
# File lib/action_mosaico/attachables/remote_image.rb, line 15 def content_type_is_image?(content_type) content_type.to_s.match?(%r{^image(/.+|$)}) end
Public Instance Methods
attachable_plain_text_representation(caption)
click to toggle source
# File lib/action_mosaico/attachables/remote_image.rb, line 36 def attachable_plain_text_representation(caption) "[#{caption || 'Image'}]" end
to_partial_path()
click to toggle source
# File lib/action_mosaico/attachables/remote_image.rb, line 40 def to_partial_path 'action_mosaico/attachables/remote_image' end