module PP::PPMethods
Module that defines helper methods for pretty_print.
Public Instance Methods
(_PrettyPrint id) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/pp/0/pp.rbs, line 96
def check_inspect_key: (_PrettyPrint id) -> bool
Check whether the object_id id is in the current buffer of objects to be pretty printed. Used to break cycles in chains of objects to be pretty printed.
() → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/pp/0/pp.rbs, line 155
def comma_breakable: () -> void
A convenience method which is same as follows:
text ',' breakable
() { () → untyped } → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/pp/0/pp.rbs, line 86
def guard_inspect_key: () { () -> untyped } -> void
Yields to a block and preserves the previous set of objects being printed.
(untyped obj) { () → untyped } → Integer
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/pp/0/pp.rbs, line 144
def object_address_group: (untyped obj) { () -> untyped } -> Integer
A convenience method, like object_group, but also reformats the Object’s object_id.
(untyped obj) { () → untyped } → Integer
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/pp/0/pp.rbs, line 135
def object_group: (untyped obj) { () -> untyped } -> Integer
A convenience method which is same as follows:
group(1, '#<' + obj.class.name, '>') { ... }
(_PrettyPrint id) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/pp/0/pp.rbs, line 113
def pop_inspect_key: (_PrettyPrint id) -> void
Removes an object from the set of objects being pretty printed.
(_PrettyPrint obj) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/pp/0/pp.rbs, line 125
def pp: (_PrettyPrint obj) -> untyped
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.
(untyped obj) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/pp/0/pp.rbs, line 201
def pp_hash: (untyped obj) -> untyped
A pretty print for a Hash
(untyped obj) → untyped
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/pp/0/pp.rbs, line 193
def pp_object: (untyped obj) -> untyped
A present standard failsafe for pretty printing any given Object
(_PrettyPrint id) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/pp/0/pp.rbs, line 105
def push_inspect_key: (_PrettyPrint id) -> void
Adds the object_id id to the set of objects being pretty printed, so as to not repeat objects.
(untyped list, ?(^() → void)? sep, ?interned iter_method) { (*untyped, **untyped) → void } → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/pp/0/pp.rbs, line 185
def seplist: (untyped list, ?(^() -> void)? sep, ?interned iter_method) { (*untyped, **untyped) -> void } -> void
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 { q.comma_breakable }, :each) {|v| xxx v } xxx 1 q.comma_breakable xxx 2 q.comma_breakable xxx 3