Skip to content

Instantly share code, notes, and snippets.

@Prigin
Last active September 25, 2019 14:11
Show Gist options
  • Save Prigin/a3ccc9d8782eb667dc15bf2932c3116b to your computer and use it in GitHub Desktop.
Save Prigin/a3ccc9d8782eb667dc15bf2932c3116b to your computer and use it in GitHub Desktop.
variant 3 (fixed)
doc = ARGV[0]
doc = "movies.txt" if doc == nil
unless File.exist?(doc)
puts "no such file"
exit
end
print "[search]> "; search = "Max"; puts search
File.foreach(doc) do |line|
line = line.split("|")
if line[1].include?(search)
print line[1] + " | "
puts "*" * (line[7].to_f * 10 - 80)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment