2010-12-09 00:59:30 +00:00
|
|
|
require 'readline'
|
|
|
|
|
2010-12-13 12:33:05 +00:00
|
|
|
class Pry
|
2010-12-09 00:59:30 +00:00
|
|
|
class Input
|
2010-12-15 04:56:06 +00:00
|
|
|
trap('INT') { exit }
|
|
|
|
|
2010-12-09 00:59:30 +00:00
|
|
|
def read(prompt)
|
|
|
|
Readline.readline(prompt, true)
|
|
|
|
end
|
|
|
|
end
|
2010-12-14 10:54:26 +00:00
|
|
|
|
2010-12-25 14:18:30 +00:00
|
|
|
class FileInput
|
|
|
|
def initialize(file, line = 1)
|
2010-12-14 10:54:26 +00:00
|
|
|
@f = File.open(file)
|
|
|
|
(line - 1).times { @f.readline }
|
|
|
|
end
|
|
|
|
|
|
|
|
def read(prompt)
|
|
|
|
@f.readline
|
|
|
|
end
|
|
|
|
end
|
2010-12-09 00:59:30 +00:00
|
|
|
end
|