Class: ResumeTools::Section

Inherits:
Object
  • Object
show all
Defined in:
lib/resumetools/resume/resume.rb

Overview

Section

Represents a section in the resume

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(props = {}) ⇒ Section


148
149
150
151
152
153
# File 'lib/resumetools/resume/resume.rb', line 148

def initialize(props={})
  @title = props[:title] || ""
  @para = props[:para] || ""
  @items = Array.new
  @periods = Array.new
end

Instance Attribute Details

#itemsObject (readonly)

List of items


145
146
147
# File 'lib/resumetools/resume/resume.rb', line 145

def items
  @items
end

#paraObject

Section paragraph


139
140
141
# File 'lib/resumetools/resume/resume.rb', line 139

def para
  @para
end

#periodsObject (readonly)

List of periods


142
143
144
# File 'lib/resumetools/resume/resume.rb', line 142

def periods
  @periods
end

#titleObject

Section title


136
137
138
# File 'lib/resumetools/resume/resume.rb', line 136

def title
  @title
end

Instance Method Details

#add_item(item) ⇒ Object

Ads an item


194
195
196
# File 'lib/resumetools/resume/resume.rb', line 194

def add_item(item)
  self.items << item
end

#add_period(period) ⇒ Object

Adds a period


189
190
191
# File 'lib/resumetools/resume/resume.rb', line 189

def add_period(period)
  self.periods << period
end

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

Creates an item and adds it to the list


199
200
201
202
203
204
# File 'lib/resumetools/resume/resume.rb', line 199

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


181
182
183
184
185
186
# File 'lib/resumetools/resume/resume.rb', line 181

def create_period(props={}, &block)
  period = Period.new(props)
  block.call(period) if block
  self.add_period(period)
  self
end

#has_items?Boolean


165
166
167
# File 'lib/resumetools/resume/resume.rb', line 165

def has_items?
  !self.items.empty?
end

#has_para?Boolean


160
161
162
# File 'lib/resumetools/resume/resume.rb', line 160

def has_para?
  self.has_paragraph?
end

#has_paragraph?Boolean


156
157
158
# File 'lib/resumetools/resume/resume.rb', line 156

def has_paragraph?
  !self.para.blank?
end

#has_periods?Boolean


170
171
172
# File 'lib/resumetools/resume/resume.rb', line 170

def has_periods?
  !self.periods.empty?
end

#has_title?Boolean


175
176
177
178
# File 'lib/resumetools/resume/resume.rb', line 175

def has_title?
  !self.title.blank?

end