Skip to content

Instantly share code, notes, and snippets.

@Prigin
Created September 25, 2019 12:31
Show Gist options
  • Save Prigin/41a133ae9d66d685f52e3c38b0f790dd to your computer and use it in GitHub Desktop.
Save Prigin/41a133ae9d66d685f52e3c38b0f790dd to your computer and use it in GitHub Desktop.
variant 1 (works)
doc = ARGV[0]
print "[search]> "
search = gets.chomp
if doc
if File.exist?(doc)
file = File.open(doc)
else
puts "no such file"
end
else
file = File.open("movies.txt")
end
file.readlines.each{|line|
line = line.split("|")
if line[1].include?(search)
puts line[1]
puts "*" * (line[7].to_f * 10 - 80).to_i
end
}
file.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment