[ruby-list:40650] [Job] Ruby開発者(東京)
From:
"Zev Blut" <rubyzbibd@...>
Date:
2005-03-07 14:53:34 UTC
List:
ruby-list #40650
#!/usr/bin/env ruby
# これは求人情報ですので注意してください。
# もし興味があるようでしたら、このファイルを実行するか読んでください。
# コメントや入力処理は意図的に省略しています。
class Company
attr_accessor :name, :location, :web_site, :description
attr_accessor :available_jobs
def initialize(name = nil, location = nil, web_site = nil)
self.name = name
self.location = location
self.web_site = web_site
self.available_jobs = Array.new
end
def ask_for_interview?(job_applicant)
available_jobs.each do |ajob|
return true if ajob.meets_requirements?(job_applicant)
end
false
end
def describe
puts "会社名 : #{name}"
puts "場所 : #{location}"
puts "ホームページ : #{web_site}"
puts "簡単な説明 : "
puts description, ""
end
def announce_job_availability(good_match, not_so_good_match)
return if available_jobs.empty?
describe
puts "募集職種:"
available_jobs.each_with_index do |job, idx|
puts "", "#{idx + 1} ) #{job.name}", job.description, ""
end
job_applicant = ask_for_job_applicant_information
return if job_applicant.nil?
if ask_for_interview?( job_applicant )
puts good_match
else
puts not_so_good_match
end
end
def ask_for_job_applicant_information
job_applicant = nil
puts "この仕事に応募しますか? Y/N"
res = gets.chomp
if res =~ /Y/i
msg = "ありがとうございます。 ご希望の職種があるようでしたら、プロン
プトに続いてプロフィールを入力してください。"
puts msg, ""
job_applicant = JobApplicant.new_from_interactive_shell
else
puts "このプログラムを実行して頂きありがとうございました。"
end
job_applicant
end
end
class Job
attr_accessor :name, :description, :requirements, :threshold
def initialize(name = nil, description = nil,
threshold = 100, requirements = [] )
self.name = name
self.description = description
self.requirements = requirements
self.threshold = threshold
end
def meets_requirements?(job_applicant)
points = 0
requirements.each do |req|
points += req.check_requirement(job_applicant)
end
points >= threshold
end
end
class JobApplicant
attr_accessor :name, :resume, :location
attr_accessor :spoken_languages, :computer_languages_skills
def initialize
self.spoken_languages = Array.new
self.computer_languages_skills = Array.new
end
def JobApplicant.new_from_interactive_shell
applicant = JobApplicant.new
puts "氏名:"
applicant.name = gets.chomp
puts "住所(市町村名,国名):"
applicant.location = gets.chomp
note = " [一行毎に内容を入力してください. CTRL-Dで入力停止] "
puts "話せる言語", note
applicant.spoken_languages = readlines.map { |d| d.chomp }
cq1 = "使えるコンピュータ言語は何ですか?"
cq2 = "それとほかのコンピュータスキルをお持ちですか?"
puts cq1, cq2, note
applicant.computer_languages_skills = readlines.map {|d| d.chomp }
puts ""
applicant
end
end
class Requirement
def initialize(points = 1, &proc)
@points = points
if proc
@requirement_calc = proc
else
@requirement_calc = Proc.new { |x| true }
end
end
def check_requirement(job_applicant)
points = 0
if @requirement_calc.call(job_applicant)
points = @points
end
points
end
end
ubit = Company.new("株式会社ユビキタス・ビジネステクノロジー",
"東京都文京区本郷3-42-5 ボア本郷ビル2F", "http://ubit.com")
ubit.description =<<EOF
ユビキタス・ビジネステクノロジー(通称、ユービット)tは日本と海外市場に
おいて携帯向けコンテンツサービスとコンテンツアグリゲーションに力を
いれている日本の会社です。
EOF
developer = Job.new("ソフトウェア開発者")
developer.description =<<EOF
私たちの製品プラットホームの内部動作に精通していただき、他の開発者と共に
新機能を追加し、現在の機能を改良して頂きます。
理想としては、動的環境の元で働くことができ、コミュニケーション力のある方。
EOF
loose_find = lambda do |data, reg_match|
data.find { |v| v =~ match }
end
reqs = Array.new
reqs<< Requirement.new(25) do |ja|
ja.spoken_languages.include?("英語")
end
reqs<< Requirement.new(25) do |ja|
ja.spoken_languages.include?("日本語")
end
reqs<< Requirement.new(5) do |ja|
sub = ["英語", "日本語"]
(ja.spoken_languages - sub).size > 0
end
reqs<< Requirement.new(50) do |ja|
ja.computer_languages_skills.include?("Ruby")
end
reqs<< Requirement.new(25) do |ja|
ja.computer_languages_skills.include?("データベース")
end
reqs<< Requirement.new(10) do |ja|
ja.computer_languages_skills.include?("携帯")
end
reqs<< Requirement.new(5) do |ja|
ja.computer_languages_skills.include?("*NIX")
end
reqs<< Requirement.new(5) do |ja|
(ja.computer_languages_skills - ["Ruby", "データベース"]).size > 0
end
reqs<< Requirement.new(25) do |ja|
ja.location =~ /Japan/i
end
developer.requirements = reqs
developer.threshold = 125
ubit.available_jobs<< developer
good_match =<<EOF
あなたのプロフィールは、期待できます。
私たちと一緒に働くことに興味があるなら、 Zev Blut(rubyzbibd@ubit.com) に
履歴書を送ってください。
EOF
nsgm =<<EOF
すみません、プロフィールではあなたは私たちが必要とするスキルをお持ちで
無いようです。しかし、あなたは十分なスキルを持っているとお考えのときは、
Zev Blut(rubyzbibd@ubit.com) に履歴書を送ってください。
EOF
ubit.announce_job_availability(good_match,nsgm)