The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Small Ruby CLI Improvements (Part 3): Hirb vs. Unicode

0 replies.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a flat view of this topic  Flat View
Previous Topic   Next Topic
Threaded View: This topic has 0 replies on 1 page
Jan Lelis

Posts: 136
Nickname: rbjl
Registered: Aug, 2009

Jan Lelis is an IT student from Dresden/Germany
Small Ruby CLI Improvements (Part 3): Hirb vs. Unicode Posted: Feb 23, 2011 5:28 PM
Reply to this message Reply

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.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Jan Lelis
Latest Posts From rbJ*_*L.net

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:

Hirb::View.formatter.add_view 'Object', :ancestor => true, :options => { :unicode => true }

Irbtools users just need to upgrade to 0.8.6.

Btw, if you don’t like the ╎ gaps, you can customize the used characters with:

Hirb::Helpers::UnicodeTable::CHARS[:bottom][:vertical][:inside] = '│'

Full-width characters

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.

CC-BY (DE)

Read: Small Ruby CLI Improvements (Part 3): Hirb vs. Unicode


Topic: Small Ruby CLI Improvements (Part 3): Hirb vs. Unicode Previous Topic   Next Topic Topic: Ruby, OSC, and SooperLooper

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use