Skip to content

Instantly share code, notes, and snippets.

@daniellockard
Created December 13, 2015 06:42
Show Gist options
  • Save daniellockard/e8b73fa4cd49ec473ae0 to your computer and use it in GitHub Desktop.
Save daniellockard/e8b73fa4cd49ec473ae0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
file = "./testfile"
begin
contents = IO.readlines(file)[0].to_i
rescue
puts "Error"
end
if !contents.is_a? Integer || contents.nil? || contents.empty?
contents = "thing"
end
puts contents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment