TalkingQuickly's Today I Learned

2 posts about #ruby

CTags Ruby and Vim

To get jumping to a class definition working in vim when writing ruby, use https://github.com/tmm1/ripper-tags

Out of the box it won't generated nested classes, e.g. Module::Class just Module and Class which will break if you have lots of identically named classes in individual modules. To fix this you need --extra=q so the full command is:

ripper-tags -R --exclude=vendor --exclude=chef --extra=q

You can then use v to enter visual mode after the leading :: of a definition, w to move to the end of it and then ctrl + ] to jump to the definition of a given class.

Passing multiple strings to `puts` in Ruby

If you pass multiple string arguments to puts, it prints each on a new line, e.g:

puts "hello", "world"

Would output hello and world on separate lines.