Recently, I had a chance to do a bit of work on the two gems that I currently maintain (tco and word_wrap). I pushed a few minor updates to both, and in this short post, I would like to sum up what has changed.
Unfortunately, the first release of
tco came with a nasty little error that
made the majority of users unable to display their palette using the
option. The bug showed up only when you forgot to configure the ANSI part of
the palette. While the issue was very quickly discovered and
Brandon on GitHub, it took me quite a
while to fix. However, it has now been
Apart from that, Hannes added a simpler
of reconfiguring the library through passing a block to the
method, rather than calling
#reconfigure. I like this approach much better
than the original one.
After a short while of working on
tco, I moved on to the word_wrap
gem to make a few improvements there
ww is quite a simple utility, I find it to be very useful when
manipulating plain text documents, such as blog posts or READMEs. You can get
more information about this gem from one of my previous
posts on this website, if
But one thing that really bothered me was the fact that the output was always
printed to stdout. That way, it wasn’t possible to edit a file in-place
(since you can’t be reading and writing to the same file at the same time). To
help with this, I added the
--in-place) option, which will make
ww save the modified contents back to the original file. One might argue,
that it is somewhat less secure, because it doesn’t force you to make a backup
of the file, but it is way more convenient if you know what you’re doing.
The other change is not related to the
ww utility directly, but in case
you’re using the
word_wrap library in your gems, you can now take advantage
#fit! functions that will modify the string in place,
rather than returning a modified copy.
These were not big changes, but I hope they make the gems more stable and easier to use. Special thanks goes to Brandon, Hannes, Chip, and Jikku, who helped me and contributed to one of the two projects.
If you have any questions, comments, suggestions, or problems, please let me know, I’ll be happy to help you :-).