Guest User

Untitled

a guest
Jun 20th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. # In this file we define the methods to help filter out candidates
  2. # This way, we keep these methods separated from other potential parts of the program
  3.  
  4. def find(id)
  5. check = @candidates.find {|cand| cand[:id] == id}
  6. return check
  7. end
  8.  
  9. def experienced?(candidate)
  10. if candidate[:years_of_experience] >= 2
  11. puts true
  12. else
  13. puts false
  14. end
  15. end
  16.  
  17. def qualified_candidates(candidates)
  18. check = candidates.find_all {|cand| cand[:years_of_experience] >= 2 && cand[:github_points] >= 100 && cand[:age] > 17 && cand[:date_applied] >= 15.days.ago.to_date && (cand[:languages].include?("Python") || cand[:languages].include?("Ruby"))}
  19. puts check
  20. end
  21.  
  22. def ordered_by_qualifications(candidates)
  23. ordered = candidates.sort_by { |i| [i[:years_of_experience], i[:github_points]] }
  24. return ordered.reverse
  25. end
  26.  
  27.  
  28.  
  29.  
  30. # More methods will go below
Add Comment
Please, Sign In to add comment