Sha256: d1a7c0ffd7a02a233320bfe26eb23ba60c9b0e2e1dcde0ed7a02d73e4b5b3551
Contents?: true
Size: 362 Bytes
Versions: 4
Compression:
Stored size: 362 Bytes
Contents
module FancyIrb module SizeDetector extend self def width_of(data) Unicode::DisplayWidth.of(Paint.unpaint(data.to_s)) end def height_of(data, width) data = data.to_s long_lines = data.split("\n").inject(0){ |sum, line| sum + width_of(line) / (width + 1) } data.count("\n") + long_lines end end end
Version data entries
4 entries across 4 versions & 1 rubygems