For a clean solution gem install hirb. hirb irb pages return values if they are too long.
If you want monkeypatch irb:
module IRB
class Irb
def output_value
@context.last_value.to_s.slice(0, MAX_LEN)
end
end
end
I do not recommend this because it is hackable and breakable anytime gems like ap and hirb are required.
monkeypatching irb, ripl, irb, .
ripl:
require 'ripl'
module Ripl::SlicedInspect
def format_result(result)
result_prompt + result.inspect.slice(MAX_LEN)
end
end
Ripl::Shell.send :include, Ripl::SlicedInspect
~/.riplrc, .