Skip to content

Instantly share code, notes, and snippets.

@mpapis
Forked from headius/gist:1706818
Created January 30, 2012 21:29
Show Gist options
  • Save mpapis/1706827 to your computer and use it in GitHub Desktop.
Save mpapis/1706827 to your computer and use it in GitHub Desktop.
require 'tempfile'
file = Tempfile.new(['','blah'])
file.open
file.write "\n"
file.close
line = File.read(file.path)
line.strip!
puts "match:#{line =~ /^$/}:"
p line
END {
file.unlink
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment