Skip to content

Instantly share code, notes, and snippets.

@Nursultan91
Last active February 27, 2018 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nursultan91/74f4e035e396ab47fc8e0b0eaaf4d036 to your computer and use it in GitHub Desktop.
Save Nursultan91/74f4e035e396ab47fc8e0b0eaaf4d036 to your computer and use it in GitHub Desktop.
Второе задание
if ARGV.length != 1
puts "We need exactly one parameter. The name of a file."
exit;
end
filename = ARGV[0]
puts "Going to open '#{filename}'"
fh = open filename
fh.each do |line|
movies = line.split("|")
if movies[1].include? "Max"
rank = (movies[7].to_f*10 - 80).to_i
puts "Title: #{movies[1]}, rank: #{rank.times {print "*"}}"
end
end
fh.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment