Hirb - "Too many fields ..." only when loading from irbrc (not directly in the console)

I am trying to configure Hirb on my console.

When I print:

require 'hirb'
Hirb.enable

My (rather large) table prints fine (with abbreviated column names). However, I want to automatically download this (and other gems) whenever I download rails c, so I edited my.irbc

  if Rails.env
    require 'rubygems'
    require 'hirb'
    Hirb.enable

    require 'wirble'
    Wirble.init
    Wirble.colorize

    require 'awesome_print'
  end

When I run the same command from the console (Account.all), I get an error message:

Too many fields for the current width. Configure your width and/or fields to avoid this error. Defaulting to a vertical table

Any ideas why? I really like Hirb, but I'm too lazy to manually turn it on every time I load the console

+5
source share
1 answer

I managed to fix it. It turns out when I was running:

Hirb::View.width

( Hirb .irbrc), , - , Hirb .

.irbrc, :

require 'hirb'
Hirb.enable({:width => 155, :height => 500})

+6

All Articles