Skip to content

Instantly share code, notes, and snippets.

@gallamine
Created January 21, 2012 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gallamine/1654216 to your computer and use it in GitHub Desktop.
Save gallamine/1654216 to your computer and use it in GitHub Desktop.
ruby script to open file and do shiznit
def self.options(filepath)
opts = {}
filepath = filepath.split.join("\n")
begin
File.open(filepath, "r") do |file|
# do stuff
end
rescue Errno::ENOENT
puts "no such file -#{filepath}-"
end
opts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment