Sha256: 07338b8f0943c58d6d13fde4edf82a8359aef6c2faa9425c320bbf30177f371b

Contents?: true

Size: 333 Bytes

Versions: 5

Compression:

Stored size: 333 Bytes

Contents

module PryMoves::Painter

  class Canvas < String

    def <<(text)
      if length > 2000
        super("... (cut)")
        throw :cut
      end
      super
    end

  end

  def self.colorize(obj)
    colored_str = Canvas.new
    catch (:cut) do
      Pry::ColorPrinter.pp obj, colored_str
    end
    colored_str.chomp
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pry-moves-0.1.9 lib/pry-moves/painter.rb
pry-moves-0.1.8 lib/pry-moves/painter.rb
pry-moves-0.1.7 lib/pry-moves/painter.rb
pry-moves-0.1.6 lib/pry-moves/painter.rb
pry-moves-0.1.5 lib/pry-moves/painter.rb