Class: Rubyword::Element::PageBreak

Inherits:
Base
  • Object
show all
Defined in:
lib/rubyword/element/page_break.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#rubyword, #section

Instance Method Summary collapse

Methods inherited from Base

#filter_text, #initialize

Constructor Details

This class inherits a constructor from Rubyword::Element::Base

Instance Attribute Details

#numbersObject

Returns the value of attribute numbers.



5
6
7
# File 'lib/rubyword/element/page_break.rb', line 5

def numbers
  @numbers
end

Instance Method Details

#save(numbers) ⇒ Object



7
8
9
10
# File 'lib/rubyword/element/page_break.rb', line 7

def save(numbers)
  @numbers ||= Queue.new
  @numbers << numbers.to_i
end

#write(section = nil, xml = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rubyword/element/page_break.rb', line 12

def write(section=nil, xml=nil)
  @xml = xml
  page_break = self.numbers.pop
  page_break.to_i.times.each do |i|
    @xml.send('w:p') {
      @xml.send('w:r') {
        @xml.send('w:br', 'w:type' => 'page')
      }  
    }
  end
end