Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Read from file (slurp)

  • read

  • slurp

  • Read the content of the whole file

  • Raise exception File::NotFoundError if file does not exist

if ARGV.size != 1
  puts "Need a filename on the command line"
  exit 1
end
filename = ARGV[0]

content = File.read(filename)

puts content