Class: ResumeTools::Resume
- Inherits:
-
Object
- Object
- ResumeTools::Resume
- Extended by:
- TextReader::ClassMethods
- Defined in:
- lib/resumetools/resume/resume.rb
Overview
Resume
Represents a single resume document
Instance Attribute Summary collapse
-
#address1 ⇒ Object
First line of the address.
-
#address2 ⇒ Object
Second line of the address.
-
#email ⇒ Object
The subject’s e-mail address.
-
#full_name ⇒ Object
The full name of the subject of this resume.
-
#sections ⇒ Object
readonly
The resume’s sections.
-
#telephone ⇒ Object
The subject’s telephone number.
-
#url ⇒ Object
The subject’s URL.
Class Method Summary collapse
-
.build(opts = {}, &block) ⇒ Object
Creates a
Resume
and passes it to the given block.
Instance Method Summary collapse
-
#add_section(section) ⇒ Object
Add section.
-
#create_section(props = {}, &block) ⇒ Object
Create new section and add to sections.
- #has_address1? ⇒ Boolean
- #has_address2? ⇒ Boolean
- #has_email? ⇒ Boolean
- #has_sections? ⇒ Boolean
- #has_telephone? ⇒ Boolean
- #has_url? ⇒ Boolean
-
#header_lines ⇒ Object
Returns an array of lines that has the contact info.
-
#initialize(props = {}) ⇒ Resume
constructor
Creates a new
Resume
with the given properties.
Methods included from TextReader::ClassMethods
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
#address1 ⇒ Object
First line of the address
45 46 47 |
# File 'lib/resumetools/resume/resume.rb', line 45 def address1 @address1 end |
#address2 ⇒ Object
Second line of the address
48 49 50 |
# File 'lib/resumetools/resume/resume.rb', line 48 def address2 @address2 end |
#email ⇒ Object
The subject’s e-mail address
39 40 41 |
# File 'lib/resumetools/resume/resume.rb', line 39 def email @email end |
#full_name ⇒ Object
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 |
#sections ⇒ Object (readonly)
The resume’s sections
51 52 53 |
# File 'lib/resumetools/resume/resume.rb', line 51 def sections @sections end |
#telephone ⇒ Object
The subject’s telephone number
42 43 44 |
# File 'lib/resumetools/resume/resume.rb', line 42 def telephone @telephone end |
#url ⇒ Object
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
101 102 103 |
# File 'lib/resumetools/resume/resume.rb', line 101 def has_address1? !self.address1.blank? end |
#has_address2? ⇒ Boolean
106 107 108 |
# File 'lib/resumetools/resume/resume.rb', line 106 def has_address2? !self.address2.blank? end |
#has_email? ⇒ Boolean
91 92 93 |
# File 'lib/resumetools/resume/resume.rb', line 91 def has_email? !self.email.blank? end |
#has_sections? ⇒ Boolean
111 112 113 |
# File 'lib/resumetools/resume/resume.rb', line 111 def has_sections? !self.sections.empty? end |
#has_telephone? ⇒ Boolean
96 97 98 |
# File 'lib/resumetools/resume/resume.rb', line 96 def has_telephone? !self.telephone.blank? end |
#has_url? ⇒ Boolean
86 87 88 |
# File 'lib/resumetools/resume/resume.rb', line 86 def has_url? !self.url.blank? end |
#header_lines ⇒ Object
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 |