This post originated from an RSS feed registered with Ruby Buzz
by Jan Lelis.
Original Post: Small Ruby CLI Improvements (Part 3): Hirb vs. Unicode
Feed Title: rbJ*_*L.net
Feed URL: http://feeds.feedburner.com/rbJL
Feed Description: Hi, I am a fan of Ruby and like to explore it and the world around ;).
So I started this blog, where I am publishing code snippets, tutorials for beginners as well as general thoughts about Ruby, the web or programming in general.
Hirb: “A mini view framework for console/irb that’s easy to use, even while under its influence. Console goodies include a no-wrap table, auto-pager, tree and menu.” now supports unicode in two ways:
┌───────────────────────────────────────────┬───────────────────────────────────────────────────┐
│ Support for unicode full-width characters │ Unicode table characters instead of + and - chars │
└───────────────────────────────────────────┴───────────────────────────────────────────────────┘
Nice unicode-drawn tables
You need to upgrade to hirb 0.4.0 to use this new feature: You can pass an :unicode => true option to your tables to get them unicodized. To automatically use it for all your tables, you can put the following statement in your ~/.irbrc:
If you were experiencing wrong table sizes, you can now use hirb-unicode (thanks to miaout17). It patches the original hirb gem with the right unicode-display_width. Unfortunately, it can be slow under some circumstances, but this may be improved with future versions of unicode-display_width.