Class: Resume::Resume::ResumeHandler

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResumeHandler

Returns a new instance of ResumeHandler.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/resume.rb', line 34

def initialize
  @about = {}
  @schools = []
  @jobs = []
  @sections = []

  [:name, :email, :address, :url, :phone].each do |field|
    self.class.class_eval do
      define_method field do |value|
        @about[field] = value
      end
    end
  end
end

Instance Attribute Details

#aboutObject (readonly)

Returns the value of attribute about.



32
33
34
# File 'lib/resume.rb', line 32

def about
  @about
end

#jobsObject (readonly)

Returns the value of attribute jobs.



32
33
34
# File 'lib/resume.rb', line 32

def jobs
  @jobs
end

#schoolsObject (readonly)

Returns the value of attribute schools.



32
33
34
# File 'lib/resume.rb', line 32

def schools
  @schools
end

#sectionsObject (readonly)

Returns the value of attribute sections.



32
33
34
# File 'lib/resume.rb', line 32

def sections
  @sections
end

Instance Method Details

#education(&block) ⇒ Object



49
50
51
52
53
# File 'lib/resume.rb', line 49

def education &block
  sh = sub_handler [:school, :finished, :will_finish, :degree, :city]
  block.arity < 1 ? sh.instance_eval(&block) : block.call(sh)
  @schools << sh.data
end

#job(&block) ⇒ Object



55
56
57
58
59
# File 'lib/resume.rb', line 55

def job &block
  sh = sub_handler [:position, :employer, :city, :date, :description]
  block.arity < 1 ? sh.instance_eval(&block) : block.call(sh)
  @jobs << sh.data
end

#section(&block) ⇒ Object



61
62
63
64
65
# File 'lib/resume.rb', line 61

def section &block
  sh = sub_handler [:name, :text, :bullets]
  block.arity < 1 ? sh.instance_eval(&block) : block.call(sh)
  @sections << sh.data
end