Class: ResumeTools::Resume

Inherits:
Object
  • Object
show all
Extended by:
TextReader::ClassMethods
Defined in:
lib/resumetools/resume/resume.rb

Overview

Resume

Represents a single resume document

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from TextReader::ClassMethods

from_text

Constructor Details

#initialize(props = {}) ⇒ Resume

Creates a new Resume with the given properties


63
64
65
66
67
68
69
70
71
# 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

Instance Attribute Details

#address1Object

First line of the address


47
48
49
# File 'lib/resumetools/resume/resume.rb', line 47

def address1
  @address1
end

#address2Object

Second line of the address


50
51
52
# File 'lib/resumetools/resume/resume.rb', line 50

def address2
  @address2
end

#emailObject

The subject's e-mail address


41
42
43
# File 'lib/resumetools/resume/resume.rb', line 41

def email
  @email
end

#full_nameObject

The full name of the subject of this resume


35
36
37
# File 'lib/resumetools/resume/resume.rb', line 35

def full_name
  @full_name
end

#sectionsObject (readonly)

The resume's sections


53
54
55
# File 'lib/resumetools/resume/resume.rb', line 53

def sections
  @sections
end

#telephoneObject

The subject's telephone number


44
45
46
# File 'lib/resumetools/resume/resume.rb', line 44

def telephone
  @telephone
end

#urlObject

The subject's URL


38
39
40
# File 'lib/resumetools/resume/resume.rb', line 38

def url
  @url
end

Class Method Details

.build(opts = {}, &block) ⇒ Object

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


56
57
58
59
60
# File 'lib/resumetools/resume/resume.rb', line 56

def self.build(opts={}, &block)
  resume = self.new(opts)
  block.call(resume)
  resume
end

Instance Method Details

#add_section(section) ⇒ Object

Add section


74
75
76
77
# File 'lib/resumetools/resume/resume.rb', line 74

def add_section(section)
  self.sections << section
  self
end

#create_section(props = {}, &block) ⇒ Object

Create new section and add to sections


80
81
82
83
84
85
# 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?Boolean

Returns:

  • (Boolean)

103
104
105
# File 'lib/resumetools/resume/resume.rb', line 103

def has_address1?
  !self.address1.blank?
end

#has_address2?Boolean

Returns:

  • (Boolean)

108
109
110
# File 'lib/resumetools/resume/resume.rb', line 108

def has_address2?
  !self.address2.blank?
end

#has_email?Boolean

Returns:

  • (Boolean)

93
94
95
# File 'lib/resumetools/resume/resume.rb', line 93

def has_email?
  !self.email.blank?
end

#has_sections?Boolean

Returns:

  • (Boolean)

113
114
115
# File 'lib/resumetools/resume/resume.rb', line 113

def has_sections?
  !self.sections.empty?
end

#has_telephone?Boolean

Returns:

  • (Boolean)

98
99
100
# File 'lib/resumetools/resume/resume.rb', line 98

def has_telephone?
  !self.telephone.blank?
end

#has_url?Boolean

Returns:

  • (Boolean)

88
89
90
# File 'lib/resumetools/resume/resume.rb', line 88

def has_url?
  !self.url.blank?
end

#header_linesObject

Returns an array of lines that has the contact info


118
119
120
121
122
123
124
125
126
127
# 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