Class: TP::Slide
- Inherits:
-
Object
show all
- Defined in:
- lib/tp/slide.rb
Defined Under Namespace
Classes: Bulleted, Code, HeaderOnly, Paragraph
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(markdown) ⇒ Slide
Returns a new instance of Slide.
5
6
7
|
# File 'lib/tp/slide.rb', line 5
def initialize(markdown)
@markdown = markdown.strip
end
|
Instance Attribute Details
#markdown ⇒ Object
Returns the value of attribute markdown.
3
4
5
|
# File 'lib/tp/slide.rb', line 3
def markdown
@markdown
end
|
Instance Method Details
14
15
16
|
# File 'lib/tp/slide.rb', line 14
def
.center Screen.width
end
|
#content ⇒ Object
18
19
20
21
22
|
# File 'lib/tp/slide.rb', line 18
def content
Array(lines[2, lines.count - 2]).reject { |line|
line.start_with?("> ")
}.join
end
|
#frames ⇒ Object
24
25
26
|
# File 'lib/tp/slide.rb', line 24
def frames
[render_terminal]
end
|
#hard_width? ⇒ Boolean
48
49
50
|
# File 'lib/tp/slide.rb', line 48
def hard_width?
true
end
|
9
10
11
12
|
# File 'lib/tp/slide.rb', line 9
def
line = lines.first
line[1, line.length - 1].to_s.strip
end
|
#height ⇒ Object
44
45
46
|
# File 'lib/tp/slide.rb', line 44
def height
lines.count
end
|
#lines ⇒ Object
28
29
30
|
# File 'lib/tp/slide.rb', line 28
def lines
markdown.lines.to_a
end
|
#pdf_content_height(pdf) ⇒ Object
32
33
34
|
# File 'lib/tp/slide.rb', line 32
def pdf_content_height(pdf)
pdf.bounds.height -
end
|
#pdf_content_top_left(pdf) ⇒ Object
36
37
38
|
# File 'lib/tp/slide.rb', line 36
def pdf_content_top_left(pdf)
[pdf.bounds.left, pdf.bounds.top - ]
end
|
40
41
42
|
# File 'lib/tp/slide.rb', line 40
def
!= "" ? 1.in : 0
end
|