Class: Clarus::Heading

Inherits:
Object
  • Object
show all
Defined in:
lib/clarus/heading.rb

Instance Method Summary collapse

Constructor Details

#initializeHeading

Returns a new instance of Heading.



3
4
5
6
# File 'lib/clarus/heading.rb', line 3

def initialize
  @style = '<w:pStyle w:val="Heading1" />'
  @finished_text = ""
end

Instance Method Details

#add_text(text) ⇒ Object



8
9
10
# File 'lib/clarus/heading.rb', line 8

def add_text(text)
  @finished_text.concat "<w:t>#{text}</w:t>\n"
end

#renderObject



12
13
14
15
# File 'lib/clarus/heading.rb', line 12

def render
  document_template = File.read(File.expand_path('../templates/paragraph_fragment_template.erb', __FILE__))
  Erubis::Eruby.new(document_template).result(:style => @style, :finished_text => @finished_text)
end