Top Level Namespace

Defined Under Namespace

Modules: Sys

Instance Method Summary collapse

Instance Method Details

#pp(obj, out = STDOUT, width = nil) ⇒ Object

Outputs obj to out in pretty printed format of width columns in width.

If out is omitted, STDOUT is assumed. If width is omitted, 79 is assumed.

Parameters:

  • obj (Object)
  • out (IO) (defaults to: STDOUT)
  • width (Fixnum) (defaults to: nil)

See Also:



34
35
36
37
38
39
# File 'lib/sys-proc.rb', line 34

def pp(obj, out = STDOUT, width = nil)
  args = [obj, out, width].compact
  colorable = (out.isatty and Kernel.const_defined?('Pry::ColorPrinter'))

  (colorable ? Pry::ColorPrinter : PP).pp(*args)
end