Bug #7656
closedHandful of documentations
Added by vbatts (Vincent Batts) over 10 years ago. Updated over 10 years ago.
Description
This fixes documentation in ENV, adds a little for debug.rb, and completes PP
Files
ruby-docs-201301_PP-Debug-ENV.patch (6.06 KB) ruby-docs-201301_PP-Debug-ENV.patch | documentation against 902a36c1f6157385fc8cd914f3c8824017efbfeb | vbatts (Vincent Batts), 01/06/2013 06:14 AM | |
ruby-docs_PrettyPrint-PP_20130206.patch (14.8 KB) ruby-docs_PrettyPrint-PP_20130206.patch | PrettyPrint and PP documentation | vbatts (Vincent Batts), 02/07/2013 02:52 PM |
Updated by zzak (Zak Scott) over 10 years ago
Awesome, thank you!!
Updated by vbatts (Vincent Batts) over 10 years ago
Is there anything I can do better?
Updated by zzak (Zak Scott) over 10 years 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!
Updated by zzak (Zak Scott) over 10 years ago
- Status changed from Open to Feedback
- Assignee changed from zzak (Zak Scott) to vbatts (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::check_inspect_key doesn't work in trunk.
::check_inspect_key(obj.object_id) returns nil
then ::push_inspect_key(obj.object_id) raises: NoMethodError: undefined method `[]=' for nil:NilClass
Updated by vbatts (Vincent Batts) over 10 years 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 check_inspect_key(id) group {obj.pretty_print_cycle 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 pop_inspect_key(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
Updated by vbatts (Vincent Batts) over 10 years ago
I see, the example added to the methods is misleading. I'll revamp the docs for PP, and create a new issue.
Updated by vbatts (Vincent Batts) over 10 years 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 *_inspect_key example and also sets nodoc on the pretty print modifications to basic objects.
This patch also completes the documentation for PrettyPrint.
Updated by zzak (Zak Scott) over 10 years ago
- Status changed from Feedback to Assigned
- Assignee changed from vbatts (Vincent Batts) to zzak (Zak Scott)
Thanks Vincent! I will review this and commit tonight.
Updated by zzak (Zak Scott) over 10 years 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 [ruby-core:51253] [Bug #7656]