Bug #5393

some style fixes in enum.c docs

Added by Bernd Homuth almost 4 years ago. Updated over 3 years ago.

[ruby-core:39886]
Status:Closed
Priority:Normal
Assignee:Eric Hodel
ruby -v:- Backport:

Description

There isn't much consistency in the docs when it comes to blocks. So I decided to go with the style that is most often used: {|obj| block }
No spaces, only around the block.

I can fix the other classes as well but before I do this let me know if this is the preferred style.

What about multiline blocks? They tend to look ugly. Curly braces everywhere and never ending chains.
See https://github.com/ruby/ruby/blob/trunk/enum.c#L2359-2364

0001-more-consistent-doc-block-style-for-enum.c.patch Magnifier - enum.c doc patch (37.3 KB) Bernd Homuth, 10/04/2011 03:32 PM

Associated revisions

Revision 33480
Added by Eric Hodel over 3 years ago

  • enum.c: Reformat block args to a single standard, { |args| ... }. Patch by b t. [Ruby 1.9 - Bug #5393]

Revision 33480
Added by Eric Hodel over 3 years ago

  • enum.c: Reformat block args to a single standard, { |args| ... }. Patch by b t. [Ruby 1.9 - Bug #5393]

History

#1 Updated by Eric Hodel almost 4 years ago

  • Category set to doc
  • Target version changed from 1.9.3 to 2.0.0

#2 Updated by Eric Hodel almost 4 years ago

=begin
I would prefer spaces for both the arguments and the block like ((|{ |args| block }|)) as it seems to be the modern style over no space between the curly-brace and the pipe like ((|{|args| block }|)) as it seems to older.

If you submit just a patch for enum.c I can give you better feedback for future clean-ups.
=end

#3 Updated by Bernd Homuth almost 4 years ago

oh, I added a patch file but that must have gone awol. Sorry for that. I'll repost as soon as I changed styles later today.

#4 Updated by Bernd Homuth almost 4 years ago

ok, here is the patch with your recommended style.

#5 Updated by Nobuyoshi Nakada almost 4 years ago

  • ruby -v changed from ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0] to -

Hi,

(11/10/04 8:28), Eric Hodel wrote:

I would prefer spaces for both the arguments and the block like
((|{ |args| block }|)) as it seems to be the modern style over no
space between the curly-brace and the pipe like ((|{|args| block}|))
as it seems to older.

Oops, you call me an old man ;-)
Is it in fashion these days, boy?

--
Nobu Nakada

#6 Updated by Eric Hodel over 3 years ago

orz

Nobu, I don't mean to make you feel old, but the extra space is the fashion for us young people. :)

Do you think this patch is OK?

#7 Updated by Eric Hodel over 3 years ago

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

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


  • enum.c: Reformat block args to a single standard, { |args| ... }. Patch by b t. [Ruby 1.9 - Bug #5393]

Also available in: Atom PDF