Class: TP::Slide::Paragraph

Inherits:
TP::Slide show all
Defined in:
lib/tp/slide/paragraph.rb

Instance Attribute Summary

Attributes inherited from TP::Slide

#markdown

Instance Method Summary collapse

Methods inherited from TP::Slide

#centered_header, #content, #frames, #header, #height, #initialize, #lines, #pdf_content_height, #pdf_content_top_left, #pdf_header_height

Constructor Details

This class inherits a constructor from TP::Slide

Instance Method Details

#hard_width?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/tp/slide/paragraph.rb', line 34

def hard_width?
  false
end

#paragraphObject



23
24
25
26
27
28
# File 'lib/tp/slide/paragraph.rb', line 23

def paragraph
  buffer = content.wrap Screen.width
  buffer = buffer.center Screen.width if buffer.lines.one?

  buffer
end

#render_pdf(pdf) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/tp/slide/paragraph.rb', line 2

def render_pdf(pdf)
  pdf.text_box header,
    align: :center,
    overflow: :shrink_to_fit,
    single_line: true,
    height: pdf_header_height,
    size: pdf_header_height

  pdf.text_box paragraph,
    at: pdf_content_top_left(pdf),
    height: pdf_content_height(pdf),
    overflow: :shrink_to_fit,
    valign: :center
end

#render_terminalObject



17
18
19
20
21
# File 'lib/tp/slide/paragraph.rb', line 17

def render_terminal
  centered_header +
    "\n\n" +
    paragraph
end

#widthObject



30
31
32
# File 'lib/tp/slide/paragraph.rb', line 30

def width
  content.length
end