Class: PrawnHtml::Tags::Img

Inherits:
PrawnHtml::Tag show all
Defined in:
lib/prawn_html/tags/img.rb

Constant Summary collapse

ELEMENTS =
[:img].freeze

Constants inherited from PrawnHtml::Tag

PrawnHtml::Tag::CALLBACKS, PrawnHtml::Tag::TAG_CLASSES

Instance Attribute Summary

Attributes inherited from PrawnHtml::Tag

#attrs, #parent, #tag

Instance Method Summary collapse

Methods inherited from PrawnHtml::Tag

#block_styles, class_for, #initialize, #process_styles, #tag_close_styles, #tag_open_styles

Constructor Details

This class inherits a constructor from PrawnHtml::Tag

Instance Method Details

#block?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/prawn_html/tags/img.rb', line 8

def block?
  true
end

#custom_render(pdf, context) ⇒ Object



12
13
14
15
16
17
# File 'lib/prawn_html/tags/img.rb', line 12

def custom_render(pdf, context)
  parsed_styles = Attributes.parse_styles(attrs.style)
  block_styles = context.block_styles
  evaluated_styles = adjust_styles(pdf, block_styles.merge(parsed_styles))
  pdf.image(@attrs.src, evaluated_styles)
end