iruby icon indicating copy to clipboard operation
iruby copied to clipboard

Limit output if it gets out of hand

Open v0dro opened this issue 8 years ago • 2 comments

If you try to put something like NMatrix.new([1600,1600], [1]*1600*1600) into iruby, it usually crashes on my computer.

Limiting the output of exponentially large to print objects might prove beneficial. We can have some kind of an option with which users can toggle this behavior.

v0dro avatar Jun 03 '16 10:06 v0dro

Could we wrap NMatrix output in an IRuby::Table? By default, a table will only display the first and last n rows.

I'm not really sure how to limit output in a general way. My only thought is to wrap all output in a Javascript that hides output after n bytes or lines with a "More output" button that displays a further n bytes or lines when you click it. That might help a lot since your browser can usually hold all the output in memory no problem, it just struggles to render it.

kylekyle avatar Jun 03 '16 14:06 kylekyle

Ah if it's just a rendering issue then I'd go with the 'more output' option. That way it can universally apply to all sorts of objects.

v0dro avatar Jun 03 '16 19:06 v0dro