Class: DEBUGGER__::LimitedPP
Instance Attribute Summary collapse
-
#buf ⇒ Object
readonly
Returns the value of attribute buf.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(other) ⇒ Object
-
#initialize(max) ⇒ LimitedPP
constructor
A new instance of LimitedPP.
Constructor Details
#initialize(max) ⇒ LimitedPP
Returns a new instance of LimitedPP.
2353 2354 2355 2356 2357 |
# File 'lib/debug/session.rb', line 2353 def initialize max @max = max @cnt = 0 @buf = String.new end |
Instance Attribute Details
#buf ⇒ Object (readonly)
Returns the value of attribute buf.
2351 2352 2353 |
# File 'lib/debug/session.rb', line 2351 def buf @buf end |
Class Method Details
.pp(obj, max = 80) ⇒ Object
2343 2344 2345 2346 2347 2348 2349 |
# File 'lib/debug/session.rb', line 2343 def self.pp(obj, max=80) out = self.new(max) catch out do PP.singleline_pp(obj, out) end out.buf end |
Instance Method Details
#<<(other) ⇒ Object
2359 2360 2361 2362 2363 2364 2365 2366 |
# File 'lib/debug/session.rb', line 2359 def <<(other) @buf << other if @buf.size >= @max @buf = @buf[0..@max] + '...' throw self end end |