Class: Arrolio::Flowables::Spacer
Instance Attribute Summary collapse
#style
Instance Method Summary
collapse
#keep_together?, #keep_with_next?, #page_break_after?, #page_break_before?, #space_after, #space_before, #split
Constructor Details
#initialize(amount, style: Style::Definition.new) ⇒ Spacer
Returns a new instance of Spacer.
8
9
10
11
|
# File 'lib/arrolio/flowables/spacer.rb', line 8
def initialize(amount, style: Style::Definition.new)
super(style: style)
@amount = amount.to_f
end
|
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
6
7
8
|
# File 'lib/arrolio/flowables/spacer.rb', line 6
def amount
@amount
end
|
Instance Method Details
#do_split(_width, remaining_height, _context = nil) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/arrolio/flowables/spacer.rb', line 25
def do_split(_width, remaining_height, _context = nil)
if @amount <= remaining_height
[self, nil]
else
[self.class.new(remaining_height), self.class.new(@amount - remaining_height)]
end
end
|
#emit(_x, _y, _width, _context = nil) ⇒ Object
17
18
19
|
# File 'lib/arrolio/flowables/spacer.rb', line 17
def emit(_x, _y, _width, _context = nil)
[[], @amount]
end
|
#height(_width, _context = nil) ⇒ Object
13
14
15
|
# File 'lib/arrolio/flowables/spacer.rb', line 13
def height(_width, _context = nil)
@amount
end
|
#splittable? ⇒ Boolean
21
22
23
|
# File 'lib/arrolio/flowables/spacer.rb', line 21
def splittable?
true
end
|