Open brunzino opened 10 years ago
You can get this by using #ai, e.g.
File.open('/dev/tty', 'w') { |h| h.puts "\e[33;1mHERE!\e[0m #{__FILE__}:#{__LINE__} #{thingy.ai}" }
Note that it uses ANSI escape sequences to highlight "HERE!" to separate it from the rest of program output.
I've got a Vim abbreviation for Ruby files that sticks the beginning part of this in:
autocmd FileType ruby inoreabbrev <buffer> tty; File.open('/dev/tty', 'w') { \|h\| h.puts "\e[33;1mHERE!\e[0m #{__FILE__}:#{__LINE__}" }<ESC>3h
It'd be nice if there was an option for the output to include the line number and file name where the 'ap' command was issued. Just for quick reference if many prints are happening or in case you forget to remove it after debugging, don't have to go searching for it.
Love awesome_print!