123456789_123456789_123456789_123456789_123456789_

Class: DEBUGGER__::LimitedPP

Relationships & Source Files
Inherits: Object
Defined in: lib/debug/session.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(max) ⇒ LimitedPP

[ GitHub ]

  
# File 'lib/debug/session.rb', line 2345

def initialize max
  @max = max
  @cnt = 0
  @buf = String.new
end

Class Method Details

.pp(obj, max = 80)

[ GitHub ]

  
# File 'lib/debug/session.rb', line 2335

def self.pp(obj, max=80)
  out = self.new(max)
  catch out do
    PP.singleline_pp(obj, out)
  end
  out.buf
end

Instance Attribute Details

#buf (readonly)

[ GitHub ]

  
# File 'lib/debug/session.rb', line 2343

attr_reader :buf

Instance Method Details

#<<(other)

[ GitHub ]

  
# File 'lib/debug/session.rb', line 2351

def <<(other)
  @buf << other

  if @buf.size >= @max
    @buf = @buf[0..@max] + '...'
    throw self
  end
end