class Prismic::Fragments::Image::View

Attributes

alt[RW]
height[RW]
url[RW]
width[RW]

Public Class Methods

new(url, width, height, alt, copyright, link_to) click to toggle source
# File lib/prismic/fragments/image.rb, line 41
def initialize(url, width, height, alt, copyright, link_to)
  @url = url
  @width = width
  @height = height
  @alt = alt
  @copyright = copyright
  @link_to = link_to
end

Public Instance Methods

as_html(link_resolver=nil) click to toggle source
# File lib/prismic/fragments/image.rb, line 54
def as_html(link_resolver=nil)
  html = []
  html << (link_to.nil? ? '' : link_to.start_html(link_resolver, link_to.target))
  html << %(<img src="#@url" alt="#@alt" width="#@width" height="#@height" />)
  html << (link_to.nil? ? '' : link_to.end_html)
  html.join
end
ratio() click to toggle source
# File lib/prismic/fragments/image.rb, line 50
def ratio
  return @width / @height
end