Class: ClockworkComicPDF::PageHeader
- Inherits:
-
Object
- Object
- ClockworkComicPDF::PageHeader
show all
- Includes:
- OptionValidation
- Defined in:
- lib/clockwork_comic_pdf/page_header.rb
Overview
storage class for the page header includes alignment, left and right side text, and size
Instance Attribute Summary collapse
Instance Method Summary
collapse
#check_options, #check_required
Constructor Details
#initialize(options = {}) ⇒ PageHeader
Returns a new instance of PageHeader.
49
50
51
52
53
54
55
56
57
|
# File 'lib/clockwork_comic_pdf/page_header.rb', line 49
def initialize(options = {})
valid_options = [:size, :text, :left_text, :right_text, :align]
check_options(options.keys, valid_options)
self.size = options[:size]
self.text = options[:text]
self.left_text = options[:left_text]
self.right_text = options[:right_text]
self.align = options[:align]
end
|
Instance Attribute Details
#align ⇒ Object
9
10
11
12
|
# File 'lib/clockwork_comic_pdf/page_header.rb', line 9
def align
@align = :center unless @align
@align
end
|
Instance Method Details
#left_text ⇒ Object
24
25
26
|
# File 'lib/clockwork_comic_pdf/page_header.rb', line 24
def left_text
@left_text ||= ''
end
|
#left_text=(left_text) ⇒ Object
28
29
30
|
# File 'lib/clockwork_comic_pdf/page_header.rb', line 28
def left_text=(left_text)
@left_text = left_text.to_s
end
|
#right_text ⇒ Object
32
33
34
|
# File 'lib/clockwork_comic_pdf/page_header.rb', line 32
def right_text
@right_text ||= ''
end
|
#right_text=(right_text) ⇒ Object
36
37
38
|
# File 'lib/clockwork_comic_pdf/page_header.rb', line 36
def right_text=(right_text)
@right_text = right_text.to_s
end
|
#size ⇒ Object
40
41
42
43
|
# File 'lib/clockwork_comic_pdf/page_header.rb', line 40
def size
@size = 8 unless @size
@size
end
|
#size=(size) ⇒ Object
45
46
47
|
# File 'lib/clockwork_comic_pdf/page_header.rb', line 45
def size=(size)
@size = size.to_points
end
|
#text ⇒ Object
20
21
22
|
# File 'lib/clockwork_comic_pdf/page_header.rb', line 20
def text
{ left: left_text, right: right_text }
end
|
#text=(text) ⇒ Object
15
16
17
18
|
# File 'lib/clockwork_comic_pdf/page_header.rb', line 15
def text=(text)
self.left_text = text
self.right_text = text
end
|