Class: Wee::Brush::Page

Inherits:
Wee::Brush show all
Defined in:
lib/wee/renderer/html/brushes.rb

Instance Attribute Summary

Attributes inherited from Wee::Brush

#canvas, #parent

Instance Method Summary collapse

Methods inherited from Wee::Brush

#close, #initialize

Constructor Details

This class inherits a constructor from Wee::Brush

Instance Method Details

#title(t) ⇒ Object



605
606
607
608
# File 'lib/wee/renderer/html/brushes.rb', line 605

def title(t)
  @title = t
  self
end

#with(text = nil, &block) ⇒ Object



610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
# File 'lib/wee/renderer/html/brushes.rb', line 610

def with(text=nil, &block)
  doc = @canvas.document
  doc.start_tag("html")

  if @title
    doc.start_tag("head")
    doc.start_tag("title")
    doc.text(@title)
    doc.end_tag("title")
    doc.end_tag("head")
  end

  doc.start_tag("body")

  if text
    doc.text(text)
    super(text, &block)
  else
    super(&block)
  end

  doc.end_tag("body")
  doc.end_tag("html")
  nil
end