Method: PP::ObjectMixin#pretty_print_inspect
- Defined in:
- lib/pp.rb
#pretty_print_inspect ⇒ Object
Is #inspect implementation using #pretty_print. If you implement #pretty_print, it can be used as follows.
alias inspect pretty_print_inspect
However, doing this requires that every class that #inspect is called on implement #pretty_print, or a RuntimeError will be raised.
322 323 324 325 326 327 |
# File 'lib/pp.rb', line 322 def pretty_print_inspect if Object.instance_method(:method).bind_call(self, :pretty_print).owner == PP::ObjectMixin raise "pretty_print is not overridden for #{self.class}" end PP.singleline_pp(self, ''.dup) end |