Skip to content

Instantly share code, notes, and snippets.

@will
Forked from schneems/gist:96cc971fd8e7f2180dd6
Created May 8, 2014 19:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save will/fd6b3311516f070073e7 to your computer and use it in GitHub Desktop.
Save will/fd6b3311516f070073e7 to your computer and use it in GitHub Desktop.
module Kernel
alias :old_puts :puts
def puts(val)
old_puts val
split = caller.first.split(':')
yolo(split[0], split[1].to_i)
end
private
def yolo(filename, line_number)
f = File.new(filename, 'r+')
f.each_with_index do |line, i|
if i == line_number-1
f.seek(-line.length, IO::SEEK_CUR)
f.write(' ' * (line.length - 1))
f.write("\n")
end
end
f.close
end
end
puts 'what'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment