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



61
62
63
64
65
66
67
68
69
# File 'lib/resumetools/resume/resume.rb', line 61

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



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

def address1
  @address1
end

#address2Object

Second line of the address



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

def address2
  @address2
end

#emailObject

The subject’s e-mail address



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

def email
  @email
end

#full_nameObject

The full name of the subject of this resume



33
34
35
# File 'lib/resumetools/resume/resume.rb', line 33

def full_name
  @full_name
end

#sectionsObject (readonly)

The resume’s sections



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

def sections
  @sections
end

#telephoneObject

The subject’s telephone number



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

def telephone
  @telephone
end

#urlObject

The subject’s URL



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

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.



54
55
56
57
58
# File 'lib/resumetools/resume/resume.rb', line 54

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

Instance Method Details

#add_section(section) ⇒ Object

Add section



72
73
74
75
# File 'lib/resumetools/resume/resume.rb', line 72

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

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

Create new section and add to sections



78
79
80
81
82
83
# File 'lib/resumetools/resume/resume.rb', line 78

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)


101
102
103
# File 'lib/resumetools/resume/resume.rb', line 101

def has_address1?
  !self.address1.blank?
end

#has_address2?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/resumetools/resume/resume.rb', line 106

def has_address2?
  !self.address2.blank?
end

#has_email?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/resumetools/resume/resume.rb', line 91

def has_email?
  !self.email.blank?
end

#has_sections?Boolean

Returns:

  • (Boolean)


111
112
113
# File 'lib/resumetools/resume/resume.rb', line 111

def has_sections?
  !self.sections.empty?      
end

#has_telephone?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/resumetools/resume/resume.rb', line 96

def has_telephone?
  !self.telephone.blank?
end

#has_url?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/resumetools/resume/resume.rb', line 86

def has_url?
  !self.url.blank?
end

#header_linesObject

Returns an array of lines that has the contact info



116
117
118
119
120
121
122
123
124
# File 'lib/resumetools/resume/resume.rb', line 116

def header_lines
  elements = []
  [:address1, :address2, :telephone, :email, :url].each do |element|
    elements << self.send(element) unless self.send(element).blank?
  end
  lines = []
  elements.each_slice(2) { |pair| lines << pair.join("") }
  lines
end