How to force a vertical table or restrict columns in Hirb?

I want to display some active entries in the rails console, I have Hirb enabled. The table is narrow enough to display (therefore, Hirb uses a standard horizontal table), but the columns are so narrow that the content is completely unreadable. Do you know what I can do about it?

Displaying only a few columns would be great (I have entries in a clean array, not in an AR collection, so I can't just pass :select to finder). Forcing Hirb to display entries in a vertical table would also be ideal.

Thanks in advance.

+7
ruby irb
source share
1 answer

If you look at the β€œViews: Anytime, Anywhere” section of hirb readme , you will see that hirb provides you with a table command that allows you to select columns / fields:

 >> extend Hirb::Console => main >> table My_AR_Array, :fields=>[:field1, :another_field, :and_another_one] # ... Displays table with only these three columns 

If you want to include vertical view, read the docs . In particular, find out about the table options (: the vertical is what you want) and find out about hirb config .

In the future, please ask these github questions.

+7
source share

All Articles