Class: Megatest::PrettyPrint
- Inherits:
-
Object
- Object
- Megatest::PrettyPrint
- Defined in:
- lib/megatest/pretty_print.rb
Defined Under Namespace
Classes: Printer
Instance Method Summary collapse
-
#initialize(config) ⇒ PrettyPrint
constructor
A new instance of PrettyPrint.
- #pretty_print(object) ⇒ Object (also: #pp)
Constructor Details
#initialize(config) ⇒ PrettyPrint
Returns a new instance of PrettyPrint.
285 286 287 |
# File 'lib/megatest/pretty_print.rb', line 285 def initialize(config) @config = config end |
Instance Method Details
#pretty_print(object) ⇒ Object Also known as: pp
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
# File 'lib/megatest/pretty_print.rb', line 291 def pretty_print(object) case object when Exception [ "Class: <#{pp(object.class)}>", "Message: <#{object..inspect}>", "---Backtrace---", *@config.backtrace.clean(object.backtrace), "---------------", ].join("\n") else out = "".dup Printer.pp(object, out) out.strip end end |