Bug #7656

Handful of documentations

Added by Vincent Batts over 1 year ago. Updated about 1 year ago.

[ruby-core:51253]
Status:Closed
Priority:Normal
Assignee:Zachary Scott
Category:doc
Target version:2.0.0
ruby -v:ruby 2.0.0dev (2012-12-08) [i686-linux] Backport:

Description

This fixes documentation in ENV, adds a little for debug.rb, and completes PP

ruby-docs-201301_PP-Debug-ENV.patch Magnifier - documentation against 902a36c1f6157385fc8cd914f3c8824017efbfeb (6.06 KB) Vincent Batts, 01/06/2013 06:14 AM

ruby-docs_PrettyPrint-PP_20130206.patch Magnifier - PrettyPrint and PP documentation (14.8 KB) Vincent Batts, 02/07/2013 02:52 PM

Associated revisions

Revision 39180
Added by Zachary Scott about 1 year ago

  • lib/pp.rb, lib/prettyprint.rb: Documentation for PP and PrettyPrint Based on a patch by Vincent Batts [Bug #7656]

History

#1 Updated by Zachary Scott over 1 year ago

Awesome, thank you!!

#2 Updated by Vincent Batts about 1 year ago

Is there anything I can do better?

#3 Updated by Zachary Scott about 1 year ago

vbatts (Vincent Batts) wrote:

Is there anything I can do better?

These are good, for small changes I don't mind grouping them into one patch, though I'll probably commit them separately.

I noticed a few small spelling errors, like usage vs useage, but nothing I can't handle myself.

Sorry for dragging my feet on these, but you're doing a good job Vincent. Thank you!

#4 Updated by Zachary Scott about 1 year ago

  • Status changed from Open to Feedback
  • Assignee changed from Zachary Scott to Vincent Batts

Hello Vincent,

I've committed your patch for lib/debug. as r39019, I was reviewing your patch for lib/pp.rb and noticed the example for PPMethods::checkinspectkey doesn't work in trunk.

::checkinspectkey(obj.objectid) returns nil
then ::push
inspectkey(obj.objectid) raises: NoMethodError: undefined method `[]=' for nil:NilClass

#5 Updated by Vincent Batts about 1 year ago

interesting, doing a little bootleg debugging

diff --git a/lib/pp.rb b/lib/pp.rb
index 6e0c797..681956d 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -145,13 +145,16 @@ class PP < PrettyPrint
def pp(obj)
id = obj.object_id

  •  puts check_inspect_key(id)
    

    if checkinspectkey(id)
    group {obj.prettyprintcycle self}
    return
    end

    begin

  •    push_inspect_key(id)
    
  •    puts push_inspect_key(id)
    
  •    puts check_inspect_key(id)
    
  •    p Thread.current[:__recursive_key__][:inspect]
     group {obj.pretty_print self}
    

    ensure
    popinspectkey(id) unless PP.sharing_detection

and running
<~/foo.rb>
class Foo
def pretty_print(q)
q.text 'foo'
end
end

f = Foo.new
pp f
</~/foo.rb>

I get the following results:

vbatts@satellite ~/src/ruby (trunk) $ ruby -I./lib -r pp ~/foo.rb
false
true
true
{67976200=>true, 67976030=>true}
foo

#6 Updated by Vincent Batts about 1 year ago

I see, the example added to the methods is misleading. I'll revamp the docs for PP, and create a new issue.

#7 Updated by Vincent Batts about 1 year ago

Alrighty, since I don't have rights to close issues, I'll just add the updated PP/PrettyPrint patch here.
This patch fixes the confusing *inspectkey example and also sets nodoc on the pretty print modifications to basic objects.
This patch also completes the documentation for PrettyPrint.

#8 Updated by Zachary Scott about 1 year ago

  • Status changed from Feedback to Assigned
  • Assignee changed from Vincent Batts to Zachary Scott

Thanks Vincent! I will review this and commit tonight.

#9 Updated by Zachary Scott about 1 year ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r39180.
Vincent, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/pp.rb, lib/prettyprint.rb: Documentation for PP and PrettyPrint Based on a patch by Vincent Batts [Bug #7656]

Also available in: Atom PDF