Skip to content

Instantly share code, notes, and snippets.

@Prigin
Created September 25, 2019 01:02
Show Gist options
  • Save Prigin/91bdaf3ff374107ddf2b083c5e23f64d to your computer and use it in GitHub Desktop.
Save Prigin/91bdaf3ff374107ddf2b083c5e23f64d to your computer and use it in GitHub Desktop.
MKDEV
doc = ARGV[0]
def Output (file)
print "[search]> "
@search = gets.chomp # how to avoid THIS?!
file.readlines.each do |line|
line = line.split("|")
if line[1].include?(@search) # how to avoid THIS?!
print line[1] + " | "
puts "*" * (line[7].to_f * 10 - 80)
end
end
end
if doc == nil
File.open("movies.txt") {|file| Output(file)}
elsif File.exist?(doc)
File.open(doc) {|file| Output(file)}
else
puts "no such file"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment