class Proforma::Modeling::Banner
A Banner
is a specific type of header that is comprised of an image and some text. Both the image and text could be optional and, like all modeling components, it is up to the rendering engine how to render it.
Attributes
details[W]
image[RW]
image_height[W]
image_width[W]
title[W]
Public Class Methods
new( details: '', image: nil, image_height: nil, image_width: nil, title: '' )
click to toggle source
# File lib/proforma/modeling/banner.rb, line 23 def initialize( details: '', image: nil, image_height: nil, image_width: nil, title: '' ) @details = details @image = image @image_height = image_height @image_width = image_width @title = title end
Public Instance Methods
compile(data, evaluator)
click to toggle source
# File lib/proforma/modeling/banner.rb, line 53 def compile(data, evaluator) resolved_image = image.to_s.empty? ? nil : evaluator.value(data, image) self.class.new( details: evaluator.text(data, details), image: resolved_image, image_height: image_height, image_width: image_width, title: evaluator.text(data, title) ) end
details()
click to toggle source
# File lib/proforma/modeling/banner.rb, line 37 def details @details.to_s end
image_height()
click to toggle source
# File lib/proforma/modeling/banner.rb, line 45 def image_height @image_height ? @image_height.to_f : nil end
image_width()
click to toggle source
# File lib/proforma/modeling/banner.rb, line 49 def image_width @image_width ? @image_width.to_f : nil end
title()
click to toggle source
# File lib/proforma/modeling/banner.rb, line 41 def title @title.to_s end