class ResumeTools::Resume

Resume

Represents a single resume document

Attributes

address1[RW]

First line of the address

address2[RW]

Second line of the address

email[RW]

The subject's e-mail address

full_name[RW]

The full name of the subject of this resume

sections[R]

The resume's sections

telephone[RW]

The subject's telephone number

url[RW]

The subject's URL

Public Class Methods

build(opts={}, &block) click to toggle source

Creates a Resume and passes it to the given block. Returns the created Resume.

# File lib/resumetools/resume/resume.rb, line 56
def self.build(opts={}, &block)
  resume = self.new(opts)
  block.call(resume)
  resume
end
new(props={}) click to toggle source

Creates a new Resume with the given properties

# File lib/resumetools/resume/resume.rb, line 63
def initialize(props={})
  @full_name = props[:full_name] || ""
  @url = props[:url] || ""
  @email = props[:email] || ""
  @telephone = props[:telephone] || ""
  @address1 = props[:address1] || ""
  @address2 = props[:address2] || ""
  @sections = Array.new
end

Public Instance Methods

add_section(section) click to toggle source

Add section

# File lib/resumetools/resume/resume.rb, line 74
def add_section(section)
  self.sections << section
  self
end
create_section(props={}, &block) click to toggle source

Create new section and add to sections

# File lib/resumetools/resume/resume.rb, line 80
def create_section(props={}, &block)
  section = Section.new(props)
  block.call(section) if block
  self.add_section(section)
  self
end
has_address1?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 103
def has_address1?
  !self.address1.blank?
end
has_address2?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 108
def has_address2?
  !self.address2.blank?
end
has_email?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 93
def has_email?
  !self.email.blank?
end
has_sections?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 113
def has_sections?
  !self.sections.empty?
end
has_telephone?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 98
def has_telephone?
  !self.telephone.blank?
end
has_url?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 88
def has_url?
  !self.url.blank?
end
header_lines() click to toggle source

Returns an array of lines that has the contact info

# File lib/resumetools/resume/resume.rb, line 118
def header_lines
  elements = []
  [:address1, :address2, :telephone, :email].each do |element|
    elements << self.send(element) unless self.send(element).blank?
  end
  lines = []
  elements.each_slice(2) { |pair| lines << pair.join(" • ") }
  lines << self.url unless self.url.blank?
  lines
end