Top Level Namespace

Defined Under Namespace

Modules: Sys

Instance Method Summary collapse

Instance Method Details

#pp(obj, out = STDOUT, width = 79) ⇒ 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: 79)

See Also:



43
44
45
46
47
48
# File 'lib/sys-proc.rb', line 43

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

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