Class: PrawnHtml::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/prawn_html/instance.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pdf) ⇒ Instance

Returns a new instance of Instance.



7
8
9
10
11
# File 'lib/prawn_html/instance.rb', line 7

def initialize(pdf)
  @pdf_wrapper = PrawnHtml::PdfWrapper.new(pdf)
  @renderer = PrawnHtml::DocumentRenderer.new(@pdf_wrapper)
  @html_parser = PrawnHtml::HtmlParser.new(@renderer)
end

Instance Attribute Details

#html_parserObject (readonly)

Returns the value of attribute html_parser.



5
6
7
# File 'lib/prawn_html/instance.rb', line 5

def html_parser
  @html_parser
end

#pdf_wrapperObject (readonly)

Returns the value of attribute pdf_wrapper.



5
6
7
# File 'lib/prawn_html/instance.rb', line 5

def pdf_wrapper
  @pdf_wrapper
end

#rendererObject (readonly)

Returns the value of attribute renderer.



5
6
7
# File 'lib/prawn_html/instance.rb', line 5

def renderer
  @renderer
end

Instance Method Details

#append(css: nil, html: nil) ⇒ Object



13
14
15
16
# File 'lib/prawn_html/instance.rb', line 13

def append(css: nil, html: nil)
  html_parser.parse_styles(css) if css
  html_parser.process(html) if html
end