Class: PP
- Includes:
- PPMethods
- Defined in:
- lib/pp-colour/temp.rb
Defined Under Namespace
Modules: ObjectMixin, PPMethods Classes: SingleLine
Constant Summary
Constants included from PPMethods
Class Attribute Summary collapse
-
.sharing_detection ⇒ Object
Returns the sharing detection flag as a boolean value.
Class Method Summary collapse
-
.mcall(obj, mod, meth, *args, &block) ⇒ Object
:stopdoc:.
-
.pp(obj, out = $>, width = 79) ⇒ Object
Outputs
obj
toout
in pretty printed format ofwidth
columns in width. -
.singleline_pp(obj, out = $>) ⇒ Object
Outputs
obj
toout
like PP.pp but with no indent and newline.
Methods included from PPMethods
#comma_breakable, #guard_inspect_key, #object_address_group, #object_group, #pp, #pp_hash, #pp_object, #seplist
Class Attribute Details
.sharing_detection ⇒ Object
Returns the sharing detection flag as a boolean value. It is false by default.
86 87 88 |
# File 'lib/pp-colour/temp.rb', line 86 def sharing_detection @sharing_detection end |
Class Method Details
.mcall(obj, mod, meth, *args, &block) ⇒ Object
:stopdoc:
77 78 79 |
# File 'lib/pp-colour/temp.rb', line 77 def PP.mcall(obj, mod, meth, *args, &block) mod.instance_method(meth).bind(obj).call(*args, &block) end |
.pp(obj, out = $>, width = 79) ⇒ Object
Outputs obj
to out
in pretty printed format of width
columns in width.
If out
is omitted, $> is assumed. If width
is omitted, 79 is assumed.
PP.pp returns out
.
56 57 58 59 60 61 62 63 |
# File 'lib/pp-colour/temp.rb', line 56 def PP.pp(obj, out=$>, width=79) q = PP.new(out, width) q.guard_inspect_key {q.pp obj} q.flush #$pp = q out << "\n" out end |
.singleline_pp(obj, out = $>) ⇒ Object
Outputs obj
to out
like PP.pp but with no indent and newline.
PP.singleline_pp returns out
.
69 70 71 72 73 74 |
# File 'lib/pp-colour/temp.rb', line 69 def PP.singleline_pp(obj, out=$>) q = SingleLine.new(out) q.guard_inspect_key {q.pp obj} q.flush out end |