-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path65_face_to_file.rb
27 lines (24 loc) · 964 Bytes
/
65_face_to_file.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
file_path = File.dirname(__FILE__)
if File.exist?(file_path + "/modules/data/55_hair.txt") &&
File.exist?(file_path + "/modules/data/55_eyes.txt") &&
File.exist?(file_path + "/modules/data/55_noses.txt")
File.exist?(file_path + "/modules/data/55_eyes.txt") &&
File.exist?(file_path + "/modules/data/55_mouths.txt")
hair = File.readlines(file_path + "/modules/data/55_hair.txt")
eyes = File.readlines(file_path + "/modules/data/55_eyes.txt")
noses = File.readlines(file_path + "/modules/data/55_noses.txt")
mouths = File.readlines(file_path + "/modules/data/55_mouths.txt")
time = Time.now
file_name = "face_#{time.strftime("%d-%m-%Y")}_#{time.strftime("%H:%M")}"
file_face = File.new(file_path + "/modules/data/faces/#{file_name}.txt", "a")
file_face.puts "
#{hair.sample.chomp}
/ \\
#{eyes.sample.chomp}
#{noses.sample.chomp}
#{mouths.sample.chomp}
\\_____/"
file_face.close
else
puts "Files not found"
end