Skip to content

Instantly share code, notes, and snippets.

@retrography
Created May 8, 2014 18:13
Show Gist options
  • Save retrography/00c73ca458f5f8bc6b54 to your computer and use it in GitHub Desktop.
Save retrography/00c73ca458f5f8bc6b54 to your computer and use it in GitHub Desktop.
This is the shortest way of opening a text file in Ruby and transferring its whole content to a single string variable.
#!/usr/bin/env ruby
s = IO.read(ARGV.first)
puts s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment