-
Notifications
You must be signed in to change notification settings - Fork 35
[DOC] Doc for StringIO#each #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ext/stringio/stringio.c
Outdated
| * each(sep = $/, chomp: false) {|line| ... } -> self | ||
| * each(limit, chomp: false) {|line| ... } -> self | ||
| * each(sep, limit, chomp: false) {|line| ... } -> self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you keep using each_line?
each_line is preferred over each.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree entirely
Can we switch the alias relationship between #each and #each_line? If so, I can do that here (along with changing the call-seq and examples); that would change this PR to not-[DOC].
Would that be okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you intend the following change?
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index f81dd60..d424c59 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -2032,8 +2032,8 @@ Init_stringio(void)
rb_define_method(StringIO, "sync=", strio_set_sync, 1);
rb_define_method(StringIO, "tell", strio_tell, 0);
- rb_define_method(StringIO, "each", strio_each, -1);
rb_define_method(StringIO, "each_line", strio_each, -1);
+ rb_define_alias(StringIO, "each", "each_line");
rb_define_method(StringIO, "each_byte", strio_each_byte, 0);
rb_define_method(StringIO, "each_char", strio_each_char, 0);
rb_define_method(StringIO, "each_codepoint", strio_each_codepoint, 0);We don't need it because IO doesn't do it: https://github.com/ruby/ruby/blob/fcf8b10b3c674eecf16c14fa6ee7f4211fa3b673/io.c#L15792-L15793
Can we add alias information by RDoc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RDoc adds alias info automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you keep using
each_line?each_lineis preferred overeach.
Done.
| * | ||
| * Leaves stream position as end-of-stream. | ||
| * | ||
| * **No Arguments** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using ### Subsection (####?) instead of **Subsection**?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc guide says not to. I think a reason is that in some renderings, the heading can show up in the left-pane TOC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't know it...
ext/stringio/stringio.c
Outdated
| * Text = <<EOT | ||
| * First line | ||
| * Second line | ||
| * | ||
| * Fourth line | ||
| * Fifth line | ||
| * EOT | ||
| * | ||
| * Russian = 'тест' | ||
| * Data = "\u9990\u9991\u9992\u9993\u9994" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use UPPER_CASE for constant names such as TEXT, RUSSIAN and DATA?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
@kou, I also had forgotten keyword arg |
No description provided.