Module

PP::PPMethods

Inheritance

Constants

Name   Description
InspectKey = :__inspect_key__

Methods

Instance

Visibility Signature
public comma_breakable ()
public guard_inspect_key () {|| ...}
public object_address_group (obj, &block)
public object_group (obj) {|| ...}
public pp (obj)
public pp_hash (obj)
public pp_object (obj)
public seplist (list, sep=nil, iter_method=:each) {|element| ...}

Instance Method Detail

comma_breakable()

A convenience method which is same as follows:

  text ','
  breakable

guard_inspect_key() {|| ...}

object_address_group(obj, &block)

object_group(obj) {|| ...}

A convenience method which is same as follows:

  group(1, '#<' + obj.class.name, '>') { ... }

pp(obj)

Adds obj to the pretty printing buffer using Object#pretty_print or Object#pretty_print_cycle.

Object#pretty_print_cycle is used when obj is already printed, a.k.a the object reference chain has a cycle.

pp_hash(obj)

pp_object(obj)

seplist(list, sep=nil, iter_method=:each) {|element| ...}

Adds a separated list. The list is separated by comma with breakable space, by default.

seplist iterates the list using iter_method. It yields each object to the block given for seplist. The procedure separator_proc is called between each yields.

If the iteration is zero times, separator_proc is not called at all.

If separator_proc is nil or not given, +lambda { comma_breakable }+ is used. If iter_method is not given, :each is used.

For example, following 3 code fragments has similar effect.

  q.seplist([1,2,3]) {|v| xxx v }

  q.seplist([1,2,3], lambda { comma_breakable }, :each) {|v| xxx v }

  xxx 1
  q.comma_breakable
  xxx 2
  q.comma_breakable
  xxx 3