Class: Arrolio::Flowable
- Inherits:
-
Object
show all
- Defined in:
- lib/arrolio/flowable.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(style: Style::Definition.new) ⇒ Flowable
Returns a new instance of Flowable.
9
10
11
|
# File 'lib/arrolio/flowable.rb', line 9
def initialize(style: Style::Definition.new)
@style = style
end
|
Instance Attribute Details
#style ⇒ Object
Returns the value of attribute style.
7
8
9
|
# File 'lib/arrolio/flowable.rb', line 7
def style
@style
end
|
Instance Method Details
#do_split(_width, _remaining_height, _context = nil) ⇒ Object
62
63
64
|
# File 'lib/arrolio/flowable.rb', line 62
def do_split(_width, _remaining_height, _context = nil)
[self, nil]
end
|
#emit(_x, _y, _width, _context = nil) ⇒ Object
17
18
19
|
# File 'lib/arrolio/flowable.rb', line 17
def emit(_x, _y, _width, _context = nil)
raise NotImplementedError, "#{self.class}#emit not implemented"
end
|
#height(_width, _context = nil) ⇒ Object
13
14
15
|
# File 'lib/arrolio/flowable.rb', line 13
def height(_width, _context = nil)
raise NotImplementedError, "#{self.class}#height not implemented"
end
|
#keep_together? ⇒ Boolean
25
26
27
|
# File 'lib/arrolio/flowable.rb', line 25
def keep_together?
@style.keep_together
end
|
#keep_with_next? ⇒ Boolean
29
30
31
|
# File 'lib/arrolio/flowable.rb', line 29
def keep_with_next?
@style.keep_with_next
end
|
#page_break_after? ⇒ Boolean
37
38
39
|
# File 'lib/arrolio/flowable.rb', line 37
def page_break_after?
@style.page_break_after
end
|
#page_break_before? ⇒ Boolean
33
34
35
|
# File 'lib/arrolio/flowable.rb', line 33
def page_break_before?
@style.page_break_before
end
|
#space_after ⇒ Object
45
46
47
|
# File 'lib/arrolio/flowable.rb', line 45
def space_after
@style.margin_bottom
end
|
#space_before ⇒ Object
41
42
43
|
# File 'lib/arrolio/flowable.rb', line 41
def space_before
@style.margin_top
end
|
#split(width, remaining_height, context = nil) ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/arrolio/flowable.rb', line 49
def split(width, remaining_height, context = nil)
natural = height(width, context)
if natural <= remaining_height
[self, nil]
elsif splittable?
do_split(width, remaining_height, context)
elsif keep_together?
[nil, self]
else
[self, nil]
end
end
|
#splittable? ⇒ Boolean
21
22
23
|
# File 'lib/arrolio/flowable.rb', line 21
def splittable?
false
end
|