Class: PP
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.
Attributes inherited from PrettyPrint
#genspace, #group_queue, #indent, #maxwidth, #newline, #output
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
#check_inspect_key, #comma_breakable, #guard_inspect_key, #object_address_group, #object_group, #pop_inspect_key, #pp, #pp_hash, #pp_object, #push_inspect_key, #seplist
Methods inherited from PrettyPrint
#break_outmost_groups, #breakable, #current_group, #fill_breakable, #first?, #flush, format, #group, #group_sub, #initialize, #nest, singleline_format, #text
Constructor Details
This class inherits a constructor from PrettyPrint
Class Attribute Details
.sharing_detection ⇒ Object
Returns the sharing detection flag as a boolean value. It is false by default.
480 481 482 |
# File 'lib/extensions/mspec/mspec/pp.rb', line 480 def sharing_detection @sharing_detection end |
Class Method Details
.mcall(obj, mod, meth, *args, &block) ⇒ Object
:stopdoc:
471 472 473 |
# File 'lib/extensions/mspec/mspec/pp.rb', line 471 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
.
451 452 453 454 455 456 457 |
# File 'lib/extensions/mspec/mspec/pp.rb', line 451 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" end |
.singleline_pp(obj, out = $>) ⇒ Object
Outputs obj
to out
like PP.pp but with no indent and newline.
PP.singleline_pp returns out
.
463 464 465 466 467 468 |
# File 'lib/extensions/mspec/mspec/pp.rb', line 463 def PP.singleline_pp(obj, out=$>) q = SingleLine.new(out) q.guard_inspect_key {q.pp obj} q.flush out end |