Bug #7326

Time.c doc improvements

Added by Bernd Homuth over 1 year ago. Updated over 1 year ago.

[ruby-core:49203]
Status:Closed
Priority:Normal
Assignee:Zachary Scott
Category:doc
Target version:2.0.0
ruby -v:1.9.3 Backport:

Description

I tried to improve some parts of the documentation. Mainly I changed +Time+ for classes and time for objects. I fixed some typos and probably introduced new ones. Please check carefully.

time_doc_improvements.patch Magnifier (29.7 KB) Bernd Homuth, 11/11/2012 02:43 AM

time_docs_2.diff Magnifier (30.1 KB) Bernd Homuth, 11/18/2012 08:21 PM

time_patch0001.diff Magnifier (4.57 KB) Bernd Homuth, 11/24/2012 07:38 PM

time_patch0002.diff Magnifier (20.7 KB) Bernd Homuth, 11/24/2012 07:38 PM

time_patch0003.diff Magnifier (9.46 KB) Bernd Homuth, 11/24/2012 07:38 PM

time_patch0004.diff Magnifier (39.6 KB) Bernd Homuth, 11/25/2012 07:00 AM

Associated revisions

Revision 38032
Added by Zachary Scott over 1 year ago

  • time.c: Documentation improvements, grammar and formatting Patch by Bernd Homuth [Bug #7326]

History

#1 Updated by Bernd Homuth over 1 year ago

Actually, I'm not really happy with my "improvements". After looking through more classes there is inconsistency everywhere and it seems every class has its own style. Maybe there should be some API documentation guideline first. I checked the Rails guidelines but don't think they cover everything: http://edgeguides.rubyonrails.org/api_documentation_guidelines.html

#2 Updated by Zachary Scott over 1 year ago

  • Assignee changed from Eric Hodel to Zachary Scott
  • Target version set to 2.0.0

#3 Updated by Rohit Arondekar over 1 year ago

=begin
Made a quick pass through the patch and the following stood out:

((The idea is taken from Perl:))

I would prefer "The idea is borrowed from Perl:"

((The first DST is at 1916 in German.
So we don't need to care DST before that.
))

I would prefer "DST was used for the first time by Germany starting in 1916" and "Therefore we don't check for DST prior to 1916"

Also IMHO I think it would have been better if the patch was split into two ― one only for formatting changes and another for corrections. Don't do it because I said so! I just think it would have made reviewing the patch easier. :)

I agree on CRuby needing a API Documentation guideline. The reasons are obvious, it will make editing and adding docs much easier for both newcomers as well as existing contributors. However how do you go about writing a documentation guide for a programming language? :) I'll try to find if other programming languages have such a guide.
=end

#4 Updated by Bernd Homuth over 1 year ago

@rohitarondekar thank you for the comments and welcome to ruby bugs :)

I would prefer "The idea is borrowed from Perl:"
yes, sounds better, you're right.

((The first DST is at 1916 in German.
So we don't need to care DST before that.
))

I would prefer "DST was used for the first time by Germany starting in 1916" and "Therefore we don't check for DST prior to 1916"
Doesn't really matter if it was used in Germany or elsewhere, should be rephrased altogether.

Also IMHO I think it would have been better if the patch was split into two ― one only for formatting changes and another for corrections. Don't do it because I said so! I just think it would have made reviewing the patch easier. :)

I agree on CRuby needing a API Documentation guideline. The reasons are obvious, it will make editing and adding docs much easier for both newcomers as well as existing contributors. However how do you go about writing a documentation guide for a programming language? :) I'll try to find if other programming languages have such a guide.

yes to both, zzak sent me the link to this: http://bugs.ruby-lang.org/projects/ruby/wiki/DocumenterHowTo
so there is some documentation available. Needs some clarifications, though.

#5 Updated by Zachary Scott over 1 year ago

The formatting looks good, except you shouldn't wrap classes in anything, such as ArgumentError or Time and Time#to_f

This allow rdoc to properly link these objects.

#6 Updated by Bernd Homuth over 1 year ago

In contrast to the guidelines I have: arguments, object and otherobject_ (also self)
Monospaced only for return values: +nil and +true+
What about class methods: Time::new vs Time#new vs Time.new?
Method references should be complete or abbreviated: Time#toa vs #toa

If we can decide on a format I can go through the other classes as well.

diff is just for review, not yet split.

#7 Updated by Zachary Scott over 1 year ago

If you can separate typo/grammar changes from formatting, it will be much easier for me to review and more likely to commit.

edit: s/grammer/grammar ... how ironic

#8 Updated by Eric Hodel over 1 year ago

=begin
Arguments should be surrounded by "+", not "". In Time.at, (({+seconds+})), (({+secondswithfrac+})) and (({+microsecondswith_frac+})) are preferred.

Otherwise, a quick scan makes me think this patch is good.

For reference purposes, methods will be linked in the same class if they have an "" or them, so (({Time#tos})) and (({#tos})) and (({tos})) would all link to the same place. A full name like (({Array#join})) should be used when referring to a method external to the current class.

If a method doesn't have an "_" like (({Time#sec})) you need to prefix it with an "#". (({Time#sec})) and (({#sec})) would both link to the same place, but (({sec})) would not be linked.

Similarly, for class methods without "_", prefix the method with "::". When using a full name, if the method is unambiguous, a "." will also work. (({Time.sec})) will link to (({Time#sec}))

=end

#9 Updated by Bernd Homuth over 1 year ago

See my three patches (time_patch000x.diff), first one for typos etc, second one for format changes and third one for more substantial changes to the docs.

#10 Updated by Bernd Homuth over 1 year ago

After going over the file one last time I found a couple of lines I've missed.

#11 Updated by Zachary Scott over 1 year ago

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

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


  • time.c: Documentation improvements, grammar and formatting Patch by Bernd Homuth [Bug #7326]

Also available in: Atom PDF