class ResumeTools::Period

Period

Represents a period in the section

Attributes

dtend[RW]

Period end date

dtstart[RW]

Period start date

items[R]

List of items

location[RW]

Period location

organization[RW]

Period organization

title[RW]

Period title

Public Class Methods

new(props={}) click to toggle source
# File lib/resumetools/resume/resume.rb, line 230
def initialize(props={})
  @title = props[:title] || ""
  @location = props[:location] || ""
  @organization = props[:organization] || ""
  @dtstart = props[:dtstart] || nil
  @dtend = props[:dtend] || nil
  @items = Array.new
end

Public Instance Methods

add_item(item) click to toggle source

Adds an item

# File lib/resumetools/resume/resume.rb, line 265
def add_item(item)
  self.items << item
end
create_item(props={}, &block) click to toggle source

Creates an item and adds it to the list

# File lib/resumetools/resume/resume.rb, line 270
def create_item(props={}, &block)
  item = Item.new(props)
  block.call(item) if block
  self.add_item(item)
  item
end
has_dtend?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 256
def has_dtend?
  !self.dtend.blank?
end
has_dtstart?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 252
def has_dtstart?
  !self.dtstart.blank?
end
has_items?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 260
def has_items?
  !self.items.empty?
end
has_location?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 244
def has_location?
  !self.location.blank?
end
has_organization?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 248
def has_organization?
  !self.organization.blank?
end
has_title?() click to toggle source
# File lib/resumetools/resume/resume.rb, line 240
def has_title?
  !self.title.blank?
end
line() click to toggle source

The period details in a single line

# File lib/resumetools/resume/resume.rb, line 278
def line
  elements = []
  elements << self.organization if self.has_organization?
  elements << self.location if self.has_location?
  if self.has_dtstart? && self.has_dtend?
    date = " (#{self.dtstart} - #{self.dtend})"
  elsif self.has_dtstart? || self.has_dtend?
    value = self.has_dtstart? ? self.dtstart : self.dtend
    date = " (#{value})"
  else
    date = ''
  end
  elements.join(", ").concat("#{date}")
end