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

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

#itemsObject (readonly)

List of items



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

def items
  @items
end

#paraObject

Section paragraph



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

def para
  @para
end

#periodsObject (readonly)

List of periods



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

def periods
  @periods
end

#titleObject

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

Returns:

  • (Boolean)


162
163
164
# File 'lib/resumetools/resume/resume.rb', line 162

def has_items?
  !self.items.empty?
end

#has_para?Boolean

Returns:

  • (Boolean)


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

def has_para?
  self.has_paragraph?
end

#has_paragraph?Boolean

Returns:

  • (Boolean)


153
154
155
# File 'lib/resumetools/resume/resume.rb', line 153

def has_paragraph?
  !self.para.blank?
end

#has_periods?Boolean

Returns:

  • (Boolean)


167
168
169
# File 'lib/resumetools/resume/resume.rb', line 167

def has_periods?
  !self.periods.empty?
end

#has_title?Boolean

Returns:

  • (Boolean)


172
173
174
175
# File 'lib/resumetools/resume/resume.rb', line 172

def has_title?
  !self.title.blank?
  
end