Class: ResumeTools::Section
- Inherits:
-
Object
- Object
- ResumeTools::Section
- Defined in:
- lib/resumetools/resume/resume.rb
Overview
Section
Represents a section in the resume
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
List of items.
-
#para ⇒ Object
Section paragraph.
-
#periods ⇒ Object
readonly
List of periods.
-
#title ⇒ Object
Section title.
Instance Method Summary collapse
-
#add_item(item) ⇒ Object
Ads an item.
-
#add_period(period) ⇒ Object
Adds a period.
-
#create_item(props = {}, &block) ⇒ Object
Creates an item and adds it to the list.
-
#create_period(props = {}, &block) ⇒ Object
Creates a period and adds it to the list.
- #has_items? ⇒ Boolean
- #has_para? ⇒ Boolean
- #has_paragraph? ⇒ Boolean
- #has_periods? ⇒ Boolean
- #has_title? ⇒ Boolean
-
#initialize(props = {}) ⇒ Section
constructor
A new instance of Section.
Constructor Details
#initialize(props = {}) ⇒ Section
Returns a new instance of Section.
145 146 147 148 149 150 |
# File 'lib/resumetools/resume/resume.rb', line 145 def initialize(props={}) @title = props[:title] || "" @para = props[:para] || "" @items = Array.new @periods = Array.new end |
Instance Attribute Details
#items ⇒ Object (readonly)
List of items
142 143 144 |
# File 'lib/resumetools/resume/resume.rb', line 142 def items @items end |
#para ⇒ Object
Section paragraph
136 137 138 |
# File 'lib/resumetools/resume/resume.rb', line 136 def para @para end |
#periods ⇒ Object (readonly)
List of periods
139 140 141 |
# File 'lib/resumetools/resume/resume.rb', line 139 def periods @periods end |
#title ⇒ Object
Section title
133 134 135 |
# File 'lib/resumetools/resume/resume.rb', line 133 def title @title end |
Instance Method Details
#add_item(item) ⇒ Object
Ads an item
191 192 193 |
# File 'lib/resumetools/resume/resume.rb', line 191 def add_item(item) self.items << item end |
#add_period(period) ⇒ Object
Adds a period
186 187 188 |
# File 'lib/resumetools/resume/resume.rb', line 186 def add_period(period) self.periods << period end |
#create_item(props = {}, &block) ⇒ Object
Creates an item and adds it to the list
196 197 198 199 200 201 |
# File 'lib/resumetools/resume/resume.rb', line 196 def create_item(props={}, &block) item = Item.new(props) block.call(item) if block self.add_item(item) self end |
#create_period(props = {}, &block) ⇒ Object
Creates a period and adds it to the list
178 179 180 181 182 183 |
# File 'lib/resumetools/resume/resume.rb', line 178 def create_period(props={}, &block) period = Period.new(props) block.call(period) if block self.add_period(period) self end |
#has_items? ⇒ Boolean
162 163 164 |
# File 'lib/resumetools/resume/resume.rb', line 162 def has_items? !self.items.empty? end |
#has_para? ⇒ Boolean
157 158 159 |
# File 'lib/resumetools/resume/resume.rb', line 157 def has_para? self.has_paragraph? end |
#has_paragraph? ⇒ Boolean
153 154 155 |
# File 'lib/resumetools/resume/resume.rb', line 153 def has_paragraph? !self.para.blank? end |
#has_periods? ⇒ Boolean
167 168 169 |
# File 'lib/resumetools/resume/resume.rb', line 167 def has_periods? !self.periods.empty? end |
#has_title? ⇒ Boolean
172 173 174 175 |
# File 'lib/resumetools/resume/resume.rb', line 172 def has_title? !self.title.blank? end |