Class: ResumeTools::Renderer::PlainText

Inherits:
Object
  • Object
show all
Defined in:
lib/resumetools/resume/plain_text.rb

Instance Method Summary collapse

Constructor Details

#initialize(resume) ⇒ PlainText


4
5
6
# File 'lib/resumetools/resume/plain_text.rb', line 4

def initialize(resume)
  @resume = resume
end

Instance Method Details

#render(opts = {}) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/resumetools/resume/plain_text.rb', line 8

def render(opts={})
  @opts = {
    :item_bullet => '-',
    :header_filler => '-',
    :newline => "\n",
    :first_indent => 0,
    :columns => 80,
    :indent => 2,
    :centered_top => true,
    :lined_headers => true
  }
  @opts.merge!(opts)
  @format = ::Text::Format.new
  @format.first_indent = @opts[:first_indent]
  @format.columns = @opts[:columns]
  
  top_line @resume.full_name unless @resume.full_name.blank?
  top_line @resume.address1 if @resume.has_address1?
  top_line @resume.address2 if @resume.has_address2?
  top_line @resume.telephone if @resume.has_telephone?
  top_line @resume.email if @resume.has_email?
  top_line @resume.url if @resume.has_url?
  blank_line

  @resume.sections.each_with_index do |section, n|
    render_section(section)
    blank_line if (n < @resume.sections.length - 1)
  end  
  content
end