Project

General

Profile

Actions

Bug #7326

closed

Time.c doc improvements

Added by bt (Bernd Homuth) over 11 years ago. Updated over 11 years ago.

Status:
Closed
Assignee:
Target version:
ruby -v:
1.9.3
Backport:
[ruby-core:49203]

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.


Files

time_doc_improvements.patch (29.7 KB) time_doc_improvements.patch bt (Bernd Homuth), 11/11/2012 02:43 AM
time_docs_2.diff (30.1 KB) time_docs_2.diff bt (Bernd Homuth), 11/18/2012 08:21 PM
time_patch0001.diff (4.57 KB) time_patch0001.diff bt (Bernd Homuth), 11/24/2012 07:38 PM
time_patch0002.diff (20.7 KB) time_patch0002.diff bt (Bernd Homuth), 11/24/2012 07:38 PM
time_patch0003.diff (9.46 KB) time_patch0003.diff bt (Bernd Homuth), 11/24/2012 07:38 PM
time_patch0004.diff (39.6 KB) time_patch0004.diff bt (Bernd Homuth), 11/25/2012 07:00 AM

Updated by bt (Bernd Homuth) over 11 years 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

Updated by zzak (zzak _) over 11 years ago

  • Assignee changed from drbrain (Eric Hodel) to zzak (zzak _)
  • Target version set to 2.0.0

Updated by rohitarondekar (Rohit Arondekar) over 11 years 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

Updated by bt (Bernd Homuth) over 11 years ago

@rohitarondekar (Rohit Arondekar) 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.

Updated by zzak (zzak _) over 11 years 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.

Updated by bt (Bernd Homuth) over 11 years ago

In contrast to the guidelines I have: arguments, object and other_object (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#to_a vs #to_a

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

diff is just for review, not yet split.

Updated by zzak (zzak _) over 11 years 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

Updated by drbrain (Eric Hodel) over 11 years ago

=begin
Arguments should be surrounded by "+", not "_". In Time.at, (({+seconds+})), (({+seconds_with_frac+})) and (({+microseconds_with_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#to_s})) and (({#to_s})) and (({to_s})) 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

Updated by bt (Bernd Homuth) over 11 years 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.

Updated by bt (Bernd Homuth) over 11 years ago

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

Actions #11

Updated by zzak (zzak _) over 11 years 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 [ruby-core:49203] [Bug #7326]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0