Class: Docxer::Word::Contents::Break

Inherits:
Object
  • Object
show all
Defined in:
lib/docxer/word/contents/break.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Break

Returns a new instance of Break.



8
9
10
11
# File 'lib/docxer/word/contents/break.rb', line 8

def initialize(options={})
  @options = options
  @options[:times] ||= 1
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



7
8
9
# File 'lib/docxer/word/contents/break.rb', line 7

def options
  @options
end

Instance Method Details

#render(xml) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/docxer/word/contents/break.rb', line 13

def render(xml)
  if @options[:page]
    xml['w'].p do
      xml['w'].r do
        xml['w'].br( 'w:type' => "page" )
      end
    end
  else
    @options[:times].times do
      xml['w'].r do
        xml['w'].br
      end
    end
  end
end