Skip to content

Instantly share code, notes, and snippets.

@skylerto
Created October 25, 2016 14:56
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 skylerto/7e411abb78641757265b47af5e899dd0 to your computer and use it in GitHub Desktop.
Save skylerto/7e411abb78641757265b47af5e899dd0 to your computer and use it in GitHub Desktop.
module Util
class << self
def first_line file_name
File.open(file_name, 'r') do |f|
p f.gets
end
rescue Errno::ENOENT => ex
handle_error(ex)
end
def handle_error ex
p "Do the file creation: #{ex.to_s}"
end
end
end
Util.first_line 'version.txt'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment