Class: Recruit

Inherits:
Object
  • Object
show all
Includes:
Haml, Octopi
Defined in:
lib/recruit.rb

Overview

Follows the builder pattern

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#blogObject (readonly)

Returns the value of attribute blog.



12
13
14
# File 'lib/recruit.rb', line 12

def blog
  @blog
end

#emailObject (readonly)

Returns the value of attribute email.



11
12
13
# File 'lib/recruit.rb', line 11

def email
  @email
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/recruit.rb', line 10

def name
  @name
end

#scopeObject (readonly)

Returns the value of attribute scope.



13
14
15
# File 'lib/recruit.rb', line 13

def scope
  @scope
end

#templateObject

Returns the value of attribute template.



15
16
17
# File 'lib/recruit.rb', line 15

def template
  @template
end

Class Method Details

.create_resume(*args) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/recruit.rb', line 17

def self.create_resume(*args)
  APICache.store=APICache::MemoryStore.new
  recruit = Recruit.new
  recruit.find_user_data(args[0])
  recruit.load_template
  recruit.generate_resume
end

Instance Method Details

#find_user_data(github_user_name) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/recruit.rb', line 25

def find_user_data(github_user_name)
  user = User.find(github_user_name)

  @scope = {
    :name => user.name,
    :email => user.email,
    :blog_url => user.blog
  }
end

#generate_resumeObject



39
40
41
# File 'lib/recruit.rb', line 39

def generate_resume
  Engine.new(@template).render(@scope)
end

#load_templateObject



35
36
37
# File 'lib/recruit.rb', line 35

def load_template
    @template = File.open(File.join(File.dirname(__FILE__), 'templates', 'default.haml')).read
end